/** * Note: This constructor is for internal use only. Clients should not call * this constructor. * @param editor the java editor * * @noreference This constructor is not intended to be referenced by clients. */ public ChangeTypeAction(JavaEditor editor) { this(editor.getEditorSite()); fEditor= editor; setEnabled(SelectionConverter.getInputAsCompilationUnit(fEditor) != null); }
/** * Note: This constructor is for internal use only. Clients should not call this constructor. * @param editor the java editor */ public IntroduceFactoryAction(JavaEditor editor) { this(editor.getEditorSite()); fEditor= editor; setEnabled(SelectionConverter.getInputAsCompilationUnit(fEditor) != null); }
/** * Note: This constructor is for internal use only. Clients should not call * this constructor. * @param editor the java editor * * @noreference This constructor is not intended to be referenced by clients. */ public ChangeTypeAction(JavaEditor editor) { this(editor.getEditorSite()); fEditor= editor; setEnabled(SelectionConverter.getInputAsCompilationUnit(fEditor) != null); }
/** * Note: This constructor is for internal use only. Clients should not call this constructor. * @param editor the Java editor * * @noreference This constructor is not intended to be referenced by clients. */ public IntroduceFactoryAction(JavaEditor editor) { this(editor.getEditorSite()); fEditor= editor; setEnabled(SelectionConverter.getInputAsCompilationUnit(fEditor) != null); }
@Override boolean isApplicable() { if (!super.isApplicable()) return false; ICompilationUnit compilationUnit= SelectionConverter.getInputAsCompilationUnit(fEditor); IJavaProject javaProject= compilationUnit.getJavaProject(); return JavaModelUtil.is17OrHigher(javaProject); }
@Override public void run(ITextSelection selection) { if (!ActionUtil.isEditable(fEditor)) return; RefactoringExecutionStarter.startIntroduceFactoryRefactoring(SelectionConverter.getInputAsCompilationUnit(fEditor), selection, getShell()); } }
@Override public void run(ITextSelection selection) { try { run(selection, SelectionConverter.getInputAsCompilationUnit(fEditor)); } catch (JavaModelException e) { ExceptionHandler.handle(e, getShell(), RefactoringMessages.MoveInstanceMethodAction_dialog_title, RefactoringMessages.MoveInstanceMethodAction_unexpected_exception); } }
/** * Note: This constructor is for internal use only. Clients should not call this * constructor. * * @param editor the compilation unit editor */ public AddGetterSetterAction(CompilationUnitEditor editor) { this(editor.getEditorSite()); fEditor= editor; setEnabled(SelectionConverter.getInputAsCompilationUnit(editor) != null); fEditor.getEditorSite(); }
public void run(ITextSelection selection) { try{ run(SelectionConverter.getInputAsCompilationUnit(fEditor), selection.getOffset(), selection.getLength()); } catch (JavaModelException e){ ExceptionHandler.handle(e, RefactoringMessages.ConvertAnonymousToNestedAction_dialog_title, RefactoringMessages.NewTextRefactoringAction_exception); } }
@Override public void run(ITextSelection selection) { if (!ActionUtil.isEditable(fEditor)) return; RefactoringExecutionStarter.startChangeTypeRefactoring(SelectionConverter.getInputAsCompilationUnit(fEditor), getShell(), selection.getOffset(), selection.getLength()); } }
/** * Note: This constructor is for internal use only. Clients should not call this constructor. * @param editor the compilation unit editor */ public SurroundWithTryCatchAction(CompilationUnitEditor editor) { super(editor.getEditorSite()); setText(RefactoringMessages.SurroundWithTryCatchAction_label); fEditor= editor; setEnabled((fEditor != null && SelectionConverter.getInputAsCompilationUnit(fEditor) != null)); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.SURROUND_WITH_TRY_CATCH_ACTION); }
/** * Note: This constructor is for internal use only. Clients should not call this constructor. * @param editor the java editor */ public IntroduceParameterAction(JavaEditor editor) { super(editor.getEditorSite()); setText(RefactoringMessages.IntroduceParameterAction_label); fEditor= editor; setEnabled(SelectionConverter.getInputAsCompilationUnit(fEditor) != null); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.INTRODUCE_PARAMETER_ACTION); }
public void run(ITextSelection selection) { if (!ActionUtil.isEditable(fEditor)) return; try{ ICompilationUnit unit= SelectionConverter.getInputAsCompilationUnit(fEditor); RefactoringExecutionStarter.startIntroduceParameter(unit, selection.getOffset(), selection.getLength(), getShell()); } catch (CoreException e){ ExceptionHandler.handle(e, RefactoringMessages.IntroduceParameterAction_dialog_title, RefactoringMessages.NewTextRefactoringAction_exception); } } }
/** * Note: This constructor is for internal use only. Clients should not call this constructor. * @param editor the java editor */ public ExtractTempAction(JavaEditor editor) { super(editor.getEditorSite()); setText(RefactoringMessages.ExtractTempAction_label); fEditor= editor; setEnabled(SelectionConverter.getInputAsCompilationUnit(fEditor) != null); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.EXTRACT_TEMP_ACTION); }
/** * Note: This constructor is for internal use only. Clients should not call this constructor. * @param editor the java editor */ public ExtractConstantAction(JavaEditor editor) { super(editor.getEditorSite()); setText(RefactoringMessages.ExtractConstantAction_label); fEditor= editor; setEnabled(SelectionConverter.getInputAsCompilationUnit(fEditor) != null); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.EXTRACT_CONSTANT_ACTION); }
@Override public void run(ITextSelection selection) { if (!ActionUtil.isEditable(fEditor)) return; ExtractMethodRefactoring refactoring= new ExtractMethodRefactoring(SelectionConverter.getInputAsCompilationUnit(fEditor), selection.getOffset(), selection.getLength()); new RefactoringStarter().activate(new ExtractMethodWizard(refactoring), getShell(), RefactoringMessages.ExtractMethodAction_dialog_title, RefactoringSaveHelper.SAVE_NOTHING); } }
@Override public void run(ITextSelection selection) { if (!ActionUtil.isEditable(fEditor)) return; ExtractConstantRefactoring refactoring= new ExtractConstantRefactoring(SelectionConverter.getInputAsCompilationUnit(fEditor), selection.getOffset(), selection.getLength()); new RefactoringStarter().activate(new ExtractConstantWizard(refactoring), getShell(), RefactoringMessages.ExtractConstantAction_extract_constant, RefactoringSaveHelper.SAVE_NOTHING); } }
@Override public void run(ITextSelection selection) { ICompilationUnit compilationUnit= SelectionConverter.getInputAsCompilationUnit(fEditor); IJavaProject javaProject= compilationUnit.getJavaProject(); if (!JavaModelUtil.is17OrHigher(javaProject)) { String message= Messages.format(RefactoringMessages.SurroundWithTryMultiCatchAction_not17, BasicElementLabels.getJavaElementName(javaProject.getElementName())); MessageDialog.openInformation(JavaPlugin.getActiveWorkbenchShell(), getDialogTitle(), message); return; } super.run(selection); }
@Override public void run(ITextSelection selection) { ICompilationUnit compilationUnit= SelectionConverter.getInputAsCompilationUnit(fEditor); IJavaProject javaProject= compilationUnit.getJavaProject(); if (!JavaModelUtil.is17OrHigher(javaProject)) { String message= Messages.format(RefactoringMessages.SurroundWithTryMultiCatchAction_not17, BasicElementLabels.getJavaElementName(javaProject.getElementName())); MessageDialog.openInformation(JavaPlugin.getActiveWorkbenchShell(), getDialogTitle(), message); return; } super.run(selection); }
public void run(ITextSelection selection) { if (!ActionUtil.isEditable(fEditor)) return; try{ final ExtractTempRefactoring refactoring= new ExtractTempRefactoring(SelectionConverter.getInputAsCompilationUnit(fEditor), selection.getOffset(), selection.getLength()); new RefactoringStarter().activate(refactoring, new ExtractTempWizard(refactoring), getShell(), RefactoringMessages.ExtractTempAction_extract_temp, RefactoringSaveHelper.SAVE_NOTHING); } catch (JavaModelException e){ ExceptionHandler.handle(e, RefactoringMessages.ExtractTempAction_extract_temp, RefactoringMessages.NewTextRefactoringAction_exception); } } }