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

UserCommandSupport (NetBeans VCS API) - NetBeans API Javadoc 4.1.0

 

org.netbeans.modules.vcscore.cmdline
Class UserCommandSupport

java.lang.Object
  extended byorg.netbeans.spi.vcs.commands.CommandSupport
      extended byorg.netbeans.modules.vcscore.cmdline.UserCommandSupport
All Implemented Interfaces:
ActionCommandSupport, Cloneable, PrivilegedAction, RecursionAwareCommandSupport

public class UserCommandSupport
extends CommandSupport
implements PrivilegedAction, ActionCommandSupport, RecursionAwareCommandSupport

The adapter from UserCommand to CommandSupport. This class is used to transfer the VcsCommand approach to the new org.netbeans.api.vcs.commands.Command approach.


Field Summary
static String VAR_ARGUMENT_FILES_TO_CLONE
          The list of variables, that contains file paths which will be clonned when a next command is created.
 
Constructor Summary
UserCommandSupport(UserCommand cmd, CommandExecutionContext executionContext)
          Creates a new instance of UserCommandSupport
 
Method Summary
 boolean canProcessFoldersNonRecursively()
          Tells, whether the created commands will be able to process folders non-recursively.
protected  Object clone()
          Subclasses need to implement the clone() method in order the command creation work properly.
protected  CommandTaskSupport createTask(Command command)
          Create the CommandTask, that is supposed to execute the command.
protected  int execute(CommandTask task)
          Perform the actual execution of the command from the provided info.
 Class getActionClass()
          Get the class of the action.
 String getActionDisplayName()
          Get the display name of the action.
 FileObject[] getApplicableFiles(FileObject[] files)
          Find, whether this command can act on a set of files.
 String getDisplayName()
          Get the display name of the command.
 CommandExecutionContext getExecutionContext()
          Get the execution context, that is associated with this support.
 Class[] getImplementedCommandClasses()
           
 String getName()
          Get the name of the command.
 UserCommand getVcsCommand()
          Get the UserCommand associated with this support.
 boolean hasExpertMode()
          Whether the command supports an expert mode.
protected  void initializeCommand(Command cmd)
          Initialize the command after it's created.
 Object run()
          Create the customizer for the command.
static boolean setCommandFilesFromTable(Command command, Table files, CommandExecutionContext executionContext)
          Set the files as arguments to the command.
static void setVariables(VcsCommand command, Table files, Hashtable vars, VariableValueAdjustment valueAdjustment, String relativeMountPoint, boolean useGreatestParentPaths)
          Add files specific variables.
 String toString()
          For debug purposes only.
 
Methods inherited from class org.netbeans.spi.vcs.commands.CommandSupport
canExecute, createCommand, getCommand, getCommand, getListeners, stop
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VAR_ARGUMENT_FILES_TO_CLONE

public static final String VAR_ARGUMENT_FILES_TO_CLONE
The list of variables, that contains file paths which will be clonned when a next command is created.

See Also:
Constant Field Values
Constructor Detail

UserCommandSupport

public UserCommandSupport(UserCommand cmd,
                          CommandExecutionContext executionContext)
Creates a new instance of UserCommandSupport

Method Detail

getVcsCommand

public UserCommand getVcsCommand()
Get the UserCommand associated with this support.


getExecutionContext

public CommandExecutionContext getExecutionContext()
Get the execution context, that is associated with this support.


getName

public String getName()
Get the name of the command.

Specified by:
getName in class CommandSupport

toString

public String toString()
For debug purposes only.


getDisplayName

public String getDisplayName()
Get the display name of the command. It will be visible on the popup menu under this name. When null, the command will not be visible on the popup menu.

Specified by:
getDisplayName in class CommandSupport

getImplementedCommandClasses

public Class[] getImplementedCommandClasses()

hasExpertMode

public boolean hasExpertMode()
Whether the command supports an expert mode. The command should provide a more complex customizer and/or output if in expert mode. If the command does not differentiate expert mode, it should declare, that it does not have an expert mode.

Specified by:
hasExpertMode in class CommandSupport
Returns:
true If the command differentiate expert mode, false otherwise

createTask

protected CommandTaskSupport createTask(Command command)
Description copied from class: CommandSupport
Create the CommandTask, that is supposed to execute the command. This implementation must return an instance of CommandTaskSupport.

Overrides:
createTask in class CommandSupport
Parameters:
command - The copy of the customized command, that can be used by the task to get the customized information.
Returns:
The instance of CommandTaskSupport.

execute

protected int execute(CommandTask task)
Perform the actual execution of the command from the provided info.

Specified by:
execute in class CommandSupport

getApplicableFiles

public FileObject[] getApplicableFiles(FileObject[] files)
Find, whether this command can act on a set of files.

Specified by:
getApplicableFiles in class CommandSupport
Parameters:
files - The array of files to inspect
Returns:
an array of files the command can act on or null when it can not act on any file listed.

canProcessFoldersNonRecursively

public boolean canProcessFoldersNonRecursively()
Description copied from interface: RecursionAwareCommandSupport
Tells, whether the created commands will be able to process folders non-recursively. If this is true, the created commands should implement RecursionAwareCommand and when setRecursionBanned(true) is called on them, they should still return non-null from getApplicableFiles() method for some files.

Specified by:
canProcessFoldersNonRecursively in interface RecursionAwareCommandSupport
Returns:
true when the created commands can process folders non-recursively.

clone

protected Object clone()
                throws CloneNotSupportedException
Description copied from class: CommandSupport
Subclasses need to implement the clone() method in order the command creation work properly.

Specified by:
clone in class CommandSupport
Returns:
The clonned command support object.
Throws:
CloneNotSupportedException

initializeCommand

protected void initializeCommand(Command cmd)
Initialize the command after it's created. This allows the implementator to preset some initial values to the command before it's customized. When sb. is just creates a command through VcsManager.createCommand(..) they will get this customized command.

Overrides:
initializeCommand in class CommandSupport
Parameters:
cmd - The command to be customized.

run

public Object run()
Create the customizer for the command. This uses a hack through the PrivilegedAction. If the returned object is UserCancelException, the command is canceled.

Specified by:
run in interface PrivilegedAction

getActionClass

public Class getActionClass()
Get the class of the action.

Specified by:
getActionClass in interface ActionCommandSupport

getActionDisplayName

public String getActionDisplayName()
Get the display name of the action.

Specified by:
getActionDisplayName in interface ActionCommandSupport

setCommandFilesFromTable

public static boolean setCommandFilesFromTable(Command command,
                                               Table files,
                                               CommandExecutionContext executionContext)
Set the files as arguments to the command. All FileObjects from the table are set via setFiles() method, all other are converted to java.io.Files through fileSystem.getFile(name) and set to the command via setDiskFiles() method.

Parameters:
command - The command to set the files on.
files - The table of file names and associated FileObjects.
Returns:
true when the files were successfully set, false when there are no applicable files to be set.

setVariables

public static void setVariables(VcsCommand command,
                                Table files,
                                Hashtable vars,
                                VariableValueAdjustment valueAdjustment,
                                String relativeMountPoint,
                                boolean useGreatestParentPaths)
Add files specific variables. Turbo compatible. The following variables are added:
PATH - the full path to the first file from the filesystem root
ABSPATH - the absolute path to the first file
DIR - the directory of the first file from the filesystem root
FILE - the first file
QFILE - the first file quoted
MIMETYPE - the MIME type of the first file

FILES - all files delimeted by the system file separator
QFILES - all files quoted by filesystem quotation string and delimeted by spaces
PATHS - full paths to all files delimeted by two system file separators
QPATHS - full paths to all files quoted by filesystem quotation string and delimeted by spaces
QABSPATHS - absolute paths to all files quoted by filesystem quotation string and delimeted by spaces
NUM_FILES - the number of files
MULTIPLE_FILES - "true" when more than one file is to be processed, "" otherwise
CACHED_ISLOCAL - "true" when file is local
CACHED_SIZE
CACHED_ATTR
COMMON_PARENT - the greatest common parent of provided files. If defined, all file paths change to be relative to this common parent

Parameters:
command - variables target command
files - the table of files
vars - the table of variables to extend
valueAdjustment - the variable value adjustment utility object
useGreatestParentPaths - whether to define COMMON_PARENT variable and change the file paths to be relative to this greatest common parent

 

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