|
Runtime | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.eclipse.core.commands.operations.AbstractOperation
org.eclipse.gmf.runtime.common.core.command.AbstractCommand
org.eclipse.gmf.runtime.diagram.ui.commands.CreateViewAndOptionallyElementCommand
A command used to optionally create a new view and new element. This command is used when it is not known at command creation time whether or not an element should be created as well. For example, when creating a connection to an unspecified target, did the user want to
Note: This command will pop up a dialog box if the element exists already and there is a view for it on the diagram to ask the user what they want to do.
| Constructor Summary | |
CreateViewAndOptionallyElementCommand(IAdaptable elementAdapter,
IGraphicalEditPart containerEP,
Point location,
PreferencesHint preferencesHint)
Creates a new CreateViewAndOptionallyElementCommand. |
|
| Method Summary | |
boolean |
canRedo()
|
boolean |
canUndo()
|
protected CommandResult |
doExecuteWithResult(IProgressMonitor progressMonitor,
IAdaptable info)
If the element adapter is empty, this command creates a new element and view for it. |
protected CommandResult |
doRedoWithResult(IProgressMonitor progressMonitor,
IAdaptable info)
Performs the actual work of redoing this command. |
protected CommandResult |
doUndoWithResult(IProgressMonitor progressMonitor,
IAdaptable info)
Performs the actual work of undoing this command. |
java.util.List |
getAffectedFiles()
Returns the IFiles that may be modified when the operation is
executed, undone or redone. |
protected Command |
getCommand()
Gets the command. |
protected IGraphicalEditPart |
getContainerEP()
Gets the containerEP. |
protected IAdaptable |
getElementAdapter()
Gets the elementAdapter. |
protected View |
getExistingView(EObject element)
Searches the container editpart to see if the element passed in already has a view. |
protected Point |
getLocation()
Gets the location. |
protected PreferencesHint |
getPreferencesHint()
Gets the preferences hint that is to be used to find the appropriate preference store from which to retrieve diagram preference values. |
IAdaptable |
getResult()
|
protected void |
setCommand(Command command)
Sets the command. |
protected void |
setContainerEP(IGraphicalEditPart containerEP)
Sets the containerEP. |
protected void |
setElementAdapter(IAdaptable elementAdapter)
Sets the elementAdapter. |
protected void |
setLocation(Point location)
Sets the location. |
protected void |
setPreferencesHint(PreferencesHint preferencesHint)
Sets the preferences hint that is to be used to find the appropriate preference store from which to retrieve diagram preference values. |
protected void |
setResult(IAdaptable viewAdapter)
Sets the result to adapt to the view passed in. |
protected boolean |
useExistingView(View view)
Prompts the user to see if they would like to use an existing view on the diagram. |
| Methods inherited from class org.eclipse.gmf.runtime.common.core.command.AbstractCommand |
compose, dispose, execute, getCommandResult, internalSetResult, redo, reduce, setResult, undo |
| Methods inherited from class org.eclipse.core.commands.operations.AbstractOperation |
addContext, canExecute, getContexts, getLabel, hasContext, removeContext, setLabel, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.eclipse.core.commands.operations.IUndoableOperation |
addContext, canExecute, getContexts, getLabel, hasContext, removeContext |
| Constructor Detail |
public CreateViewAndOptionallyElementCommand(IAdaptable elementAdapter, IGraphicalEditPart containerEP, Point location, PreferencesHint preferencesHint)
CreateViewAndOptionallyElementCommand.
elementAdapter - Adapts to the element, if null at command execution time, an
element is to be created.containerEP - The container edit part, where the view request is sent.location - The location to create the new view. If null, a default
location is usedpreferencesHint - The preference hint that is to be used to find the appropriate
preference store from which to retrieve diagram preference
values. The preference hint is mapped to a preference store in
the preference registry <@link DiagramPreferencesRegistry>.| Method Detail |
public java.util.List getAffectedFiles()
AbstractCommandIFiles that may be modified when the operation is
executed, undone or redone.
getAffectedFiles in interface ICommandgetAffectedFiles in class AbstractCommandprotected View getExistingView(EObject element)
element -
protected boolean useExistingView(View view)
view - the existing view
protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException
doExecuteWithResult in class AbstractCommandprogressMonitor - the progress monitor provided by the operation history. Must
never be null.info - the IAdaptable (or null) provided by the
caller in order to supply UI information for prompting the
user if necessary. When this parameter is not
null, it should minimally contain an adapter
for the org.eclipse.swt.widgets.Shell.class.
null
if the execution status is OK, but there is no meaningful result
to be returned.
ExecutionException - if, for some reason, I fail to complete the operationpublic boolean canUndo()
public boolean canRedo()
protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException
AbstractCommand
doRedoWithResult in class AbstractCommandprogressMonitor - the progress monitor provided by the operation history. Must
never be null.info - the IAdaptable (or null) provided by the
caller in order to supply UI information for prompting the
user if necessary. When this parameter is not
null, it should minimally contain an adapter
for the org.eclipse.swt.widgets.Shell.class.
null
if the execution status is OK, but there is no meaningful result
to be returned.
ExecutionException - on failure to redoprotected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException
AbstractCommand
doUndoWithResult in class AbstractCommandprogressMonitor - the progress monitor provided by the operation history. Must
never be null.info - the IAdaptable (or null) provided by the
caller in order to supply UI information for prompting the
user if necessary. When this parameter is not
null, it should minimally contain an adapter
for the org.eclipse.swt.widgets.Shell.class.
null
if the execution status is OK, but there is no meaningful result
to be returned.
ExecutionException - on failure to undopublic IAdaptable getResult()
protected void setResult(IAdaptable viewAdapter)
viewAdapter - protected IAdaptable getElementAdapter()
protected void setElementAdapter(IAdaptable elementAdapter)
elementAdapter - The elementAdapter to set.protected Point getLocation()
protected void setLocation(Point location)
location - The location to set.protected IGraphicalEditPart getContainerEP()
protected void setContainerEP(IGraphicalEditPart containerEP)
containerEP - The containerEP to set.protected PreferencesHint getPreferencesHint()
protected void setPreferencesHint(PreferencesHint preferencesHint)
preferencesHint - the preferences hintprotected Command getCommand()
protected void setCommand(Command command)
command - The command to set.
|
Runtime | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.