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 SummaryFields inherited from interface org.eclipse.jface.action.IActionAS_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 SummaryConstructorsConstructorDescriptionPasteTemplateAction(IWorkbenchPart editor) Constructor for PasteTemplateAction.
- 
Method SummaryModifier 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.SelectionActiondispose, getSelectedEditParts, getSelectedObjects, getSelection, handleSelectionChanged, setSelection, setSelectionProvider, updateMethods inherited from class org.eclipse.gef.ui.actions.WorkbenchPartActionexecute, getCommandStack, getWorkbenchPart, isEnabled, refresh, setLazyEnablementCalculation, setWorkbenchPartMethods inherited from class org.eclipse.jface.action.ActionconvertAccelerator, 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.AbstractActionaddPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListenerMethods inherited from class org.eclipse.core.commands.common.EventManageraddListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
- 
Constructor Details- 
PasteTemplateActionConstructor for PasteTemplateAction.- Parameters:
- editor-
 
 
- 
- 
Method Details- 
calculateEnabledprotected boolean calculateEnabled()Description copied from class:WorkbenchPartActionCalculates and returns the enabled state of this action.- Specified by:
- calculateEnabledin class- WorkbenchPartAction
- Returns:
- trueif- createPasteCommand()returns an executable command
- See Also:
 
- 
createPasteCommandCreates and returns a command (which may benull) to create a new EditPart based on the template on the clipboard.- Returns:
- the paste command
 
- 
getClipboardContentsReturns 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
 
- 
getFactoryReturns 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 be- null
- Returns:
- a Factory
 
- 
getPasteLocation- Parameters:
- container- the parent of the new part that is being pasted
- Returns:
- the location at which to insert
 
- 
initprotected void init()Description copied from class:WorkbenchPartActionInitializes this action.- Overrides:
- initin class- WorkbenchPartAction
- See Also:
 
- 
runpublic void run()Executes the command returned bycreatePasteCommand().
 
-