|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.emf.common.command.AbstractCommand
org.eclipse.emf.edit.command.DragAndDropCommand
public class DragAndDropCommand
The drag and drop command logically acts upon an owner object onto which a collection of things is being dragged.
The static create method delegates command creation to EditingDomain.createCommand
,
which may or may not result in the actual creation of an instance of this class.
The implementation of this class is high-level and generic; it ultimately delegates all behaviour to other types of command, and is typically undoable as a result.
Nested Class Summary | |
---|---|
static class |
DragAndDropCommand.Detail
This class is used to encode the drag and drop arguments into an object that will be passed as the feature of a CommandParameter . |
Nested classes/interfaces inherited from class org.eclipse.emf.common.command.AbstractCommand |
---|
AbstractCommand.NonDirtying |
Field Summary | |
---|---|
protected java.util.Collection<?> |
collection
This keeps track of the collection of dragged sources. |
protected static java.lang.String |
DESCRIPTION
This caches the description. |
protected EditingDomain |
domain
This keeps track of the domain in which this command is created. |
protected Command |
dragCommand
This keeps track of the command that implements the drag side of the operation. |
protected Command |
dropCommand
This keeps track of the command that implements the drop side of the operation. |
protected int |
feedback
This keeps track of the feedback that will be returned by getFeedback() . |
protected boolean |
isDragCommandExecuted
This keeps track of whether execute has been called on the dragCommand . |
protected static java.lang.String |
LABEL
This caches the label. |
protected float |
location
This keeps track of the location of the drag and drop. |
protected float |
lowerLocationBound
This keeps track of the lower range of locations in which the effect of this command remains unchanged. |
protected int |
operation
This keeps track of the current operation that will be returned by getOperation() . |
protected int |
operations
This keeps track of the permitted operations. |
protected boolean |
optimize
This controls whether or not to optimize the prepare() . |
protected java.lang.Object |
optimizedDropCommandOwner
This is to remember which owner to use for the drop command in the optimized mode. |
protected java.lang.Object |
owner
This keeps track of the owner that is the target of the drag and drop. |
protected float |
upperLocationBound
This keeps track of the upper range of locations in which the effect of this command remains unchanged. |
Fields inherited from class org.eclipse.emf.common.command.AbstractCommand |
---|
description, isExecutable, isPrepared, label |
Fields inherited from interface org.eclipse.emf.edit.command.DragAndDropFeedback |
---|
DROP_COPY, DROP_LINK, DROP_MOVE, DROP_NONE, FEEDBACK_INSERT_AFTER, FEEDBACK_INSERT_BEFORE, FEEDBACK_NONE, FEEDBACK_SELECT |
Constructor Summary | |
---|---|
DragAndDropCommand(EditingDomain domain,
java.lang.Object owner,
float location,
int operations,
int operation,
java.util.Collection<?> collection)
This creates and instance in the given domain and for the given information. |
|
DragAndDropCommand(EditingDomain domain,
java.lang.Object owner,
float location,
int operations,
int operation,
java.util.Collection<?> collection,
boolean optimize)
|
Method Summary | |
---|---|
protected boolean |
analyzeForNonContainment(Command command)
|
static Command |
create(EditingDomain domain,
java.lang.Object owner,
float location,
int operations,
int operation,
java.util.Collection<?> collection)
This creates a command to perform a drag and drop operation upon the owner. |
void |
dispose()
Called to indicate that the command will never be used again. |
void |
execute()
Performs the command activity required for the effect. |
java.util.Collection<?> |
getAffectedObjects()
Returns an empty list. |
protected java.util.Collection<?> |
getChildren(java.lang.Object object)
This can be overridden to determine the children of an object; this implementation uses EditingDomain.getChildren(java.lang.Object) . |
java.util.Collection<?> |
getCollection()
|
int |
getFeedback()
This returns one of the FEEDBACK_* values. |
float |
getLocation()
|
int |
getOperation()
This returns one of the DROP_* values. |
int |
getOperations()
|
java.lang.Object |
getOwner()
|
protected java.lang.Object |
getParent(java.lang.Object object)
This can be overridden to determine the parent of an object; this implementation uses EditingDomain.getParent(java.lang.Object) . |
java.util.Collection<?> |
getResult()
Returns an empty list. |
protected boolean |
isCrossDomain()
|
protected boolean |
isNonContainment(EStructuralFeature feature)
|
protected boolean |
optimizedCanExecute()
|
protected boolean |
prepare()
This implementation of prepare is called again to implement validate . |
protected boolean |
prepareDropCopyInsert(java.lang.Object parent,
java.util.Collection<?> children,
int index)
This attempts to prepare a drop copy insert operation. |
protected boolean |
prepareDropCopyOn()
This attempts to prepare a drop copy on operation. |
protected boolean |
prepareDropInsert()
This attempts to prepare a drop insert operation. |
protected boolean |
prepareDropLinkInsert(java.lang.Object parent,
java.util.Collection<?> children,
int index)
This attempts to prepare a drop link insert operation. |
protected boolean |
prepareDropLinkOn()
This attempts to prepare a drop link on operation. |
protected boolean |
prepareDropMoveInsert(java.lang.Object parent,
java.util.Collection<?> children,
int index)
This attempts to prepare a drop move insert operation. |
protected boolean |
prepareDropMoveOn()
This attempts to prepare a drop move on operation. |
protected boolean |
prepareDropOn()
This attempts to prepare a drop on operation. |
void |
redo()
Performs the command activity required to redo the effect after undoing the effect. |
protected void |
reset()
This restores the command to its default initialized state, disposing an command that may have been contained. |
java.lang.String |
toString()
This gives an abbreviated name using this object's own class' name, without package qualification, followed by a space separated list of field:value pairs. |
void |
undo()
Throws a runtime exception. |
boolean |
validate(java.lang.Object owner,
float location,
int operations,
int operation,
java.util.Collection<?> collection)
This is called by EditingDomainViewerDropAdapter to determine if the drag and drop operation is still enabled. |
Methods inherited from class org.eclipse.emf.common.command.AbstractCommand |
---|
canExecute, canUndo, chain, getDescription, getLabel, setDescription, setLabel |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String LABEL
protected static final java.lang.String DESCRIPTION
protected EditingDomain domain
protected java.lang.Object owner
protected float location
protected float lowerLocationBound
protected float upperLocationBound
protected int operations
protected int operation
getOperation()
.
protected int feedback
getFeedback()
.
protected java.util.Collection<?> collection
protected Command dragCommand
protected boolean isDragCommandExecuted
dragCommand
.
protected Command dropCommand
protected boolean optimize
prepare()
.
protected java.lang.Object optimizedDropCommandOwner
Constructor Detail |
---|
public DragAndDropCommand(EditingDomain domain, java.lang.Object owner, float location, int operations, int operation, java.util.Collection<?> collection)
public DragAndDropCommand(EditingDomain domain, java.lang.Object owner, float location, int operations, int operation, java.util.Collection<?> collection, boolean optimize)
Method Detail |
---|
public static Command create(EditingDomain domain, java.lang.Object owner, float location, int operations, int operation, java.util.Collection<?> collection)
DragAndDropCommand
for a description of the arguments.
protected boolean analyzeForNonContainment(Command command)
protected boolean isNonContainment(EStructuralFeature feature)
public java.lang.Object getOwner()
public float getLocation()
public int getOperations()
public java.util.Collection<?> getCollection()
protected boolean prepare()
validate
.
The method reset()
will have been called before doing so.
prepare
in class AbstractCommand
protected java.lang.Object getParent(java.lang.Object object)
EditingDomain.getParent(java.lang.Object)
.
protected java.util.Collection<?> getChildren(java.lang.Object object)
EditingDomain.getChildren(java.lang.Object)
.
protected boolean prepareDropInsert()
protected boolean prepareDropMoveInsert(java.lang.Object parent, java.util.Collection<?> children, int index)
protected boolean isCrossDomain()
protected boolean prepareDropCopyInsert(java.lang.Object parent, java.util.Collection<?> children, int index)
protected boolean prepareDropLinkInsert(java.lang.Object parent, java.util.Collection<?> children, int index)
protected boolean prepareDropOn()
protected boolean prepareDropMoveOn()
protected boolean prepareDropCopyOn()
protected boolean prepareDropLinkOn()
protected boolean optimizedCanExecute()
protected void reset()
public boolean validate(java.lang.Object owner, float location, int operations, int operation, java.util.Collection<?> collection)
validate
in interface DragAndDropFeedback
public int getFeedback()
DragAndDropFeedback
getFeedback
in interface DragAndDropFeedback
public int getOperation()
DragAndDropFeedback
getOperation
in interface DragAndDropFeedback
public void execute()
Command
execute
when canExecute
returns false
,
or when canExecute
hasn't been called, is undefined.
execute
in interface Command
public void undo()
AbstractCommand
undo
in interface Command
undo
in class AbstractCommand
public void redo()
Command
redo
the effect after undoing the effect.
The effect, if any, of calling redo
before undo
is called is undefined.
Note that if you implement redo
to call execute
then any derived class will be restricted by that decision also.
redo
in interface Command
public void dispose()
Command
dispose
in interface Command
dispose
in class AbstractCommand
public java.util.Collection<?> getResult()
AbstractCommand
getResult
in interface Command
getResult
in class AbstractCommand
public java.util.Collection<?> getAffectedObjects()
AbstractCommand
getAffectedObjects
in interface Command
getAffectedObjects
in class AbstractCommand
public java.lang.String toString()
toString
in class AbstractCommand
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |