de.cau.cs.kieler.core.kivi.menu
Class KiviMenuContributionService

java.lang.Object
  extended by de.cau.cs.kieler.core.kivi.menu.KiviMenuContributionService

public class KiviMenuContributionService
extends Object

A simple programmatic API to specify toolbar buttons to be used with the KIELER View Management.

Rating red

Nested Class Summary
static class KiviMenuContributionService.ButtonConfiguration
          A container class for configurations for buttons.
 
Field Summary
static KiviMenuContributionService INSTANCE
          Singleton instance of this service.
 
Constructor Summary
KiviMenuContributionService()
           
 
Method Summary
 void addToolbarButton(ICombination responsibleCombination, String id, String label)
          Add the simplest button configuration possible.
 void addToolbarButton(ICombination responsibleCombination, String id, String tooltip, ImageDescriptor icon, String... activeEditors)
          Add a button configuration with only a few parameters.
 void addToolbarButton(ICombination responsibleCombination, String id, String label, String tooltip, ImageDescriptor icon, int style, Expression visibilityExpression, String... activeEditors)
          Add a button configuration with all possible parameters.
 KiviMenuContributionService.ButtonConfiguration getButtonConfiguration(String id)
          Get a ButtonCnfiguration with the given ID.
 List<KiviMenuContributionService.ButtonConfiguration> getButtonConfigurations()
          Get the list of registered ButtonConfigurations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final KiviMenuContributionService INSTANCE
Singleton instance of this service.

Constructor Detail

KiviMenuContributionService

public KiviMenuContributionService()
Method Detail

addToolbarButton

public void addToolbarButton(ICombination responsibleCombination,
                             String id,
                             String label,
                             String tooltip,
                             ImageDescriptor icon,
                             int style,
                             Expression visibilityExpression,
                             String... activeEditors)
Add a button configuration with all possible parameters.

Parameters:
responsibleCombination - the KiVi Combination which is responsible for this button. the button will be made invisible if the combination gets deactivated
id - the ID that the button should get. Need to identify the button lateron with this ID
label - an optional label for the button. May be null. Either the label or the icon should be specified.
tooltip - a tooltip for the button, may be null
icon - the icon for the button, may be null. Either the label or the icon should be specified. An Image descriptor can be obtained by the plugin activator with the plugin ID and the relative path of the icon within that plugin.
style - an SWT style constant, either SWT.PUSH, SWT.RADIO or SWT.CHECK
visibilityExpression - an eclipse core Expression that gets registered as visibility expression, may be null
activeEditors - Strings of editor IDs for which this button should be made visible only, parameter to avoid using the visibilityExpression, may be left

addToolbarButton

public void addToolbarButton(ICombination responsibleCombination,
                             String id,
                             String tooltip,
                             ImageDescriptor icon,
                             String... activeEditors)
Add a button configuration with only a few parameters.

Parameters:
responsibleCombination - the KiVi Combination which is responsible for this button. the button will be made invisible if the combination gets deactivated
id - the ID that the button should get. Need to identify the button lateron with this ID
tooltip - a tooltip for the button, may be null
icon - the icon for the button, may be null. Either the label or the icon should be specified. An Image descriptor can be obtained by the plugin activator with the plugin ID and the relative path of the icon within that plugin.
activeEditors - Strings of editor IDs for which this button should be made visible only, parameter to avoid using the visibilityExpression, may be left

addToolbarButton

public void addToolbarButton(ICombination responsibleCombination,
                             String id,
                             String label)
Add the simplest button configuration possible. Usually used only for quick testing.

Parameters:
responsibleCombination - the KiVi Combination which is responsible for this button. the button will be made invisible if the combination gets deactivated
id - the ID that the button should get. Need to identify the button lateron with this ID
label - an optional label for the button. May be null. Either the label or the icon should be specified.

getButtonConfigurations

public List<KiviMenuContributionService.ButtonConfiguration> getButtonConfigurations()
Get the list of registered ButtonConfigurations.

Returns:
all registered ButtonConfigurations

getButtonConfiguration

public KiviMenuContributionService.ButtonConfiguration getButtonConfiguration(String id)
Get a ButtonCnfiguration with the given ID.

Parameters:
id - given ID
Returns:
null if there is no config registered for the given ID