Package org.eclipse.gef.ui.actions
Class PasteTemplateAction
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.jface.action.AbstractAction
org.eclipse.jface.action.Action
org.eclipse.gef.ui.actions.WorkbenchPartAction
org.eclipse.gef.ui.actions.SelectionAction
org.eclipse.gef.ui.actions.PasteTemplateAction
- All Implemented Interfaces:
Disposable,UpdateAction,IAction
If the current object on the clipboard is a valid template, this action will
paste the template to the viewer.
- Since:
- 3.8
- See Also:
-
Field Summary
Fields inherited from interface org.eclipse.jface.action.IAction
AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, AS_RADIO_BUTTON, AS_UNSPECIFIED, CHECKED, DESCRIPTION, ENABLED, HANDLED, IMAGE, RESULT, TEXT, TOOL_TIP_TEXT -
Constructor Summary
ConstructorsConstructorDescriptionPasteTemplateAction(IWorkbenchPart editor) Constructor for PasteTemplateAction. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanCalculates and returns the enabled state of this action.protected CommandCreates and returns a command (which may benull) to create a new EditPart based on the template on the clipboard.protected ObjectReturns the template on the clipboard, if there is one.protected CreationFactorygetFactory(Object template) Returns the appropriate Factory object to be used for the specified template.protected PointgetPasteLocation(GraphicalEditPart container) protected voidinit()Initializes this action.voidrun()Executes the command returned bycreatePasteCommand().Methods inherited from class org.eclipse.gef.ui.actions.SelectionAction
dispose, getSelectedEditParts, getSelectedObjects, getSelection, handleSelectionChanged, setSelection, setSelectionProvider, updateMethods inherited from class org.eclipse.gef.ui.actions.WorkbenchPartAction
execute, getCommandStack, getWorkbenchPart, isEnabled, refresh, setLazyEnablementCalculation, setWorkbenchPartMethods inherited from class org.eclipse.jface.action.Action
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipTextMethods inherited from class org.eclipse.jface.action.AbstractAction
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListenerMethods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
Constructor Details
-
PasteTemplateAction
Constructor for PasteTemplateAction.- Parameters:
editor-
-
-
Method Details
-
calculateEnabled
protected boolean calculateEnabled()Description copied from class:WorkbenchPartActionCalculates and returns the enabled state of this action.- Specified by:
calculateEnabledin classWorkbenchPartAction- Returns:
trueifcreatePasteCommand()returns an executable command- See Also:
-
createPasteCommand
Creates and returns a command (which may benull) to create a new EditPart based on the template on the clipboard.- Returns:
- the paste command
-
getClipboardContents
Returns the template on the clipboard, if there is one. Note that the template on the clipboard might be from a palette from another type of editor.- Returns:
- the clipboard's contents
-
getFactory
Returns the appropriate Factory object to be used for the specified template. This Factory is used on the CreateRequest that is sent to the target EditPart. Note that the given template might be from a palette for a different GEF-based editor. In that case, this method can returnnull.- Parameters:
template- the template Object; it will never benull- Returns:
- a Factory
-
getPasteLocation
- Parameters:
container- the parent of the new part that is being pasted- Returns:
- the location at which to insert
-
init
protected void init()Description copied from class:WorkbenchPartActionInitializes this action.- Overrides:
initin classWorkbenchPartAction- See Also:
-
run
public void run()Executes the command returned bycreatePasteCommand().
-