本文整理匯總了Java中org.eclipse.ui.part.AbstractMultiEditor類的典型用法代碼示例。如果您正苦於以下問題:Java AbstractMultiEditor類的具體用法?Java AbstractMultiEditor怎麽用?Java AbstractMultiEditor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AbstractMultiEditor類屬於org.eclipse.ui.part包,在下文中一共展示了AbstractMultiEditor類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setSelectionFromEditor
import org.eclipse.ui.part.AbstractMultiEditor; //導入依賴的package包/類
private void setSelectionFromEditor(IWorkbenchPart part, ISelection selection) {
if (part instanceof IEditorPart) {
IJavaElement element= null;
if (selection instanceof IStructuredSelection) {
Object obj= getSingleElementFromSelection(selection);
if (obj instanceof IJavaElement)
element= (IJavaElement)obj;
}
IEditorInput ei;
if (part instanceof AbstractMultiEditor)
ei= ((AbstractMultiEditor)part).getActiveEditor().getEditorInput();
else
ei= ((IEditorPart)part).getEditorInput();
if (selection instanceof ITextSelection) {
int offset= ((ITextSelection)selection).getOffset();
element= getElementAt(ei, offset);
}
if (element != null) {
adjustInputAndSetSelection(element);
return;
}
if (ei instanceof IFileEditorInput) {
IFile file= ((IFileEditorInput)ei).getFile();
IJavaElement je= (IJavaElement)file.getAdapter(IJavaElement.class);
IContainer container= null;
if (je == null) {
container= ((IFileEditorInput)ei).getFile().getParent();
if (container != null)
je= (IJavaElement)container.getAdapter(IJavaElement.class);
}
if (je == null && container == null) {
setSelection(null, false);
return;
}
adjustInputAndSetSelection(je);
} else if (ei instanceof IClassFileEditorInput) {
IClassFile cf= ((IClassFileEditorInput)ei).getClassFile();
adjustInputAndSetSelection(cf);
}
}
}