Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJayant Gupta2012-08-20 19:39:05 +0000
committerJayant Gupta2012-08-20 20:22:20 +0000
commite26a9c9b54bd10190880e273c190eef4d1667d81 (patch)
treed74b436eb9c701cbb9b13f1b4fa4a6b7e86c88d1 /plugins
parentad11ea0ca47da9d3f8090d08d05c8e6dc519e17c (diff)
downloadorg.eclipse.etrice-e26a9c9b54bd10190880e273c190eef4d1667d81.tar.gz
org.eclipse.etrice-e26a9c9b54bd10190880e273c190eef4d1667d81.tar.xz
org.eclipse.etrice-e26a9c9b54bd10190880e273c190eef4d1667d81.zip
Adds user documentation and a new layout configurator.
1. Adds User documentation (textile and images). 2. Adds missing code comments and improves comment strings. 3. Adds a new layout configurator (ETriceLayoutConfig). 4. Removes the old semantic layout configurator. Change-Id: Id06b242316ea07c4c72fbe0b354dc068c6398a47
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/043-layout-with-kieler.textile125
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/etrice-index.txt2
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/043-ContextMenu.pngbin0 -> 10525 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/043-KielerArrange.gifbin0 -> 609 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/043-LayoutOptionDescription.pngbin0 -> 95405 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/043-LayoutView.pngbin0 -> 26038 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/043-PreferencePage.pngbin0 -> 68454 bytes
-rw-r--r--plugins/org.eclipse.etrice.ui.layout/plugin.xml21
-rw-r--r--plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/Activator.java5
-rw-r--r--plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/BehaviorDiagramLayoutManager.java15
-rw-r--r--plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceDiagramLayoutManager.java10
-rw-r--r--plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceLayoutConfig.java126
-rw-r--r--plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceSemanticLayoutConfig.java96
-rw-r--r--plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureDiagramLayoutManager.java13
-rw-r--r--plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/ETricePreferenceUtil.java4
15 files changed, 291 insertions, 126 deletions
diff --git a/plugins/org.eclipse.etrice.doc/doc/043-layout-with-kieler.textile b/plugins/org.eclipse.etrice.doc/doc/043-layout-with-kieler.textile
new file mode 100644
index 000000000..52447eef8
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/043-layout-with-kieler.textile
@@ -0,0 +1,125 @@
+h1. Automatic Diagram Layout with KIELER
+
+h2. Overview
+
+eTrice now provides a new feature of automatic layout of the ROOM diagrams in its graphical editors. This helps in improving the pragmatics of the diagrams and frees the user from the burden of manually lay-outing the diagrams on the canvas.
+
+The automatic lay-outing has been provided with the help of the well known KIELER framework, which focuses on the pragmatics of model-based system design, which can improve comprehensibility of diagrams, improve development and maintenance time, and improve the analysis of dynamic behavior.
+
+This chapter will answer the following questions :-
+* "How to perform automatic layout in the graphical editors of eTrice?":#performLayout
+* "What are layout options?":#layoutOptions
+* "How to configure the layout options to alter the diagram layout as desired?":#configureOptions
+
+Moreover, some "special layout options":#specialOptions will also be discussed.
+
+h2(#performLayout). Performing Automatic Layout
+
+Automatic layout could be performed in eTrice graphical editors using the command to layout the current diagram.
+
+This command is available in :-
+* The main KIELER menu
+* The toolbar (!(inline)images/043-KielerArrange.gif!)
+* Using the _Ctrl+R L_ shortcut.
+
+Additionally, an entry in the context menu allows to layout only a selected part of the diagram.
+
+h2(#layoutOptions). Layout Options
+
+A layout option is a customization point for the layout algorithms, with a specific data type and optionally a default value, used to affect how the active layout algorithm computes concrete coordinates for the graph elements.
+
+User-configurable layout options for a particular diagram object can be viewed and configured through the Layout View.The Layout View can be opened from the context menu of a selected diagram object by clicking the _Show Layout View_ entry.
+
+On opening the layout view, and selecting any layout option, a description of the layout option is available in the footer of eclipse SDK. This is shown below :
+
+!images/043-LayoutOptionDescription.png!
+
+
+h2(#configureOptions). Configuring Layout Options
+
+The values of the layout options for a particular diagram object (in the visible diagram) can be changed using the Layout View of that diagram object. The initial values are the predefined *default* values. These defaults can be changed using the context menu in Layout View as well as the Layout preference pages provided by eTrice.
+
+h3(#layoutView). The Layout View
+
+!images/043-LayoutView.png!
+
+The Layout view allows flexible customization of layout options for the selected objects in the eTrice diagram. If no object is selected, the view shows the options for the top-level container of the diagram. Options are stored persistently in diagram file (*.structure file / *.behavior file) of the eTrice diagram, so that they are still available after the next Eclipse restart. Of course this requires the diagram to be saved after an option was changed.
+
+The options are grouped according to the function of the selected objects. The group Nodes (respectively Edges, Ports, or Labels) contains options related to the object itself, such as its size or priority, while the group Parents contains options for the elements contained in the selected objects, such as the applied layout algorithm or the spacing between elements. Which layout options are displayed depends on the types of selected objects and the active layout algorithm, since each algorithm supports only a subset of the available options. Furthermore, some options are only visible if the _Show Advanced Properties_ button in the view toolbar is activated. The group types can be hidden using the Show Categories button.
+
+An option can be changed by selecting or entering a new value in the corresponding cell of the Value column.
+
+The most important option is Layout Algorithm, which is used to determine the layout algorithm for the contents of the selected element. Here either a specific layout algorithm or a layout type can be chosen; in the latter case, the most suitable layout algorithm of the given type is taken. By changing the active layout algorithm, the content of the layout view is updated to display only those options that are supported by the new layout algorithm.
+
+Selecting Restore Default Value in the context menu or the view toolbar removes any value for the currently selected option that is stored in the current model file, thus resetting the option to its default value. The view menu has an entry Remove all Layout Options which resets all options of the current model by removing persistent data in the model file.
+
+!images/043-ContextMenu.png!
+
+The context menu for a specific layout option has different alternatives to set the currently active value as *default* value:
+* _Set as Default for this Diagram_ : Changes the open diagram file so that the same value is applied to all similar objects (edit parts) of that diagram.
+
+* _Set as Default for ... in this Context_ : Applies the value to all similar objects that are displayed with the any of the eTrice editors (the option is linked to the edit part class of the selected object).
+
+* _Set as Default for all ..._ : Links the option value with the domain model element or the diagram type of the selected object (see the context menu depicted above).
+
+These four alternatives have different priorities: if present, the default value for the current diagram is taken first, then the default value for the edit part is checked, then the default value for the domain model element, and then the default value for the diagram type.
+
+Tips :
+* The information button of the view toolbar can be used to display some useful details on the current selection, such as the edit part and domain model classes.
+* Default values for layout options can most easily be manipulated based on the eTrice domain model elements.
+
+h3(#preferencePage). Preference Pages
+
+The user-defined *default* values for layout options can also be set using the preference pages provided in eTrice. Three preference pages have been provided for this purpose :-
+* _Layout_ : for general preferences regarding layout
+* _Behavior_ : for setting default values of layout options for eTrice behavior diagrams
+* _Structure_ : for setting default values of layout options for eTrice structure diagrams
+
+These preference pages can be accessed via _Windows > Preferences > eTrice > Layout_.
+
+Note that the contents of these preference pages are in sync with the _KIELER > Layout_ preference page provided by the KIELER. Relevant entries in the _KIELER > Layout_ page are shown in the above preference pages.
+
+h4. _Layout_ Preference Page
+
+The _Layout_ preference page is meant to configure general options regarding the layout.
+
+If _Set routing style of all edges to oblique_ is active, all routing styles and smoothness settings of edges are removed when automatic layout is performed. Since most layouters compute the routing of edges as part of their algorithm, these styles usually do not yield the expected results.
+
+h4. _Behavior_ and _Structure_ Preference Pages
+
+The _Behavior_ and _Structure_ sub-preference pages help in setting up the default values of layout options in behavior and structure diagrams respectively.
+
+The _Default Layout Option Values_ table is used to manage the default setting for layout options, which can also be modified with the context menu of the layout view (see above). All user-defined settings are displayed here, and the buttons on the right of the table serve to create, edit, and remove entries. The Type column shows the type of element the option is linked with: either edit part, model element, or diagram type. The Element column shows the class name for options that relate to edit parts or domain model elements, and the diagram type name for options that relate to diagram types. Option is the name of the layout option, and Value is the currently set value of the option.
+
+Creating a new entry requires the selection of the type of related element and entering its class name or identifier. Class names of edit parts can be explored using the information button of the layout view, while the class names for the domain model elements and the diagram type identifiers for the diagram types can be selected with the Browse button. After that, a layout option has to be selected from the list using the corresponding Browse button. Hitting OK creates an entry, and its value can then be set using the Edit button.
+
+!images/043-PreferencePage.png!
+
+Note that the _Behavior_ preference page will show only those entries which hold for the behavior diagrams. Moreover, it will allow setting default values of layout options for only those domain model elements and diagram types which could be present in the behavior editor diagrams. Similar thing holds for the _Structure_ preference page.
+
+
+h2(#specialOptions). Special Layout Options
+
+While most layout options are used to affect how the active layout algorithm computes concrete coordinates for the graph elements, there are some layout options that have a special role.
+
+h3. Layout Algorithm
+
+The option with identifier de.cau.cs.kieler.algorithm specifies which layout algorithm to use for the content of a composite node. The value can be either the identifier of a layout algorithm or the identifier of a layout type. In the latter case the algorithm with highest priority of that type is applied.
+
+For the purpose of automatic diagram layout in eTrice, we use the _Layered_ algorithms which are meant for lay-outing hierarchical diagrams and are best suited for behavior and structure diagrams in eTrice. For the behavior diagrams we have used the _Graphviz Dot_ algorithm whereas for the structure diagrams we have used the _KLay Layered_ algorithm. Though the layout algorithm being used for performing layout can be changed at ones own will, it is recommended to use the defaults.
+
+h3. Diagram Type
+
+Diagram types are used to classify graphical diagrams for setting default layout option values for a set of similar diagrams. The diagram type of an element is specified with the layout option de.cau.cs.kieler.diagramType. Thus, these help in
+
+The following diagram types have been defined and used in eTrice :
+
+* _General_ - This type is automatically assigned to all diagrams for which no specific type is declared. (Predefined in KIELER)
+* _eTrice Behavior Diagrams_ - This type has been assigned to the diagram objects in eTrice Behavior Diagrams.
+* _eTrice Structure Diagrams_ - This type has been assigned to the diagram objects in eTrice Structurer Diagrams.
+
+Note that not all diagrams objects in the behavior and structure diagrams are assigned the last two diagram types. Only the top-level container and the visible bounding box has been assigned these diagram types in respective editors.
+
+h2. Further References
+
+Most parts of the above documentation have been taken from the "KIML wiki":http://rtsys.informatik.uni-kiel.de/confluence/pages/viewpage.action?pageId=328078 and have been modified for automatic layout in eTrice. A more detailed description about the layout algorithms, predefined diagram types and the internal structure of KIELER Infrastructure for Meta-Layout(KIML) can be found at the "KIML wiki":http://rtsys.informatik.uni-kiel.de/confluence/pages/viewpage.action?pageId=328078 . \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.doc/doc/etrice-index.txt b/plugins/org.eclipse.etrice.doc/doc/etrice-index.txt
index adfd640df..1b13158f2 100644
--- a/plugins/org.eclipse.etrice.doc/doc/etrice-index.txt
+++ b/plugins/org.eclipse.etrice.doc/doc/etrice-index.txt
@@ -8,3 +8,5 @@
030-tutorial-ped-lights.textile
040-room-concepts.textile
+
+043-layout-with-kieler.textile \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/043-ContextMenu.png b/plugins/org.eclipse.etrice.doc/doc/images/043-ContextMenu.png
new file mode 100644
index 000000000..77ea0e19d
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/043-ContextMenu.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/043-KielerArrange.gif b/plugins/org.eclipse.etrice.doc/doc/images/043-KielerArrange.gif
new file mode 100644
index 000000000..da85b00e8
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/043-KielerArrange.gif
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/043-LayoutOptionDescription.png b/plugins/org.eclipse.etrice.doc/doc/images/043-LayoutOptionDescription.png
new file mode 100644
index 000000000..667400cb4
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/043-LayoutOptionDescription.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/043-LayoutView.png b/plugins/org.eclipse.etrice.doc/doc/images/043-LayoutView.png
new file mode 100644
index 000000000..33873740c
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/043-LayoutView.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/043-PreferencePage.png b/plugins/org.eclipse.etrice.doc/doc/images/043-PreferencePage.png
new file mode 100644
index 000000000..523f0fb99
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/043-PreferencePage.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.ui.layout/plugin.xml b/plugins/org.eclipse.etrice.ui.layout/plugin.xml
index a2865dd7e..dee8a4903 100644
--- a/plugins/org.eclipse.etrice.ui.layout/plugin.xml
+++ b/plugins/org.eclipse.etrice.ui.layout/plugin.xml
@@ -28,6 +28,11 @@
option="de.cau.cs.kieler.borderSpacing"
value="30">
</option>
+ <option
+ class="org.eclipse.etrice.ui.layout.eTriceBehaviorDiagram"
+ option="de.cau.cs.kieler.spacing"
+ value="50">
+ </option>
<diagramType
id="org.eclipse.etrice.ui.layout.eTriceStructureDiagram"
name="eTrice Structure Diagram">
@@ -47,19 +52,9 @@
option="de.cau.cs.kieler.borderSpacing"
value="50">
</option>
- <semanticOption
- class="org.eclipse.etrice.core.room.ActorContainerClass"
- config="org.eclipse.etrice.ui.layout.ETriceSemanticLayoutConfig">
- </semanticOption>
- <semanticOption
- class="org.eclipse.etrice.core.room.StateGraph"
- config="org.eclipse.etrice.ui.layout.ETriceSemanticLayoutConfig">
- </semanticOption>
- <option
- class="org.eclipse.etrice.ui.layout.eTriceBehaviorDiagram"
- option="de.cau.cs.kieler.spacing"
- value="50">
- </option>
+ <config
+ class="org.eclipse.etrice.ui.layout.ETriceLayoutConfig">
+ </config>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">
diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/Activator.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/Activator.java
index c3e810a6d..ad0fab811 100644
--- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/Activator.java
+++ b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/Activator.java
@@ -6,6 +6,11 @@ import org.osgi.framework.BundleContext;
import de.cau.cs.kieler.kiml.ui.KimlUiPlugin;
+/**
+ * The activator class which controls the plug-in life cycle.
+ *
+ * @author jayant
+ */
public class Activator extends AbstractUIPlugin {
// The plug-in ID
diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/BehaviorDiagramLayoutManager.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/BehaviorDiagramLayoutManager.java
index b110fd9ba..03fb475c5 100644
--- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/BehaviorDiagramLayoutManager.java
+++ b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/BehaviorDiagramLayoutManager.java
@@ -77,6 +77,11 @@ public class BehaviorDiagramLayoutManager extends ETriceDiagramLayoutManager {
}
+ /**
+ * {@inheritDoc}
+ *
+ * @author jayant
+ */
@Override
protected Dimension getDefaultSize(Shape shape) {
Dimension defaultSize = new Dimension();
@@ -86,10 +91,10 @@ public class BehaviorDiagramLayoutManager extends ETriceDiagramLayoutManager {
defaultSize.setSize(StateSupport.MIN_SIZE_X, StateSupport.MIN_SIZE_Y);
/*
- * This code sets default size differently for State Graphs and States.
- * This keeps the top-level container quite large on layout (according
- * to the default size in StateGraphSupport), which might not seem so
- * pleasant.
+ * This code snippet sets default the size for State Graphs and States
+ * differently. With this the top-level container remains large after
+ * layout (according to the default size in StateGraphSupport), which
+ * might not look proper.
*/
/*
EObject modelObject = shape.getLink().getBusinessObjects().get(0);
@@ -103,7 +108,7 @@ public class BehaviorDiagramLayoutManager extends ETriceDiagramLayoutManager {
} else {
defaultSize.setSize(20, 20);
}*/
-
+
return defaultSize;
}
diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceDiagramLayoutManager.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceDiagramLayoutManager.java
index 18aeb5640..af474b44c 100644
--- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceDiagramLayoutManager.java
+++ b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceDiagramLayoutManager.java
@@ -188,6 +188,8 @@ public abstract class ETriceDiagramLayoutManager extends
/**
* {@inheritDoc}
+ *
+ * @author jayant
*/
@Override
public LayoutMapping<PictogramElement> buildLayoutGraph(
@@ -230,14 +232,6 @@ public abstract class ETriceDiagramLayoutManager extends
shapeLayout.setSize(ga.getWidth(), ga.getHeight());
mapping.getGraphMap().put(diagramNode, element);
- VolatileLayoutConfig staticConfig = mapping
- .getProperty(KimlGraphitiUtil.STATIC_CONFIG);
-
- if (workbenchPart instanceof BehaviorEditor)
- staticConfig.setValue(LayoutOptions.DIAGRAM_TYPE, diagramNode,
- LayoutContext.GRAPH_ELEM,
- ETriceSemanticLayoutConfig.BEHAVIOR_DIAGRAM_TYPE);
-
// Node creation for currently visible top-level Container
// Shape(Bounding Box) in
// eTrice Diagrams
diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceLayoutConfig.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceLayoutConfig.java
new file mode 100644
index 000000000..970182d09
--- /dev/null
+++ b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceLayoutConfig.java
@@ -0,0 +1,126 @@
+package org.eclipse.etrice.ui.layout;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.room.ActorContainerClass;
+import org.eclipse.etrice.core.room.StateGraph;
+import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor;
+import org.eclipse.ui.IWorkbenchPart;
+
+import de.cau.cs.kieler.core.kgraph.KGraphData;
+import de.cau.cs.kieler.kiml.LayoutContext;
+import de.cau.cs.kieler.kiml.LayoutOptionData;
+import de.cau.cs.kieler.kiml.config.DefaultLayoutConfig;
+import de.cau.cs.kieler.kiml.config.ILayoutConfig;
+import de.cau.cs.kieler.kiml.options.LayoutOptions;
+import de.cau.cs.kieler.kiml.ui.service.EclipseLayoutConfig;
+
+/**
+ * A layout config for option configuration in eTrice. It configures the diagram
+ * types of diagram elements based on the domain model and the specific diagram
+ * editor.
+ *
+ * @author jayant
+ */
+public class ETriceLayoutConfig implements ILayoutConfig {
+
+ /** The priority for this layout configurations. */
+ public static final int PRIORITY = 40;
+
+ /**
+ * The diagram type for the diagram elements in eTrice behavior diagrams.
+ */
+ public static final String BEHAVIOR_DIAGRAM_TYPE = "org.eclipse.etrice.ui.layout.eTriceBehaviorDiagram";
+
+ /**
+ * The diagram type for the diagram elements in eTrice structure diagrams.
+ */
+ public static final String STRUCTURE_DIAGRAM_TYPE = "org.eclipse.etrice.ui.layout.eTriceStructureDiagram";
+
+ /**
+ * {@inheritDoc}
+ *
+ * @author jayant
+ */
+ @Override
+ public int getPriority() {
+ return PRIORITY;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @author jayant
+ */
+ @Override
+ public void enrich(LayoutContext context) {
+ Object element = context.getProperty(LayoutContext.DOMAIN_MODEL);
+
+ if (element instanceof ActorContainerClass
+ || element instanceof StateGraph) {
+ IWorkbenchPart workbenchPart = context
+ .getProperty(EclipseLayoutConfig.WORKBENCH_PART);
+ Object diagramType = getDiagramType(element, workbenchPart);
+
+ if (diagramType != null)
+ context.setProperty(DefaultLayoutConfig.CONTENT_DIAGT,
+ diagramType);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @author jayant
+ */
+ @Override
+ public Object getValue(LayoutOptionData<?> optionData, LayoutContext context) {
+ if (optionData.getId().equals(LayoutOptions.DIAGRAM_TYPE.getId())) {
+ EObject element = context.getProperty(LayoutContext.DOMAIN_MODEL);
+
+ if (element instanceof ActorContainerClass
+ || element instanceof StateGraph) {
+ IWorkbenchPart workbenchPart = context
+ .getProperty(EclipseLayoutConfig.WORKBENCH_PART);
+ return getDiagramType(element, workbenchPart);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @author jayant
+ */
+ @Override
+ public void transferValues(KGraphData graphData, LayoutContext context) {
+ // not required : no other options to set dynamically
+ }
+
+ /**
+ * Returns the diagram type(string) for a domain model element depending
+ * upon the diagram editor which contains the corresponding diagram element
+ *
+ * @param modelElement
+ * the domain model element
+ * @param workbenchPart
+ * the editor containing the corresspnding diagram element
+ * @return the diagram type for the domain model element
+ *
+ * @author jayant
+ */
+ private String getDiagramType(final Object modelElement,
+ IWorkbenchPart workbenchPart) {
+ if (modelElement instanceof StateGraph) {
+ return BEHAVIOR_DIAGRAM_TYPE;
+ } else if (modelElement instanceof ActorContainerClass) {
+ if (workbenchPart instanceof BehaviorEditor)
+ return BEHAVIOR_DIAGRAM_TYPE;
+ else
+ return STRUCTURE_DIAGRAM_TYPE;
+ }
+
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceSemanticLayoutConfig.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceSemanticLayoutConfig.java
deleted file mode 100644
index d4db0c0af..000000000
--- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceSemanticLayoutConfig.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Jayant Gupta (initial contribution)
- *
- *******************************************************************************/
-package org.eclipse.etrice.ui.layout;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.room.ActorContainerClass;
-import org.eclipse.etrice.core.room.StateGraph;
-
-import de.cau.cs.kieler.core.properties.IProperty;
-import de.cau.cs.kieler.kiml.LayoutOptionData;
-import de.cau.cs.kieler.kiml.config.SemanticLayoutConfig;
-import de.cau.cs.kieler.kiml.options.LayoutOptions;
-
-/**
- * @author jayant
- *
- */
-public class ETriceSemanticLayoutConfig extends SemanticLayoutConfig {
-
- /**
- * The diagram type for the top-level bounding box containers in eTrice
- * Behavior Diagram.
- */
- public static final String BEHAVIOR_DIAGRAM_TYPE = "org.eclipse.etrice.ui.layout.eTriceBehaviorDiagram";
-
- /**
- * The diagram type for the top-level bounding box containers in eTrice
- * Structure Diagram.
- */
- public static final String STRUCTURE_DIAGRAM_TYPE = "org.eclipse.etrice.ui.layout.eTriceStructureDiagram";
-
- /** the priority for eTrice Semantic layout configurations. */
- public static final int PRIORITY = 20;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getPriority() {
- return PRIORITY;
- }
-
- /**
- * {@inheritDoc}
- *
- * @author jayant
- */
- @Override
- protected IProperty<?>[] getAffectedOptions(EObject semanticElem) {
- if (semanticElem instanceof ActorContainerClass
- || semanticElem instanceof StateGraph)
- return new IProperty<?>[] { LayoutOptions.DIAGRAM_TYPE };
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @author jayant
- */
- @Override
- protected Object getSemanticValue(EObject semanticElem,
- LayoutOptionData<?> layoutOption) {
- if (layoutOption.getId().equals(LayoutOptions.DIAGRAM_TYPE.getId())) {
- if (semanticElem instanceof ActorContainerClass)
- return STRUCTURE_DIAGRAM_TYPE;
- else if (semanticElem instanceof StateGraph)
- return BEHAVIOR_DIAGRAM_TYPE;
- else
- return "de.cau.cs.kieler.layout.diagrams.general";
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @author jayant
- */
- @Override
- protected void setSemanticValue(EObject semanticElem,
- LayoutOptionData<?> layoutOption, Object value) {
- // not supported by this layout configuration
- }
-
-}
diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureDiagramLayoutManager.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureDiagramLayoutManager.java
index 47121beae..0482ac04b 100644
--- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureDiagramLayoutManager.java
+++ b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureDiagramLayoutManager.java
@@ -72,6 +72,11 @@ public class StructureDiagramLayoutManager extends ETriceDiagramLayoutManager {
}
}
+ /**
+ * {@inheritDoc}
+ *
+ * @author jayant
+ */
@Override
protected Dimension getDefaultSize(Shape shape) {
@@ -83,10 +88,10 @@ public class StructureDiagramLayoutManager extends ETriceDiagramLayoutManager {
ActorContainerRefSupport.MIN_SIZE_Y);
/*
- * This code sets default size differently for Actor Class and Actor
- * Container Refs. This keeps the top-level container quite large on
- * layout(according to the default size in StructureSupport), which
- * might not seem so pleasant.
+ * This code snippet sets default the size for Actor Class and Actor
+ * Container Refs differently. With this the top-level container remains
+ * large after layout (according to the default size in
+ * StructureSupport), which might not look proper.
*/
/*
EObject modelObject = shape.getLink().getBusinessObjects().get(0);
diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/ETricePreferenceUtil.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/ETricePreferenceUtil.java
index 7d1a770aa..4bf61c7ff 100644
--- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/ETricePreferenceUtil.java
+++ b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/preferences/ETricePreferenceUtil.java
@@ -511,6 +511,8 @@ public final class ETricePreferenceUtil {
return images.getPropInt();
case FLOAT:
return images.getPropFloat();
+ default:
+ break;
}
}
return null;
@@ -734,6 +736,8 @@ public final class ETricePreferenceUtil {
return images.getPropInt();
case FLOAT:
return images.getPropFloat();
+ default:
+ break;
}
}
return null;

Back to the top