de.cau.cs.kieler.ksbase.ui.menus
Class KSBasEContributionItem

java.lang.Object
  extended by org.eclipse.jface.action.ContributionItem
      extended by org.eclipse.ui.actions.CompoundContributionItem
          extended by de.cau.cs.kieler.ksbase.ui.menus.KSBasEContributionItem
All Implemented Interfaces:
IContributionItem, IWorkbenchContribution

public class KSBasEContributionItem
extends CompoundContributionItem
implements IWorkbenchContribution

Dynamic toolbar contribution for the use with KIELER View Management. It extends the idea of CompoundContributionItems, which are only defined for menus, to toolbars. Hence, the toolbar is filled dynamically with buttons, which only get updated at the ToolbarManager updates, which are not in control of the user. Hence, newly inserted buttons or visibility updates might be delayed until the next ToolbarManager update, which is for example at a change to a different kind of editor or the change of the perspective. All visibility management is implemented using the standard core expressions of eclipse that are also used by the org.eclipse.ui.menu extension point. However, the core expressions API is not publicly available due to restrictions in the corresponding org.eclipse.core.expressions plug-in and therefore result in compiler warnings.

Rating red

Constructor Summary
KSBasEContributionItem()
           
 
Method Summary
 void fill(ToolBar parent, int index)
          haf: simply copied the code from the CompoundContributionItem.
protected  IContributionItem[] getContributionItems()
          The main code to create a button.
 void initialize(IServiceLocator theServiceLocator)
          
static void setEnabledState(String buttonID, boolean enabled)
          Set the enabled state of a menu contribution handler associated with the given ID.
static void setSoftUpdate(boolean _softUpdate)
           
 
Methods inherited from class org.eclipse.ui.actions.CompoundContributionItem
dispose, fill, isDirty, isDynamic, setParent
 
Methods inherited from class org.eclipse.jface.action.ContributionItem
fill, fill, getId, getParent, isEnabled, isGroupMarker, isSeparator, isVisible, saveWidgetState, setId, setVisible, toString, update, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KSBasEContributionItem

public KSBasEContributionItem()
Method Detail

initialize

public void initialize(IServiceLocator theServiceLocator)

Specified by:
initialize in interface IWorkbenchContribution

getContributionItems

protected IContributionItem[] getContributionItems()
The main code to create a button. It reads the button configurations from the KiviMenuContributionService and adds buttons accordingly.

Specified by:
getContributionItems in class CompoundContributionItem

setEnabledState

public static void setEnabledState(String buttonID,
                                   boolean enabled)
Set the enabled state of a menu contribution handler associated with the given ID. This state is used by corresponding menu contributions (buttons, menu entries, etc.) to determine the enabled state of that menu item, e.g. whether a button should be grayed out or not.

Parameters:
buttonID - the id associated in KiVi with the menu item
enabled - true if the handler is enabled.

fill

public void fill(ToolBar parent,
                 int index)
haf: simply copied the code from the CompoundContributionItem. This also supports the compound idea for the Toolbar and not only for menus.

Specified by:
fill in interface IContributionItem
Overrides:
fill in class ContributionItem

setSoftUpdate

public static void setSoftUpdate(boolean _softUpdate)