Class ShiftAction

All Implemented Interfaces:
IAction, IReadOnlyDependent, IUpdate

public class ShiftAction extends TextEditorAction implements IReadOnlyDependent
Action for shifting code to the right or left by one indentation level.
  • Constructor Details

    • ShiftAction

      public ShiftAction(ResourceBundle bundle, String prefix, ITextEditor editor, int operationCode)
      Creates and initializes the action for the given text editor and operation code. The action configures its visual representation from the given resource bundle. The action works by asking the text editor at the time for its text operation target adapter (using getAdapter(ITextOperationTarget.class). The action runs that operation with the given opcode.
      bundle - the resource bundle
      prefix - a prefix to be prepended to the various resource keys (described in ResourceAction constructor), or null if none
      editor - the text editor
      operationCode - the operation code
      See Also:
  • Method Details

    • run

      public void run()
      The TextOperationAction implementation of this IAction method runs the operation with the current operation code.
      Specified by:
      run in interface IAction
      run in class Action
      See Also:
    • update

      public void update()
      Description copied from class: TextEditorAction
      Always enables this action if it is connected to a text editor. If the associated editor is null, the action is disabled. Subclasses may override.
      Specified by:
      update in interface IUpdate
      update in class TextEditorAction
    • updateForTab

      protected void updateForTab()
      Enablement when tab key is pressed - the current selection has to be cover multiple lines.
    • setEditor

      public void setEditor(ITextEditor editor)
      Description copied from class: TextEditorAction
      Retargets this action to the given editor.
      setEditor in class TextEditorAction
      editor - the new editor, or null if none
    • isEnabled

      public boolean isEnabled(boolean isWritable)
      Description copied from interface: IReadOnlyDependent
      Returns whether the actions would be enabled if its target would be enabled given the writable state described by isWritable. isEnabled() and isEnabled(boolean) holds the following invariants: isEnabled() == false, if isEnabled(true) == false || isEnabled(false) == false isEnabled() == true, if isEnabled(true) == true || isEnabled(false) == true
      Specified by:
      isEnabled in interface IReadOnlyDependent
      isWritable - the writable state
      the hypothetical enable state of the action