diff options
author | Henrik Rentz-Reichert | 2011-03-12 07:20:18 +0000 |
---|---|---|
committer | Henrik Rentz-Reichert | 2011-03-12 07:20:18 +0000 |
commit | 4a6cc7935ef94c6474449d6923c9699d5536f484 (patch) | |
tree | 06ee891df37d020cc044209dc1174a2f9dd7d497 | |
parent | 52478f8f999b20bae507fcac5af2e24c9bf13467 (diff) | |
download | org.eclipse.etrice-4a6cc7935ef94c6474449d6923c9699d5536f484.tar.gz org.eclipse.etrice-4a6cc7935ef94c6474449d6923c9699d5536f484.tar.xz org.eclipse.etrice-4a6cc7935ef94c6474449d6923c9699d5536f484.zip |
ui.structure: using RoomHelpers
3 files changed, 11 insertions, 27 deletions
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/ActorContainerRefSupport.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/ActorContainerRefSupport.java index 124dd08d8..f6759d364 100644 --- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/ActorContainerRefSupport.java +++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/ActorContainerRefSupport.java @@ -28,6 +28,7 @@ import org.eclipse.etrice.core.room.LogicalSystem; import org.eclipse.etrice.core.room.RoomFactory;
import org.eclipse.etrice.core.room.StructureClass;
import org.eclipse.etrice.core.room.SubSystemRef;
+import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.ui.structure.DiagramAccess;
import org.eclipse.etrice.ui.structure.ImageProvider;
import org.eclipse.etrice.ui.structure.dialogs.ActorContainerRefPropertyDialog;
@@ -507,7 +508,7 @@ public class ActorContainerRefSupport { // check interface ports and spps added to model not present in diagram
{
ActorContainerClass acc = (acr instanceof ActorRef)?((ActorRef)acr).getType():((SubSystemRef)acr).getType();
- List<InterfaceItem> interfaceItems = InterfaceItemSupport.getInterfaceItems(acc);
+ List<InterfaceItem> interfaceItems = RoomHelpers.getInterfaceItems(acc);
List<InterfaceItem> presentItems = new ArrayList<InterfaceItem>();
for (Shape child : containerShape.getChildren()) {
bo = getBusinessObjectForPictogramElement(child);
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/InterfaceItemSupport.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/InterfaceItemSupport.java index 917e4f0f2..a627f63da 100644 --- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/InterfaceItemSupport.java +++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/InterfaceItemSupport.java @@ -25,8 +25,8 @@ import org.eclipse.etrice.core.room.ActorRef; import org.eclipse.etrice.core.room.InterfaceItem;
import org.eclipse.etrice.core.room.Port;
import org.eclipse.etrice.core.room.SPPRef;
-import org.eclipse.etrice.core.room.SubSystemClass;
import org.eclipse.etrice.core.room.SubSystemRef;
+import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.ui.common.support.NoResizeFeature;
import org.eclipse.etrice.ui.structure.DiagramAccess;
import org.eclipse.graphiti.dt.IDiagramTypeProvider;
@@ -678,33 +678,10 @@ public class InterfaceItemSupport { }
}
- public static List<InterfaceItem> getInterfaceItems(ActorContainerClass acc) {
- ArrayList<InterfaceItem> result = new ArrayList<InterfaceItem>();
-
-
- if (acc instanceof ActorClass) {
- ActorClass ac = (ActorClass) acc;
- do {
- result.addAll(acc.getIfSPPs());
- result.addAll(ac.getIfPorts());
- ac = ac.getBase();
- }
- while (ac!=null);
- }
- else if (acc instanceof SubSystemClass) {
- result.addAll(acc.getIfSPPs());
- result.addAll(((SubSystemClass) acc).getRelayPorts());
- }
- else {
- assert(false): "unexpected sub type";
- }
- return result;
- }
-
public static void createRefItems(ActorContainerRef acr, ContainerShape refShape, IFeatureProvider featureProvider) {
ActorContainerClass refClass = (acr instanceof ActorRef)?((ActorRef)acr).getType():((SubSystemRef)acr).getType();
- List<? extends InterfaceItem> refItems = getInterfaceItems(refClass);
+ List<? extends InterfaceItem> refItems = RoomHelpers.getInterfaceItems(refClass);
if (refShape!=null && refClass!=null &&!refItems.isEmpty()) {
@@ -721,7 +698,7 @@ public class InterfaceItemSupport { ActorContainerClass extRefClass = (ActorContainerClass) bo;
assert(extRefClass.getName().equals(refClass.getName())): "structure class names must match";
- List<InterfaceItem> extRefItems = getInterfaceItems(extRefClass);
+ List<InterfaceItem> extRefItems = RoomHelpers.getInterfaceItems(extRefClass);
List<InterfaceItem> intRefItems = new ArrayList<InterfaceItem>();
for (Shape ch : refShape.getChildren()) {
bo = featureProvider.getBusinessObjectForPictogramElement(ch);
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/StructureClassSupport.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/StructureClassSupport.java index ef086c61b..0d54b4f0a 100644 --- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/StructureClassSupport.java +++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/StructureClassSupport.java @@ -12,6 +12,7 @@ package org.eclipse.etrice.ui.structure.support;
+import java.util.List;
import java.util.Map;
import org.eclipse.emf.common.util.EList;
@@ -24,6 +25,7 @@ import org.eclipse.etrice.core.room.Binding; import org.eclipse.etrice.core.room.InterfaceItem;
import org.eclipse.etrice.core.room.Port;
import org.eclipse.etrice.core.room.StructureClass;
+import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.ui.structure.DiagramAccess;
import org.eclipse.graphiti.dt.IDiagramTypeProvider;
import org.eclipse.graphiti.features.IAddFeature;
@@ -220,6 +222,10 @@ public class StructureClassSupport { return Reason.createTrueReason("Structure class deleted from model");
}
+ StructureClass sc = (StructureClass) bo;
+
+ List<InterfaceItem> interfaceItems = RoomHelpers.getInterfaceItems(sc);
+
// TODOHRR: check for refs added in model not present in diagram
// also inherited
|