private static void throwPartInitException(String message) throws PartInitException { throwPartInitException(message, IStatus.OK); }
private static void throwPartInitException(String message) throws PartInitException { throwPartInitException(message, IStatus.OK); }
private static IEditorPart openInEditor(IFile file, boolean activate) throws PartInitException { if (file == null) throwPartInitException(JavaEditorMessages.EditorUtility_file_must_not_be_null); IWorkbenchPage p= JavaPlugin.getActivePage(); if (p == null) throwPartInitException(JavaEditorMessages.EditorUtility_no_active_WorkbenchPage); IEditorPart editorPart= IDE.openEditor(p, file, activate); initializeHighlightRange(editorPart); return editorPart; }
private static IEditorPart openInEditor(IFile file, boolean activate) throws PartInitException { if (file == null) throwPartInitException(JavaEditorMessages.EditorUtility_file_must_not_be_null); IWorkbenchPage p= JavaPlugin.getActivePage(); if (p == null) throwPartInitException(JavaEditorMessages.EditorUtility_no_active_WorkbenchPage); IEditorPart editorPart= IDE.openEditor(p, file, activate); initializeHighlightRange(editorPart); return editorPart; }
private static IEditorPart openInEditor(IFile file, boolean activate) throws PartInitException { if (file == null) throwPartInitException(JavaEditorMessages.EditorUtility_file_must_not_be_null); IWorkbenchPage p= JavaPlugin.getActivePage(); if (p == null) throwPartInitException(JavaEditorMessages.EditorUtility_no_active_WorkbenchPage); IEditorPart editorPart= IDE.openEditor(p, file, activate); initializeHighlightRange(editorPart); return editorPart; }
private static IEditorPart openInEditor(IEditorInput input, String editorID, boolean activate) throws PartInitException { Assert.isNotNull(input); Assert.isNotNull(editorID); IWorkbenchPage p= JavaPlugin.getActivePage(); if (p == null) throwPartInitException(JavaEditorMessages.EditorUtility_no_active_WorkbenchPage); IEditorPart editorPart= p.openEditor(input, editorID, activate); initializeHighlightRange(editorPart); return editorPart; }
private static IEditorPart openInEditor(IEditorInput input, String editorID, boolean activate) throws PartInitException { Assert.isNotNull(input); Assert.isNotNull(editorID); IWorkbenchPage p= JavaPlugin.getActivePage(); if (p == null) throwPartInitException(JavaEditorMessages.EditorUtility_no_active_WorkbenchPage); IEditorPart editorPart= p.openEditor(input, editorID, activate); initializeHighlightRange(editorPart); return editorPart; }
private static IEditorPart openInEditor(IEditorInput input, String editorID, boolean activate) throws PartInitException { Assert.isNotNull(input); Assert.isNotNull(editorID); IWorkbenchPage p= JavaPlugin.getActivePage(); if (p == null) throwPartInitException(JavaEditorMessages.EditorUtility_no_active_WorkbenchPage); IEditorPart editorPart= p.openEditor(input, editorID, activate); initializeHighlightRange(editorPart); return editorPart; }
private static String getEditorID(IEditorInput input) throws PartInitException { Assert.isNotNull(input); IEditorDescriptor editorDescriptor; if (input instanceof IFileEditorInput) editorDescriptor= IDE.getEditorDescriptor(((IFileEditorInput)input).getFile()); else { String name= input.getName(); if (name == null) throwPartInitException(JavaEditorMessages.EditorUtility_could_not_find_editorId); editorDescriptor= IDE.getEditorDescriptor(name); } return editorDescriptor.getId(); }
/** * Opens the editor currently associated with the given element (IJavaElement, IFile, IStorage...) * * @param inputElement the input element * @param activate <code>true</code> if the editor should be activated * @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, boolean activate) throws PartInitException { if (inputElement instanceof IFile) { IFile file= (IFile) inputElement; if (!isClassFile(file)) return openInEditor(file, activate); inputElement= JavaCore.createClassFileFrom(file); } IEditorPart editor= findEditor(inputElement, activate); if (editor != null) return editor; IEditorInput input= getEditorInput(inputElement); if (input == null) throwPartInitException(JavaEditorMessages.EditorUtility_no_editorInput, IJavaStatusConstants.EDITOR_NO_EDITOR_INPUT); return openInEditor(input, getEditorID(input), activate); }
/** * Opens the editor currently associated with the given element (IJavaElement, IFile, IStorage...) * * @param inputElement the input element * @param activate <code>true</code> if the editor should be activated * @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, boolean activate) throws PartInitException { if (inputElement instanceof IFile) { IFile file= (IFile) inputElement; if (!isClassFile(file)) return openInEditor(file, activate); inputElement= JavaCore.createClassFileFrom(file); } IEditorPart editor= findEditor(inputElement, activate); if (editor != null) return editor; IEditorInput input= getEditorInput(inputElement); if (input == null) throwPartInitException(JavaEditorMessages.EditorUtility_no_editorInput, IJavaStatusConstants.EDITOR_NO_EDITOR_INPUT); return openInEditor(input, getEditorID(input), activate); }
throwPartInitException(JavaEditorMessages.EditorUtility_no_editorInput);