|
Modelers | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.gef.commands.CommandStack
org.topcased.modeler.commands.CommandStack
public class CommandStack
Copy of the GEF command stack with some bug fixes. Waiting the bug #39386 will be fixed.
| Field Summary | |
|---|---|
protected java.util.List |
listeners
Deprecated. This field should not be referenced, use notifyListeners() |
static int |
POST_EXECUTE
Constant indicating notification after a command has been executed (value is 8). |
static int |
POST_REDO
Constant indicating notification after a command has been redone (value is 16). |
static int |
POST_UNDO
Constant indicating notification after a command has been undone (value is 32). |
static int |
PRE_EXECUTE
Constant indicating notification prior to executing a command (value is 1). |
static int |
PRE_REDO
Constant indicating notification prior to redoing a command (value is 2). |
static int |
PRE_UNDO
Constant indicating notification prior to undoing a command (value is 4). |
| Constructor Summary | |
|---|---|
CommandStack()
Constructs a new command stack. |
|
| Method Summary | |
|---|---|
void |
addCommandStackEventListener(org.eclipse.gef.commands.CommandStackEventListener listener)
Appends the listener to the list of command stack listeners. |
void |
addCommandStackListener(org.eclipse.gef.commands.CommandStackListener listener)
Appends the listener to the list of command stack listeners. |
boolean |
canRedo()
|
boolean |
canUndo()
|
void |
dispose()
This will dispose() all the commands in both the undo and
redo stack. |
void |
execute(org.eclipse.gef.commands.Command command)
Executes the specified Command if possible. |
void |
flush()
Flushes the entire stack and resets the save location to zero. |
java.lang.Object[] |
getCommands()
|
protected java.util.Stack |
getRedoable()
Returns the redoable commands |
org.eclipse.gef.commands.Command |
getRedoCommand()
Peeks at the top of the redo stack. |
protected int |
getSaveLocation()
Returns the save location |
protected java.util.Stack |
getUndoable()
Returns the undoable commands |
org.eclipse.gef.commands.Command |
getUndoCommand()
Peeks at the top of the undo stack. |
int |
getUndoLimit()
Returns the undo limit. |
boolean |
isDirty()
Returns true if the stack is dirty. |
void |
markSaveLocation()
Marks the last executed or redone Command as the point at which the changes were saved. |
protected void |
notifyListeners()
Deprecated. |
protected void |
notifyListeners(org.eclipse.gef.commands.Command command,
int state)
|
void |
redo()
Calls redo on the Command at the top of the redo stack, and pushes that Command onto the undo stack. |
void |
removeCommandStackEventListener(org.eclipse.gef.commands.CommandStackEventListener listener)
Removes the first occurrence of the specified listener. |
void |
removeCommandStackListener(org.eclipse.gef.commands.CommandStackListener listener)
Removes the first occurrence of the specified listener. |
void |
setUndoLimit(int undoLimit)
Sets the undo limit. |
void |
undo()
Undoes the most recently executed (or redone) Command. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.List listeners
notifyListeners()CommandStackListeners.
public static final int PRE_EXECUTE
public static final int PRE_REDO
public static final int PRE_UNDO
public static final int POST_EXECUTE
public static final int POST_REDO
public static final int POST_UNDO
| Constructor Detail |
|---|
public CommandStack()
false.
| Method Detail |
|---|
public void addCommandStackListener(org.eclipse.gef.commands.CommandStackListener listener)
addCommandStackListener in class org.eclipse.gef.commands.CommandStacklistener - the listenerpublic void addCommandStackEventListener(org.eclipse.gef.commands.CommandStackEventListener listener)
addCommandStackEventListener in class org.eclipse.gef.commands.CommandStacklistener - the event listenerpublic boolean canRedo()
canRedo in class org.eclipse.gef.commands.CommandStacktrue if it is appropriate to call redo().public boolean canUndo()
canUndo in class org.eclipse.gef.commands.CommandStacktrue if undo() can be calledpublic void execute(org.eclipse.gef.commands.Command command)
PRE_EXECUTE will be fired to
event listeners. Similarly, after attempting to execute the command, an
event for POST_EXECUTE will be fired. If the execution of the
command completely normally, stack listeners will receive
stackChanged
notification.
If the command is null or cannot be executed, nothing
happens.
execute in class org.eclipse.gef.commands.CommandStackcommand - the Command to executeCommandStackEventListener
protected void notifyListeners(org.eclipse.gef.commands.Command command,
int state)
notifyListeners in class org.eclipse.gef.commands.CommandStackcommand - post_execute2 - public void dispose()
dispose() all the commands in both the undo and
redo stack. Both stacks will be empty afterwards.
dispose in class org.eclipse.gef.commands.CommandStackpublic void flush()
flush in class org.eclipse.gef.commands.CommandStackpublic java.lang.Object[] getCommands()
getCommands in class org.eclipse.gef.commands.CommandStackpublic org.eclipse.gef.commands.Command getRedoCommand()
Command has
a label describing it.
getRedoCommand in class org.eclipse.gef.commands.CommandStacknullpublic org.eclipse.gef.commands.Command getUndoCommand()
Command has
a label describing it.
getUndoCommand in class org.eclipse.gef.commands.CommandStacknullpublic int getUndoLimit()
-1 is used to indicate
no limit.
getUndoLimit in class org.eclipse.gef.commands.CommandStackpublic boolean isDirty()
markSaveLocation() was last called.
isDirty in class org.eclipse.gef.commands.CommandStacktrue if the stack is dirtypublic void markSaveLocation()
isDirty() will be based on
this checkpoint.
markSaveLocation in class org.eclipse.gef.commands.CommandStackprotected void notifyListeners()
CommandStackListeners.
notifyListeners in class org.eclipse.gef.commands.CommandStackpublic void redo()
canUndo() returns true.
redo in class org.eclipse.gef.commands.CommandStackpublic void removeCommandStackListener(org.eclipse.gef.commands.CommandStackListener listener)
removeCommandStackListener in class org.eclipse.gef.commands.CommandStacklistener - the listenerpublic void removeCommandStackEventListener(org.eclipse.gef.commands.CommandStackEventListener listener)
removeCommandStackEventListener in class org.eclipse.gef.commands.CommandStacklistener - the listenerpublic void setUndoLimit(int undoLimit)
-1 is used to indicate
no limit.
setUndoLimit in class org.eclipse.gef.commands.CommandStackundoLimit - the undo limitpublic void undo()
canUndo() returns true.
undo in class org.eclipse.gef.commands.CommandStackprotected java.util.Stack getUndoable()
protected java.util.Stack getRedoable()
protected int getSaveLocation()
|
Modelers | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.