站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

ActionsImplementationProvider (Refactoring API) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.refactoring.api 1.0

org.netbeans.modules.refactoring.spi.ui
Class ActionsImplementationProvider

java.lang.Object
  extended by org.netbeans.modules.refactoring.spi.ui.ActionsImplementationProvider

public abstract class ActionsImplementationProvider
extends Object

Create your own provider of this class and register it in META-INF services, if you want to create your own implementations of refactorin actions. For instance Java module wants to have refactoring rename action for java files. So Java Refactoring module must implement 2 methods.

 public boolean canRename(Lookup lookup) {
   Node[] nodes = lookup.lookupAll(Node.class);
   if (..one node selected and the node belongs to java...)
      return true;
   else 
      return false;
 }

 public void doRename(Lookup selectedNodes) {
   Node[] nodes = lookup.lookupAll(Node.class);
   final FileObject fo = getFileFromNode(nodes[0]);
   UI.openRefactoringUI(new RenameRefactoringUI(fo);
 }
 
For help on creating and registering actions See Refactoring FAQ


Constructor Summary
ActionsImplementationProvider()
           
 
Method Summary
 boolean canCopy(Lookup lookup)
           
 boolean canDelete(Lookup lookup)
           
 boolean canFindUsages(Lookup lookup)
           
 boolean canMove(Lookup lookup)
           
 boolean canRename(Lookup lookup)
           
 void doCopy(Lookup lookup)
           
 void doDelete(Lookup lookup)
           
 void doFindUsages(Lookup lookup)
           
 void doMove(Lookup lookup)
           
 void doRename(Lookup lookup)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionsImplementationProvider

public ActionsImplementationProvider()
Method Detail

canRename

public boolean canRename(Lookup lookup)
Parameters:
lookup - current context
Returns:
true if provider can handle rename

doRename

public void doRename(Lookup lookup)
Parameters:
lookup - current context

canFindUsages

public boolean canFindUsages(Lookup lookup)
Parameters:
lookup - current context
Returns:
true if provider can handle find usages

doFindUsages

public void doFindUsages(Lookup lookup)
Parameters:
lookup - current context

canDelete

public boolean canDelete(Lookup lookup)
Parameters:
lookup - current context
Returns:
true if provider can handle delete

doDelete

public void doDelete(Lookup lookup)
Parameters:
lookup - current context

canMove

public boolean canMove(Lookup lookup)
Parameters:
lookup - current context
Returns:
true if provider can handle move

doMove

public void doMove(Lookup lookup)
Parameters:
lookup - current context

canCopy

public boolean canCopy(Lookup lookup)
Parameters:
lookup - current context
Returns:
true if provider can handle copy

doCopy

public void doCopy(Lookup lookup)
Parameters:
lookup - current context

org.netbeans.modules.refactoring.api 1.0

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.