public static boolean isProcessable(Shell shell, IJavaElement element) { if (element == null) return true; if (isOnBuildPath(element)) return true; MessageDialog.openInformation(shell, ActionMessages.ActionUtil_notOnBuildPath_title, ActionMessages.ActionUtil_notOnBuildPath_message); return false; }
public static boolean isEditable(JavaEditor editor) { if (! isProcessable(editor)) return false; return editor.validateEditorInputState(); }
@Override public void run(IStructuredSelection selection) { List<?> elements= selection.toList(); if (!CallHierarchy.arePossibleInputElements(elements)) { elements= Collections.EMPTY_LIST; } IMember[] members= elements.toArray(new IMember[elements.size()]); if (!ActionUtil.areProcessable(getShell(), members)) return; CallHierarchyUI.openView(members, getSite().getWorkbenchWindow()); }
private void run(IJavaElement element, boolean lightweight) throws CoreException { // Work around for http://dev.eclipse.org/bugs/show_bug.cgi?id=19104 if (! ActionUtil.isEditable(fEditor, getShell(), element)) return; //XXX workaround bug 31998 if (ActionUtil.mustDisableJavaModelAction(getShell(), element)) return; if (lightweight && fEditor instanceof CompilationUnitEditor && ! (element instanceof IPackageFragment)) { new RenameLinkedMode(element, (CompilationUnitEditor) fEditor).start(); } else { RefactoringExecutionStarter.startRenameRefactoring(element, getShell()); } }
@Override public void run(ITextSelection selection) { if (!ActionUtil.isProcessable(fEditor)) return; ITypeRoot editorInput= SelectionConverter.getInput(fEditor); if (!ActionUtil.isEditable(getShell(), editorInput)) return; if (editorInput instanceof ICompilationUnit) run(selection.getOffset(), selection.getLength(), (ICompilationUnit) editorInput); else if (editorInput instanceof IClassFile) run(selection.getOffset(), selection.getLength(), (IClassFile) editorInput); }
private void run(int offset, int length, IClassFile file) throws JavaModelException { if (!ActionUtil.isEditable(fEditor, getShell(), file)) return; RefactoringExecutionStarter.startIntroduceIndirectionRefactoring(file, offset, length, getShell()); }
private void run(IMethod method) throws JavaModelException { if (!ActionUtil.isEditable(fEditor, getShell(), method)) return; RefactoringExecutionStarter.startIntroduceIndirectionRefactoring(method, getShell()); } }
private void run(IJavaElement element, boolean lightweight) throws CoreException { // Work around for http://dev.eclipse.org/bugs/show_bug.cgi?id=19104 if (! ActionUtil.isEditable(fEditor, getShell(), element)) return; //XXX workaround bug 31998 if (ActionUtil.mustDisableJavaModelAction(getShell(), element)) return; if (lightweight && fEditor instanceof CompilationUnitEditor && ! (element instanceof IPackageFragment)) { new RenameLinkedMode(element, (CompilationUnitEditor) fEditor).start(); } else { RefactoringExecutionStarter.startRenameRefactoring(element, getShell()); } }
@Override public void run(ITextSelection selection) { if (!ActionUtil.isProcessable(fEditor)) return; ITypeRoot editorInput= SelectionConverter.getInput(fEditor); if (!ActionUtil.isEditable(getShell(), editorInput)) return; if (editorInput instanceof ICompilationUnit) run(selection.getOffset(), selection.getLength(), (ICompilationUnit) editorInput); else if (editorInput instanceof IClassFile) run(selection.getOffset(), selection.getLength(), (IClassFile) editorInput); }
public static boolean isEditable(JavaEditor editor) { if (! isProcessable(editor)) return false; return editor.validateEditorInputState(); }
/** * Note: this method is for internal use only. Clients should not call this method. * @param unit the compilation unit * * @noreference This method is not intended to be referenced by clients. */ public void run(ICompilationUnit unit) { if (!ActionUtil.isEditable(fEditor, getShell(), unit)) return; ExternalizeWizard.open(unit, getShell()); }
public static boolean isProcessable(Shell shell, IJavaElement element) { if (element == null) return true; if (isOnBuildPath(element)) return true; MessageDialog.openInformation(shell, ActionMessages.ActionUtil_notOnBuildPath_title, ActionMessages.ActionUtil_notOnBuildPath_message); return false; }
private void run(IJavaElement element, boolean lightweight) throws CoreException { // Work around for http://dev.eclipse.org/bugs/show_bug.cgi?id=19104 if (! ActionUtil.isEditable(fEditor, getShell(), element)) return; //XXX workaround bug 31998 if (ActionUtil.mustDisableJavaModelAction(getShell(), element)) return; if (lightweight && fEditor instanceof CompilationUnitEditor && ! (element instanceof IPackageFragment)) { new RenameLinkedMode(element, (CompilationUnitEditor) fEditor).start(); } else { RefactoringExecutionStarter.startRenameRefactoring(element, getShell()); } } }
@Override public void run(IStructuredSelection selection) { List<?> elements= selection.toList(); if (!CallHierarchy.arePossibleInputElements(elements)) { elements= Collections.EMPTY_LIST; } IMember[] members= elements.toArray(new IMember[elements.size()]); if (!ActionUtil.areProcessable(getShell(), members)) return; CallHierarchyUI.openView(members, getSite().getWorkbenchWindow()); }
public static boolean isEditable(JavaEditor editor) { if (! isProcessable(editor)) return false; return editor.validateEditorInputState(); }
private void run(ICompilationUnit unit, int offset, int length) { if (!ActionUtil.isEditable(fEditor, getShell(), unit)) return; RefactoringExecutionStarter.startConvertAnonymousRefactoring(unit, offset, length, getShell()); } }
public static boolean isProcessable(Shell shell, IJavaElement element) { if (element == null) return true; if (isOnBuildPath(element)) return true; MessageDialog.openInformation(shell, ActionMessages.ActionUtil_notOnBuildPath_title, ActionMessages.ActionUtil_notOnBuildPath_message); return false; }
public void run(IStructuredSelection selection) { IJavaElement[] elements= getSelectedElements(selection); try { if (! ActionUtil.areProcessable(getShell(), elements)) return; if (RefactoringAvailabilityTester.isInferTypeArgumentsAvailable(elements)) { RefactoringExecutionStarter.startInferTypeArgumentsRefactoring(elements, getShell()); } else { MessageDialog.openInformation(getShell(), RefactoringMessages.OpenRefactoringWizardAction_unavailable, RefactoringMessages.InferTypeArgumentsAction_unavailable); } } catch (JavaModelException e) { ExceptionHandler.handle(e, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringMessages.OpenRefactoringWizardAction_exception); } }
/** * Executes this action for the given java element. * @param element The java element to be found. */ public void run(IJavaElement element) { if (!ActionUtil.isProcessable(getShell(), element)) return; run(new IJavaElement[] {element}); }
private void run(int offset, int length, ICompilationUnit unit) throws JavaModelException { if (!ActionUtil.isEditable(fEditor, getShell(), unit)) return; RefactoringExecutionStarter.startIntroduceIndirectionRefactoring(unit, offset, length, getShell()); }