本文整理匯總了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);
}