de.cau.cs.kieler.kiml.ui.service
Class EclipseLayoutInfoService

java.lang.Object
  extended by de.cau.cs.kieler.kiml.service.LayoutInfoService
      extended by de.cau.cs.kieler.kiml.ui.service.EclipseLayoutInfoService

public final class EclipseLayoutInfoService
extends LayoutInfoService

An extension of the layout info service for diagram layout managers and preference handling.

Rating red

Field Summary
static String ATTRIBUTE_PRIORITY
          name of the 'priority' attribute in the extension points.
static String ELEMENT_ENGINE
          name of the 'engine' element in the 'layout managers' extension point.
static String ELEMENT_MANAGER
          name of the 'manager' element in the 'layout managers' extension point.
static String EXTP_ID_LAYOUT_MANAGERS
          identifier of the extension point for layout managers.
static String PREF_OBLIQUE_ROUTE
          preference identifier for oblique edge routing.
static String PREF_REG_ELEMENTS
          preference identifier for the list of registered diagram elements.
 
Fields inherited from class de.cau.cs.kieler.kiml.service.LayoutInfoService
ATTRIBUTE_CLASS, ATTRIBUTE_CONFIG, ATTRIBUTE_ID, ATTRIBUTE_NAME, ATTRIBUTE_OPTION, ATTRIBUTE_VALUE, ELEMENT_BINDING, ELEMENT_DIAGRAM_TYPE, ELEMENT_OPTION, ELEMENT_SEMANTIC_OPTION, EXTP_ID_LAYOUT_INFO
 
Method Summary
static void create()
          Create the layout info service and load extension points.
static EclipseLayoutInfoService getInstance()
          Returns the singleton instance of the layout info service.
 IGraphLayoutEngine getLayoutEngine()
          Returns the active graph layout engine with highest priority.
 IDiagramLayoutManager<?> getManager(IWorkbenchPart workbenchPart, Object diagramPart)
          Returns the most suitable layout manager for the given workbench and diagram part.
static String getPreferenceName(String id1, String id2)
          Returns the preference name associated with the two identifiers.
 Set<String> getRegisteredElements()
          Returns the set of registered diagram elements.
protected  void reportError(CoreException exception)
          Report an error that occurred while reading extensions.
protected  void reportError(String extensionPoint, IConfigurationElement element, String attribute, Throwable exception)
          Report an error that occurred while reading extensions.
 void storeOption(EditPart editPart, LayoutOptionData<?> optionData, String valueString, boolean storeDomainModel)
          Stores the layout option with given value for the edit part.
 void storeOption(String diagramType, LayoutOptionData<?> optionData, String valueString)
          Stores the layout option with given value for the diagram type.
 void storePreferences()
          Stores preferences for KIML.
 
Methods inherited from class de.cau.cs.kieler.kiml.service.LayoutInfoService
addDiagramType, addOptionValue, addSemanticConfig, getDiagramTypeName, getDiagramTypes, getOptionValue, getOptionValue, getOptionValues, getOptionValues, getSemanticConfigs, loadLayoutInfoExtensions, removeOptionValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXTP_ID_LAYOUT_MANAGERS

public static final String EXTP_ID_LAYOUT_MANAGERS
identifier of the extension point for layout managers.

See Also:
Constant Field Values

ELEMENT_MANAGER

public static final String ELEMENT_MANAGER
name of the 'manager' element in the 'layout managers' extension point.

See Also:
Constant Field Values

ELEMENT_ENGINE

public static final String ELEMENT_ENGINE
name of the 'engine' element in the 'layout managers' extension point.

See Also:
Constant Field Values

ATTRIBUTE_PRIORITY

public static final String ATTRIBUTE_PRIORITY
name of the 'priority' attribute in the extension points.

See Also:
Constant Field Values

PREF_REG_ELEMENTS

public static final String PREF_REG_ELEMENTS
preference identifier for the list of registered diagram elements.

See Also:
Constant Field Values

PREF_OBLIQUE_ROUTE

public static final String PREF_OBLIQUE_ROUTE
preference identifier for oblique edge routing.

See Also:
Constant Field Values
Method Detail

getInstance

public static EclipseLayoutInfoService getInstance()
Returns the singleton instance of the layout info service.

Returns:
the singleton instance

create

public static void create()
Create the layout info service and load extension points.


reportError

protected void reportError(String extensionPoint,
                           IConfigurationElement element,
                           String attribute,
                           Throwable exception)
Report an error that occurred while reading extensions.

Specified by:
reportError in class LayoutInfoService
Parameters:
extensionPoint - the identifier of the extension point
element - the configuration element
attribute - the attribute that contains an invalid entry
exception - an optional exception that was caused by the invalid entry

reportError

protected void reportError(CoreException exception)
Report an error that occurred while reading extensions.

Specified by:
reportError in class LayoutInfoService
Parameters:
exception - a core exception holding a status with further information

getManager

public IDiagramLayoutManager<?> getManager(IWorkbenchPart workbenchPart,
                                           Object diagramPart)
Returns the most suitable layout manager for the given workbench and diagram part.

Parameters:
workbenchPart - the workbench part for which the layout manager should be fetched
diagramPart - the diagram part for which the layout manager should be fetched, or null
Returns:
the most suitable diagram layout manager

getLayoutEngine

public IGraphLayoutEngine getLayoutEngine()
Returns the active graph layout engine with highest priority.

Returns:
the active graph layout engine with highest priority

getPreferenceName

public static String getPreferenceName(String id1,
                                       String id2)
Returns the preference name associated with the two identifiers.

Parameters:
id1 - first identifier
id2 - second identifier
Returns:
a preference name for the combination of both identifiers

storeOption

public void storeOption(String diagramType,
                        LayoutOptionData<?> optionData,
                        String valueString)
Stores the layout option with given value for the diagram type.

Parameters:
diagramType - a diagram type identifier
optionData - a layout option data
valueString - the value to store for the diagram type and option

storeOption

public void storeOption(EditPart editPart,
                        LayoutOptionData<?> optionData,
                        String valueString,
                        boolean storeDomainModel)
Stores the layout option with given value for the edit part.

Parameters:
editPart - an edit part
optionData - a layout option data
valueString - the value to store for the edit part and option
storeDomainModel - if true, the option is stored for the domain model element associated with the edit part, else for the edit part itself

storePreferences

public void storePreferences()
Stores preferences for KIML.


getRegisteredElements

public Set<String> getRegisteredElements()
Returns the set of registered diagram elements.

Returns:
the set of registered diagram elements