Class ToggleHandler

java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.core.commands.AbstractHandler
org.eclipse.ease.ui.tools.ToggleHandler
All Implemented Interfaces:
org.eclipse.core.commands.IHandler, org.eclipse.core.commands.IHandler2, org.eclipse.ui.commands.IElementUpdater

public abstract class ToggleHandler extends org.eclipse.core.commands.AbstractHandler implements org.eclipse.ui.commands.IElementUpdater
Use this handler for style="toggle" command contributions. You need to declare a state for your command to use ToggleHandler:
 <command id="somecommand" name="SomeCommand">
    <state class="org.eclipse.jface.commands.ToggleState" id="STYLE"/>
 </command>
 
The id="STYLE" was chosen because of IMenuStateIds.STYLE - maybe this will work without any Handler foo in later Eclipse versions. See http://www.ralfebert.de/eclipse/2009_01_21_togglehandler/ http://eclipsesource.com/blogs/2009/01/15/toggling-a-command-contribution/
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final Object
    execute(org.eclipse.core.commands.ExecutionEvent event)
     
    void
    updateElement(org.eclipse.ui.menus.UIElement element, Map parameters)
    Update command element with toggle state

    Methods inherited from class org.eclipse.core.commands.AbstractHandler

    addHandlerListener, dispose, isEnabled, isHandled, removeHandlerListener, setEnabled

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ToggleHandler

      public ToggleHandler()
  • Method Details

    • execute

      public final Object execute(org.eclipse.core.commands.ExecutionEvent event) throws org.eclipse.core.commands.ExecutionException
      Specified by:
      execute in interface org.eclipse.core.commands.IHandler
      Throws:
      org.eclipse.core.commands.ExecutionException
    • updateElement

      public void updateElement(org.eclipse.ui.menus.UIElement element, Map parameters)
      Update command element with toggle state
      Specified by:
      updateElement in interface org.eclipse.ui.commands.IElementUpdater