Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.ui.actions
Class PartEventAction

java.lang.Object
  extended by 

org.eclipse.core.commands.common.EventManager
      extended by 

org.eclipse.jface.action.AbstractAction
          extended by 

org.eclipse.jface.action.Action
              extended by 
org.eclipse.ui.actions.PartEventAction
All Implemented Interfaces:
IAction, IPartListener
Direct Known Subclasses:
RetargetAction

public abstract class PartEventAction
extends Action
implements IPartListener

The abstract superclass for actions that listen to part activation and open/close events. This implementation tracks the active part (see getActivePart) and provides a convenient place to monitor part lifecycle events that could affect the availability of the action.

Subclasses must implement the following IAction method:

  • run - to do the action's work

Subclasses may extend any of the IPartListener methods if the action availablity needs to be recalculated:

  • partActivated
  • partDeactivated
  • partOpened
  • partClosed
  • partBroughtToTop

Although this method implements the IPartListener interface, it does NOT register itself.


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
protected PartEventAction ( String text)
          Creates a new action with the given text.
protected PartEventAction ( String text, int style)
          Creates a new action with the given text and style.
 
Method Summary
  IWorkbenchPart getActivePart ()
          Returns the currently active part in the workbench.
 void partActivated ( IWorkbenchPart part)
          The PartEventAction implementation of this IPartListener method records that the given part is active.
 void partBroughtToTop ( IWorkbenchPart part)
          The PartEventAction implementation of this IPartListener method does nothing.
 void partClosed ( IWorkbenchPart part)
          The PartEventAction implementation of this IPartListener method clears the active part if it just closed.
 void partDeactivated ( IWorkbenchPart part)
          The PartEventAction implementation of this IPartListener method records that there is no active part.
 void partOpened ( IWorkbenchPart part)
          The PartEventAction implementation of this IPartListener method does nothing.
 
Methods 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, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, run, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 
Methods inherited from class org.eclipse.jface.action. AbstractAction
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
 
Methods inherited from class org.eclipse.core.commands.common. EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.action. IAction
addPropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

PartEventAction

protected PartEventAction(
String text)
Creates a new action with the given text.

Parameters:
text - the action's text, or null if there is no text

PartEventAction

protected PartEventAction(
String text,
                          int style)
Creates a new action with the given text and style.

Parameters:
text - the action's text, or null if there is no text
style - one of AS_PUSH_BUTTON, AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_RADIO_BUTTON, and AS_UNSPECIFIED
Since:
3.0
Method Detail

getActivePart

public 
IWorkbenchPart getActivePart()
Returns the currently active part in the workbench.

Returns:
currently active part in the workbench, or null if none

partActivated

public void partActivated(
IWorkbenchPart part)
The PartEventAction implementation of this IPartListener method records that the given part is active. Subclasses may extend this method if action availability has to be recalculated.

Specified by:
partActivated in interface IPartListener
Parameters:
part - the part that was activated
See Also:
IWorkbenchPage.activate(org.eclipse.ui.IWorkbenchPart)

partBroughtToTop

public void partBroughtToTop(
IWorkbenchPart part)
The PartEventAction implementation of this IPartListener method does nothing. Subclasses should extend this method if action availability has to be recalculated.

Specified by:
partBroughtToTop in interface IPartListener
Parameters:
part - the part that was surfaced
See Also:
IWorkbenchPage.bringToTop(org.eclipse.ui.IWorkbenchPart)

partClosed

public void partClosed(
IWorkbenchPart part)
The PartEventAction implementation of this IPartListener method clears the active part if it just closed. Subclasses may extend this method if action availability has to be recalculated.

Specified by:
partClosed in interface IPartListener
Parameters:
part - the part that was closed
See Also:
IWorkbenchPage.hideView(IViewPart)

partDeactivated

public void partDeactivated(
IWorkbenchPart part)
The PartEventAction implementation of this IPartListener method records that there is no active part. Subclasses may extend this method if action availability has to be recalculated.

Specified by:
partDeactivated in interface IPartListener
Parameters:
part - the part that was deactivated
See Also:
IWorkbenchPage.activate(IWorkbenchPart)

partOpened

public void partOpened(
IWorkbenchPart part)
The PartEventAction implementation of this IPartListener method does nothing. Subclasses should extend this method if action availability has to be recalculated.

Specified by:
partOpened in interface IPartListener
Parameters:
part - the part that was opened
See Also:
IWorkbenchPage.showView(String)

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire