org.eclipse.emf.edit.command
Class PasteFromClipboardCommand

java.lang.Object
  |
  +--org.eclipse.emf.common.command.AbstractCommand
        |
        +--org.eclipse.emf.edit.command.AbstractOverrideableCommand
              |
              +--org.eclipse.emf.edit.command.PasteFromClipboardCommand
All Implemented Interfaces:
Command, OverrideableCommand

public class PasteFromClipboardCommand
extends AbstractOverrideableCommand

This works exactly like an AddCommand but the things to be added are copied from the EditingDomain clipboard.


Field Summary
protected  StrictCompoundCommand command
          This is the command that does the actual pasting.
protected static java.lang.String DESCRIPTION
          This caches the description.
protected  java.lang.Object feature
          This is feature of the owner where the clipboard copy is pasted.
protected  int index
          This is index in the feature of the owner where the clipboard copy is pasted.
protected static java.lang.String LABEL
          This caches the label.
protected  boolean optimize
          This controls whether or not to optimize the canExecute (prepare)
protected  java.lang.Object owner
          This is object where the clipboard copy is pasted.
 
Fields inherited from class org.eclipse.emf.edit.command.AbstractOverrideableCommand
domain, overrideCommand
 
Fields inherited from class org.eclipse.emf.common.command.AbstractCommand
description, isExecutable, isPrepared, label
 
Constructor Summary
PasteFromClipboardCommand(EditingDomain domain, java.lang.Object owner, java.lang.Object feature, int index)
          This constructs an instance from the domain, which provides access the clipboard collection via EditingDomain.getCommandStack().
PasteFromClipboardCommand(EditingDomain domain, java.lang.Object owner, java.lang.Object feature, int index, boolean optimize)
           
 
Method Summary
static Command create(EditingDomain domain, java.lang.Object owner, java.lang.Object feature)
          This creates a command to add copies from the clipboard to the specified feature of the owner.
static Command create(EditingDomain domain, java.lang.Object owner, java.lang.Object feature, int index)
          This creates a command to add copies from the clipboard to the specified feature of the owner and at the given index.
 void doDispose()
          This is overrideable command's implementation of dispose.
 void doExecute()
          This is overrideable command's implementation of execute.
 java.util.Collection doGetAffectedObjects()
          This is overrideable command's implementation of getAffectedObjects.
 java.util.Collection doGetResult()
          This is overrideable command's implementation of getResult.
 void doRedo()
          This is overrideable command's implementation of redo.
 void doUndo()
          This is overrideable command's implementation of undo.
 java.lang.Object getFeature()
           
 int getIndex()
           
 java.lang.Object getOwner()
           
protected  boolean optimizedCanExecute()
           
protected  boolean prepare()
          Called at most once in AbstractOverrideableCommand.canExecute() to give the command an opportunity to ready itself for execution.
 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.
 
Methods inherited from class org.eclipse.emf.edit.command.AbstractOverrideableCommand
canExecute, canUndo, dispose, doCanExecute, doCanUndo, doGetChildrenToCopy, doGetDescription, doGetLabel, execute, getAffectedObjects, getChildrenToCopy, getDescription, getDomain, getLabel, getOverride, getOwnerList, getResult, redo, setOverride, undo
 
Methods inherited from class org.eclipse.emf.common.command.AbstractCommand
chain, setDescription, setLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.common.command.Command
chain
 

Field Detail

LABEL

protected static final java.lang.String LABEL
This caches the label.

DESCRIPTION

protected static final java.lang.String DESCRIPTION
This caches the description.

command

protected StrictCompoundCommand command
This is the command that does the actual pasting.

owner

protected java.lang.Object owner
This is object where the clipboard copy is pasted.

feature

protected java.lang.Object feature
This is feature of the owner where the clipboard copy is pasted.

index

protected int index
This is index in the feature of the owner where the clipboard copy is pasted.

optimize

protected boolean optimize
This controls whether or not to optimize the canExecute (prepare)
Constructor Detail

PasteFromClipboardCommand

public PasteFromClipboardCommand(EditingDomain domain,
                                 java.lang.Object owner,
                                 java.lang.Object feature,
                                 int index)
This constructs an instance from the domain, which provides access the clipboard collection via EditingDomain.getCommandStack().

PasteFromClipboardCommand

public PasteFromClipboardCommand(EditingDomain domain,
                                 java.lang.Object owner,
                                 java.lang.Object feature,
                                 int index,
                                 boolean optimize)
Method Detail

create

public static Command create(EditingDomain domain,
                             java.lang.Object owner,
                             java.lang.Object feature)
This creates a command to add copies from the clipboard to the specified feature of the owner.

create

public static Command create(EditingDomain domain,
                             java.lang.Object owner,
                             java.lang.Object feature,
                             int index)
This creates a command to add copies from the clipboard to the specified feature of the owner and at the given index.

getOwner

public java.lang.Object getOwner()

getFeature

public java.lang.Object getFeature()

getIndex

public int getIndex()

prepare

protected boolean prepare()
Description copied from class: AbstractCommand
Called at most once in AbstractCommand.canExecute() to give the command an opportunity to ready itself for execution. The returned value is stored in AbstractCommand.canExecute(). In other words, you can override this method to initialize and to yield a cached value for the all subsequent calls to canExecute.
Overrides:
prepare in class AbstractCommand
Following copied from class: org.eclipse.emf.common.command.AbstractCommand
Returns:
whether the command is executable.

optimizedCanExecute

protected boolean optimizedCanExecute()

doExecute

public void doExecute()
Description copied from interface: OverrideableCommand
This is overrideable command's implementation of execute.
Overrides:
doExecute in class AbstractOverrideableCommand

doUndo

public void doUndo()
Description copied from interface: OverrideableCommand
This is overrideable command's implementation of undo.
Overrides:
doUndo in class AbstractOverrideableCommand

doRedo

public void doRedo()
Description copied from interface: OverrideableCommand
This is overrideable command's implementation of redo.
Overrides:
doRedo in class AbstractOverrideableCommand

doGetResult

public java.util.Collection doGetResult()
Description copied from interface: OverrideableCommand
This is overrideable command's implementation of getResult.
Overrides:
doGetResult in class AbstractOverrideableCommand

doGetAffectedObjects

public java.util.Collection doGetAffectedObjects()
Description copied from interface: OverrideableCommand
This is overrideable command's implementation of getAffectedObjects.
Overrides:
doGetAffectedObjects in class AbstractOverrideableCommand

doDispose

public void doDispose()
Description copied from interface: OverrideableCommand
This is overrideable command's implementation of dispose.
Overrides:
doDispose in class AbstractOverrideableCommand

toString

public 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.
Overrides:
toString in class AbstractOverrideableCommand
Following copied from class: org.eclipse.emf.common.command.AbstractCommand
Returns:
string representation.

Copyright 2001-2002 IBM Corporation and others.
All Rights Reserved.