|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
javax.ide.command.Command
public abstract class 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.Commands are executed using the CommandProcessor
. As NORMAL
commands are executed, they are recorded by the command processor. This allows the command processor to perform undo and redo operations.
CommandProcessor
Field Summary | |
---|---|
static int |
CANCEL Command execution CANCEL 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 |
Constructor Summary | |
---|---|
protected |
Command() |
protected |
Command(int type) |
Method Summary | |
---|---|
abstract int |
doit() Executes the actions associated with a specific command. |
Document[] |
getAffectedDocuments() In general, the command processor manages undo stacks on a per Document basis. |
protected Context |
getContext() Gets the ide current Context . |
abstract 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 |
abstract 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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.ide.Identifiable |
---|
getID |
Field Detail |
---|
public static final int NORMAL
public static final int NO_CHANGE
public static final int NO_UNDO
public static final int OK
public static final int CANCEL
Constructor Detail |
---|
protected Command()
protected Command(int type)
Method Detail |
---|
public abstract int doit() throws java.lang.Exception
java.lang.Exception
public abstract int undo() throws java.lang.Exception
java.lang.Exception
public abstract java.lang.String getName()
public final int getType()
NORMAL
, NO_UNDO
, or NO_CHANGE
.protected final Context getContext()
Context
.public final void setContext(Context context)
Context
associated with commandpublic Document[] getAffectedDocuments()
Document
basis. When the execution of a command affects more than the target document, the other affected documents undo stacks must be be flushed in order to maintain document consistency. This method should be called by the command processor implementations after a command is executed to determine if that command affects other documents.
The CommandProcessor uses the return value to clear the undo stack of the affected documents.
For commands of the NORMAL and NO_UNDO type, 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.
Commands of type NO_CHANGE should return an empty array. The default implementation returns an empty array.
null
.
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |