# Class PerspectiveAction

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

All Implemented Interfaces:
  `IAction, ActionFactory.IWorkbenchAction`

Direct Known Subclasses:
  `ToggleEditorsVisibilityAction`

public abstract class PerspectiveAction extends Action implements ActionFactory.IWorkbenchAction
Abstract superclass of actions which are enabled iff there is an active perspective in the window.

Since:
  3.1

## 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
Modifier
Constructor
Description
`protected`
`PerspectiveAction(IWorkbenchWindow window)`
Constructs a new perspective action for the given window.

## Method Summary

Modifier and Type
Method
Description
`void`
`dispose()`
Disposes of this action.
`protected IWorkbenchWindow`
`getWindow()`
Returns the window, or `null` if the action has been disposed.
`void`
`run()`
The default implementation of this `IAction` method does nothing.
`protected abstract void`
`run(IWorkbenchPage page, IPerspectiveDescriptor persp)`
Runs the action, passing the active page and perspective.

### Methods inherited from class Action

`convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, runWithEvent, 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`

### Methods inherited from interface IAction

`addPropertyChangeListener, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, removePropertyChangeListener, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText`

## Constructor Details

### PerspectiveAction

protected PerspectiveAction(IWorkbenchWindow window)
Constructs a new perspective action for the given window.

Parameters:
  `window` - the window

## Method Details

### getWindow

protected IWorkbenchWindow getWindow()
Returns the window, or `null` if the action has been disposed.

Returns:
  the window or `null`

### run

public void run()
Description copied from class: `Action`
The default implementation of this `IAction` method does nothing. Subclasses should override this method if they do not need information from the triggering event, or override `runWithEvent(Event)` if they do.

Specified by:
  `run` in interface `IAction`
Overrides:
  `run` in class `Action`
See Also:
  - How radio buttons are handled
  - How check boxes are handled

### run

protected abstract void run(IWorkbenchPage page, IPerspectiveDescriptor persp)
Runs the action, passing the active page and perspective.

Parameters:
  `page` - the active page
  `persp` - the active perspective

### dispose

public void dispose()
Description copied from interface: `ActionFactory.IWorkbenchAction`
Disposes of this action. Once disposed, this action cannot be used. This operation has no effect if the action has already been disposed.

Specified by:
  `dispose` in interface `ActionFactory.IWorkbenchAction`