本文整理汇总了Java中org.eclipse.ui.texteditor.ITextEditor.getAdapter方法的典型用法代码示例。如果您正苦于以下问题:Java ITextEditor.getAdapter方法的具体用法?Java ITextEditor.getAdapter怎么用?Java ITextEditor.getAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.texteditor.ITextEditor
的用法示例。
在下文中一共展示了ITextEditor.getAdapter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.eclipse.ui.texteditor.ITextEditor; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
IFileEditorInput input = (IFileEditorInput) part.getEditorInput();
IFile file = input.getFile();
if (part instanceof ITextEditor) {
final ITextEditor editor = (ITextEditor) part;
IVerticalRulerInfo ruleInfo = editor.getAdapter(IVerticalRulerInfo.class);
IDocumentProvider provider = editor.getDocumentProvider();
IDocument document = provider.getDocument(editor.getEditorInput());
int lineNumber = ruleInfo.getLineOfLastMouseButtonActivity();
String className = file.getName().substring(0, file.getName().lastIndexOf('.'));
HashMap<VFUnit, VFMethod> resultantUnit = getSelectedUnit(className, document, lineNumber);
List<VFNode> unit = new ArrayList<>();
if (resultantUnit.size() > 0) {
if (event.getCommand().getId().equals("JavaHandler.NavigateToJimple")) {
NavigationHandler handler = new NavigationHandler();
handler.highlightJimpleSource(new ArrayList<>(resultantUnit.keySet()));
} else {
for (VFUnit vfUnit : resultantUnit.keySet()) {
unit.add(new VFNode(vfUnit, 0));
}
try {
ServiceUtil.getService(DataModel.class).filterGraph(unit, true, true, null);
} catch (Exception e) {
e.printStackTrace();
}
}
}
// call graph highlighting code here
} else {
logger.error("Editor not a Text Editor");
}
return null;
}
示例2: getAnnotationModel
import org.eclipse.ui.texteditor.ITextEditor; //导入方法依赖的package包/类
private IAnnotationModel getAnnotationModel(ITextEditor editor)
{
return (IAnnotationModel) editor.getAdapter(ProjectionAnnotationModel.class);
}