# Class ViewPluginAction

java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.jface.action.AbstractAction
org.eclipse.jface.action.Action
org.eclipse.ui.internal.PluginAction
org.eclipse.ui.internal.PartPluginAction
org.eclipse.ui.internal.ViewPluginAction

All Implemented Interfaces:
  `EventListener, IAction, ISelectionChangedListener, INullSelectionListener, IPluginContribution, ISelectionListener`

public final class ViewPluginAction extends PartPluginAction
This class extends regular plugin action with the additional requirement that the delegate has to implement interface IViewActionDeelgate. This interface has one additional method (init) whose purpose is to initialize the delegate with the view part in which the action is intended to run.

## Field Summary

### Fields inherited from interface 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

Constructors
Constructor
Description
`ViewPluginAction(IConfigurationElement actionElement, IViewPart viewPart, String id, int style)`
This class adds the requirement that action delegates loaded on demand implement IViewActionDelegate

## Method Summary

Modifier and Type
Method
Description
`void`
`dispose()`
Disposes this plugin action.
`protected void`
`initDelegate()`
Initialize the action delegate by calling its lifecycle method.
`boolean`
`isOkToCreateDelegate()`
Returns true if the view has been set The view may be null after the constructor is called and before the view is stored.
`protected IActionDelegate`
`validateDelegate(Object obj)`
Validates the object is a delegate of the expected type.

### Methods inherited from class PartPluginAction

`registerSelectionListener, unregisterSelectionListener`

### Methods inherited from class PluginAction

`createDelegate, disposeDelegate, getConfigElement, getDelegate, getLocalId, getMenuCreator, getOverrideActionId, getPluginId, getSelection, refreshEnablement, run, runWithEvent, selectionChanged, selectionChanged, selectionChanged`

### Methods inherited from class Action

`convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText`

### Methods inherited from class AbstractAction

`addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener`

### Methods inherited from class EventManager

`addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ViewPluginAction

public ViewPluginAction(IConfigurationElement actionElement, IViewPart viewPart, String id, int style)
This class adds the requirement that action delegates loaded on demand implement IViewActionDelegate

## Method Details

### validateDelegate

protected IActionDelegate validateDelegate(Object obj) throws WorkbenchException
Description copied from class: `PluginAction`
Validates the object is a delegate of the expected type. Subclasses can override to check for specific delegate types.

Note: Calls to the object are not allowed during this method.

Overrides:
  `validateDelegate` in class `PluginAction`
Parameters:
  `obj` - a possible action delegate implementation
Returns:
  the `IActionDelegate` implementation for the object
Throws:
  `WorkbenchException` - if not of the expected delegate type

### initDelegate

protected void initDelegate()
Description copied from class: `PluginAction`
Initialize the action delegate by calling its lifecycle method. Subclasses may override but must call this implementation first.

Overrides:
  `initDelegate` in class `PluginAction`

### isOkToCreateDelegate

public boolean isOkToCreateDelegate()
Returns true if the view has been set The view may be null after the constructor is called and before the view is stored. We cannot create the delegate at that time.

Overrides:
  `isOkToCreateDelegate` in class `PluginAction`

### dispose

public void dispose()
Description copied from class: `PluginAction`
Disposes this plugin action.

Overrides:
  `dispose` in class `PluginAction`