|
org.netbeans.modules.refactoring.java/1 1.37.0 1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.netbeans.modules.refactoring.java.spi.ui.JavaRefactoringActionDelegate
public abstract class JavaRefactoringActionDelegate
Delegate which creates a refactoring UI and runs a refactoring. To be used by implementors of Java refactorings.
Usage:
Implement this class to provide a RefactoringUI for your refactoring.
Include a static method on your implementation which instantiates an
instance of your JavaRefactoringActionDelegate and passes it to
JavaRefactoringActionDelegate.createAction().
Register an action in your module‘s XML Layer, in the folder for
the menu (toolbar button, keybinding, etc.) where you want it to appear -
typically Menu/Refactorings. Set the
instanceCreate attribute to the fully qualified path to the
static method you created (which should return javax.swing.Action.
Example Registration
<filesystem>
<folder name="Menu">
<folder name="Refactoring">
<file name="MyRefactoring.shadow">
<attr name="originalFile"
stringvalue="Actions/Refactoring/MyRefactoring.instance"/>
</file>
</folder>
</folder>
<folder name="Actions">
<folder name="Refactoring">
<file name="MyRefactoring.instance">
<attr name="instanceCreate" methodvalue="com.foo.MyClass.myStaticMethod"/>
</file>
</folder>
</folder>
</filesystem>
| Constructor Summary | |
|---|---|
protected |
JavaRefactoringActionDelegate(String name)
Create a new refactoring action delegate which does not require a text selection, with the passed name. |
protected |
JavaRefactoringActionDelegate(String name,
boolean requiresSelection)
Create a new refactoring action delegate which may require a text selection, with the passed name. |
| Method Summary | |
|---|---|
static Action |
createAction(JavaRefactoringActionDelegate delegate)
Create an Action which should appear in menus to invoke this refactoring. |
abstract RefactoringUI |
createRefactoringUI(TreePathHandle selectedElement,
int startOffset,
int endOffset,
CompilationInfo info)
Create the refactoring UI which will be used to configure and invoke the refactoring. |
String |
getErrorMessage()
Get an error message to be shown to the user if the creaetRefactoringUI() has just returned null. |
protected boolean |
isEnabled(Lookup context)
Determine if the action should be enabled. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected JavaRefactoringActionDelegate(String name)
name - The display name of the action
protected JavaRefactoringActionDelegate(String name,
boolean requiresSelection)
name - The display name of the actionrequiresSelection - if true, isEnabled() will return false unless
there is a text selection in the editor| Method Detail |
|---|
public abstract RefactoringUI createRefactoringUI(TreePathHandle selectedElement,
int startOffset,
int endOffset,
CompilationInfo info)
public String getErrorMessage()
public static Action createAction(JavaRefactoringActionDelegate delegate)
delegate - An instance of JavaRefactoringActionDelegate which the
resulting action will call to create the refactoring ui.protected boolean isEnabled(Lookup context)
requiresSelection
was passed to the constructor, it also depends on a text selection in that
editor being present.
context - A Lookup containing either an EditorCookie or one or more
Nodes whose lookup contains an EditorCookie
|
org.netbeans.modules.refactoring.java/1 1.37.0 1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||