Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

oracle.jdeveloper.vcs.spi
Class VCSCommand

java.lang.Object
  extended by oracle.ide.controller.Command
      extended by oracle.jdeveloper.vcs.spi.VCSCommand
Direct Known Subclasses:
AbstractPatchCommand, ActionCommand, AnnotationsCommand, ShareApplicationCommand, ShareProjectCommand, VersionHistoryCommand, VersionTreeCommand

public abstract class VCSCommand
extends Command

Abstract superclass for version control commands.

Since:
9.0.5

Field Summary
static int CANCEL
          Command execution CANCEL status.
static int ERROR
          Command execution ERROR status (exception handled).
static int NOOP
          Command execution NOOP status (no operation, invalid context).
static int OK
          Command execution OK status.
 
Fields inherited from class oracle.ide.controller.Command
context, EXECUTING, MULTI_NODE, NO_CHANGE, NO_UNDO, NORMAL, type
 
Constructor Summary
protected VCSCommand(int cmdId)
          Constructor.
protected VCSCommand(int cmdId, int type)
          Constructor.
protected VCSCommand(int cmdId, int type, java.lang.String name)
          Constructor.
 
Method Summary
protected  Context buildContextForEditor()
          Build a context for invoking an editor.
protected  VCSStatusFilter createStatusFilter(VCSStatus[] statuses)
          Creates a VCSStatus filter that accepts only the given statuses.
 int doit()
          Executes the actions associated with a specific command.
protected abstract  int doitImpl()
          Executes the actions associated with a specific version control command (implementation).
protected  void fireFileStructureChanged(java.net.URL[] urls)
          Fires notification that the structure of the given URLs has changed.
protected  void fireSomeFilesCreated(java.net.URL[] urls)
          Fires notification that the given URLs have been created, where existent.
protected  void fireSomeFilesDeleted(java.net.URL[] urls)
          Fires notification that the given URLs have been deleted, where non-existent.
protected  Locatable[] getContextLocatables()
          Gets the valid locatables from the context node selection, applying the filter returned by getLocatableURLFilter().
protected  VCSExceptionHandler getExceptionHandler()
          Get the exception handler used to report errors from this command.
protected  VCSExtension getExtension()
           
protected  java.util.Collection getFilteredSelection()
          Gets the filtered Locatable selection based on the context and the command's defined status cache and filter.
protected  java.util.Collection getFilteredSelection(Locatable[] locatables)
          Gets the filtered Locatable selection based on given selection and the command's defined status cache and filter.
protected  URLFilter getLocatableURLFilter()
          Deprecated. replaced by getURLFilter().
protected  VCSStatusCache getStatusCache()
          Gets the status cache for the VCS command.
protected  VCSStatusFilter getStatusFilter()
          Gets the status filter for the VCS command.
protected  URLFilter getURLFilter()
          Gets the URL filter controlling locatables in the command context.
protected  void initializeCommandStyle(VCSCommandStyle commandStyle)
          Initializes the style of this command, a construction-time requirement.
protected  void initializeCommandType(VCSCommandType commandType)
           
 boolean isAvailable()
           
protected  boolean isAvailableImpl()
          Asks whether the command is available for the current context.
protected  boolean isAvailableImpl(Locatable locatable)
          Asks whether the command is available for the current context.
protected  boolean isAvailableImpl(Locatable[] locatables)
          Asks whether the command is available for the current context.
protected  boolean isAvailableImpl(java.net.URL url)
          Asks whether the command is available for the current context.
protected  boolean isThreaded()
          Asks whether this command should be executed on a separate temporary thread.
 void noOp()
           
protected  void noOpImpl()
          Performs actions, such as exception notification, when a command exits with the VCSCommand.NOOP code.
protected  void reloadBuffers(java.util.Map timestampMap)
           
protected  java.util.Map storeTimestamps(java.util.Collection nodes)
           
protected  void updateReadOnlyStates(Node[] nodes)
          Updates the editor read-only states of nodes for the given URLs.
 
Methods inherited from class oracle.ide.controller.Command
getAffectedNodes, getContext, getData, getId, getName, getType, isGlobal, setContext, setData, undo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OK

public static final int OK
Command execution OK status.

See Also:
Constant Field Values

CANCEL

public static final int CANCEL
Command execution CANCEL status.

See Also:
Constant Field Values

ERROR

public static final int ERROR
Command execution ERROR status (exception handled).

See Also:
Constant Field Values

NOOP

public static final int NOOP
Command execution NOOP status (no operation, invalid context).

See Also:
Constant Field Values
Constructor Detail

VCSCommand

protected VCSCommand(int cmdId)
Constructor.

Parameters:
cmdId - the command id.

VCSCommand

protected VCSCommand(int cmdId,
                     int type)
Constructor.

Parameters:
cmdId - the command id.
type - the command type.

VCSCommand

protected VCSCommand(int cmdId,
                     int type,
                     java.lang.String name)
Constructor.

Parameters:
cmdId - the command id.
type - the command type.
name - the command name, for undo and redo.
Method Detail

initializeCommandStyle

protected void initializeCommandStyle(VCSCommandStyle commandStyle)
Initializes the style of this command, a construction-time requirement.

Parameters:
commandStyle - the style of the command to set.

initializeCommandType

protected void initializeCommandType(VCSCommandType commandType)

doit

public int doit()
         throws java.lang.Exception
Description copied from class: Command
Executes the actions associated with a specific command. When a command executes successfully, implementations should return OK, otherwise, return CANCEL or any other non-zero value.

Specified by:
doit in class Command
Throws:
java.lang.Exception

isAvailable

public boolean isAvailable()

noOp

public void noOp()

isAvailableImpl

protected boolean isAvailableImpl()
                           throws java.lang.Exception
Asks whether the command is available for the current context.

Returns:
true if the command style is VCSCommandStyle.NORMAL, otherwise calls isAvailableImpl(Locatable[]) with contextual locatables.
Throws:
java.lang.Exception

isAvailableImpl

protected boolean isAvailableImpl(Locatable[] locatables)
                           throws java.lang.Exception
Asks whether the command is available for the current context.

Returns:
if the number of locatables in the context is different to 1, a value based on the VCSCommandStyle, otherwise calls isAvailableImpl(Locatable).
Throws:
java.lang.Exception

isAvailableImpl

protected boolean isAvailableImpl(Locatable locatable)
                           throws java.lang.Exception
Asks whether the command is available for the current context.

Returns:
false if the Locatable's URL is null or filtered by the locatable URL filter, otherwhise calls otherwise calls isAvailableImpl(URL).
Throws:
java.lang.Exception

isAvailableImpl

protected boolean isAvailableImpl(java.net.URL url)
                           throws java.lang.Exception
Asks whether the command is available for the current context.

Returns:
true if either getStatusCache() or getStatusFilter() return null, otherwise uses the acceptance value of the status filter.
Throws:
java.lang.Exception

noOpImpl

protected void noOpImpl()
                 throws VCSException
Performs actions, such as exception notification, when a command exits with the VCSCommand.NOOP code.

Throws:
VCSException - if the non-operation of the command is an exceptional state.

doitImpl

protected abstract int doitImpl()
                         throws java.lang.Exception
Executes the actions associated with a specific version control command (implementation).

Returns:
Command.OK, Command.CANCEL, VCSCommand.NOOP, VCSCommand.ERROR - or any negative value to indicate command failure.
Throws:
java.lang.Exception

getExtension

protected VCSExtension getExtension()

getExceptionHandler

protected VCSExceptionHandler getExceptionHandler()
Get the exception handler used to report errors from this command.

Returns:
an exception handler.

getURLFilter

protected URLFilter getURLFilter()
Gets the URL filter controlling locatables in the command context.

Returns:
the command's URL filter.

getStatusCache

protected VCSStatusCache getStatusCache()
Gets the status cache for the VCS command.

Returns:
the command's status cache.

getStatusFilter

protected VCSStatusFilter getStatusFilter()
Gets the status filter for the VCS command.

Returns:
the command's status filter.

isThreaded

protected boolean isThreaded()
Asks whether this command should be executed on a separate temporary thread.

Returns:
a verdict on temporary thread creation.

getContextLocatables

protected final Locatable[] getContextLocatables()
Gets the valid locatables from the context node selection, applying the filter returned by getLocatableURLFilter().

Returns:
the valid locatable context.

buildContextForEditor

protected final Context buildContextForEditor()
Build a context for invoking an editor. Certain elements in the IDE implement Locatable but not Node. As a result, you can't normally invoke an editor on such nodes. This method provides a workaround for this problem. Whenever invoking an editor from a VCS command, you should use this method in preference to getContext() to ensure that Locatables are properly wrapped in Node implementing interfaces.

Returns:
a modified context that can be used to invoke an editor on the context locatable.

updateReadOnlyStates

protected final void updateReadOnlyStates(Node[] nodes)
Updates the editor read-only states of nodes for the given URLs.

Parameters:
nodes - the nodes for read-only state updates.

createStatusFilter

protected final VCSStatusFilter createStatusFilter(VCSStatus[] statuses)
Creates a VCSStatus filter that accepts only the given statuses.

Parameters:
statuses - status objects accepted by the created filter.
Returns:
the created VCSStatus filter instance.

fireSomeFilesCreated

protected final void fireSomeFilesCreated(java.net.URL[] urls)
Fires notification that the given URLs have been created, where existent.

Parameters:
urls - the URLs for the event.

fireSomeFilesDeleted

protected final void fireSomeFilesDeleted(java.net.URL[] urls)
Fires notification that the given URLs have been deleted, where non-existent.

Parameters:
urls - the URLs for the event.

fireFileStructureChanged

protected final void fireFileStructureChanged(java.net.URL[] urls)
Fires notification that the structure of the given URLs has changed.

Parameters:
urls - the URLs for the event.

storeTimestamps

protected final java.util.Map storeTimestamps(java.util.Collection nodes)
See Also:
NodeUtil.storeTimestamps(Map,Collection)

reloadBuffers

protected final void reloadBuffers(java.util.Map timestampMap)
See Also:
NodeUtil.reloadBuffers(Map)

getFilteredSelection

protected final java.util.Collection getFilteredSelection()
                                                   throws java.lang.Exception
Gets the filtered Locatable selection based on the context and the command's defined status cache and filter.

Returns:
a collection of locatables which passed the status filter.
Throws:
java.lang.Exception

getFilteredSelection

protected final java.util.Collection getFilteredSelection(Locatable[] locatables)
                                                   throws java.lang.Exception
Gets the filtered Locatable selection based on given selection and the command's defined status cache and filter.

Parameters:
locatables - the locatables to filter.
Returns:
a collection of locatables which passed the status filter.
Throws:
java.lang.Exception

getLocatableURLFilter

protected URLFilter getLocatableURLFilter()
Deprecated. replaced by getURLFilter().

Gets the URL filter controlling locatables in the command context.

Returns:
the command's URL filter.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

Copyright © 1997, 2010, Oracle. All rights reserved.