/** * Opens a Java editor for the given element if the element is a Java compilation unit or a Java * class file. * * @return the IEditorPart or null if wrong element type or opening failed */ public static IEditorPart openInEditor(ICompilationUnit aCompilationUnit) throws JavaModelException, PartInitException { return EditorUtility.openInEditor(aCompilationUnit); }
/** * Opens a Java editor for an element such as <code>IJavaElement</code>, <code>IFile</code>, or <code>IStorage</code>. * The editor is activated by default. * * @return an open editor or <code>null</code> if an external editor was opened * @throws PartInitException if the editor could not be opened or the input element is not valid */ public static IEditorPart openInEditor(Object inputElement) throws JavaModelException, PartInitException { return openInEditor(inputElement, true); }
/** * Opens a Java editor for an element such as <code>IJavaElement</code>, <code>IFile</code>, or <code>IStorage</code>. * The editor is activated by default. * * @param inputElement the input element * @return an open editor or <code>null</code> if an external editor was opened * @throws PartInitException if the editor could not be opened or the input element is not valid. * Status code {@link IJavaStatusConstants#EDITOR_NO_EDITOR_INPUT} if opening the editor failed as * no editor input could be created for the given element. */ public static IEditorPart openInEditor(Object inputElement) throws PartInitException { return openInEditor(inputElement, true); }
/** * Opens a Java editor for an element such as <code>IJavaElement</code>, <code>IFile</code>, or <code>IStorage</code>. * The editor is activated by default. * * @param inputElement the input element * @return an open editor or <code>null</code> if an external editor was opened * @throws PartInitException if the editor could not be opened or the input element is not valid. * Status code {@link IJavaStatusConstants#EDITOR_NO_EDITOR_INPUT} if opening the editor failed as * no editor input could be created for the given element. */ public static IEditorPart openInEditor(Object inputElement) throws PartInitException { return openInEditor(inputElement, true); }
@Override protected void activate(ISelection selection) { try { final Object selectedElement= SelectionUtil.getSingleElement(selection); if (EditorUtility.isOpenInEditor(selectedElement) != null) EditorUtility.openInEditor(selectedElement, true); } catch (PartInitException ex) { // ignore if no editor input can be found } }
@Override protected void activate(ISelection selection) { try { final Object selectedElement= SelectionUtil.getSingleElement(selection); if (EditorUtility.isOpenInEditor(selectedElement) != null) EditorUtility.openInEditor(selectedElement, true); } catch (PartInitException ex) { // ignore if no editor input can be found } }
@Override protected void activate(ISelection selection) { try { final Object selectedElement= SelectionUtil.getSingleElement(selection); if (EditorUtility.isOpenInEditor(selectedElement) != null) EditorUtility.openInEditor(selectedElement, true); } catch (PartInitException ex) { // ignore if no editor input can be found } }
private IEditorPart showWithoutReuse(Object element) throws PartInitException { try { return EditorUtility.openInEditor(element, false); } catch (PartInitException e) { if (e.getStatus().getCode() != IJavaStatusConstants.EDITOR_NO_EDITOR_INPUT) { throw e; } } return null; }
private boolean openInNewEditor(Object element) { try { IEditorPart newEditor= EditorUtility.openInEditor(element); if (newEditor != null && element instanceof IJavaElement) EditorUtility.revealInEditor(newEditor, (IJavaElement) element); return true; } catch (PartInitException e) { JavaPlugin.log(e); return false; } }
@Override protected void activate(ISelection selection) { try { final Object selectedElement= SelectionUtil.getSingleElement(selection); if (EditorUtility.isOpenInEditor(selectedElement) != null) EditorUtility.openInEditor(selectedElement, true); } catch (PartInitException ex) { // ignore if no editor input can be found } }
@Override protected void activate(ISelection selection) { try { final Object selectedElement= SelectionUtil.getSingleElement(selection); if (EditorUtility.isOpenInEditor(selectedElement) != null) EditorUtility.openInEditor(selectedElement, true); } catch (PartInitException ex) { // ignore if no editor input can be found } }
@Override protected void activate(ISelection selection) { try { final Object selectedElement= SelectionUtil.getSingleElement(selection); if (EditorUtility.isOpenInEditor(selectedElement) != null) EditorUtility.openInEditor(selectedElement, true); } catch (PartInitException ex) { // ignore if no editor input can be found } }
private boolean openInNewEditor(Object element) { try { IEditorPart newEditor= EditorUtility.openInEditor(element); if (newEditor != null && element instanceof IJavaElement) EditorUtility.revealInEditor(newEditor, (IJavaElement) element); return true; } catch (PartInitException e) { JavaPlugin.log(e); return false; } }
@Override protected void activate(ISelection selection) { try { final Object selectedElement= SelectionUtil.getSingleElement(selection); if (EditorUtility.isOpenInEditor(selectedElement) != null) EditorUtility.openInEditor(selectedElement, true); } catch (PartInitException ex) { // ignore if no editor input can be found } }
@Override protected void activate(ISelection selection) { try { final Object selectedElement= SelectionUtil.getSingleElement(selection); if (EditorUtility.isOpenInEditor(selectedElement) != null) EditorUtility.openInEditor(selectedElement, true); } catch (PartInitException ex) { // ignore if no editor input can be found } }
private IEditorPart showWithoutReuse(Object element) throws PartInitException { try { return EditorUtility.openInEditor(element, false); } catch (PartInitException e) { if (e.getStatus().getCode() != IJavaStatusConstants.EDITOR_NO_EDITOR_INPUT) { throw e; } } return null; }
/** * Opens a Java editor for the given element if the element is a Java compilation unit or a Java * class file. * * @return the IEditorPart or null if wrong element type or opening failed */ public static IEditorPart openInEditor(JavaClass javaClass, IJavaProject javaProject) throws JavaModelException, PartInitException { if (javaClass == null || javaProject == null) return null; IType type = getType(javaClass); if (type == null) return openInEditor(getCompilationUnit(javaClass, javaProject)); return EditorUtility.openInEditor(type); }
private void gotoSelectedElement() { Object selectedElement= getSelectedElement(); if (selectedElement != null) { try { dispose(); IEditorPart part= EditorUtility.openInEditor(selectedElement, true); if (part != null && selectedElement instanceof IJavaElement) EditorUtility.revealInEditor(part, (IJavaElement) selectedElement); } catch (CoreException ex) { JavaPlugin.log(ex); } } }
private void gotoSelectedElement() { Object selectedElement= getSelectedElement(); if (selectedElement != null) { try { dispose(); IEditorPart part= EditorUtility.openInEditor(selectedElement, true); if (part != null && selectedElement instanceof IJavaElement) EditorUtility.revealInEditor(part, (IJavaElement) selectedElement); } catch (CoreException ex) { JavaPlugin.log(ex); } } }
private void gotoSelectedElement() { Object selectedElement= getSelectedElement(); if (selectedElement != null) { try { dispose(); IEditorPart part= EditorUtility.openInEditor(selectedElement, true); if (part != null && selectedElement instanceof IJavaElement) EditorUtility.revealInEditor(part, (IJavaElement) selectedElement); } catch (CoreException ex) { JavaPlugin.log(ex); } } }