Eclipse Platform
2.0

org.eclipse.ui.texteditor
Class TextNavigationAction

java.lang.Object
  |
  +--org.eclipse.ui.texteditor.TextNavigationAction
All Implemented Interfaces:
IAction

public class TextNavigationAction
extends Object
implements IAction

An IAction wrapper for text widget navigational and selection actions.

Since:
2.0

Field Summary
 
Fields inherited from interface org.eclipse.jface.action.IAction
AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, CHECKED, DESCRIPTION, ENABLED, IMAGE, TEXT, TOOL_TIP_TEXT
 
Constructor Summary
TextNavigationAction(StyledText textWidget, int action)
          Creates a new TextNavigationAction.
 
Method Summary
 void addPropertyChangeListener(IPropertyChangeListener listener)
          Adds a property change listener to this action.
 int getAccelerator()
          Returns the accelerator keycode for this action.
 String getActionDefinitionId()
          Returns the action definition id of this action.
 String getDescription()
          Returns the action's description if it has one.
 ImageDescriptor getDisabledImageDescriptor()
          Returns the disabled image for this action as an image descriptor.
 HelpListener getHelpListener()
          Returns a help listener for this action.
 ImageDescriptor getHoverImageDescriptor()
          Returns the hover image for this action as an image descriptor.
 String getId()
          Returns a unique identifier for this action, or null if it has none.
 ImageDescriptor getImageDescriptor()
          Returns the image for this action as an image descriptor.
 IMenuCreator getMenuCreator()
          Returns the menu creator for this action.
 int getStyle()
          Return this action's style.
 String getText()
          Returns the text for this action.
 String getToolTipText()
          Returns the tool tip text for this action.
 boolean isChecked()
          Returns the checked status of this action.
 boolean isEnabled()
          Returns whether this action is enabled.
 void removePropertyChangeListener(IPropertyChangeListener listener)
          Removes the given listener from this action.
 void run()
          Runs this action.
 void runWithEvent(Event event)
          Runs this action, passing the triggering SWT event.
 void setAccelerator(int keycode)
          Sets the accelerator keycode that this action maps to.
 void setActionDefinitionId(String id)
          Sets the action definition id of this action.
 void setChecked(boolean checked)
          Sets the checked status of this action.
 void setDescription(String text)
          Sets this action's description.
 void setDisabledImageDescriptor(ImageDescriptor newImage)
          Sets the disabled image for this action, as an image descriptor.
 void setEnabled(boolean enabled)
          Sets the enabled state of this action.
 void setHelpListener(HelpListener listener)
          Sets a help listener for this action.
 void setHoverImageDescriptor(ImageDescriptor newImage)
          Sets the hover image for this action, as an image descriptor.
 void setId(String id)
          Sets the unique identifier for this action.
 void setImageDescriptor(ImageDescriptor newImage)
          Sets the image for this action, as an image descriptor.
 void setMenuCreator(IMenuCreator creator)
          Sets the menu creator for this action.
 void setText(String text)
          Sets the text for this action.
 void setToolTipText(String text)
          Sets the tool tip text for this action.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextNavigationAction

public TextNavigationAction(StyledText textWidget,
                            int action)
Creates a new TextNavigationAction.

Parameters:
textWidget - the text widget
action - the styled text widget action
Method Detail

run

public void run()
Description copied from interface: IAction
Runs this action. Each action implementation must define the steps needed to carry out this action. The default implementation of this method in Action does nothing.

Specified by:
run in interface IAction

runWithEvent

public void runWithEvent(Event event)
Description copied from interface: IAction
Runs this action, passing the triggering SWT event. As of 2.0, ActionContributionItem calls this method instead of run(). The default implementation of this method in Action simply calls run() for backwards compatibility. NOTE: This is experimental API, which may change in the future.

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

setActionDefinitionId

public void setActionDefinitionId(String id)
Description copied from interface: IAction
Sets the action definition id of this action.

Specified by:
setActionDefinitionId in interface IAction
Parameters:
id - the action definition id

getActionDefinitionId

public String getActionDefinitionId()
Description copied from interface: IAction
Returns the action definition id of this action.

Specified by:
getActionDefinitionId in interface IAction
Returns:
the action definition id of this action, or null if none

setId

public void setId(String id)
Description copied from interface: IAction
Sets the unique identifier for this action. This is used to identify actions when added to a contribution manager. It should be set when the action is created. It should not be modified once the action is part of an action contribution item.

Specified by:
setId in interface IAction
Parameters:
id - the action id
See Also:
ActionContributionItem, IContributionItem.getId()

getId

public String getId()
Description copied from interface: IAction
Returns a unique identifier for this action, or null if it has none.

Specified by:
getId in interface IAction
Returns:
the action id, or null if none

addPropertyChangeListener

public void addPropertyChangeListener(IPropertyChangeListener listener)
Description copied from interface: IAction
Adds a property change listener to this action. Has no effect if an identical listener is already registered.

Specified by:
addPropertyChangeListener in interface IAction
Parameters:
listener - a property change listener

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
Returns:
the accelerator keycode
See Also:
MenuItem.getAccelerator()

getDescription

public String getDescription()
Description copied from interface: IAction
Returns the action's description if it has one. Otherwise it returns getToolTipText().

Specified by:
getDescription in interface IAction

getDisabledImageDescriptor

public ImageDescriptor getDisabledImageDescriptor()
Description copied from interface: IAction
Returns the disabled image for this action as an image descriptor.

This method is associated with the IMAGE property; property change events are reported when its value changes.

Specified by:
getDisabledImageDescriptor in interface IAction
Returns:
the image, or null if this action has no image
See Also:
IAction.IMAGE

getHelpListener

public HelpListener getHelpListener()
Description copied from interface: IAction
Returns a help listener for this action.

Specified by:
getHelpListener in interface IAction
Returns:
a help listener for this action

getHoverImageDescriptor

public ImageDescriptor getHoverImageDescriptor()
Description copied from interface: IAction
Returns the hover image for this action as an image descriptor.

Hover images will be used on platforms that support changing the image when the user hovers over the item. This method is associated with the IMAGE property; property change events are reported when its value changes.

Specified by:
getHoverImageDescriptor in interface IAction
Returns:
the image, or null if this action has no image
See Also:
IAction.IMAGE

getImageDescriptor

public ImageDescriptor getImageDescriptor()
Description copied from interface: IAction
Returns the image for this action as an image descriptor.

This method is associated with the IMAGE property; property change events are reported when its value changes.

Specified by:
getImageDescriptor in interface IAction
Returns:
the image, or null if this action has no image
See Also:
IAction.IMAGE

getMenuCreator

public IMenuCreator getMenuCreator()
Description copied from interface: IAction
Returns the menu creator for this action.

Specified by:
getMenuCreator in interface IAction
Returns:
the menu creator, or null if none

getStyle

public int getStyle()
Description copied from interface: IAction
Return this action's style.

Specified by:
getStyle in interface IAction
Returns:
one of AS_PUSH_BUTTON, AS_CHECK_BOX, and AS_DROP_DOWN.

getText

public String getText()
Description copied from interface: IAction
Returns the text for this action.

This method is associated with the TEXT property; property change events are reported when its value changes.

Specified by:
getText in interface IAction
Returns:
the text, or null if none
See Also:
IAction.TEXT

getToolTipText

public String getToolTipText()
Description copied from interface: IAction
Returns the tool tip text for this action.

This method is associated with the TOOL_TIP_TEXT property; property change events are reported when its value changes.

Specified by:
getToolTipText in interface IAction
Returns:
the tool tip text, or null if none
See Also:
IAction.TOOL_TIP_TEXT

isChecked

public boolean isChecked()
Description copied from interface: IAction
Returns the checked status of this action.

This method is associated with the CHECKED property; property change events are reported when its value changes.

Specified by:
isChecked in interface IAction
Returns:
the checked status
See Also:
IAction.CHECKED

isEnabled

public boolean isEnabled()
Description copied from interface: IAction
Returns whether this action is enabled.

This method is associated with the ENABLED property; property change events are reported when its value changes.

Specified by:
isEnabled in interface IAction
Returns:
true if enabled, and false if disabled
See Also:
IAction.ENABLED

removePropertyChangeListener

public void removePropertyChangeListener(IPropertyChangeListener listener)
Description copied from interface: IAction
Removes the given listener from this action. Has no effect if an identical listener is not registered.

Specified by:
removePropertyChangeListener in interface IAction
Parameters:
listener - a property change listener

setAccelerator

public void setAccelerator(int keycode)
Description copied from interface: IAction
Sets the accelerator keycode that this action maps to. This is a bitwise OR of zero or more SWT key modifier masks (i.e. SWT.CTRL or SWT.ALT) and a character code. For example, for Ctrl+Z, use SWT.CTRL | 'Z'. Use 0 for no accelerator.

Specified by:
setAccelerator in interface IAction

setChecked

public void setChecked(boolean checked)
Description copied from interface: IAction
Sets the checked status of this action.

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

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

setDescription

public void setDescription(String text)
Description copied from interface: IAction
Sets this action's description. Typically the description is shown as a (longer) help text in the status line.

Fires a property change event for the DESCRIPTION property if the description actually changes as a consequence.

Specified by:
setDescription in interface IAction
Parameters:
text - the description, or null to clear the description
See Also:
IAction.DESCRIPTION

setDisabledImageDescriptor

public void setDisabledImageDescriptor(ImageDescriptor newImage)
Description copied from interface: IAction
Sets the disabled image for this action, as an image descriptor.

Disabled images will be used on platforms that support changing the image when the item is disabled.Fires a property change event for the IMAGE property if the image actually changes as a consequence.

Specified by:
setDisabledImageDescriptor in interface IAction
Parameters:
newImage - the image, or null if this action should not have an image
See Also:
IAction.IMAGE

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: IAction
Sets the enabled state of this action.

When an action is in the enabled state, the control associated with it is active; triggering it will end up inkoking this action's run method.

Fires a property change event for the ENABLED property if the enabled state actually changes as a consequence.

Specified by:
setEnabled in interface IAction
Parameters:
enabled - true to enable, and false to disable
See Also:
IAction.ENABLED

setHelpListener

public void setHelpListener(HelpListener listener)
Description copied from interface: IAction
Sets a help listener for this action.

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

setHoverImageDescriptor

public void setHoverImageDescriptor(ImageDescriptor newImage)
Description copied from interface: IAction
Sets the hover image for this action, as an image descriptor.

Hover images will be used on platforms that support changing the image when the user hovers over the item.Fires a property change event for the IMAGE property if the image actually changes as a consequence.

Specified by:
setHoverImageDescriptor in interface IAction
Parameters:
newImage - the image, or null if this action should not have an image
See Also:
IAction.IMAGE

setImageDescriptor

public void setImageDescriptor(ImageDescriptor newImage)
Description copied from interface: IAction
Sets the image for this action, as an image descriptor.

Fires a property change event for the IMAGE property if the image actually changes as a consequence.

Specified by:
setImageDescriptor in interface IAction
Parameters:
newImage - the image, or null if this action should not have an image
See Also:
IAction.IMAGE

setMenuCreator

public void setMenuCreator(IMenuCreator creator)
Description copied from interface: IAction
Sets the menu creator for this action.

Note that if this method is called, it overrides the check status.

Specified by:
setMenuCreator in interface IAction
Parameters:
creator - the menu creator, or null if none

setText

public void setText(String text)
Description copied from interface: IAction
Sets the text for this action.

An accelerator specification may follow the actual text, separated from it by an '@' or a '\t' character. An accelerator specification consists of zero or more modifier tokens followed by a key code token. The tokens are separated by a '+' character.

Fires a property change event for the TEXT property if the text actually changes as a consequence.

Specified by:
setText in interface IAction
Parameters:
text - the text, or null if none
See Also:
IAction.TEXT, Action.findModifier(java.lang.String), Action.findKeyCode(java.lang.String)

setToolTipText

public void setToolTipText(String text)
Description copied from interface: IAction
Sets the tool tip text for this action.

Fires a property change event for the TOOL_TIP_TEXT property if the tool tip text actually changes as a consequence.

Specified by:
setToolTipText in interface IAction
Parameters:
text - the tool tip text, or null if none
See Also:
IAction.TOOL_TIP_TEXT

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.