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 RetargetAction

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
                  extended by 
org.eclipse.ui.actions.RetargetAction
All Implemented Interfaces:
IAction, ActionFactory.IWorkbenchAction, IPartListener
Direct Known Subclasses:
LabelRetargetAction

public class RetargetAction
extends PartEventAction
implements ActionFactory.IWorkbenchAction

A RetargetAction tracks the active part in the workbench. Each RetargetAction has an ID. If the active part provides an action handler for the ID the enable and check state of the RetargetAction is determined from the enable and check state of the handler. If the active part does not provide an action handler then this action is disabled.

Note: instances of this class add themselves as listeners to their action handler. It is important for the creator of a retarget action to call dispose when the action is no longer needed. This will ensure that the listener is removed.

This class may be instantiated. It is not intented to be subclassed.

Since:
2.0
Restriction:
This class is not intended to be subclassed by clients.

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
RetargetAction ( String actionID, String text)
          Constructs a RetargetAction with the given action id and text.
RetargetAction ( String actionID, String text, int style)
          Constructs a RetargetAction with the given action id, text and style.
 
Method Summary
 void dispose ()
          Disposes of the action and any resources held.
 void enableAccelerator (boolean b)
          Enables the accelerator for this action.
 int getAccelerator ()
          Returns the accelerator keycode for this action.
  IAction getActionHandler ()
          Returns the action handler.
 boolean isHandled ()
          Returns whether this action is handled.
 void partActivated ( IWorkbenchPart part)
          A workbench part has been activated.
 void partClosed ( IWorkbenchPart part)
          A workbench part has been closed.
 void partDeactivated ( IWorkbenchPart part)
          A workbench part has been deactivated.
protected  void propagateChange ( PropertyChangeEvent event)
          Either the action handler itself has changed, or the configured action handlers on the action bars have changed.
 void run ()
          Invoked when an action occurs.
 void runWithEvent ( Event event)
          Invoked when an action occurs.
protected  void setActionHandler ( IAction newHandler)
          Sets the action handler.
 void setChecked (boolean checked)
          Sets the checked status of this action.
 void setHelpListener ( HelpListener listener)
          The RetargetAction implementation of this method declared on IAction stores the help listener in a local field.
  String toString ()
          Returns a string representation of this action.
 
Methods inherited from class org.eclipse.ui.actions. PartEventAction
getActivePart, partBroughtToTop, partOpened
 
Methods inherited from class org.eclipse.jface.action. Action
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, notifyResult, removeAcceleratorText, removeMnemonics, setAccelerator, setActionDefinitionId, setDescription, setDisabledImageDescriptor, setEnabled, 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, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.action. IAction
addPropertyChangeListener, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, removePropertyChangeListener, setAccelerator, setActionDefinitionId, setDescription, setDisabledImageDescriptor, setEnabled, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 

Constructor Detail

RetargetAction

public RetargetAction(
String actionID,
                      
String text)
Constructs a RetargetAction with the given action id and text.

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

RetargetAction

public RetargetAction(
String actionID,
                      
String text,
                      int style)
Constructs a RetargetAction with the given action id, text and style.

Parameters:
actionID - the retargetable action id
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

dispose

public void dispose()
Disposes of the action and any resources held.

Specified by:
dispose in interface ActionFactory.IWorkbenchAction

enableAccelerator

public void enableAccelerator(boolean b)
Enables the accelerator for this action.

Parameters:
b - the new enable state

getAccelerator

public int getAccelerator()
Description copied from interface: IAction
Returns the accelerator keycode for this action. The result is the bit-wise OR of zero or more modifier masks and a key, as explained in MenuItem.getAccelerator.

Specified by:
getAccelerator in interface IAction
Overrides:
getAccelerator in class Action
Returns:
the accelerator keycode
See Also:
MenuItem.getAccelerator()

partActivated

public void partActivated(
IWorkbenchPart part)
A workbench part has been activated. Try to connect to it.

Specified by:
partActivated in interface IPartListener
Overrides:
partActivated in class PartEventAction
Parameters:
part - the workbench part that has been activated
See Also:
IWorkbenchPage.activate(org.eclipse.ui.IWorkbenchPart)

partClosed

public void partClosed(
IWorkbenchPart part)
A workbench part has been closed.

Specified by:
partClosed in interface IPartListener
Overrides:
partClosed in class PartEventAction
Parameters:
part - the workbench part that has been closed
See Also:
IWorkbenchPage.hideView(IViewPart)

partDeactivated

public void partDeactivated(
IWorkbenchPart part)
A workbench part has been deactivated. Disconnect from it.

Specified by:
partDeactivated in interface IPartListener
Overrides:
partDeactivated in class PartEventAction
Parameters:
part - the workbench part that has been deactivated
See Also:
IWorkbenchPage.activate(IWorkbenchPart)

propagateChange

protected void propagateChange(
PropertyChangeEvent event)
Either the action handler itself has changed, or the configured action handlers on the action bars have changed. Update self.


run

public void run()
Invoked when an action occurs.

Specified by:
run in interface IAction
Overrides:
run in class Action

runWithEvent

public void runWithEvent(
Event event)
Invoked when an action occurs.

Specified by:
runWithEvent in interface IAction
Overrides:
runWithEvent in class Action
Parameters:
event - the SWT event which triggered this action being run

getActionHandler

public 
IAction getActionHandler()
Returns the action handler. This method was made public in 3.0.

Returns:
The current action handling this retargettable action. This handler will be null if there is no current handler.

isHandled

public final boolean isHandled()
Description copied from interface: IAction
Returns whether this action is handled. In the default case, this is always true. However, if the action delegates some of its behaviour to some other object, then this method should answer whether such an object is currently available.

Specified by:
isHandled in interface IAction
Overrides:
isHandled in class Action
Returns:
true if all of the action's behaviour is available; false otherwise.

setActionHandler

protected void setActionHandler(
IAction newHandler)
Sets the action handler.


setChecked

public void setChecked(boolean checked)
Description copied from interface: IAction
Sets the checked status of this action. Applicable for the styles AS_CHECK_BOX or AS_RADIO_BUTTON.

Fires a property change event for the CHECKED property if the checked status actually changes as a consequence.

Specified by:
setChecked in interface IAction
Overrides:
setChecked in class Action
Parameters:
checked - the new checked status
See Also:
IAction.CHECKED

setHelpListener

public void setHelpListener(
HelpListener listener)
The RetargetAction implementation of this method declared on IAction stores the help listener in a local field. The supplied listener is only used if there is no hanlder.

Specified by:
setHelpListener in interface IAction
Overrides:
setHelpListener in class Action
Parameters:
listener - a help listener for this action

toString

public final 
String toString()
Returns a string representation of this action.

Overrides:
toString in class Object
Returns:
A string representation of this action.
Since:
3.2

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