Class ContextMenuItem

  • All Implemented Interfaces:
    org.eclipse.core.commands.IHandler, org.eclipse.core.commands.IHandler2

    public class ContextMenuItem
    extends org.eclipse.core.commands.AbstractHandler
    The Add Item class for a DesignerProp class. This class serves multiple purposes, i.e. to be the Command Contribution Item, the Command and the Handler for the Command, all in one.
    Author:
    Christopher Mindus
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int accelerator
      The accelerator.
      static java.lang.String HANDLER_ID
      This Handler ID.
    • Constructor Summary

      Constructors 
      Constructor Description
      ContextMenuItem()
      The Eclipse constructor.
      ContextMenuItem​(java.lang.String label, IContextMenuAction adder)
      Creates the Add Item instance for a DesignerProp class.
      ContextMenuItem​(java.lang.String label, java.lang.String mnemonic, int accelerator, org.eclipse.jface.resource.ImageDescriptor icon, IContextMenuAction adder)
      Creates the Add Item instance for a DesignerProp class.
      ContextMenuItem​(java.lang.String label, java.lang.String mnemonic, IContextMenuAction adder)
      Creates the Add Item instance for a DesignerProp class.
      ContextMenuItem​(java.lang.String label, java.lang.String mnemonic, org.eclipse.jface.resource.ImageDescriptor icon, IContextMenuAction adder)
      Creates the Add Item instance for a DesignerProp class.
      ContextMenuItem​(java.lang.String label, org.eclipse.jface.resource.ImageDescriptor icon, IContextMenuAction adder)
      Creates the Add Item instance for a DesignerProp class.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.eclipse.ui.menus.CommandContributionItem createCommandContributionItem()
      Gets the command contribution item.
      IzMenuItem createMenuItem​(DesignerProp target, org.eclipse.swt.widgets.Control control, IzMenu menu, IPropUndoRedo undoRedo)
      Creates a menu item for this Add-Item.
      IzMenuItem createMenuItem​(org.eclipse.jface.viewers.Viewer viewer, IzMenu menu, IPropUndoRedo undoRedo)
      Creates a menu item for this Add-Item.
      boolean doAddSeparator()
      Checks if this item requires a separator before.
      java.lang.Object execute​(org.eclipse.core.commands.ExecutionEvent event)
      Performs the Handler operation.
      org.eclipse.ui.menus.CommandContributionItem getCommandContributionItem()
      Gets the command contribution item.
      boolean isEnabled​(DesignerProp target)
      Checks if the Add Item is enabled in order not to add it in a pop-up menu if disabled.
      void setSeparatorBefore()
      Adds a separator before this item.
      • Methods inherited from class org.eclipse.core.commands.AbstractHandler

        addHandlerListener, dispose, fireHandlerChanged, hasListeners, isEnabled, isHandled, removeHandlerListener, setBaseEnabled, setEnabled
      • 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, toString, wait, wait, wait
    • Field Detail

      • HANDLER_ID

        public static final java.lang.String HANDLER_ID
        This Handler ID.
      • accelerator

        public final int accelerator
        The accelerator.
    • Constructor Detail

      • ContextMenuItem

        public ContextMenuItem()
        The Eclipse constructor.
      • ContextMenuItem

        public ContextMenuItem​(java.lang.String label,
                               IContextMenuAction adder)
        Creates the Add Item instance for a DesignerProp class.
      • ContextMenuItem

        public ContextMenuItem​(java.lang.String label,
                               org.eclipse.jface.resource.ImageDescriptor icon,
                               IContextMenuAction adder)
        Creates the Add Item instance for a DesignerProp class.
      • ContextMenuItem

        public ContextMenuItem​(java.lang.String label,
                               java.lang.String mnemonic,
                               IContextMenuAction adder)
        Creates the Add Item instance for a DesignerProp class.
      • ContextMenuItem

        public ContextMenuItem​(java.lang.String label,
                               java.lang.String mnemonic,
                               org.eclipse.jface.resource.ImageDescriptor icon,
                               IContextMenuAction adder)
        Creates the Add Item instance for a DesignerProp class.
      • ContextMenuItem

        public ContextMenuItem​(java.lang.String label,
                               java.lang.String mnemonic,
                               int accelerator,
                               org.eclipse.jface.resource.ImageDescriptor icon,
                               IContextMenuAction adder)
        Creates the Add Item instance for a DesignerProp class.
    • Method Detail

      • setSeparatorBefore

        public void setSeparatorBefore()
        Adds a separator before this item.
      • doAddSeparator

        public boolean doAddSeparator()
        Checks if this item requires a separator before.
      • isEnabled

        public boolean isEnabled​(DesignerProp target)
        Checks if the Add Item is enabled in order not to add it in a pop-up menu if disabled.
      • getCommandContributionItem

        public org.eclipse.ui.menus.CommandContributionItem getCommandContributionItem()
        Gets the command contribution item.
      • createCommandContributionItem

        public org.eclipse.ui.menus.CommandContributionItem createCommandContributionItem()
        Gets the command contribution item.
      • execute

        public java.lang.Object execute​(org.eclipse.core.commands.ExecutionEvent event)
                                 throws org.eclipse.core.commands.ExecutionException
        Performs the Handler operation.
        Throws:
        org.eclipse.core.commands.ExecutionException
      • createMenuItem

        public IzMenuItem createMenuItem​(org.eclipse.jface.viewers.Viewer viewer,
                                         IzMenu menu,
                                         IPropUndoRedo undoRedo)
        Creates a menu item for this Add-Item.