Class TextNavigationAction

    • 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

      • getTextWidget

        protected StyledText getTextWidget()
        Returns the text widget this actions is bound to.
        Returns:
        returns the text widget this actions is bound to
      • 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
      • fireSelectionChanged

        protected void fireSelectionChanged()
        Sends a selection event with the current selection to all selection listeners of the action's text widget
        Since:
        3.0
      • fireSelectionChanged

        protected void fireSelectionChanged​(Point oldSelection)
        Fires a selection event to all selection listener of the action's text widget if the current selection differs from the given selection.
        Parameters:
        oldSelection - the old selection
        Since:
        3.0
      • runWithEvent

        public void runWithEvent​(Event event)
        Description copied from class: Action
        The default implementation of this IAction method ignores the event argument, and simply calls run(). Subclasses should override this method if they need information from the triggering event, or override run() if not.
        Specified by:
        runWithEvent in interface IAction
        Overrides:
        runWithEvent in class Action
        Parameters:
        event - the SWT event which triggered this action being run
        See Also:
        How radio buttons are handled, How check boxes are handled
      • 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()
      • 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
        Overrides:
        getDescription in class Action
        Returns:
        a description for the action; may be null
      • 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
        Overrides:
        getDisabledImageDescriptor in class Action
        Returns:
        the image, or null if this action has no image
        See Also:
        IAction.IMAGE
      • 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
        Overrides:
        getHoverImageDescriptor in class Action
        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
        Overrides:
        getImageDescriptor in class Action
        Returns:
        the image, or null if this action has no image
        See Also:
        IAction.IMAGE
      • getStyle

        public int getStyle()
        Description copied from interface: IAction
        Return this action's style.
        Specified by:
        getStyle in interface IAction
        Overrides:
        getStyle in class Action
        Returns:
        one of AS_PUSH_BUTTON, AS_CHECK_BOX, AS_RADIO_BUTTON and AS_DROP_DOWN_MENU.
      • 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
        Overrides:
        getText in class Action
        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
        Overrides:
        getToolTipText in class Action
        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. Applicable only if the style is AS_CHECK_BOX or AS_RADIO_BUTTON.

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

        Specified by:
        isChecked in interface IAction
        Overrides:
        isChecked in class Action
        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
        Overrides:
        isEnabled in class Action
        Returns:
        true if enabled, and false if disabled
        See Also:
        IAction.ENABLED
      • 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.

        This method should no longer be used for actions in the Eclipse workbench. IWorkbenchCommandSupport and IWorkbenchContextSupport provide all the functionality required for key bindings. If you set an accelerator using this method, then it will not work in the workbench if it conflicts any existing key binding, or if there is a different key binding defined for this action's definition id. The definition id should be used instead -- referring to the command in the workbench from which the key binding should be retrieved.

        Specified by:
        setAccelerator in interface IAction
        Overrides:
        setAccelerator in class Action
        Parameters:
        keycode - the keycode to be accepted.
      • 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
      • 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
        Overrides:
        setDescription in class Action
        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
        Overrides:
        setDisabledImageDescriptor in class Action
        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
        Overrides:
        setEnabled in class Action
        Parameters:
        enabled - true to enable, and false to disable
        See Also:
        IAction.ENABLED
      • 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
        Overrides:
        setHoverImageDescriptor in class Action
        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.

        Note: This operation is a hint and is not supported in all contexts on platforms that do not have this concept (for example, Windows NT). Furthermore, some platforms (such as GTK), cannot display both a check box and an image at the same time. Instead, they hide the image and display the check box.

        Specified by:
        setImageDescriptor in interface IAction
        Overrides:
        setImageDescriptor in class Action
        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 class: Action
        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
        Overrides:
        setMenuCreator in class Action
        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 is identified by the last index of a '\t' character. If there are no '\t' characters, then it is identified by the last index of an '@' character. If neither, then there is no accelerator text. Note that if you want to insert an '@' character into the text (but no accelerator), then you can simply insert an '@' or a '\t' at the end of the text.
        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
        Overrides:
        setText in class Action
        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 class: Action
        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
        Overrides:
        setToolTipText in class Action
        Parameters:
        text - the tool tip text, or null if none
        See Also:
        IAction.TOOL_TIP_TEXT