diff options
Diffstat (limited to 'plugins/org.eclipse.etrice.ui.layout')
-rw-r--r-- | plugins/org.eclipse.etrice.ui.layout/plugin.xml | 40 | ||||
-rw-r--r-- | plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/BehaviorDiagramLayoutManager.java | 43 | ||||
-rw-r--r-- | plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/BehaviorLayoutCommand.java | 16 | ||||
-rw-r--r-- | plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceDiagramLayoutManager.java | 116 | ||||
-rw-r--r-- | plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceLayoutCommand.java | 7 | ||||
-rw-r--r-- | plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceSemanticLayoutConfig.java | 96 | ||||
-rw-r--r-- | plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureDiagramLayoutManager.java (renamed from plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureDiagramLayoutmanager.java) | 35 | ||||
-rw-r--r-- | plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureLayoutCommand.java | 21 |
8 files changed, 242 insertions, 132 deletions
diff --git a/plugins/org.eclipse.etrice.ui.layout/plugin.xml b/plugins/org.eclipse.etrice.ui.layout/plugin.xml index 8528c918b..8df4cb91b 100644 --- a/plugins/org.eclipse.etrice.ui.layout/plugin.xml +++ b/plugins/org.eclipse.etrice.ui.layout/plugin.xml @@ -8,29 +8,55 @@ priority="1"> </manager> <manager - class="org.eclipse.etrice.ui.layout.StructureDiagramLayoutmanager" + class="org.eclipse.etrice.ui.layout.StructureDiagramLayoutManager" priority="1"> </manager> </extension> <extension point="de.cau.cs.kieler.kiml.layoutInfo"> + <diagramType + id="org.eclipse.etrice.ui.layout.eTriceBehaviorDiagram" + name="eTrice Behavior Diagram"> + </diagramType> <option - class="org.eclipse.etrice.core.room.ActorClass" + class="org.eclipse.etrice.ui.layout.eTriceBehaviorDiagram" + option="de.cau.cs.kieler.algorithm" + value="de.cau.cs.kieler.graphviz.dot"> + </option> + <option + class="org.eclipse.etrice.ui.layout.eTriceBehaviorDiagram" option="de.cau.cs.kieler.borderSpacing" - value="50"> + value="30"> + </option> + <diagramType + id="org.eclipse.etrice.ui.layout.eTriceStructureDiagram" + name="eTrice Structure Diagram"> + </diagramType> + <option + class="org.eclipse.etrice.ui.layout.eTriceStructureDiagram" + option="de.cau.cs.kieler.algorithm" + value="de.cau.cs.kieler.klay.layered"> </option> <option - class="org.eclipse.etrice.core.room.ActorClass" + class="org.eclipse.etrice.ui.layout.eTriceStructureDiagram" option="de.cau.cs.kieler.spacing" value="50"> </option> <option - class="org.eclipse.etrice.core.room.StateGraph" + class="org.eclipse.etrice.ui.layout.eTriceStructureDiagram" option="de.cau.cs.kieler.borderSpacing" - value="30"> + value="50"> </option> - <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> 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 1bb0d2958..b110fd9ba 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 @@ -11,6 +11,7 @@ package org.eclipse.etrice.ui.layout; +import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.emf.ecore.EObject; import org.eclipse.etrice.core.room.StateGraph; import org.eclipse.etrice.core.room.TrPoint; @@ -77,32 +78,32 @@ public class BehaviorDiagramLayoutManager extends ETriceDiagramLayoutManager { } @Override - protected Size getDefaultSize(Shape shape) { - Size defaultSize = new Size(); - - // This code sets same minimal default size for both State Graph and + protected Dimension getDefaultSize(Shape shape) { + Dimension defaultSize = new Dimension(); + + // This code sets the same minimal default size for both State Graph and // State - defaultSize.setHeight(StateSupport.MIN_SIZE_Y); - defaultSize.setWidth(StateSupport.MIN_SIZE_X); - + defaultSize.setSize(StateSupport.MIN_SIZE_X, StateSupport.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, which - * might not seem so pleasant, but is more closer to the model. + * 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. */ - /* + /* EObject modelObject = shape.getLink().getBusinessObjects().get(0); if (modelObject instanceof StateGraph) { - defaultSize.setHeight(StateGraphSupport.DEFAULT_SIZE_Y); - defaultSize.setWidth(StateGraphSupport.DEFAULT_SIZE_X); + defaultSize.setSize(StateGraphSupport.DEFAULT_SIZE_X, + StateGraphSupport.DEFAULT_SIZE_Y); } else if (modelObject instanceof State) { - defaultSize.setHeight(StateSupport.MIN_SIZE_Y); - defaultSize.setWidth(StateSupport.MIN_SIZE_X); + defaultSize.setSize(StateSupport.MIN_SIZE_X, + StateSupport.MIN_SIZE_Y); + } else { - defaultSize.setHeight(MIN_HEIGHT); - defaultSize.setWidth(MIN_WIDHT); + defaultSize.setSize(20, 20); }*/ - + return defaultSize; } @@ -146,7 +147,6 @@ public class BehaviorDiagramLayoutManager extends ETriceDiagramLayoutManager { return false; } - /** * {@inheritDoc} * @@ -154,10 +154,10 @@ public class BehaviorDiagramLayoutManager extends ETriceDiagramLayoutManager { */ @Override public boolean isInternalPort(Shape shape) { - //No shape is an internal port (i.e. All ports are external only) + // No shape is an internal port (i.e. All ports are external only) return false; } - + /** * {@inheritDoc} * @@ -172,5 +172,4 @@ public class BehaviorDiagramLayoutManager extends ETriceDiagramLayoutManager { return false; } - } diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/BehaviorLayoutCommand.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/BehaviorLayoutCommand.java index 26ee58162..a107f13b0 100644 --- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/BehaviorLayoutCommand.java +++ b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/BehaviorLayoutCommand.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * 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; @@ -18,6 +28,12 @@ import org.eclipse.graphiti.services.IGaService; import de.cau.cs.kieler.core.kgraph.KNode; import de.cau.cs.kieler.core.kgraph.KPort; +/** + * A command for applying the result of automatic layout to diagram elements in + * eTrice Behavior Editor. + * + * @author jayant + */ public class BehaviorLayoutCommand extends ETriceLayoutCommand { public BehaviorLayoutCommand(TransactionalEditingDomain domain, 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 9cf2a5f91..09f22f298 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 @@ -16,6 +16,7 @@ import java.util.List; import java.util.Map.Entry; import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor; @@ -32,11 +33,7 @@ import org.eclipse.graphiti.mm.pictograms.PictogramElement; import org.eclipse.graphiti.mm.pictograms.Shape; import org.eclipse.graphiti.ui.editor.DiagramEditor; import org.eclipse.graphiti.ui.internal.parts.IPictogramElementEditPart; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.MessageBox; -import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PlatformUI; import de.cau.cs.kieler.core.kgraph.KGraphElement; import de.cau.cs.kieler.core.kgraph.KLabeledGraphElement; @@ -58,7 +55,7 @@ import de.cau.cs.kieler.kiml.util.KimlUtil; /** * The abstract class to support the creation of eTrice * {@link BehaviorDiagramLayoutManager } and - * {@link StructureDiagramLayoutmanager} + * {@link StructureDiagramLayoutManager} * * @author jayant */ @@ -233,6 +230,14 @@ 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_DAGRAM_TYPE); + // Node creation for currently visible top-level Container // Shape(Bounding Box) in // eTrice Diagrams @@ -265,32 +270,20 @@ public abstract class ETriceDiagramLayoutManager extends mapping.setLayoutGraph((KNode) internalKGraphElement); } else { - // The selected Element is a Port(Boundary or Internal) or an Edge Label. - - // Giving the user a SWT dialog indicating that this Shape - // cannot be lay-outed. - Shell shell = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getShell(); - MessageBox dialog = new MessageBox(shell, SWT.ICON_ERROR - | SWT.OK | SWT.CANCEL); - dialog.setText("Invalid Layout Call"); - dialog.setMessage("This shape connot be layouted saparately."); - System.out.println(dialog.open()); + // The selected Element is a Port(Boundary or Internal) or + // an Edge Label. + // It is an illegal argument for layout + throw new IllegalArgumentException( + "The seleted element cannot be lay-outed separately"); } } } else if (element instanceof FreeFormConnection) { - // This gives the user a SWT dialog indicating this is a connection - // and - // cannot be lay-outed. - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); - MessageBox dialog = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK - | SWT.CANCEL); - dialog.setText("Invalid Layout Call"); - dialog.setMessage("A connection connot be layouted saparately"); - System.out.println(dialog.open()); + // The selected element is an edge. + // It is an illegal argument for layout + throw new IllegalArgumentException( + "A connection cannot be layouted separately"); } for (Connection entry : mapping @@ -313,8 +306,13 @@ public abstract class ETriceDiagramLayoutManager extends * @param mapping * the mapping of pictogram elements to graph elements * @param diagram + * The Diagram Containing the Bounding Box * @param diagramNode + * The Node for the diagram * @param onlyVisible + * If true, only the visible bounding box will be lay-outed. + * Otherwise, all bounding boxes in current Diagram are + * lay-outed. * * @author jayant */ @@ -491,7 +489,7 @@ public abstract class ETriceDiagramLayoutManager extends * This is fairly general for both the eTrice editors and same for Nodes and * Ports */ - public static void setCurrentPositionAndSize( + protected void setCurrentPositionAndSize( final LayoutMapping<PictogramElement> mapping, final KNode parentNode, final KGraphElement kelem, final Shape shape) { @@ -545,7 +543,7 @@ public abstract class ETriceDiagramLayoutManager extends * @param node * the node for which layout options need to be set * @param shape - * TODO + * the corresponding shape * @author jayant */ /* This is fairly general for both the eTrice editors */ @@ -567,56 +565,11 @@ public abstract class ETriceDiagramLayoutManager extends VolatileLayoutConfig staticConfig = mapping .getProperty(KimlGraphitiUtil.STATIC_CONFIG); - Size defaultSize = getDefaultSize(shape); + Dimension defaultSize = getDefaultSize(shape); staticConfig.setValue(LayoutOptions.MIN_WIDTH, node, - LayoutContext.GRAPH_ELEM, defaultSize.getWidth() + labelWidth); - staticConfig - .setValue(LayoutOptions.MIN_HEIGHT, node, - LayoutContext.GRAPH_ELEM, defaultSize.getHeight() - + labelHeight); - } - - public static class Size { - private float width = 0; - private float height = 0; - - /** - * Getter for width - * - * @return the width - */ - public float getWidth() { - return width; - } - - /** - * Setter for width - * - * @param width - * the width to set - */ - public void setWidth(float width) { - this.width = width; - } - - /** - * Getter for height - * - * @return the height - */ - public float getHeight() { - return height; - } - - /** - * Setter for height - * - * @param height - * the height to set - */ - public void setHeight(float height) { - this.height = height; - } + LayoutContext.GRAPH_ELEM, defaultSize.width() + labelWidth); + staticConfig.setValue(LayoutOptions.MIN_HEIGHT, node, + LayoutContext.GRAPH_ELEM, defaultSize.height() + labelHeight); } /** @@ -646,6 +599,7 @@ public abstract class ETriceDiagramLayoutManager extends * * @param shape * the shape to be investigated + * * @return true if the {@code shape} is the Top Level Bounding Box * * @author jayant @@ -653,15 +607,15 @@ public abstract class ETriceDiagramLayoutManager extends public abstract boolean isTopLevelBoundingBox(Shape shape); /** - * Gets the Default Minimal Width for a node + * Gets the Default Minimal Size for a node * * @param shape - * TODO + * The shape attached to the node * - * @return the defaults minimal width a node + * @return the defaults minimal size for a node * * @author jayant */ - protected abstract Size getDefaultSize(Shape shape); + protected abstract Dimension getDefaultSize(Shape shape); } diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceLayoutCommand.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceLayoutCommand.java index 5d33d8a2c..dcd58138d 100644 --- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceLayoutCommand.java +++ b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceLayoutCommand.java @@ -34,8 +34,9 @@ import de.cau.cs.kieler.kiml.klayoutdata.KInsets; import de.cau.cs.kieler.kiml.klayoutdata.KShapeLayout; /** - * A command for applying the result of automatic layout to an eTrice - * editor(Graphiti) diagram. + * An abstract class to support creation of commands for applying the result of + * automatic layout to eTrice diagrams. Help create the + * {@link BehaviorLayoutCommand} and the {@link StructureLayoutCommand}. * * @author jayant */ @@ -114,7 +115,7 @@ public abstract class ETriceLayoutCommand extends GraphitiLayoutCommand { * * @author jayant */ - public static void setCalculatedPositionAndSize(final KGraphElement kelem, + protected void setCalculatedPositionAndSize(final KGraphElement kelem, KNode parentNode, final ContainerShape shape) { KShapeLayout shapeLayout = kelem.getData(KShapeLayout.class); 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 new file mode 100644 index 000000000..d9e21ee44 --- /dev/null +++ b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/ETriceSemanticLayoutConfig.java @@ -0,0 +1,96 @@ +/******************************************************************************* + * 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_DAGRAM_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_DAGRAM_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_DAGRAM_TYPE; + else if (semanticElem instanceof StateGraph) + return BEHAVIOR_DAGRAM_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 63a1976bf..47121beae 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 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.etrice.ui.layout; +import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.emf.ecore.EObject; import org.eclipse.etrice.core.room.ActorClass; import org.eclipse.etrice.core.room.ActorContainerClass; @@ -37,7 +38,7 @@ import de.cau.cs.kieler.kiml.util.KimlUtil; * @author jayant */ @SuppressWarnings("restriction") -public class StructureDiagramLayoutmanager extends ETriceDiagramLayoutManager { +public class StructureDiagramLayoutManager extends ETriceDiagramLayoutManager { /** * {@inheritDoc} @@ -72,33 +73,33 @@ public class StructureDiagramLayoutmanager extends ETriceDiagramLayoutManager { } @Override - protected Size getDefaultSize(Shape shape) { - Size defaultSize = new Size(); + protected Dimension getDefaultSize(Shape shape) { - // This code sets same minimal default size for both Actor Class and - // Actor Container Ref - defaultSize.setHeight(ActorContainerRefSupport.MIN_SIZE_Y); - defaultSize.setWidth(ActorContainerRefSupport.MIN_SIZE_X); + Dimension defaultSize = new Dimension(); + // This code sets the same minimal default size for both Actor Class and + // Actor Container Refs + defaultSize.setSize(ActorContainerRefSupport.MIN_SIZE_X, + 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, which - * might not seem so pleasant, but is more closer to the model. + * 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. */ /* EObject modelObject = shape.getLink().getBusinessObjects().get(0); if (modelObject instanceof ActorClass) { - defaultSize.setHeight(StructureClassSupport.DEFAULT_SIZE_Y); - defaultSize.setWidth(StructureClassSupport.DEFAULT_SIZE_X); + defaultSize.setSize(StructureClassSupport.DEFAULT_SIZE_X, + StructureClassSupport.DEFAULT_SIZE_Y); } else if (modelObject instanceof ActorContainerRef) { - defaultSize.setHeight(ActorContainerRefSupport.MIN_SIZE_Y); - defaultSize.setWidth(ActorContainerRefSupport.MIN_SIZE_X); + defaultSize.setSize(ActorContainerRefSupport.MIN_SIZE_X, + ActorContainerRefSupport.MIN_SIZE_Y); } else { - defaultSize.setHeight(MIN_HEIGHT); - defaultSize.setWidth(MIN_WIDHT); + defaultSize.setSize(20, 20); }*/ - + return defaultSize; } diff --git a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureLayoutCommand.java b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureLayoutCommand.java index f3f4dde40..9955e58f1 100644 --- a/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureLayoutCommand.java +++ b/plugins/org.eclipse.etrice.ui.layout/src/org/eclipse/etrice/ui/layout/StructureLayoutCommand.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * 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; @@ -19,6 +29,12 @@ import org.eclipse.graphiti.services.IGaService; import de.cau.cs.kieler.core.kgraph.KNode; import de.cau.cs.kieler.core.kgraph.KPort; +/** + * A command for applying the result of automatic layout to diagram elements in + * eTrice Structure Editor. + * + * @author jayant + */ public class StructureLayoutCommand extends ETriceLayoutCommand { public StructureLayoutCommand(TransactionalEditingDomain domain, @@ -79,11 +95,12 @@ public class StructureLayoutCommand extends ETriceLayoutCommand { */ private static void adjustLabelForPort(ContainerShape shape) { GraphicsAlgorithm ga = shape.getGraphicsAlgorithm(); - EObject boContainer = shape.getContainer().getLink().getBusinessObjects().get(0); + EObject boContainer = shape.getContainer().getLink() + .getBusinessObjects().get(0); // First make sure that the shape corresponds to a Port EObject bo = shape.getLink().getBusinessObjects().get(0); - if ( bo instanceof InterfaceItem) { + if (bo instanceof InterfaceItem) { // margin and size for bounding box (ActorClass ) int margin = InterfaceItemSupport.MARGIN; int size = InterfaceItemSupport.ITEM_SIZE; |