Extension SDK 10.1.2

oracle.ide.addin
Class AbstractCommand

java.lang.Object
  extended byoracle.ide.addin.AbstractCommand
All Implemented Interfaces:
Command
Direct Known Subclasses:
CloseNodeCommand, DeleteTNodeCommand, ExitCommand, IdeSettingsCommand, LogWindowCommand, NewWorkspaceCommand, OpenCommand, OpenEditorCommand, OpenWizardCommand, PropertySetCommand, PropertySetCommand, RedoCommand, RemoveFileCommand, RevertNodeCommand, SaveAllCommand, SaveAsCommand, SaveCommand, UndoCommand, VCSAbstractCommand, VCSCheckOutDocumentCmd

public abstract class AbstractCommand
extends java.lang.Object
implements Command

The AbstractCommand abstract class implements the Command interface. IDE commands should extend this class when implementing new commands. This class implements all Command methods with the exception of the doit. Concrete subclasses implement the doit method with necessary behavior to carry out a command.

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

Field Summary
protected  int cmdId
           
protected  Context context
           
protected  java.lang.String name
          Stores the name of the command.
protected  int type
          Keeps the command type.
 
Fields inherited from interface oracle.ide.addin.Command
CANCEL, EXECUTING, NO_CHANGE, NO_UNDO, NORMAL, OK
 
Constructor Summary
protected AbstractCommand(int cmdId)
           
protected AbstractCommand(int cmdId, int type)
          Constructor.
protected AbstractCommand(int cmdId, int type, java.lang.String name)
          Constructor.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.ide.addin.Command
doit
 

Field Detail

cmdId

protected int cmdId

type

protected int type
Keeps the command type. Default value is NO_CHANGE.


context

protected Context context

name

protected java.lang.String name
Stores the name of the command. This name will be display along side the Undo and Redo menu items.

Constructor Detail

AbstractCommand

protected AbstractCommand(int cmdId,
                          int type)
Constructor.


AbstractCommand

protected AbstractCommand(int cmdId)

AbstractCommand

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

Parameters:
name - the command name. This name will be displayed along side the Undo and Redo menu items
type - the command type.
Method Detail

undo

public int undo()
         throws java.lang.Exception
Called by the CommandProcessor to undo a command. Does nothing in this implemenation. Commands that can be undone should provide the behavior here to undo whatever actions were carried out when the doit method was called When a command executes successfully, implementations should return OK, otherwise, return CANCEL or any other non-zero value.

Specified by:
undo in interface Command
Throws:
java.lang.Exception

getName

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

Specified by:
getName in interface Command

getId

public int getId()
Gets the command identifier

Specified by:
getId in interface Command

getType

public int getType()
Gets the command type. The default value is NO_CHANGE

Specified by:
getType in interface Command

setData

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

Specified by:
setData in interface Command

getData

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

Specified by:
getData in interface Command

setContext

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

Specified by:
setContext in interface Command

getContext

public Context getContext()
Gets the ide current context

Specified by:
getContext in interface Command

getAffectedDocuments

public Document[] getAffectedDocuments()
Description copied from interface: Command
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.

Specified by:
getAffectedDocuments in interface Command
Returns:
the documents affected by this command, otherwise, null.

Extension SDK

 

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