Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJayant Gupta2012-08-20 15:39:05 -0400
committerJayant Gupta2012-08-20 16:22:20 -0400
commite26a9c9b54bd10190880e273c190eef4d1667d81 (patch)
treed74b436eb9c701cbb9b13f1b4fa4a6b7e86c88d1 /plugins/org.eclipse.etrice.ui.layout
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/org.eclipse.etrice.ui.layout')
-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
8 files changed, 164 insertions, 126 deletions
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