Extension SDK 10.1.2

oracle.ide.addin
Interface Command

All Known Subinterfaces:
VCSCommand
All Known Implementing Classes:
AbstractCommand, VCSAbstractCommand

public interface Command

The Command interface defines the interface of all command objects. This interface consists of a procedure, doit, to execute a command. Concrete Command subclasses implement the necessary behavior to carry out a specific command. This interface also provides additional methods necessary to implement the undo service provided by the CommandProcessor. For the undo mechanism it is necessary to distinguish three types of commands: NO_CHANGE A command that require no undo. NORMAL A command that can be undone. NO_UNDO A command that cannot be undone, and which prevents the undo of previously performed normal commands.

See Also:
CommandProcessor, oracle.ide.IdeCommand, oracle.ide.IdeCommandProcessor

Field Summary
static int CANCEL
          Command execution CANCEL status
static int EXECUTING
          Command execution EXECUTING status.
static int NO_CHANGE
          Indicates a command that requires no undo.
static int NO_UNDO
          Indicates a command that cannot be undone, and which prevents the undo of previously performed normal commands.
static int NORMAL
          Indicates a command that can be undone.
static int OK
          Command execution OK status
 
Method Summary
 int doit()
          Executes the actions associated with a specific command.
 Document[] getAffectedDocuments()
          For commands of the NORMAL and NO_UNDO this method should return an array of documents affected by the execution of this command.
 Context getContext()
          Gets the ide current context
 java.lang.Object getData()
          Gets the stored command specific data
 int getId()
          Gets the command identifier
 java.lang.String getName()
          Gets the name of the command to display as the action to undo
 int getType()
          Gets the command type
 void setContext(Context context)
          Sets context associated with command
 void setData(java.lang.Object data)
          Sets command specific data
 int undo()
          Called by the CommandProcessor to undo a command When a command executes successfully, implementations should return OK, otherwise, return CANCEL or any other non-zero value.
 

Field Detail

NORMAL

public static final int NORMAL
Indicates a command that can be undone.

See Also:
Constant Field Values

NO_CHANGE

public static final int NO_CHANGE
Indicates a command that requires no undo.

See Also:
Constant Field Values

NO_UNDO

public static final int NO_UNDO
Indicates a command that cannot be undone, and which prevents the undo of previously performed normal commands.

See Also:
Constant Field Values

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

EXECUTING

public static final int EXECUTING
Command execution EXECUTING status. Indicates the command is currently executing.

See Also:
Constant Field Values
Method Detail

doit

public int doit()
         throws java.lang.Exception
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.

Throws:
java.lang.Exception

undo

public int undo()
         throws java.lang.Exception
Called by the CommandProcessor to undo a command When a command executes successfully, implementations should return OK, otherwise, return CANCEL or any other non-zero value.

Throws:
java.lang.Exception

getName

public java.lang.String getName()
Gets the name of the command to display as the action to undo


getId

public int getId()
Gets the command identifier


getType

public int getType()
Gets the command type


setData

public void setData(java.lang.Object data)
Sets command specific data


getData

public java.lang.Object getData()
Gets the stored command specific data


setContext

public void setContext(Context context)
Sets context associated with command


getContext

public Context getContext()
Gets the ide current context


getAffectedDocuments

public Document[] getAffectedDocuments()
For commands of the NORMAL and NO_UNDO this method should return an array of documents affected by the execution of this command. This array should not include the primary document on which this command is operating, it should only include other documents affected as a side effect of executing this command. The affected documents undo stack will be flushed. The CommandProcessor uses the return value to clear the undo stack of the affected documents. Commands of type NO_CHANGE should return null.

Returns:
the documents affected by this command, otherwise, null.

Extension SDK

 

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