Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2014-08-06 08:56:38 -0400
committerHenrik Rentz-Reichert2014-08-06 08:56:38 -0400
commitcc931d088f87d69a2deeb145d541f83aae8bab50 (patch)
tree332ee8870baa362e5ca4340ceb89a9ac97be65cb
parent19c21a758ce51f0e207158a216ede3477f7cf353 (diff)
downloadorg.eclipse.etrice-cc931d088f87d69a2deeb145d541f83aae8bab50.tar.gz
org.eclipse.etrice-cc931d088f87d69a2deeb145d541f83aae8bab50.tar.xz
org.eclipse.etrice-cc931d088f87d69a2deeb145d541f83aae8bab50.zip
static utility methods converted to class methods to be able to use
inheritance and overriding in super classes. This was done mainly for * BaseHelpers.java * RoomHelpers.java and had a lot of impacts on the whole code base
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java7
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ActiveRules.java4
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ProposalGenerator.java6
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityCheck.java8
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java4
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/SemanticsCheck.java10
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/util/AbstractExecutionUtil.java71
-rw-r--r--plugins/org.eclipse.etrice.core.common/src/org/eclipse/etrice/core/common/base/util/BaseHelpers.java16
-rw-r--r--plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java43
-rw-r--r--plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/contentassist/ConfigProposalProvider.java22
-rw-r--r--plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/labeling/ConfigLabelProvider.java7
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/util/ConfigUtil.java27
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/scoping/ConfigScopeProvider.java32
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/validation/ConfigJavaValidator.java15
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/BindingUtil.java4
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/GeneratorModelBuilder.java6
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/Wiring.java34
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java43
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedRefinedStateImpl.java11
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/TransitionChainImpl.java12
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/util/ETriceGenUtil.java8
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/util/RoomCrossReferencer.java4
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/contentassist/RoomProposalProvider.java12
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java18
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/linking/RoomHyperlinkHelper.java7
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/naming/RoomNameProvider.java298
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomHelpers.java442
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomUtil.java208
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/ActorRefFilter.java8
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java25
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/RoomJavaValidator.java65
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidationUtil.java231
-rw-r--r--plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostprocessor.java12
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend5
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/DataClassGen.xtend3
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Initialization.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java63
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java9
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/DataClassGen.java12
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java8
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java27
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.java6
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java17
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java10
-rw-r--r--plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend23
-rw-r--r--plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/util/DataConfigurationHelper.java33
-rw-r--r--plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java25
-rw-r--r--plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/DocGen.xtend6
-rw-r--r--plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/DocGen.java38
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.xtend3
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend9
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend6
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend3
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Initialization.xtend5
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.xtend7
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.xtend12
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/StateMachineGen.xtend7
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend5
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.java8
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java41
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java14
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java6
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java8
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.java12
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.java5
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java13
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/StateMachineGen.java8
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java14
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/MappingBuilder.java5
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/CodegenHelpers.java31
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DefaultTranslationProvider.java11
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DetailCodeTranslator.java13
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/Diagnostician.java7
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.xtend3
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.xtend3
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend24
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend9
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend5
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TransitionChainVisitor.java15
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TypeHelpers.xtend3
-rw-r--r--plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.java14
-rw-r--r--plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.java8
-rw-r--r--plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java120
-rw-r--r--plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java38
-rw-r--r--plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java28
-rw-r--r--plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java7
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/commands/PopulateDiagramCommand.java2
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/commands/StateGraphContext.java8
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/AbstractMemberAwarePropertyDialog.java10
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/ChoicePointPropertyDialog.java4
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/MemberSelectionDialog.java4
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/PortMessageSelectionDialog.java22
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/StatePropertyDialog.java22
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TrPointPropertyDialog.java4
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TransitionPropertyDialog.java32
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/editor/BehaviorEditor.java19
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/editor/BehaviorExporter.java7
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/quickfix/BehaviorQuickfixProvider.java28
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/ChoicePointSupport.java23
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/ContextSwitcher.java2
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/DefaultPositionProvider.java23
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/DiagramUpdateFeature.java6
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/InitialPointSupport.java15
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateGraphSupport.java18
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java109
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/SupportUtil.java188
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java27
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TransitionSupport.java93
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditBehaviorHandler.java16
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/create_contents.xml2
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/dialogs/ActorContainerRefPropertyDialog.java4
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/dialogs/PortPropertyDialog.java37
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/dialogs/SPPPropertyDialog.java6
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/ActorContainerRefSupport.java14
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/BindingSupport.java66
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/InterfaceItemSupport.java3
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/LayerConnectionSupport.java51
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/PortSupport.java8
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SPPSupport.java8
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/StructureClassUpdate.java9
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SupportUtil.java113
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/provider/DefaultPositionProvider.java8
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/.classpath6
-rw-r--r--tests/org.eclipse.etrice.abstractexec.behavior.tests/META-INF/MANIFEST.MF3
-rw-r--r--tests/org.eclipse.etrice.abstractexec.behavior.tests/src/org/eclipse/etrice/abstractexec/behavior/tests/TestSemantics.java10
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestCodeInheritance.java21
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestInstanceModelBuilderBase.java9
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestMultipleConnectedChoicepoint.java5
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStates.java5
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesAndTriggers.java5
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesInheritance.java9
-rw-r--r--tests/org.eclipse.etrice.generator.java.tests/make.xml22
-rw-r--r--tests/org.eclipse.etrice.generator.tests/src/org/eclipse/etrice/generator/base/TestDetailCodeTranslator.java3
137 files changed, 2049 insertions, 1614 deletions
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF
index 3b048e7dc..46f89bd21 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF
@@ -14,4 +14,5 @@ Require-Bundle: org.eclipse.etrice.core.room;bundle-version="0.5.0",
org.eclipse.xtext.ui;bundle-version="2.1.1"
Bundle-Activator: org.eclipse.etrice.abstractexec.behavior.Activator
Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.etrice.abstractexec.behavior;x-friends:="org.eclipse.etrice.abstractexec.behavior.tests,org.eclipse.etrice.ui.behavior"
+Export-Package: org.eclipse.etrice.abstractexec.behavior,
+ org.eclipse.etrice.abstractexec.behavior.util;x-friends:="org.eclipse.etrice.abstractexec.behavior.tests"
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java
index 2769924ed..0a352b85f 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java
@@ -21,6 +21,7 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.abstractexec.behavior.util.AbstractExecutionUtil;
import org.eclipse.etrice.core.common.validation.ICustomValidator;
import org.eclipse.etrice.core.genmodel.base.NullDiagnostician;
import org.eclipse.etrice.core.genmodel.base.NullLogger;
@@ -38,8 +39,6 @@ import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.StateGraphItem;
import org.eclipse.etrice.core.room.Trigger;
import org.eclipse.etrice.core.room.TriggeredTransition;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
-import org.eclipse.etrice.core.validation.ValidationUtil;
import org.eclipse.xtext.validation.ValidationMessageAcceptor;
/**
@@ -93,12 +92,12 @@ public class AbstractExecutionValidator implements ICustomValidator {
if (ac.isAbstract())
return;
- if (ValidationUtil.isCircularClassHierarchy(ac))
+ if (AbstractExecutionUtil.getInstance().getRoomHelpers().isCircularClassHierarchy(ac))
// is checked elsewhere
return;
boolean oneProtocolsWithSemantics = false;
- List<InterfaceItem> ifItems = RoomHelpers.getAllInterfaceItems(ac);
+ List<InterfaceItem> ifItems = AbstractExecutionUtil.getInstance().getRoomHelpers().getAllInterfaceItems(ac);
for (InterfaceItem item : ifItems) {
GeneralProtocolClass pc = item.getGeneralProtocol();
if (!(pc instanceof ProtocolClass))
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ActiveRules.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ActiveRules.java
index 219180504..b352f5c8c 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ActiveRules.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ActiveRules.java
@@ -19,6 +19,7 @@ import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.etrice.abstractexec.behavior.util.AbstractExecutionUtil;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.room.GeneralProtocolClass;
import org.eclipse.etrice.core.room.InSemanticsRule;
@@ -26,7 +27,6 @@ import org.eclipse.etrice.core.room.InterfaceItem;
import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.ProtocolSemantics;
import org.eclipse.etrice.core.room.SemanticsRule;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
public class ActiveRules {
private HashMap<InterfaceItem, List<SemanticsRule>> rules;
@@ -148,7 +148,7 @@ public class ActiveRules {
public void buildInitLocalRules(ExpandedActorClass xpAct) {
// HashMap<InterfaceItem, EList<SemanticsRule>> locals = new
// HashMap<InterfaceItem, EList<SemanticsRule>>();
- List<InterfaceItem> portList = RoomHelpers.getAllInterfaceItems(xpAct
+ List<InterfaceItem> portList = AbstractExecutionUtil.getInstance().getRoomHelpers().getAllInterfaceItems(xpAct
.getActorClass());
for (InterfaceItem ifitem : portList) {
GeneralProtocolClass gpc = ifitem.getGeneralProtocol();
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ProposalGenerator.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ProposalGenerator.java
index 7c8930346..ad3b4e729 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ProposalGenerator.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ProposalGenerator.java
@@ -18,6 +18,7 @@ import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.etrice.abstractexec.behavior.util.AbstractExecutionUtil;
import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.room.InterfaceItem;
@@ -26,7 +27,6 @@ import org.eclipse.etrice.core.room.MessageFromIf;
import org.eclipse.etrice.core.room.RoomFactory;
import org.eclipse.etrice.core.room.SemanticsRule;
import org.eclipse.etrice.core.room.State;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
public class ProposalGenerator {
private ExpandedActorClass xpac;
@@ -65,7 +65,7 @@ public class ProposalGenerator {
return;
// ignore substates
- if (RoomHelpers.hasDirectSubStructure(st))
+ if (AbstractExecutionUtil.getInstance().getRoomHelpers().hasDirectSubStructure(st))
return;
outgoingProposal.clear();
@@ -85,7 +85,7 @@ public class ProposalGenerator {
.createMessageFromIf();
mif.setFrom(port);
mif.setMessage(curRule.getMsg());
- boolean isOutgoing = RoomHelpers.getMessageListDeep(
+ boolean isOutgoing = AbstractExecutionUtil.getInstance().getRoomHelpers().getMessageListDeep(
port, true).contains(curRule.getMsg());
if (isOutgoing) {
outgoingProposal.add(mif);
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityCheck.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityCheck.java
index 4bdad9743..3b7494c99 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityCheck.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityCheck.java
@@ -18,6 +18,7 @@ import java.util.Queue;
import java.util.Set;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.etrice.abstractexec.behavior.util.AbstractExecutionUtil;
import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.room.EntryPoint;
@@ -31,7 +32,6 @@ import org.eclipse.etrice.core.room.TrPoint;
import org.eclipse.etrice.core.room.Transition;
import org.eclipse.etrice.core.room.TransitionPoint;
import org.eclipse.etrice.core.room.TriggeredTransition;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.generator.generic.RoomExtensions;
public class ReachabilityCheck {
@@ -67,7 +67,7 @@ public class ReachabilityCheck {
for (Transition trans : transitions)
if (trans instanceof InitialTransition) {
visited.add(trans);
- StateGraphNode cur = RoomHelpers.getNode(trans.getTo());
+ StateGraphNode cur = AbstractExecutionUtil.getInstance().getRoomHelpers().getNode(trans.getTo());
if (!visited.contains(cur))
queue.add(cur);
break;
@@ -101,7 +101,7 @@ public class ReachabilityCheck {
visited.add(node);
if (node instanceof State) {
State st = (State) node;
- if (RoomHelpers.hasDirectSubStructure(st)) {
+ if (AbstractExecutionUtil.getInstance().getRoomHelpers().hasDirectSubStructure(st)) {
addStartingPoints(st.getSubgraph(), true);
} else {
// visit outgoing triggered transitions
@@ -129,7 +129,7 @@ public class ReachabilityCheck {
private void visit(Transition trans){
visited.add(trans);
- StateGraphNode target = RoomHelpers.getNode(trans.getTo());
+ StateGraphNode target = AbstractExecutionUtil.getInstance().getRoomHelpers().getNode(trans.getTo());
if (!visited.contains(target))
queue.add(target);
}
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java
index 35b5ed6f0..cd0990b9b 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java
@@ -21,6 +21,7 @@ import java.util.Set;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.abstractexec.behavior.util.AbstractExecutionUtil;
import org.eclipse.etrice.core.common.validation.ICustomValidator;
import org.eclipse.etrice.core.genmodel.base.NullDiagnostician;
import org.eclipse.etrice.core.genmodel.base.NullLogger;
@@ -29,7 +30,6 @@ import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.RoomPackage;
import org.eclipse.etrice.core.room.StateGraphItem;
-import org.eclipse.etrice.core.validation.ValidationUtil;
import org.eclipse.xtext.validation.ValidationMessageAcceptor;
@@ -56,7 +56,7 @@ public class ReachabilityValidator implements ICustomValidator {
if (ac.isAbstract())
return;
- if (ValidationUtil.isCircularClassHierarchy(ac))
+ if (AbstractExecutionUtil.getInstance().getRoomHelpers().isCircularClassHierarchy(ac))
// is checked elsewhere
return;
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/SemanticsCheck.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/SemanticsCheck.java
index 1e6bcca92..0fb1b823b 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/SemanticsCheck.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/SemanticsCheck.java
@@ -22,6 +22,7 @@ import java.util.Set;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.etrice.abstractexec.behavior.util.AbstractExecutionUtil;
import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.room.InitialTransition;
@@ -30,7 +31,6 @@ import org.eclipse.etrice.core.room.StateGraph;
import org.eclipse.etrice.core.room.StateGraphItem;
import org.eclipse.etrice.core.room.StateGraphNode;
import org.eclipse.etrice.core.room.Transition;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
public class SemanticsCheck {
private Queue<StateGraphNode> queue;
@@ -86,7 +86,7 @@ public class SemanticsCheck {
EList<Transition> transitions = graph.getTransitions();
for (Transition trans : transitions)
if (trans instanceof InitialTransition) {
- StateGraphNode cur = RoomHelpers.getNode(trans.getTo());
+ StateGraphNode cur = AbstractExecutionUtil.getInstance().getRoomHelpers().getNode(trans.getTo());
List<HandledMessage> msgList = codeAnalyzer.analyze(trans.getAction());
if (cur instanceof State) {
msgList.addAll(codeAnalyzer.analyze(((State) cur).getEntryCode()));
@@ -117,7 +117,7 @@ public class SemanticsCheck {
visited.add(node);
if (node instanceof State) {
State st = (State) node;
- if (RoomHelpers.hasDirectSubStructure(st)) {
+ if (AbstractExecutionUtil.getInstance().getRoomHelpers().hasDirectSubStructure(st)) {
addStartingPoints(st.getSubgraph(), mapToRules.get(st));
}
else {
@@ -128,7 +128,7 @@ public class SemanticsCheck {
}
for (Transition trans : trigger.getTransitions()) {
- StateGraphNode target = RoomHelpers.getNode(trans.getTo());
+ StateGraphNode target = AbstractExecutionUtil.getInstance().getRoomHelpers().getNode(trans.getTo());
List<HandledMessage> msgList = new LinkedList<HandledMessage>();
// create a list of codes here in the order
// trigger, exit, action, entry
@@ -188,7 +188,7 @@ public class SemanticsCheck {
for (Transition trans : xpAct.getOutgoingTransitions(node)) {
ActiveRules tempRule = mapToRules.get(node).createCopy();
List<HandledMessage> msgList = codeAnalyzer.analyze(trans.getAction());
- StateGraphNode target = RoomHelpers.getNode(trans.getTo());
+ StateGraphNode target = AbstractExecutionUtil.getInstance().getRoomHelpers().getNode(trans.getTo());
if (target instanceof State) {
msgList.addAll(codeAnalyzer.analyze(((State) target).getEntryCode()));
}
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/util/AbstractExecutionUtil.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/util/AbstractExecutionUtil.java
new file mode 100644
index 000000000..0947168f9
--- /dev/null
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/util/AbstractExecutionUtil.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2014 protos software gmbh (http://www.protos.de).
+ * All rights reserved. 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.abstractexec.behavior.util;
+
+import org.eclipse.etrice.core.naming.RoomNameProvider;
+import org.eclipse.etrice.core.room.util.RoomHelpers;
+import org.eclipse.etrice.core.ui.RoomUiModule;
+import org.eclipse.etrice.core.validation.ValidationUtil;
+
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public class AbstractExecutionUtil {
+
+ private static AbstractExecutionUtil instance = null;
+
+ /**
+ * @return the instance
+ */
+ public static AbstractExecutionUtil getInstance() {
+ if (instance==null) {
+ Injector injector = RoomUiModule.getInjector();
+ instance = injector.getInstance(AbstractExecutionUtil.class);
+ }
+ return instance;
+ }
+
+ @Inject
+ private ValidationUtil validationUtil;
+
+ @Inject
+ private RoomHelpers roomHelpers;
+
+ @Inject
+ private RoomNameProvider roomNameProvider;
+
+ /**
+ * @return the validationUtil
+ */
+ public ValidationUtil getValidationUtil() {
+ return validationUtil;
+ }
+
+ /**
+ * @return the roomHelpers
+ */
+ public RoomHelpers getRoomHelpers() {
+ return roomHelpers;
+ }
+
+ /**
+ * @return the roomNameProvider
+ */
+ public RoomNameProvider getRoomNameProvider() {
+ return roomNameProvider;
+ }
+}
diff --git a/plugins/org.eclipse.etrice.core.common/src/org/eclipse/etrice/core/common/base/util/BaseHelpers.java b/plugins/org.eclipse.etrice.core.common/src/org/eclipse/etrice/core/common/base/util/BaseHelpers.java
index 1553098ef..a10d67670 100644
--- a/plugins/org.eclipse.etrice.core.common/src/org/eclipse/etrice/core/common/base/util/BaseHelpers.java
+++ b/plugins/org.eclipse.etrice.core.common/src/org/eclipse/etrice/core/common/base/util/BaseHelpers.java
@@ -24,7 +24,7 @@ import org.eclipse.etrice.core.common.base.RealLiteral;
import org.eclipse.etrice.core.common.base.StringLiteral;
/**
- * This class provides a convenience methods for eTrice's common base language
+ * This class provides convenience methods for eTrice's common base language
* elements, such as Annotations and Literals.
*/
public class BaseHelpers {
@@ -37,7 +37,7 @@ public class BaseHelpers {
*
* @return <code>true</code> if the named annotation is present in a list of {@link Annotation}s
*/
- public static boolean isAnnotationPresent(List<Annotation> annotations, String name) {
+ public boolean isAnnotationPresent(List<Annotation> annotations, String name) {
for (Annotation annotation : annotations) {
if (annotation.getType().getName().equals(name))
return true;
@@ -54,7 +54,7 @@ public class BaseHelpers {
*
* @return a list of the {@link Annotation} attributes of the named annotation
*/
- public static List<KeyValue> getAttributes(List<Annotation> annotations, String name) {
+ public List<KeyValue> getAttributes(List<Annotation> annotations, String name) {
for (Annotation annotation : annotations) {
if (annotation.getType().getName().equals(name))
return annotation.getAttributes();
@@ -71,7 +71,7 @@ public class BaseHelpers {
*
* @return <code>true</code> if such an attribute is present
*/
- public static boolean isAttributePresent(List<Annotation> annotations, String name,
+ public boolean isAttributePresent(List<Annotation> annotations, String name,
String key) {
List<KeyValue> attributes = getAttributes(annotations, name);
for (KeyValue attrib : attributes) {
@@ -90,7 +90,7 @@ public class BaseHelpers {
*
* @return the string value of the attribute or an empty string if not found
*/
- public static String getAttribute(List<Annotation> annotations, String name, String key) {
+ public String getAttribute(List<Annotation> annotations, String name, String key) {
List<KeyValue> attributes = getAttributes(annotations, name);
for (KeyValue attrib : attributes) {
if (attrib.getKey().equals(key))
@@ -107,7 +107,7 @@ public class BaseHelpers {
*
* @return <code>true</code> if such an attribute is present
*/
- public static boolean isAttributePresent(Annotation annotation, String key) {
+ public boolean isAttributePresent(Annotation annotation, String key) {
for (KeyValue attrib : annotation.getAttributes()) {
if (attrib.getKey().equals(key))
return true;
@@ -123,7 +123,7 @@ public class BaseHelpers {
*
* @return the string value of the attribute or an empty string if not found
*/
- public static String getAttribute(Annotation annotation, String key) {
+ public String getAttribute(Annotation annotation, String key) {
for (KeyValue attrib : annotation.getAttributes()) {
if (attrib.getKey().equals(key))
return literalToString(attrib.getValue());
@@ -135,7 +135,7 @@ public class BaseHelpers {
* @param l a {@link Literal}
* @return a string representation of the literal
*/
- public static String literalToString(Literal l) {
+ public String literalToString(Literal l) {
if (l instanceof BooleanLiteral) {
return ((BooleanLiteral) l).isIsTrue()? "true":"false";
}
diff --git a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java
index 8ac9c2624..928322a30 100644
--- a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java
+++ b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java
@@ -38,39 +38,33 @@ public class PostprocessingHelpers {
}
public static void setDocumentation(final EModelElement eModelElement, final String documentation) {
- String _plus = (PostprocessingHelpers.JAVADOC_NEWLINE + documentation);
- EcoreUtil.setDocumentation(eModelElement, _plus);
+ EcoreUtil.setDocumentation(eModelElement, (PostprocessingHelpers.JAVADOC_NEWLINE + documentation));
}
public static EAttribute getAttribute(final EClass cls, final String name) {
EList<EAttribute> _eAllAttributes = cls.getEAllAttributes();
- final Function1<EAttribute,Boolean> _function = new Function1<EAttribute,Boolean>() {
- public Boolean apply(final EAttribute a) {
- String _name = a.getName();
- boolean _equals = _name.equals(name);
- return Boolean.valueOf(_equals);
- }
- };
- EAttribute _findFirst = IterableExtensions.<EAttribute>findFirst(_eAllAttributes, _function);
- return _findFirst;
+ final Function1<EAttribute, Boolean> _function = new Function1<EAttribute, Boolean>() {
+ public Boolean apply(final EAttribute a) {
+ String _name = a.getName();
+ return Boolean.valueOf(_name.equals(name));
+ }
+ };
+ return IterableExtensions.<EAttribute>findFirst(_eAllAttributes, _function);
}
public static EReference getReference(final EClass cls, final String name) {
EList<EReference> _eAllReferences = cls.getEAllReferences();
- final Function1<EReference,Boolean> _function = new Function1<EReference,Boolean>() {
- public Boolean apply(final EReference a) {
- String _name = a.getName();
- boolean _equals = _name.equals(name);
- return Boolean.valueOf(_equals);
- }
- };
- EReference _findFirst = IterableExtensions.<EReference>findFirst(_eAllReferences, _function);
- return _findFirst;
+ final Function1<EReference, Boolean> _function = new Function1<EReference, Boolean>() {
+ public Boolean apply(final EReference a) {
+ String _name = a.getName();
+ return Boolean.valueOf(_name.equals(name));
+ }
+ };
+ return IterableExtensions.<EReference>findFirst(_eAllReferences, _function);
}
public static boolean addOperation(final EClass owner, final String name, final EClassifier type, final String body) {
- boolean _addOperation = PostprocessingHelpers.addOperation(owner, name, type, Integer.valueOf(1), body);
- return _addOperation;
+ return PostprocessingHelpers.addOperation(owner, name, type, Integer.valueOf(1), body);
}
public static boolean addOperation(final EClass owner, final String name, final EClassifier type, final Integer upperBound, final String body) {
@@ -82,13 +76,12 @@ public class PostprocessingHelpers {
op.setUpperBound((upperBound).intValue());
final EAnnotation anno = EcoreFactory.eINSTANCE.createEAnnotation();
anno.setSource("http://www.eclipse.org/emf/2002/GenModel");
- EMap<String,String> _details = anno.getDetails();
+ EMap<String, String> _details = anno.getDetails();
_details.put("body", body);
EList<EAnnotation> _eAnnotations = op.getEAnnotations();
_eAnnotations.add(anno);
EList<EOperation> _eOperations = owner.getEOperations();
- boolean _add = _eOperations.add(op);
- _xblockexpression = (_add);
+ _xblockexpression = _eOperations.add(op);
}
return _xblockexpression;
}
diff --git a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/contentassist/ConfigProposalProvider.java b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/contentassist/ConfigProposalProvider.java
index 7b2b5ed7b..f04708081 100644
--- a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/contentassist/ConfigProposalProvider.java
+++ b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/contentassist/ConfigProposalProvider.java
@@ -39,12 +39,20 @@ import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
+import com.google.inject.Inject;
+
/**
* see
* http://www.eclipse.org/Xtext/documentation/latest/xtext.html#contentAssist on
* how to customize content assistant
*/
public class ConfigProposalProvider extends AbstractConfigProposalProvider {
+
+ @Inject
+ private RoomHelpers roomHelpers;
+
+ @Inject
+ private ConfigUtil configUtil;
@Override
public void completeImport_ImportURI(EObject model, Assignment assignment,
@@ -94,9 +102,9 @@ public class ConfigProposalProvider extends AbstractConfigProposalProvider {
if (root != null) {
RefPath path = config.getPath();
if (path != null && !path.getRefs().isEmpty())
- root = ConfigUtil.resolve(root, path);
+ root = configUtil.resolve(root, path);
if (root != null) {
- for (ActorContainerRef ref : RoomHelpers.getRefs(root, true)) {
+ for (ActorContainerRef ref : roomHelpers.getRefs(root, true)) {
if (ref instanceof ActorRef) {
ActorRef aRef = (ActorRef) ref;
if (aRef.getMultiplicity() == 1)
@@ -114,7 +122,7 @@ public class ConfigProposalProvider extends AbstractConfigProposalProvider {
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
Attribute attr = getAttribute(model);
if (attr != null) {
- LiteralType type = ConfigUtil.getLiteralType(attr);
+ LiteralType type = configUtil.getLiteralType(attr);
if (type != LiteralType.CHAR)
return;
}
@@ -129,7 +137,7 @@ public class ConfigProposalProvider extends AbstractConfigProposalProvider {
Attribute attr = getAttribute(model);
if (attr != null) {
mult = (attr.getSize() > 0) ? "[" + attr.getSize() + "]" : "";
- LiteralType type = ConfigUtil.getLiteralType(attr);
+ LiteralType type = configUtil.getLiteralType(attr);
if (type != LiteralType.BOOL)
return;
}
@@ -148,7 +156,7 @@ public class ConfigProposalProvider extends AbstractConfigProposalProvider {
Attribute attr = getAttribute(model);
if (attr != null) {
mult = (attr.getSize() > 0) ? "[" + attr.getSize() + "]" : "";
- LiteralType type = ConfigUtil.getLiteralType(attr);
+ LiteralType type = configUtil.getLiteralType(attr);
if (type != LiteralType.INT && type != LiteralType.REAL)
return;
}
@@ -166,7 +174,7 @@ public class ConfigProposalProvider extends AbstractConfigProposalProvider {
Attribute attr = getAttribute(model);
if (attr != null) {
mult = (attr.getSize() > 0) ? "[" + attr.getSize() + "]" : "";
- LiteralType type = ConfigUtil.getLiteralType(attr);
+ LiteralType type = configUtil.getLiteralType(attr);
if (type != LiteralType.REAL)
return;
}
@@ -221,7 +229,7 @@ public class ConfigProposalProvider extends AbstractConfigProposalProvider {
}
private boolean hideKeyword(AttrConfig config, Keyword keyword) {
- LiteralType type = ConfigUtil.getLiteralType(config.getAttribute());
+ LiteralType type = configUtil.getLiteralType(config.getAttribute());
DataType dataType = config.getAttribute().getType().getType();
if (keyword.getValue().equals("min")
|| keyword.getValue().equals("max")) {
diff --git a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/labeling/ConfigLabelProvider.java b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/labeling/ConfigLabelProvider.java
index e39de0341..c999ad5f3 100644
--- a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/labeling/ConfigLabelProvider.java
+++ b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/labeling/ConfigLabelProvider.java
@@ -31,6 +31,9 @@ import com.google.inject.Inject;
public class ConfigLabelProvider extends BaseLabelProvider {
@Inject
+ private ConfigUtil configUtil;
+
+ @Inject
public ConfigLabelProvider(AdapterFactoryLabelProvider delegate) {
super(delegate);
}
@@ -94,8 +97,8 @@ public class ConfigLabelProvider extends BaseLabelProvider {
String text(ActorInstanceConfig mdl) {
ActorContainerClass root = mdl.getSubSystem().getType();
RefPath path = mdl.getPath();
- ActorRef ref = ConfigUtil.getLastActorRef(root, path);
- return "Config of ActorInstance "+ConfigUtil.getPath(mdl)+" ("+ref.getType().getName()+")";
+ ActorRef ref = configUtil.getLastActorRef(root, path);
+ return "Config of ActorInstance "+configUtil.getPath(mdl)+" ("+ref.getType().getName()+")";
}
String text(AttrClassConfig mdl) {
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/util/ConfigUtil.java b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/util/ConfigUtil.java
index d8f62ca47..53d1ea549 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/util/ConfigUtil.java
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/util/ConfigUtil.java
@@ -40,9 +40,14 @@ import org.eclipse.etrice.core.room.SAP;
import org.eclipse.etrice.core.room.SubSystemClass;
import org.eclipse.etrice.core.room.util.RoomHelpers;
+import com.google.inject.Inject;
+
public class ConfigUtil {
- public static LiteralType getLiteralType(Attribute attr) {
+ @Inject
+ private RoomHelpers roomHelpers;
+
+ public LiteralType getLiteralType(Attribute attr) {
if (attr == null)
return null;
@@ -55,14 +60,14 @@ public class ConfigUtil {
return null;
}
- public static ActorClass resolve(ActorContainerClass root, RefPath path) {
+ public ActorClass resolve(ActorContainerClass root, RefPath path) {
if (path.getRefs().isEmpty())
return null;
ActorContainerClass result = root;
for (RefSegment ref : path.getRefs()) {
ActorRef match = null;
- for (ActorContainerRef actor : RoomHelpers.getRefs(result, true)) {
+ for (ActorContainerRef actor : roomHelpers.getRefs(result, true)) {
if (actor instanceof ActorRef
&& actor.getName().equals(ref.getRef())) {
match = (ActorRef) actor;
@@ -86,7 +91,7 @@ public class ConfigUtil {
return (ActorClass) result;
}
- public static ActorRef getLastActorRef(ActorContainerClass root,
+ public ActorRef getLastActorRef(ActorContainerClass root,
RefPath path) {
if (path.getRefs().isEmpty())
return null;
@@ -95,7 +100,7 @@ public class ConfigUtil {
ActorContainerClass result = root;
for (RefSegment ref : path.getRefs()) {
ActorRef match = null;
- for (ActorContainerRef actor : RoomHelpers.getRefs(result, true)) {
+ for (ActorContainerRef actor : roomHelpers.getRefs(result, true)) {
if (actor instanceof ActorRef
&& actor.getName().equals(ref.getRef())) {
match = (ActorRef) actor;
@@ -119,7 +124,7 @@ public class ConfigUtil {
* @param path
* @return the first invalid path segment else {@code null}
*/
- public static String checkPath(ActorContainerClass root, RefPath path) {
+ public String checkPath(ActorContainerClass root, RefPath path) {
if (path == null)
return null;
@@ -170,7 +175,7 @@ public class ConfigUtil {
return null;
}
- public static PortClass getPortClass(PortInstanceConfig config) {
+ public PortClass getPortClass(PortInstanceConfig config) {
InterfaceItem item = config.getItem();
PortClass portClass = null;
if (item instanceof Port) {
@@ -191,7 +196,7 @@ public class ConfigUtil {
return portClass;
}
- public static List<InterfaceItem> getConfigurableInterfaceItems(
+ public List<InterfaceItem> getConfigurableInterfaceItems(
ActorContainerClass acc, boolean includeInherited) {
ArrayList<InterfaceItem> result = new ArrayList<InterfaceItem>();
@@ -211,7 +216,7 @@ public class ConfigUtil {
return result;
}
- public static String getPath(ActorInstanceConfig config) {
+ public String getPath(ActorInstanceConfig config) {
String path = "/" + config.getRoot().getName() + "/"
+ config.getSubSystem().getName();
for (RefSegment s : config.getPath().getRefs())
@@ -220,12 +225,12 @@ public class ConfigUtil {
return path;
}
- public static String getPath(SubSystemConfig config) {
+ public String getPath(SubSystemConfig config) {
return "/" + config.getRoot().getName() + "/"
+ config.getSubSystem().getName();
}
- public static List<Attribute> filterConfigurableAttributes(
+ public List<Attribute> filterConfigurableAttributes(
List<Attribute> attributes) {
List<Attribute> result = new ArrayList<Attribute>();
for (Attribute a : attributes) {
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/scoping/ConfigScopeProvider.java b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/scoping/ConfigScopeProvider.java
index f0d27086e..b58f685a2 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/scoping/ConfigScopeProvider.java
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/scoping/ConfigScopeProvider.java
@@ -44,6 +44,8 @@ import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
import org.eclipse.xtext.scoping.impl.SimpleScope;
+import com.google.inject.Inject;
+
/**
* This class contains custom scoping description.
*
@@ -53,6 +55,12 @@ import org.eclipse.xtext.scoping.impl.SimpleScope;
*/
public class ConfigScopeProvider extends AbstractDeclarativeScopeProvider {
+ @Inject
+ private ConfigUtil configUtil;
+
+ @Inject
+ private RoomHelpers roomHelpers;
+
public IScope scope_SubSystemConfig_subSystem(SubSystemConfig ctx, EReference ref){
final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
@@ -82,9 +90,9 @@ public class ConfigScopeProvider extends AbstractDeclarativeScopeProvider {
.eContainer();
SubSystemClass subsystem = actorConfig.getSubSystem().getType();
if (subsystem != null) {
- ActorClass ac = ConfigUtil
+ ActorClass ac = configUtil
.resolve(subsystem, actorConfig.getPath());
- for (InterfaceItem item : ConfigUtil.getConfigurableInterfaceItems(
+ for (InterfaceItem item : configUtil.getConfigurableInterfaceItems(
ac, true))
scopes.add(EObjectDescription.create(item.getName(), item));
}
@@ -139,8 +147,8 @@ public class ConfigScopeProvider extends AbstractDeclarativeScopeProvider {
if (config.getAttribute().getType().getType() instanceof DataClass) {
DataClass dc = (DataClass) config.getAttribute().getType()
.getType();
- for (Attribute att : ConfigUtil
- .filterConfigurableAttributes(RoomHelpers
+ for (Attribute att : configUtil
+ .filterConfigurableAttributes(roomHelpers
.getAllAttributes(dc))) {
scopes.add(EObjectDescription.create(att.getName(), att));
}
@@ -151,8 +159,8 @@ public class ConfigScopeProvider extends AbstractDeclarativeScopeProvider {
List<IEObjectDescription> scopes) {
ActorClass actor = config.getActor();
if (actor != null) {
- for (Attribute att : ConfigUtil
- .filterConfigurableAttributes(RoomHelpers
+ for (Attribute att : configUtil
+ .filterConfigurableAttributes(roomHelpers
.getAllAttributes(actor))) {
scopes.add(EObjectDescription.create(att.getName(), att));
}
@@ -163,9 +171,9 @@ public class ConfigScopeProvider extends AbstractDeclarativeScopeProvider {
List<IEObjectDescription> scopes) {
SubSystemClass subsystem = config.getSubSystem().getType();
if (subsystem != null) {
- ActorClass actor = ConfigUtil.resolve(subsystem, config.getPath());
- for (Attribute att : ConfigUtil
- .filterConfigurableAttributes(RoomHelpers
+ ActorClass actor = configUtil.resolve(subsystem, config.getPath());
+ for (Attribute att : configUtil
+ .filterConfigurableAttributes(roomHelpers
.getAllAttributes(actor))) {
scopes.add(EObjectDescription.create(att.getName(), att));
}
@@ -183,16 +191,16 @@ public class ConfigScopeProvider extends AbstractDeclarativeScopeProvider {
portClass = protocolConfig.getProtocol().getConjugated();
if (portClass != null)
- for (Attribute att : ConfigUtil
+ for (Attribute att : configUtil
.filterConfigurableAttributes(portClass.getAttributes()))
scopes.add(EObjectDescription.create(att.getName(), att));
}
private void collectAttributes(PortInstanceConfig config,
List<IEObjectDescription> scopes) {
- PortClass portClass = ConfigUtil.getPortClass(config);
+ PortClass portClass = configUtil.getPortClass(config);
if (portClass != null)
- for (Attribute att : ConfigUtil
+ for (Attribute att : configUtil
.filterConfigurableAttributes(portClass.getAttributes()))
scopes.add(EObjectDescription.create(att.getName(), att));
}
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/validation/ConfigJavaValidator.java b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/validation/ConfigJavaValidator.java
index 4d1d7fe69..164edfa63 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/validation/ConfigJavaValidator.java
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/validation/ConfigJavaValidator.java
@@ -59,8 +59,13 @@ import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.SubSystemRef;
import org.eclipse.xtext.validation.Check;
+import com.google.inject.Inject;
+
public class ConfigJavaValidator extends AbstractConfigJavaValidator {
+ @Inject
+ private ConfigUtil configUtil;
+
@SuppressWarnings("unused")
private ConfigValueConverterService converter = new ConfigValueConverterService();
@@ -78,7 +83,7 @@ public class ConfigJavaValidator extends AbstractConfigJavaValidator {
// duplicate actor instance config check
Set<String> actorRefs = new HashSet<String>();
for (ActorInstanceConfig instanceConfig : model.getActorInstanceConfigs()) {
- String ref = ConfigUtil.getPath(instanceConfig);
+ String ref = configUtil.getPath(instanceConfig);
if (actorRefs.contains(ref))
error("duplicate actor instance config", model, ConfigPackage.Literals.CONFIG_MODEL__CONFIG_ELEMENTS,
model.getConfigElements().indexOf(instanceConfig));
@@ -110,12 +115,12 @@ public class ConfigJavaValidator extends AbstractConfigJavaValidator {
if (root != null && !root.eIsProxy()) {
RefPath path = config.getPath();
if (path != null) {
- String invalidSegment = ConfigUtil.checkPath(root, path);
+ String invalidSegment = configUtil.checkPath(root, path);
if (invalidSegment != null)
error("no match for segment '" + invalidSegment + "'",
ConfigPackage.Literals.ACTOR_INSTANCE_CONFIG__PATH);
else {
- ActorRef aRef = ConfigUtil.getLastActorRef(root, path);
+ ActorRef aRef = configUtil.getLastActorRef(root, path);
if (aRef == null)
error("invalid actor reference", ConfigPackage.Literals.ACTOR_INSTANCE_CONFIG__PATH);
}
@@ -513,7 +518,7 @@ public class ConfigJavaValidator extends AbstractConfigJavaValidator {
ProtocolClass protocol = (ProtocolClass) generalProtocol;
for (ProtocolClassConfig cf : model.getProtocolClassConfigs()) {
if (cf.getProtocol().equals(protocol)) {
- if (protocol.getRegular().equals(ConfigUtil.getPortClass(portInstanceConfig)))
+ if (protocol.getRegular().equals(configUtil.getPortClass(portInstanceConfig)))
portClassConfig = cf.getRegular();
else
portClassConfig = cf.getConjugated();
@@ -526,7 +531,7 @@ public class ConfigJavaValidator extends AbstractConfigJavaValidator {
}
else if (source.eContainer() instanceof ActorInstanceConfig) {
ActorInstanceConfig aiConfig = (ActorInstanceConfig) source.eContainer();
- ActorClass actor = ConfigUtil.getLastActorRef(aiConfig.getSubSystem().getType(), aiConfig.getPath())
+ ActorClass actor = configUtil.getLastActorRef(aiConfig.getSubSystem().getType(), aiConfig.getPath())
.getType();
// find ActorClassConfig
for (ActorClassConfig cf : model.getActorClassConfigs()) {
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/BindingUtil.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/BindingUtil.java
index 1960c6c11..50f86d304 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/BindingUtil.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/BindingUtil.java
@@ -44,6 +44,8 @@ import org.eclipse.etrice.core.room.util.RoomHelpers;
*/
public class BindingUtil {
+ private RoomHelpers roomHelpers = new RoomHelpers();
+
private static class BindingInfo {
private Binding binding;
private int multiplicity;
@@ -108,7 +110,7 @@ public class BindingUtil {
else {
assert(false): "unexpected sub type";
}
- bindings.addAll(RoomHelpers.getAllBindings(ac));
+ bindings.addAll(roomHelpers.getAllBindings(ac));
}
}
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/GeneratorModelBuilder.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/GeneratorModelBuilder.java
index fec92bd45..a3c1fcc38 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/GeneratorModelBuilder.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/GeneratorModelBuilder.java
@@ -93,6 +93,8 @@ public class GeneratorModelBuilder {
CREATE_OPTIONAL_INSTANCES
}
+ private RoomHelpers roomHelpers = new RoomHelpers();
+
HashSet<WorkItem> alreadyDone = new HashSet<WorkItem>();
/**
@@ -744,7 +746,7 @@ public class GeneratorModelBuilder {
((OptionalActorInstance)ai).setActorClass(ac);
// get a list of super classes, super first, sub-classes last
- List<ActorClass> classes = RoomHelpers.getClassHierarchy(ac);
+ List<ActorClass> classes = roomHelpers.getClassHierarchy(ac);
// create instances for super classes recursively (ports, actor refs and bindings)
// super classes first ensures that actor refs are present when bindings are created
@@ -791,7 +793,7 @@ public class GeneratorModelBuilder {
ai.setActorClass(ac);
ai.setArray(aref.getMultiplicity()<0);
- for (ActorClass acl : RoomHelpers.getClassHierarchy(ac)) {
+ for (ActorClass acl : roomHelpers.getClassHierarchy(ac)) {
createPortInstances(ai, acl);
}
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/Wiring.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/Wiring.java
index c7fbcdb75..555c592e6 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/Wiring.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/Wiring.java
@@ -48,6 +48,8 @@ import org.eclipse.etrice.core.room.util.RoomHelpers;
*/
public class Wiring {
+ private RoomHelpers roomHelpers = new RoomHelpers();
+
private static class EndPoint {
ActorContainerRef ref;
Port port;
@@ -88,11 +90,11 @@ public class Wiring {
int psize;
int pidx = 0;
- public EndPointCreator(BindingEndPoint ep) {
- this(ep.getActorRef(), ep.getPort());
+ public EndPointCreator(BindingEndPoint ep, RoomHelpers roomHelpers) {
+ this(ep.getActorRef(), ep.getPort(), roomHelpers);
}
- public EndPointCreator(ActorContainerRef ref, Port port) {
+ public EndPointCreator(ActorContainerRef ref, Port port, RoomHelpers roomHelpers) {
this.ref = ref;
this.port = port;
@@ -102,7 +104,7 @@ public class Wiring {
rsize = ar.getMultiplicity();
}
- ProtocolClass pc = RoomHelpers.getProtocol(port);
+ ProtocolClass pc = roomHelpers.getProtocol(port);
boolean implicitMany = pc==null || pc.getCommType() == CommunicationType.DATA_DRIVEN;
if (implicitMany)
psize = -1;
@@ -193,12 +195,12 @@ public class Wiring {
WiredActorClass wired = ETriceGenFactory.eINSTANCE.createWiredActorClass();
wired.setActorClass(ac);
- wireBindings(wired, RoomHelpers.getAllBindings(ac));
+ wireBindings(wired, roomHelpers.getAllBindings(ac));
wireServices(wired,
- RoomHelpers.getAllActorContainerRefs(ac),
- RoomHelpers.getAllLayerConnections(ac),
- RoomHelpers.getAllSAPs(ac),
- RoomHelpers.getAllServiceImplementations(ac));
+ roomHelpers.getAllActorContainerRefs(ac),
+ roomHelpers.getAllLayerConnections(ac),
+ roomHelpers.getAllSAPs(ac),
+ roomHelpers.getAllServiceImplementations(ac));
handled.put(ac, wired);
root.getWiredInstances().add(wired);
@@ -213,7 +215,7 @@ public class Wiring {
wired.setSubSystemClass(ssc);
wireBindings(wired, ssc.getBindings());
- wireServices(wired, RoomHelpers.getAllActorContainerRefs(ssc), ssc.getConnections(), null, null);
+ wireServices(wired, roomHelpers.getAllActorContainerRefs(ssc), ssc.getConnections(), null, null);
root.getWiredInstances().add(wired);
@@ -268,7 +270,7 @@ public class Wiring {
String key = getEndPointKey(ep);
EndPointCreator creator = epkey2creator.get(key);
if (creator==null) {
- creator = new EndPointCreator(ep);
+ creator = new EndPointCreator(ep, roomHelpers);
epkey2creator.put(key, creator);
}
return creator;
@@ -301,7 +303,7 @@ public class Wiring {
if (path2!=null) {
// we can wire and just have to assemble the paths
Wire wire = ETriceGenFactory.eINSTANCE.createWire();
- wire.setDataDriven(RoomHelpers.isDataDriven(ep1.port) && RoomHelpers.isDataDriven(ep2.port));
+ wire.setDataDriven(roomHelpers.isDataDriven(ep1.port) && roomHelpers.isDataDriven(ep2.port));
wire.getPath1().addAll(path1);
wire.getPath2().addAll(path2);
wired.getWires().add(wire);
@@ -319,7 +321,7 @@ public class Wiring {
ActorRef ar = (ActorRef) ep.getActorRef();
- if (ar.getRefType()==ReferenceType.FIXED && RoomHelpers.isRelay(ep.getPort())) {
+ if (ar.getRefType()==ReferenceType.FIXED && roomHelpers.isRelay(ep.getPort())) {
OpenBinding open = getOpenBinding(ep);
if (open!=null) {
ArrayList<String> path = new ArrayList<String>();
@@ -362,7 +364,7 @@ public class Wiring {
private void handleBindingToLocal(WiredStructureClass wired, EndPoint localEnd, EndPoint refEnd) {
List<String> refPath = getPath(refEnd);
if (refPath!=null) {
- if (RoomHelpers.isRelay(localEnd.getPort())) {
+ if (roomHelpers.isRelay(localEnd.getPort())) {
// create an OpenBinding for ourselves
OpenBinding myOpen = ETriceGenFactory.eINSTANCE.createOpenBinding();
myOpen.getPath().addAll(refPath);
@@ -372,7 +374,7 @@ public class Wiring {
else {
// we can create a wire
Wire wire = ETriceGenFactory.eINSTANCE.createWire();
- wire.setDataDriven(RoomHelpers.isDataDriven(localEnd.port) && RoomHelpers.isDataDriven(refEnd.port));
+ wire.setDataDriven(roomHelpers.isDataDriven(localEnd.port) && roomHelpers.isDataDriven(refEnd.port));
wire.getPath1().addAll(refPath);
wire.getPath2().add(localEnd.getPortName());
wired.getWires().add(wire);
@@ -433,7 +435,7 @@ public class Wiring {
if (req.getProtocol()==prv.getProtocol()) {
// can satisfy: do wire and remember as satisfied
Wire wire = ETriceGenFactory.eINSTANCE.createWire();
- wire.setDataDriven(RoomHelpers.isDataDriven(conn.getTo().getService()));
+ wire.setDataDriven(roomHelpers.isDataDriven(conn.getTo().getService()));
wire.getPath1().add(prvRef.getName());
wire.getPath1().addAll(prv.getPath());
wire.getPath2().add(reqRef.getName());
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java
index c121fbefc..c1cf2a2ea 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java
@@ -142,7 +142,7 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
private VarDecl commonData = null;
}
- private static class TransitionToChainBundleMap extends HashMap<Transition, TransitionChainBundle> {
+ private class TransitionToChainBundleMap extends HashMap<Transition, TransitionChainBundle> {
private static final long serialVersionUID = 1L;
void put(Transition t, TransitionChain tc) {
@@ -161,11 +161,11 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
public String toString() {
StringBuffer result = new StringBuffer();
for (java.util.Map.Entry<Transition, TransitionChainBundle> entry : entrySet()) {
- result.append("transition "+RoomNameProvider.getFullPath(entry.getKey())+":\n");
+ result.append("transition "+roomNameProvider.getFullPath(entry.getKey())+":\n");
TransitionChainBundle bundle = entry.getValue();
for (TransitionChain tc : bundle.chains) {
String data = tc.getData()!=null? " with data "+tc.getData().getRefType().getType().getName() : "";
- result.append(" chain starting at "+RoomNameProvider.getFullPath(tc.getTransition())+data+"\n");
+ result.append(" chain starting at "+roomNameProvider.getFullPath(tc.getTransition())+data+"\n");
}
String data = bundle.commonData!=null? bundle.commonData.getRefType().getType().getName() : "-";
result.append(" bundle data "+data+"\n");
@@ -208,6 +208,9 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
private LinkedList<TransitionChain> trchains = null;
private TransitionToChainBundleMap trans2chainBundle = null;
private HashMap<EObject, EObject> copy2orig = null;
+
+ private RoomHelpers roomHelpers = new RoomHelpers();
+ private RoomNameProvider roomNameProvider = new RoomNameProvider();
/**
* <!-- begin-user-doc -->
@@ -463,7 +466,7 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
for (Transition t : sg.getTransitions()) {
addIncomingTransition(getAdjustedTargetNode(t), t);
if (t instanceof NonInitialTransition) {
- addOutgoingTransition(RoomHelpers.getNode(((NonInitialTransition)t).getFrom()), t);
+ addOutgoingTransition(roomHelpers.getNode(((NonInitialTransition)t).getFrom()), t);
}
}
}
@@ -478,7 +481,7 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
if (!getActorClass().isAbstract()) {
int idx = sg.getTransitions().indexOf(t);
Transition orig = (Transition) copy2orig.get(t);
- String name = RoomNameProvider.getName(orig);
+ String name = roomNameProvider.getName(orig);
validator.error("transition '"+name+"' is not part of a transition chain (only allowed for abstract actor classes)", orig.eContainer(), RoomPackage.eINSTANCE.getStateGraph_Transitions(), idx);
}
}
@@ -555,32 +558,32 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
if (data==null) {
if (!getActorClass(tp).isAbstract())
- validationError(getActorClass().getName()+": TrPoint "+RoomNameProvider.getFullPath(tp)+" is not connected", origContainer, RoomPackage.eINSTANCE.getStateGraph_TrPoints(), idx);
+ validationError(getActorClass().getName()+": TrPoint "+roomNameProvider.getFullPath(tp)+" is not connected", origContainer, RoomPackage.eINSTANCE.getStateGraph_TrPoints(), idx);
}
else {
if ((tp instanceof EntryPoint)||(tp instanceof ExitPoint)) {
// non-abstract classes must have incoming transitions for entry and exit points
if (!getActorClass().isAbstract() && data.getInTrans().isEmpty())
- validationError(getActorClass().getName()+": TrPoint "+RoomNameProvider.getFullPath(tp)+" has no incoming transition!", origContainer, RoomPackage.eINSTANCE.getStateGraph_TrPoints(), idx);
+ validationError(getActorClass().getName()+": TrPoint "+roomNameProvider.getFullPath(tp)+" has no incoming transition!", origContainer, RoomPackage.eINSTANCE.getStateGraph_TrPoints(), idx);
if (getActorClass(tp).isAbstract()) {
// transition points inherited from abstract base classes
// (of from abstract classes themselves) must not have more than one outgoing transition
if (data.getOutTrans().size()>1)
- validationError(getActorClass().getName()+": TrPoint "+RoomNameProvider.getFullPath(tp)+" must have at most one outgoing transition!", origContainer, RoomPackage.eINSTANCE.getStateGraph_TrPoints(), idx);
+ validationError(getActorClass().getName()+": TrPoint "+roomNameProvider.getFullPath(tp)+" must have at most one outgoing transition!", origContainer, RoomPackage.eINSTANCE.getStateGraph_TrPoints(), idx);
}
else {
// non-abstract or non-inherited transition points must have one outgoing transition
if (data.getOutTrans().size()!=1)
- validationError(getActorClass().getName()+": TrPoint "+RoomNameProvider.getFullPath(tp)+" must have exactly one outgoing transition!", origContainer, RoomPackage.eINSTANCE.getStateGraph_TrPoints(), idx);
+ validationError(getActorClass().getName()+": TrPoint "+roomNameProvider.getFullPath(tp)+" must have exactly one outgoing transition!", origContainer, RoomPackage.eINSTANCE.getStateGraph_TrPoints(), idx);
}
if (!data.getLoopTransitions().isEmpty())
- validationError(getActorClass().getName()+": TrPoint "+RoomNameProvider.getFullPath(tp)+" must have no self transitions!", origContainer, RoomPackage.eINSTANCE.getStateGraph_TrPoints(), idx);
+ validationError(getActorClass().getName()+": TrPoint "+roomNameProvider.getFullPath(tp)+" must have no self transitions!", origContainer, RoomPackage.eINSTANCE.getStateGraph_TrPoints(), idx);
}
else if (tp instanceof TransitionPoint) {
if (data.getOutTrans().size()<data.getLoopTransitions().size())
- validationError(getActorClass().getName()+": TrPoint "+RoomNameProvider.getFullPath(tp)+" must have no incoming transitions!", origContainer, RoomPackage.eINSTANCE.getStateGraph_TrPoints(), idx);
+ validationError(getActorClass().getName()+": TrPoint "+roomNameProvider.getFullPath(tp)+" must have no incoming transitions!", origContainer, RoomPackage.eINSTANCE.getStateGraph_TrPoints(), idx);
}
}
}
@@ -641,7 +644,7 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
for (TriggeredTransition t2 : at.getTransitions()) {
for (Trigger trig2 : t2.getTriggers()) {
if (isMatching(trig2, tr)) {
- if (!RoomHelpers.isGuarded(trig2)) {
+ if (!roomHelpers.isGuarded(trig2)) {
unguarded = t2;
if (!sameLevelTransitions.contains(t2))
accepted = false;
@@ -652,7 +655,7 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
if (accepted) {
if (unguarded!=null) {
// there already is an unguarded transition: require a quard
- if (!RoomHelpers.isGuarded(trig)) {
+ if (!roomHelpers.isGuarded(trig)) {
validationError("Transitions with same trigger on same level have to be guarded!", t, RoomPackage.eINSTANCE.getTriggeredTransition_Triggers());
}
else {
@@ -712,10 +715,10 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
// improve performance using maps name2ifitem and name2msgs
HashMap<String, InterfaceItem> name2ifitem = new HashMap<String, InterfaceItem>();
HashMap<String, List<Message>> name2msgs = new HashMap<String, List<Message>>();
- List<InterfaceItem> items = RoomHelpers.getAllInterfaceItems(getActorClass());
+ List<InterfaceItem> items = roomHelpers.getAllInterfaceItems(getActorClass());
for (InterfaceItem item : items) {
name2ifitem.put(item.getName(), item);
- name2msgs.put(item.getName(),RoomHelpers.getMessageListDeep(item, false));
+ name2msgs.put(item.getName(),roomHelpers.getMessageListDeep(item, false));
}
// compute a set of all trigger strings
@@ -811,14 +814,14 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
private void collectChainTransitions(TransitionChain tc, Transition t) {
trans2chainBundle.put(t, tc);
- StateGraphNode node = RoomHelpers.getNode(t.getTo());
+ StateGraphNode node = roomHelpers.getNode(t.getTo());
// the chain ends if a state is reached
if (node instanceof State)
return;
// the chain ends if source and destination coincide
- if (tc.getTransition() instanceof NonInitialTransition && node==RoomHelpers.getNode(((NonInitialTransition)tc.getTransition()).getFrom()))
+ if (tc.getTransition() instanceof NonInitialTransition && node==roomHelpers.getNode(((NonInitialTransition)tc.getTransition()).getFrom()))
return;
for (Transition next : getOutgoingTransitions(node)) {
@@ -919,7 +922,7 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
else
types.add(null);
}
- RefableType rt = RoomHelpers.getLastCommonSuperType(types);
+ RefableType rt = roomHelpers.getLastCommonSuperType(types);
if (rt!=null) {
VarDecl vd = RoomFactory.eINSTANCE.createVarDecl();
vd.setName("data");
@@ -1210,7 +1213,7 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
@Override
public int compare(TransitionChain o1, TransitionChain o2) {
- return RoomNameProvider.getFullPath(o1.getTransition()).compareTo(RoomNameProvider.getFullPath(o2.getTransition()));
+ return roomNameProvider.getFullPath(o1.getTransition()).compareTo(roomNameProvider.getFullPath(o2.getTransition()));
}
});
@@ -1219,7 +1222,7 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
}
private StateGraphNode getAdjustedTargetNode(Transition t) {
- StateGraphNode node = RoomHelpers.getNode(t.getTo());
+ StateGraphNode node = roomHelpers.getNode(t.getTo());
if (node instanceof EntryPoint) {
NodeData data = node2data.get(node);
if (data==null || data.getOutTrans().isEmpty()) {
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedRefinedStateImpl.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedRefinedStateImpl.java
index 2c348ce93..5baa86aa3 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedRefinedStateImpl.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedRefinedStateImpl.java
@@ -47,6 +47,9 @@ import org.eclipse.etrice.core.room.util.RoomHelpers;
* @generated
*/
public class ExpandedRefinedStateImpl extends SimpleStateImpl implements ExpandedRefinedState {
+
+ private RoomHelpers roomHelpers = new RoomHelpers();
+
/**
* The cached value of the '{@link #getInheritedEntry() <em>Inherited Entry</em>}' containment reference.
* <!-- begin-user-doc -->
@@ -242,15 +245,15 @@ public class ExpandedRefinedStateImpl extends SimpleStateImpl implements Expande
setSubgraph(rs.getSubgraph());
// now we collect the inherited detail code
- setInheritedEntry(RoomHelpers.getInheritedEntryCode(rs));
- setInheritedExit(RoomHelpers.getInheritedExitCode(rs));
- setInheritedDo(RoomHelpers.getInheritedDoCode(rs));
+ setInheritedEntry(roomHelpers.getInheritedEntryCode(rs));
+ setInheritedExit(roomHelpers.getInheritedExitCode(rs));
+ setInheritedDo(roomHelpers.getInheritedDoCode(rs));
// remove refined state from its container
((StateGraph)rs.eContainer()).getStates().remove(rs);
// put new state in place of SimpleState which is the ultimate target of the refined state
- State bs = RoomHelpers.getBaseState(rs);
+ State bs = roomHelpers.getBaseState(rs);
StateGraph parent = (StateGraph) bs.eContainer();
parent.getStates().add(this);
parent.getStates().remove(bs);
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/TransitionChainImpl.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/TransitionChainImpl.java
index d00cb73be..b8b48090a 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/TransitionChainImpl.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/TransitionChainImpl.java
@@ -55,6 +55,10 @@ import org.eclipse.etrice.core.room.util.RoomHelpers;
* @generated
*/
public class TransitionChainImpl extends EObjectImpl implements TransitionChain {
+
+ private RoomHelpers roomHelpers = new RoomHelpers();
+ private RoomNameProvider roomNameProvider = new RoomNameProvider();
+
/**
* The cached value of the '{@link #getTransition() <em>Transition</em>}' reference.
* <!-- begin-user-doc -->
@@ -223,11 +227,11 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
result.append(tcv.genActionOperationCall(tr));
- StateGraphNode node = RoomHelpers.getNode(tr.getTo());
+ StateGraphNode node = roomHelpers.getNode(tr.getTo());
EList<Transition> out = ac.getOutgoingTransitions(node);
if (node instanceof ChoicePoint) {
ContinuationTransition dflt = ac.getDefaultBranch(out);
- assert(dflt!=null): "ChoicePoint "+RoomNameProvider.getFullPath(node)+" has no default branch!";
+ assert(dflt!=null): "ChoicePoint "+roomNameProvider.getFullPath(node)+" has no default branch!";
// generate if/else
boolean isFirst = true;
@@ -236,7 +240,7 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
continue;
assert(cond instanceof CPBranchTransition): "The non default ChoicePoint branch "
- +RoomNameProvider.getFullPath(cond)+" must be of type CPBranchTransition!";
+ +roomNameProvider.getFullPath(cond)+" must be of type CPBranchTransition!";
result.append(tcv.genElseIfBranch((CPBranchTransition)cond, isFirst));
isFirst = false;
@@ -259,7 +263,7 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
return;
}
else {
- assert(out.size()<=1): "TrPoint "+RoomNameProvider.getFullPath(node)
+ assert(out.size()<=1): "TrPoint "+roomNameProvider.getFullPath(node)
+" is expected to have at most one outgoing transition!";
if (out.size()==1) {
State state = (node.eContainer().eContainer() instanceof State)? (State)node.eContainer().eContainer():null;
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/util/ETriceGenUtil.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/util/ETriceGenUtil.java
index 8a6ae6870..b0a164d10 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/util/ETriceGenUtil.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/util/ETriceGenUtil.java
@@ -23,6 +23,8 @@ import org.eclipse.etrice.core.room.util.RoomHelpers;
*
*/
public class ETriceGenUtil {
+
+ private RoomHelpers roomHelpers = new RoomHelpers();
/**
* @param trig the trigger
@@ -31,7 +33,7 @@ public class ETriceGenUtil {
*
* @see org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass#isMatching(Trigger, String)
*/
- public static boolean isMatching(Trigger trig, String trigstr) {
+ public boolean isMatching(Trigger trig, String trigstr) {
return ETriceGenFactory.eINSTANCE.createExpandedActorClass().isMatching(trig, trigstr);
}
@@ -39,11 +41,11 @@ public class ETriceGenUtil {
* @param at an {@link ActiveTrigger}
* @return <code>true</code> if the active trigger has defined a guard
*/
- public static boolean hasGuard(ActiveTrigger at) {
+ public boolean hasGuard(ActiveTrigger at) {
for (TriggeredTransition t : at.getTransitions()) {
for (Trigger trig : t.getTriggers()) {
if (isMatching(trig, at.getTrigger())
- && RoomHelpers.hasGuard(trig))
+ && roomHelpers.hasGuard(trig))
return true;
}
}
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/util/RoomCrossReferencer.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/util/RoomCrossReferencer.java
index 832d144ab..b39464458 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/util/RoomCrossReferencer.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/util/RoomCrossReferencer.java
@@ -47,6 +47,8 @@ import org.eclipse.etrice.core.room.util.RoomHelpers;
*/
public class RoomCrossReferencer {
+ private RoomHelpers roomHelpers = new RoomHelpers();
+
public Set<RoomModel> getReferencedModels(RoomClass cls) {
HashSet<DataClass> dataClasses = new HashSet<DataClass>();
@@ -218,7 +220,7 @@ public class RoomCrossReferencer {
private void recursivelyAddReferencedClasses(ActorClass ac, HashSet<ActorClass> actorClasses) {
actorClasses.add(ac);
- for (ActorContainerRef ar : RoomHelpers.getAllActorContainerRefs(ac)) {
+ for (ActorContainerRef ar : roomHelpers.getAllActorContainerRefs(ac)) {
if (ar instanceof ActorRef) {
recursivelyAddReferencedClasses(((ActorRef)ar).getType(), actorClasses);
}
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/contentassist/RoomProposalProvider.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/contentassist/RoomProposalProvider.java
index ca257ae72..7f9d9a122 100644
--- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/contentassist/RoomProposalProvider.java
+++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/contentassist/RoomProposalProvider.java
@@ -38,6 +38,7 @@ import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
import com.google.common.base.Function;
+import com.google.inject.Inject;
/**
* see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#contentAssist on how to customize content assistant
@@ -97,7 +98,7 @@ public class RoomProposalProvider extends AbstractRoomProposalProvider {
if (objectOrProxy instanceof ActorClass) {
ActorClass referenced = (ActorClass) objectOrProxy;
- return !ValidationUtil.isReferencing(referenced, ac);
+ return !roomHelpers.isReferencing(referenced, ac);
}
return false;
@@ -105,6 +106,9 @@ public class RoomProposalProvider extends AbstractRoomProposalProvider {
}
+ @Inject
+ private RoomHelpers roomHelpers;
+
protected Function<IEObjectDescription, ICompletionProposal> getProposalFactory(String ruleName, ContentAssistContext contentAssistContext) {
if (contentAssistContext!=null && contentAssistContext.getCurrentModel().eClass()==RoomPackage.eINSTANCE.getActorRef())
return new FilteredProposalCreator(new ActorRefFilter(), contentAssistContext, ruleName);
@@ -167,13 +171,13 @@ public class RoomProposalProvider extends AbstractRoomProposalProvider {
private List<ActorRef> collectInstances(ActorInstanceMapping aim) {
List<ActorRef> refs = new ArrayList<ActorRef>();
- ActorContainerClass root = RoomHelpers.getParentContainer(aim);
+ ActorContainerClass root = roomHelpers.getParentContainer(aim);
if (root != null) {
RefPath path = aim.getPath();
if (path != null && !path.getRefs().isEmpty())
- root = RoomHelpers.getActorContainerClass(aim);
+ root = roomHelpers.getActorContainerClass(aim);
if (root != null) {
- for (ActorContainerRef ref : RoomHelpers.getRefs(root, true)) {
+ for (ActorContainerRef ref : roomHelpers.getRefs(root, true)) {
if (ref instanceof ActorRef) {
ActorRef aRef = (ActorRef) ref;
if (aRef.getMultiplicity() == 1)
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java
index cef55c087..50fe5d33f 100644
--- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java
+++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java
@@ -64,6 +64,12 @@ import com.google.inject.Inject;
public class RoomLabelProvider extends BaseLabelProvider {
@Inject
+ private RoomHelpers roomHelpers;
+
+ @Inject
+ private RoomNameProvider roomNameProvider;
+
+ @Inject
public RoomLabelProvider(AdapterFactoryLabelProvider delegate) {
super(delegate);
}
@@ -162,7 +168,7 @@ public class RoomLabelProvider extends BaseLabelProvider {
}
String image(Port p) {
- boolean relay = RoomHelpers.isRelay(p);
+ boolean relay = roomHelpers.isRelay(p);
if (relay)
if (p.isConjugated())
if (p.isReplicated())
@@ -249,9 +255,9 @@ public class RoomLabelProvider extends BaseLabelProvider {
String text(Port p) {
String location = null;
- if (RoomHelpers.isInternal(p))
+ if (roomHelpers.isInternal(p))
location = "internal";
- else if (RoomHelpers.isExternal(p)) {
+ else if (roomHelpers.isExternal(p)) {
location = "external";
}
else
@@ -263,7 +269,7 @@ public class RoomLabelProvider extends BaseLabelProvider {
}
String text(Binding bind) {
- return RoomNameProvider.getDisplayName(bind);
+ return roomNameProvider.getDisplayName(bind);
}
String text(ExternalPort ep) {
@@ -312,8 +318,8 @@ public class RoomLabelProvider extends BaseLabelProvider {
StyledString text(Operation op) {
/* TODO TS: create complete signature including return type and ref */
- String signature = RoomHelpers.getSignature(op);
- String special = RoomHelpers.isConstructor(op)? "ctor " : RoomHelpers.isDestructor(op)? "dtor " : "";
+ String signature = roomNameProvider.getSignature(op);
+ String special = roomHelpers.isConstructor(op)? "ctor " : roomHelpers.isDestructor(op)? "dtor " : "";
if (op instanceof PortOperation && ((PortOperation) op).getSendsMsg()!=null) {
}
String destr = (op instanceof StandardOperation && ((StandardOperation)op).isDestructor())? "~":"";
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/linking/RoomHyperlinkHelper.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/linking/RoomHyperlinkHelper.java
index 555179b9b..299dbcc25 100644
--- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/linking/RoomHyperlinkHelper.java
+++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/linking/RoomHyperlinkHelper.java
@@ -28,12 +28,17 @@ import org.eclipse.xtext.parser.IParseResult;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.ui.editor.hyperlinking.IHyperlinkAcceptor;
+import com.google.inject.Inject;
+
/**
* @author Henrik Rentz-Reichert
*
*/
public class RoomHyperlinkHelper extends ImportAwareHyperlinkHelper {
+ @Inject
+ private RoomHelpers roomHelpers = new RoomHelpers();
+
@Override
public void createHyperlinksByOffset(XtextResource resource, int offset, IHyperlinkAcceptor acceptor) {
IParseResult parseResult = resource.getParseResult();
@@ -64,7 +69,7 @@ public class RoomHyperlinkHelper extends ImportAwareHyperlinkHelper {
}
private EObject getCrossLinkedEObject(ActorInstanceMapping aim) {
- ActorContainerClass lastAcContainer = RoomHelpers.getParentContainer(aim);
+ ActorContainerClass lastAcContainer = roomHelpers.getParentContainer(aim);
ActorRef lastRef = null;
for (RefSegment ref : aim.getPath().getRefs()) {
for (ActorRef r : lastAcContainer.getActorRefs())
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/naming/RoomNameProvider.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/naming/RoomNameProvider.java
index 6fd268f44..624361f32 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/naming/RoomNameProvider.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/naming/RoomNameProvider.java
@@ -13,12 +13,8 @@
package org.eclipse.etrice.core.naming;
-import java.util.HashSet;
-import java.util.Set;
-
import org.eclipse.emf.ecore.EObject;
import org.eclipse.etrice.core.room.ActorClass;
-import org.eclipse.etrice.core.room.ActorContainerClass;
import org.eclipse.etrice.core.room.ActorContainerRef;
import org.eclipse.etrice.core.room.ActorRef;
import org.eclipse.etrice.core.room.Binding;
@@ -30,22 +26,18 @@ import org.eclipse.etrice.core.room.ContinuationTransition;
import org.eclipse.etrice.core.room.DetailCode;
import org.eclipse.etrice.core.room.GuardedTransition;
import org.eclipse.etrice.core.room.InitialTransition;
-import org.eclipse.etrice.core.room.InterfaceItem;
-import org.eclipse.etrice.core.room.LogicalSystem;
import org.eclipse.etrice.core.room.MessageFromIf;
import org.eclipse.etrice.core.room.NonInitialTransition;
import org.eclipse.etrice.core.room.Operation;
-import org.eclipse.etrice.core.room.Port;
+import org.eclipse.etrice.core.room.PortOperation;
import org.eclipse.etrice.core.room.RefinedState;
import org.eclipse.etrice.core.room.RoomClass;
import org.eclipse.etrice.core.room.RoomModel;
-import org.eclipse.etrice.core.room.SAP;
-import org.eclipse.etrice.core.room.SPP;
import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.StateGraph;
import org.eclipse.etrice.core.room.StateGraphItem;
+import org.eclipse.etrice.core.room.StateGraphNode;
import org.eclipse.etrice.core.room.StateTerminal;
-import org.eclipse.etrice.core.room.StructureClass;
import org.eclipse.etrice.core.room.SubStateTrPointTerminal;
import org.eclipse.etrice.core.room.SubSystemClass;
import org.eclipse.etrice.core.room.SubSystemRef;
@@ -55,9 +47,11 @@ import org.eclipse.etrice.core.room.Transition;
import org.eclipse.etrice.core.room.TransitionTerminal;
import org.eclipse.etrice.core.room.Trigger;
import org.eclipse.etrice.core.room.TriggeredTransition;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
+import org.eclipse.etrice.core.room.VarDecl;
import org.eclipse.etrice.core.room.util.RoomSwitch;
+import com.google.common.base.Function;
+
/**
* A class providing names for instances of central types of the ROOM model.
@@ -75,11 +69,11 @@ public class RoomNameProvider {
*/
public static final String PATH_SEP = "_";
- private static RoomSwitch<String> nameProvider = new RoomSwitch<String>() {
- public String caseState(State object) { return RoomNameProvider.getStateName(object); }
+ private RoomSwitch<String> nameProvider = new RoomSwitch<String>() {
+ public String caseState(State object) { return getStateName(object); }
public String caseChoicePoint(ChoicePoint object) { return object.getName(); }
public String caseTrPoint(TrPoint object) { return object.getName(); }
- public String caseTransition(Transition object) { return RoomNameProvider.getTransitionName(object); }
+ public String caseTransition(Transition object) { return getTransitionName(object); }
public String caseActorRef(org.eclipse.etrice.core.room.ActorRef object) { return "ActorRef '"+object.getName()+"'"; }
public String casePort(org.eclipse.etrice.core.room.Port object) { return "Port '"+object.getName()+"'"; }
public String caseSAP(org.eclipse.etrice.core.room.SAP object) { return "SAP '"+object.getName()+"'"; }
@@ -108,7 +102,7 @@ public class RoomNameProvider {
* @param item an {@link EObject}
* @return a human readable name of the item
*/
- public static String getName(EObject item) {
+ public String getName(EObject item) {
String name = nameProvider.doSwitch(item);
if (name==null)
name = item.toString();
@@ -119,7 +113,7 @@ public class RoomNameProvider {
* @param item a {@link StateGraphItem}
* @return the path in the state machine of this item
*/
- public static String getFullPath(StateGraphItem item) {
+ public String getFullPath(StateGraphItem item) {
return getParentPath(item)+getName(item);
}
@@ -128,7 +122,7 @@ public class RoomNameProvider {
* @return a path to the containing state (using {@link #getFullPath(StateGraphItem)}
* or the {@link #TOP_STATE_NAME}
*/
- public static String getFullPath(StateGraph sg) {
+ public String getFullPath(StateGraph sg) {
if (sg.eContainer() instanceof State)
return getFullPath((State)sg.eContainer());
else
@@ -139,7 +133,7 @@ public class RoomNameProvider {
* @param obj an {@link EObject}
* @return the {@link RoomClass} containing this object or null
*/
- public static RoomClass getModelClass(EObject obj) {
+ public RoomClass getModelClass(EObject obj) {
while (obj!=null) {
if (obj instanceof RoomClass) {
return (RoomClass) obj;
@@ -153,7 +147,7 @@ public class RoomNameProvider {
* @param cls a {@link RoomClass}
* @return a human readable name for the ROOM class including its name space (model name)
*/
- public static String getClassLocation(RoomClass cls) {
+ public String getClassLocation(RoomClass cls) {
if (cls==null)
return null;
@@ -167,21 +161,21 @@ public class RoomNameProvider {
* @param source an {@link EObject}
* @return a human readable location that allows to identify the object in the model
*/
- public static String getLocation(EObject source) {
+ public String getLocation(EObject source) {
String location = null;
String clsLocation = getClassLocation(getModelClass(source));
while (source!=null) {
if (source instanceof StateGraph) {
- location = RoomNameProvider.getFullPath((StateGraph)source);
+ location = getFullPath((StateGraph)source);
break;
}
else if (source instanceof StateGraphItem) {
- location = RoomNameProvider.getFullPath((StateGraphItem)source);
+ location = getFullPath((StateGraphItem)source);
break;
}
else {
- location = RoomNameProvider.getName(source);
+ location = getName(source);
if (location!=null)
break;
}
@@ -202,7 +196,7 @@ public class RoomNameProvider {
* @return a unique identifier for the transition composed of the transition name, the terminal names
* and the trigger (if applicable)
*/
- public static String getTransitionName(Transition t) {
+ public String getTransitionName(Transition t) {
String toName = getTerminalName(t.getTo());
if (t instanceof InitialTransition) {
return "TRANS_INITIAL_TO__"+toName;
@@ -239,7 +233,7 @@ public class RoomNameProvider {
* @param item
* @return
*/
- private static boolean isTopLevel(StateGraphItem item) {
+ private boolean isTopLevel(StateGraphItem item) {
return item==null? true : !(item.eContainer().eContainer() instanceof State);
}
@@ -251,7 +245,7 @@ public class RoomNameProvider {
* @param item
* @return
*/
- private static State getParentState(StateGraphItem item) {
+ private State getParentState(StateGraphItem item) {
if (isTopLevel(item))
return null;
else
@@ -262,7 +256,7 @@ public class RoomNameProvider {
* @param s a {@link State}
* @return the name of the state of {@link #TOP_STATE_NAME} if s is <code>null</code>
*/
- public static String getStateName(State s) {
+ public String getStateName(State s) {
if (s==null) {
return TOP_STATE_NAME;
}
@@ -275,7 +269,7 @@ public class RoomNameProvider {
* @param s a {@link State}
* @return the full path of the state
*/
- public static String getStatePathName(State s) {
+ public String getStatePathName(State s) {
return getParentPath(s)+getStateName(s);
}
@@ -283,7 +277,7 @@ public class RoomNameProvider {
* @param item a {@link StateGraphItem}
* @return the path of the parent of this item (for refined states the parent path of the target state)
*/
- private static String getParentPath(StateGraphItem item) {
+ private String getParentPath(StateGraphItem item) {
if (item instanceof RefinedState)
item = ((RefinedState)item).getTarget();
@@ -298,7 +292,7 @@ public class RoomNameProvider {
* @param tr a {@link TriggeredTransition}
* @return a unique name for the transition triggers
*/
- private static String getTriggerName(TriggeredTransition tr) {
+ private String getTriggerName(TriggeredTransition tr) {
String result = "";
for (Trigger tri : tr.getTriggers()) {
for (MessageFromIf mif : tri.getMsgFromIfPairs()) {
@@ -312,7 +306,7 @@ public class RoomNameProvider {
* @param tt a {@link TransitionTerminal}
* @return a name for the terminal
*/
- private static String getTerminalName(TransitionTerminal tt) {
+ private String getTerminalName(TransitionTerminal tt) {
if (tt instanceof StateTerminal) {
return getStateName(((StateTerminal) tt).getState());
}
@@ -331,98 +325,10 @@ public class RoomNameProvider {
}
/**
- * @param sg a {@link StateGraph} serving as name space
- * @return a unique name for a new {@link Transition} (has to be unique among
- * all {@link StateGraphItem}s of the state graph)
- */
- public static String getUniqueTransitionName(StateGraph sg) {
- Set<String> names = RoomHelpers.getAllNames(sg);
-
- for (int i = 0; i < 1000; i++) {
- String name = "tr"+i;
- if (!names.contains(name))
- return name;
- }
-
- return "not_unique";
- }
-
- /**
- * @param sg a {@link StateGraph} serving as name space
- * @return a unique name for a new {@link InitialTransition} (has to be unique among
- * all {@link StateGraphItem}s of the state graph)
- */
- public static String getUniqueInitialTransitionName(StateGraph sg) {
- Set<String> names = RoomHelpers.getAllNames(sg);
-
- if (!names.contains("init"))
- return "init";
-
- for (int i = 0; i < 1000; i++) {
- String name = "init"+i;
- if (!names.contains(name))
- return name;
- }
-
- return "not_unique";
- }
-
- /**
- * @param sg a {@link StateGraph} serving as name space
- * @return a unique name for a new {@link ChoicePoint} (has to be unique among
- * all {@link StateGraphItem}s of the state graph)
- */
- public static String getUniqueChoicePointName(StateGraph sg) {
- Set<String> names = RoomHelpers.getAllNames(sg);
-
- for (int i = 0; i < 1000; i++) {
- String name = "cp"+i;
- if (!names.contains(name))
- return name;
- }
-
- return "not_unique";
- }
-
- /**
- * @param sg a {@link StateGraph} serving as name space
- * @return a unique name for a new {@link TrPoint} (has to be unique among
- * all {@link StateGraphItem}s of the state graph)
- */
- public static String getUniqueTrPointName(StateGraph sg) {
- Set<String> names = RoomHelpers.getAllNames(sg);
-
- for (int i = 0; i < 1000; i++) {
- String name = "tp"+i;
- if (!names.contains(name))
- return name;
- }
-
- return "not_unique";
- }
-
- /**
- * @param sg a {@link StateGraph} serving as name space
- * @return a unique name for a new {@link State} (has to be unique among
- * all {@link StateGraphItem}s of the state graph)
- */
- public static String getUniqueStateName(StateGraph sg) {
- Set<String> names = RoomHelpers.getAllNames(sg);
-
- for (int i = 0; i < 1000; i++) {
- String name = "state"+i;
- if (!names.contains(name))
- return name;
- }
-
- return "not_unique";
- }
-
- /**
* @param acr a {@link ActorContainerRef}
* @return a human readable label name for the reference
*/
- public static String getRefLabelName(ActorContainerRef acr) {
+ public String getRefLabelName(ActorContainerRef acr) {
String className = "<unknown>";
if (acr instanceof ActorRef) {
if (((ActorRef)acr).getType()!=null)
@@ -439,7 +345,7 @@ public class RoomNameProvider {
* @param t a {@link Transition}
* @return a human readable label name for the transition
*/
- public static String getTransitionLabelName(Transition t) {
+ public String getTransitionLabelName(Transition t) {
String name = null;
if (t instanceof InitialTransition) {
return "init";
@@ -486,7 +392,7 @@ public class RoomNameProvider {
* @param trig a {@link Trigger}
* @return a human readable label name for the trigger
*/
- public static String getTriggerLabel(Trigger trig) {
+ public String getTriggerLabel(Trigger trig) {
String name = "<";
boolean first = true;
for (MessageFromIf mif : trig.getMsgFromIfPairs()) {
@@ -506,7 +412,7 @@ public class RoomNameProvider {
* @param mif a {@link MessageFromIf}
* @return a label for a message from interface pair
*/
- public static String getMsgFromIfLabel(MessageFromIf mif) {
+ public String getMsgFromIfLabel(MessageFromIf mif) {
return mif.getMessage().getName()+":"+mif.getFrom().getName();
}
@@ -514,7 +420,7 @@ public class RoomNameProvider {
* @param sg a {@link StateGraph}
* @return a human readable label for the state graph
*/
- public static String getStateGraphLabel(StateGraph sg) {
+ public String getStateGraphLabel(StateGraph sg) {
if (sg.eContainer() instanceof State) {
State s = (State) sg.eContainer();
return getStatePathLabel(s);
@@ -527,90 +433,79 @@ public class RoomNameProvider {
* @param s a {@link State}
* @return a / separated path label for the state
*/
- public static String getStatePathLabel(State s) {
+ public String getStatePathLabel(State s) {
if (s.eContainer().eContainer() instanceof State) {
return getStatePathLabel((State) s.eContainer().eContainer())+"/"+s.getName();
}
else
return "/"+s.getName();
}
-
+
/**
- * @param sc a {@link StructureClass}
- * @return a unique name for a new {@link ActorContainerRef}
+ * Returns an operation's signature as a string.
+ *
+ * @param op the operation
+ *
+ * @return the signature string
*/
- public static String getUniqueActorContainerRefName(StructureClass sc) {
- HashSet<String> names = new HashSet<String>();
- if (sc instanceof ActorContainerClass) {
- for (ActorRef ar : ((ActorContainerClass) sc).getActorRefs()) {
- names.add(ar.getName());
- }
- }
- else if (sc instanceof LogicalSystem) {
- for (SubSystemRef ar : ((LogicalSystem) sc).getSubSystems()) {
- names.add(ar.getName());
- }
- }
-
- for (int i = 0; i < 1000; i++) {
- String name = "ref"+i;
- if (!names.contains(name))
- return name;
+ public String getSignature(Operation op) {
+ String signature = "";
+ for (VarDecl arg : op.getArguments()) {
+ if (signature.isEmpty())
+ signature = arg.getName()+": "+arg.getRefType().getType().getName();
+ else
+ signature += ", "+arg.getName()+": "+arg.getRefType().getType().getName();
}
-
- return "not_unique";
+ String rt = op.getReturnType()!=null? ": "+op.getReturnType().getType().getName():"";
+ if (op instanceof PortOperation && ((PortOperation) op).getSendsMsg()!=null)
+ rt = " sends "+((PortOperation) op).getSendsMsg().getName();
+ signature = op.getName()+"("+signature+")"+rt;
+ return signature;
}
/**
- * @param prefix a prefix (e.g. to distinguish ports, SAPs, SPPs)
- * @param acc a {@link ActorContainerClass}
- * @return a unique name for a new {@link InterfaceItem} of the actor container class
+ * Returns an operation's argument list as a string.
+ *
+ * @param op the operation
+ *
+ * @return the argument list string
*/
- public static String getUniqueInterfaceItemName(String prefix, ActorContainerClass acc) {
- HashSet<String> names = new HashSet<String>();
- if (acc instanceof ActorClass) {
- ActorClass ac = (ActorClass) acc;
- do {
- for (Port p : ac.getInterfacePorts()) {
- names.add(p.getName());
- }
- for (Port p : ac.getInternalPorts()) {
- names.add(p.getName());
- }
- for (SAP sap : ac.getServiceAccessPoints()) {
- names.add(sap.getName());
- }
- for (SPP spp : ac.getServiceProvisionPoints()) {
- names.add(spp.getName());
- }
-
- ac = ac.getBase();
- }
- while (ac!=null);
- }
- else if (acc instanceof SubSystemClass) {
- for (Port p : ((SubSystemClass) acc).getRelayPorts()) {
- names.add(p.getName());
- }
- for (SPP spp : ((SubSystemClass) acc).getServiceProvisionPoints()) {
- names.add(spp.getName());
- }
+ public String getArguments(Operation op) {
+ String signature = "";
+ for (VarDecl arg : op.getArguments()) {
+ if (signature.isEmpty())
+ signature = arg.getName();
+ else
+ signature += ", "+arg.getName();
}
-
- for (int i = 0; i < 1000; i++) {
- String name = prefix+i;
- if (!names.contains(name))
- return name;
+ signature = "("+signature+")";
+ return signature;
+ }
+
+ /**
+ * Returns an operation's typed argument list as a string.
+ *
+ * @param op the operation
+ *
+ * @return the argument list string
+ */
+ public String getTypedArgumentList(Operation op) {
+ String signature = "";
+ for (VarDecl arg : op.getArguments()) {
+ if (signature.isEmpty())
+ signature = arg.getName()+": "+arg.getRefType().getType().getName();
+ else
+ signature += ", "+arg.getName()+": "+arg.getRefType().getType().getName();
}
-
- return "not_unique";
+ signature = "("+signature+")";
+ return signature;
}
/**
* @param code a {@link DetailCode}
* @return a human readable location of a detail code in the model
*/
- public static String getDetailCodeLocation(DetailCode code) {
+ public String getDetailCodeLocation(DetailCode code) {
if (code.eContainer() instanceof Transition) {
Transition tr = (Transition) code.eContainer();
String where = "?";
@@ -620,11 +515,11 @@ public class RoomNameProvider {
where = "condition";
else if (tr instanceof GuardedTransition && code==((GuardedTransition)tr).getGuard())
where = "guard";
- return "transition "+tr.getName()+": "+RoomNameProvider.getTransitionName(tr)+" "+where+" code";
+ return "transition "+tr.getName()+": "+getTransitionName(tr)+" "+where+" code";
}
else if (code.eContainer() instanceof Trigger) {
Transition tr = (Transition) code.eContainer().eContainer();
- return "transition "+tr.getName()+": "+RoomNameProvider.getTransitionName(tr)+" trigger guard";
+ return "transition "+tr.getName()+": "+getTransitionName(tr)+" trigger guard";
}
else if (code.eContainer() instanceof State) {
State state = (State) code.eContainer();
@@ -635,10 +530,10 @@ public class RoomNameProvider {
where = "exit";
else
where = "do";
- return "state "+RoomNameProvider.getStatePathName(state)+" "+where+" code";
+ return "state "+getStatePathName(state)+" "+where+" code";
}
else if (code.eContainer() instanceof Operation) {
- return "operation "+RoomHelpers.getSignature(((Operation)code.eContainer()));
+ return "operation "+getSignature(((Operation)code.eContainer()));
}
else {
assert(false): "unexpected detaild code location";
@@ -650,7 +545,7 @@ public class RoomNameProvider {
* @param ep a {@link BindingEndPoint}
* @return a human readable name for the end point
*/
- public static String getDisplayName(BindingEndPoint ep) {
+ public String getDisplayName(BindingEndPoint ep) {
if (ep.getSub()!=null)
return ep.getPort().getName()+" sub "+ep.getSub().getName();
else
@@ -661,7 +556,24 @@ public class RoomNameProvider {
* @param bind a {@link Binding}
* @return a human readable name for the binding
*/
- public static String getDisplayName(Binding bind) {
+ public String getDisplayName(Binding bind) {
return getDisplayName(bind.getEndpoint1())+" and "+getDisplayName(bind.getEndpoint2());
}
+
+ /**
+ * @return a {@link Function} that provides a name for a {@link RefinedState}
+ */
+ public Function<RefinedState, String> getRefinedStateNameProvider() {
+
+ return new Function<RefinedState, String>() {
+ /* (non-Javadoc)
+ * @see com.google.common.base.Function#apply(java.lang.Object)
+ */
+ @Override
+ public String apply(RefinedState rs) {
+ return getFullPath(rs);
+ }
+ };
+
+ }
}
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomHelpers.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomHelpers.java
index 2c76a75f9..0fc9bc93b 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomHelpers.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomHelpers.java
@@ -13,6 +13,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -79,8 +80,8 @@ import org.eclipse.etrice.core.room.TrPointTerminal;
import org.eclipse.etrice.core.room.Transition;
import org.eclipse.etrice.core.room.TransitionTerminal;
import org.eclipse.etrice.core.room.Trigger;
-import org.eclipse.etrice.core.room.VarDecl;
-import org.eclipse.etrice.core.validation.ValidationUtil;
+
+import com.google.common.base.Function;
/**
* This class provides a collection of convenience functions that extract implicit information
@@ -103,7 +104,7 @@ public class RoomHelpers extends BaseHelpers {
* @param ac the {@link ActorClass}
* @return a list of the class itself and its base classes in reverse order (super classes to sub classes)
*/
- public static List<ActorClass> getClassHierarchy(ActorClass ac) {
+ public List<ActorClass> getClassHierarchy(ActorClass ac) {
ArrayList<ActorClass> result = new ArrayList<ActorClass>();
while (ac!=null) {
@@ -124,7 +125,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a list of all (external) interface items
*/
- public static List<InterfaceItem> getInterfaceItems(StructureClass sc, boolean includeInherited) {
+ public List<InterfaceItem> getInterfaceItems(StructureClass sc, boolean includeInherited) {
ArrayList<InterfaceItem> result = new ArrayList<InterfaceItem>();
if (sc instanceof ActorClass) {
@@ -160,7 +161,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a list of all {@link ActorContainerRef}s of a structure class.
*/
- public static List<ActorContainerRef> getRefs(StructureClass sc, boolean includeInherited) {
+ public List<ActorContainerRef> getRefs(StructureClass sc, boolean includeInherited) {
ArrayList<ActorContainerRef> result = new ArrayList<ActorContainerRef>();
if (sc instanceof ActorClass) {
@@ -192,7 +193,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a list of all {@link Binding}s of a {@link StructureClass}.
*/
- public static List<Binding> getBindings(StructureClass sc, boolean includeInherited) {
+ public List<Binding> getBindings(StructureClass sc, boolean includeInherited) {
ArrayList<Binding> result = new ArrayList<Binding>();
if (sc instanceof ActorClass) {
@@ -225,7 +226,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a list of all {@link LayerConnection}s of a {@link StructureClass}.
*/
- public static List<LayerConnection> getConnections(StructureClass sc, boolean includeInherited) {
+ public List<LayerConnection> getConnections(StructureClass sc, boolean includeInherited) {
ArrayList<LayerConnection> result = new ArrayList<LayerConnection>();
if (sc instanceof ActorClass) {
@@ -257,7 +258,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the user code 1 of a {@link DataClass} including inherited case class code as String
*/
- public static String getDeepUserCode1(DataClass dc) {
+ public String getDeepUserCode1(DataClass dc) {
return getDeepUserCode(dc, RoomPackage.Literals.DATA_CLASS__USER_CODE1);
}
@@ -270,7 +271,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the user code 2 of a {@link DataClass} including inherited case class code as String
*/
- public static String getDeepUserCode2(DataClass dc) {
+ public String getDeepUserCode2(DataClass dc) {
return getDeepUserCode(dc, RoomPackage.Literals.DATA_CLASS__USER_CODE2);
}
@@ -283,7 +284,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the user code 3 of a {@link DataClass} including inherited case class code as String
*/
- public static String getDeepUserCode3(DataClass dc) {
+ public String getDeepUserCode3(DataClass dc) {
return getDeepUserCode(dc, RoomPackage.Literals.DATA_CLASS__USER_CODE3);
}
@@ -296,7 +297,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the user code 1 of a {@link ProtocolClass} including inherited case class code as String
*/
- public static String getDeepUserCode1(ProtocolClass pc) {
+ public String getDeepUserCode1(ProtocolClass pc) {
return getDeepUserCode(pc, RoomPackage.Literals.PROTOCOL_CLASS__USER_CODE1);
}
@@ -308,7 +309,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the user code 2 of a {@link ProtocolClass} including inherited case class code as String
*/
- public static String getDeepUserCode2(ProtocolClass pc) {
+ public String getDeepUserCode2(ProtocolClass pc) {
return getDeepUserCode(pc, RoomPackage.Literals.PROTOCOL_CLASS__USER_CODE2);
}
@@ -320,7 +321,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the user code 3 of a {@link ProtocolClass} including inherited case class code as String
*/
- public static String getDeepUserCode3(ProtocolClass pc) {
+ public String getDeepUserCode3(ProtocolClass pc) {
return getDeepUserCode(pc, RoomPackage.Literals.PROTOCOL_CLASS__USER_CODE3);
}
@@ -332,7 +333,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the user code 1 of a {@link ActorContainerClass} including inherited case class code as String
*/
- public static String getDeepUserCode1(ActorContainerClass ac) {
+ public String getDeepUserCode1(ActorContainerClass ac) {
return getDeepUserCode(ac, RoomPackage.Literals.ACTOR_CONTAINER_CLASS__USER_CODE1);
}
@@ -344,7 +345,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the user code 2 of a {@link ActorContainerClass} including inherited case class code as String
*/
- public static String getDeepUserCode2(ActorContainerClass ac) {
+ public String getDeepUserCode2(ActorContainerClass ac) {
return getDeepUserCode(ac, RoomPackage.Literals.ACTOR_CONTAINER_CLASS__USER_CODE2);
}
@@ -356,11 +357,11 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the user code 3 of a {@link ActorContainerClass} including inherited case class code as String
*/
- public static String getDeepUserCode3(ActorContainerClass ac) {
+ public String getDeepUserCode3(ActorContainerClass ac) {
return getDeepUserCode(ac, RoomPackage.Literals.ACTOR_CONTAINER_CLASS__USER_CODE3);
}
- private static String getDeepUserCode(EObject obj, EStructuralFeature code) {
+ private String getDeepUserCode(EObject obj, EStructuralFeature code) {
StringBuilder result = new StringBuilder();
while (obj!=null) {
@@ -395,7 +396,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return whether a {@link State} has sub structure
*/
- public static boolean hasSubStructure(State state, ActorClass ac) {
+ public boolean hasSubStructure(State state, ActorClass ac) {
if (hasDirectSubStructure(state))
return true;
@@ -443,7 +444,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return whether a {@link State} has direct sub structure
*/
- public static boolean hasDirectSubStructure(State s) {
+ public boolean hasDirectSubStructure(State s) {
return !isEmpty(s.getSubgraph());
}
@@ -454,11 +455,11 @@ public class RoomHelpers extends BaseHelpers {
*
* @return whether an {@link ActorClass} has a non-empty {@link StateGraph}
*/
- public static boolean hasNonEmptyStateMachine(ActorClass ac) {
+ public boolean hasNonEmptyStateMachine(ActorClass ac) {
return !isEmpty(ac.getStateMachine());
}
- public static boolean isEmpty(StateGraph sg) {
+ public boolean isEmpty(StateGraph sg) {
if (sg==null)
return true;
@@ -481,7 +482,7 @@ public class RoomHelpers extends BaseHelpers {
* @return <code>true</code> if the state resides in the top level (i.e.
* directly in the actor's state machine)
*/
- public static boolean isTopLevel(StateGraphNode s) {
+ public boolean isTopLevel(StateGraphNode s) {
return !(s.eContainer().eContainer() instanceof State);
}
@@ -489,7 +490,7 @@ public class RoomHelpers extends BaseHelpers {
* @param s a {@link State}
* @return <code>true</code> if the state has no sub-graph
*/
- public static boolean isLeaf(State s) {
+ public boolean isLeaf(State s) {
return s.getSubgraph()==null;
}
@@ -497,7 +498,7 @@ public class RoomHelpers extends BaseHelpers {
* @param state a {@link State}
* @return a list of all leaf states recursively
*/
- public static List<State> getLeafStateList(State state) {
+ public List<State> getLeafStateList(State state) {
return getLeafStateList(state.getSubgraph());
}
@@ -505,7 +506,7 @@ public class RoomHelpers extends BaseHelpers {
* @param sg a {@link StateGraph}
* @return a list of all leaf states recursively
*/
- public static List<State> getLeafStateList(StateGraph sg) {
+ public List<State> getLeafStateList(StateGraph sg) {
ArrayList<State> res = new ArrayList<State>();
if (sg!=null) {
@@ -524,7 +525,7 @@ public class RoomHelpers extends BaseHelpers {
* @param sg a {@link StateGraph}
* @return a list of all states recursively
*/
- public static List<State> getStateList(StateGraph sg) {
+ public List<State> getStateList(StateGraph sg) {
ArrayList<State> res = new ArrayList<State>();
if (sg!=null) {
@@ -543,7 +544,7 @@ public class RoomHelpers extends BaseHelpers {
* @param sg a {@link StateGraph}
* @return a list of all base states recursively
*/
- public static List<State> getBaseStateList(StateGraph sg) {
+ public List<State> getBaseStateList(StateGraph sg) {
ArrayList<State> res = new ArrayList<State>();
if (sg!=null) {
@@ -562,7 +563,7 @@ public class RoomHelpers extends BaseHelpers {
* @param ac an {@link ActorClass}
* @return all base states of the actor class
*/
- public static List<State> getAllBaseStates(ActorClass ac) {
+ public List<State> getAllBaseStates(ActorClass ac) {
return getBaseStateList(ac.getStateMachine());
}
@@ -571,7 +572,7 @@ public class RoomHelpers extends BaseHelpers {
* @return the parent state of s if there is such. If the state is on
* the top level then <code>null</code> is returned
*/
- public static State getParentState(StateGraphNode s) {
+ public State getParentState(StateGraphNode s) {
if (isTopLevel(s))
return null;
else
@@ -588,7 +589,7 @@ public class RoomHelpers extends BaseHelpers {
* @return the {@link RefinedState} in the derived state machine of the {@link ActorClass}
* which is (indirectly) targeting the state
*/
- public static State getTargettingState(State state, ActorClass ac) {
+ public State getTargettingState(State state, ActorClass ac) {
State targetting = state;
for (State s : getAllStatesRecursive(ac.getStateMachine())) {
State predecessor = s;
@@ -607,7 +608,7 @@ public class RoomHelpers extends BaseHelpers {
* @param dc the {@link DetailCode}
* @return <code>true</code> if the {@link DetailCode} is null or empty.
*/
- public static boolean hasDetailCode(DetailCode dc) {
+ public boolean hasDetailCode(DetailCode dc) {
if (dc==null)
return false;
@@ -623,7 +624,7 @@ public class RoomHelpers extends BaseHelpers {
* @param trig a {@link Trigger}
* @return <code>true</code> if a guard condition is defined for this trigger
*/
- public static boolean hasGuard(Trigger trig) {
+ public boolean hasGuard(Trigger trig) {
return trig.getGuard()!=null && hasDetailCode(trig.getGuard().getGuard());
}
@@ -635,7 +636,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return <code>true</code> if the entry code of a {@link State} is empty
*/
- public static boolean hasEntryCode(State s, boolean includeInherited) {
+ public boolean hasEntryCode(State s, boolean includeInherited) {
return hasDetailCode(s, includeInherited, RoomPackage.Literals.STATE__ENTRY_CODE);
}
@@ -647,7 +648,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return <code>true</code> if the exit code of a {@link State} is empty
*/
- public static boolean hasExitCode(State s, boolean includeInherited) {
+ public boolean hasExitCode(State s, boolean includeInherited) {
return hasDetailCode(s, includeInherited, RoomPackage.Literals.STATE__EXIT_CODE);
}
@@ -659,11 +660,11 @@ public class RoomHelpers extends BaseHelpers {
*
* @return <code>true</code> if the do code of a {@link State} is empty
*/
- public static boolean hasDoCode(State s, boolean includeInherited) {
+ public boolean hasDoCode(State s, boolean includeInherited) {
return hasDetailCode(s, includeInherited, RoomPackage.Literals.STATE__DO_CODE);
}
- private static boolean hasDetailCode(State s, boolean includeInherited, EReference feature) {
+ private boolean hasDetailCode(State s, boolean includeInherited, EReference feature) {
DetailCode dc = (DetailCode) s.eGet(feature);
if (hasDetailCode(dc))
return true;
@@ -681,7 +682,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the {@link DetailCode} as String with a newline character after each command.
*/
- public static String getDetailCode(DetailCode code) {
+ public String getDetailCode(DetailCode code) {
if (code==null || code.getLines().isEmpty())
return "";
@@ -700,7 +701,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a concatenation of inherited entry codes as {@link DetailCode}
*/
- public static DetailCode getInheritedEntryCode(RefinedState rs) {
+ public DetailCode getInheritedEntryCode(RefinedState rs) {
return getInheritedCode(rs, RoomPackage.Literals.STATE__ENTRY_CODE, true);
}
@@ -712,7 +713,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a concatenation of inherited exit codes as {@link DetailCode}
*/
- public static DetailCode getInheritedExitCode(RefinedState rs) {
+ public DetailCode getInheritedExitCode(RefinedState rs) {
return getInheritedCode(rs, RoomPackage.Literals.STATE__EXIT_CODE, false);
}
@@ -724,7 +725,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a concatenation of inherited do codes as {@link DetailCode}
*/
- public static DetailCode getInheritedDoCode(RefinedState rs) {
+ public DetailCode getInheritedDoCode(RefinedState rs) {
return getInheritedCode(rs, RoomPackage.Literals.STATE__DO_CODE, true);
}
@@ -733,7 +734,7 @@ public class RoomHelpers extends BaseHelpers {
* @param code
* @return
*/
- private static DetailCode getInheritedCode(RefinedState rs, EReference code, boolean addFront) {
+ private DetailCode getInheritedCode(RefinedState rs, EReference code, boolean addFront) {
DetailCode result = RoomFactory.eINSTANCE.createDetailCode();
State s = rs.getTarget();
while (s!=null) {
@@ -762,7 +763,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a refined state targeting state or state itself
*/
- public static State getRefinedStateFor(StateGraph sg, State state) {
+ public State getRefinedStateFor(StateGraph sg, State state) {
// first we look for RefinedStates in the current context
for (State s : sg.getStates()) {
if (s instanceof RefinedState && s.getName().equals(state.getName())) {
@@ -793,8 +794,8 @@ public class RoomHelpers extends BaseHelpers {
*
* @return whether a {@link Trigger} contains a guard
*/
- public static boolean isGuarded(Trigger trig) {
- return trig.getGuard()!=null && RoomHelpers.hasDetailCode(trig.getGuard().getGuard());
+ public boolean isGuarded(Trigger trig) {
+ return trig.getGuard()!=null && hasDetailCode(trig.getGuard().getGuard());
}
/**
@@ -804,7 +805,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the destination {@link StateGraphNode} of a {@link TransitionTerminal}
*/
- public static StateGraphNode getNode(TransitionTerminal tt) {
+ public StateGraphNode getNode(TransitionTerminal tt) {
if (tt instanceof StateTerminal)
return ((StateTerminal)tt).getState();
else if (tt instanceof TrPointTerminal)
@@ -824,7 +825,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return all {@link State}s of a {@link StateGraph} including parent state graphs recursively
*/
- public static List<State> getAllStates(StateGraph sg) {
+ public List<State> getAllStates(StateGraph sg) {
return getAllStateGraphItems(sg, RoomPackage.eINSTANCE.getStateGraph_States(), false);
}
@@ -836,7 +837,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return all {@link State}s of a {@link StateGraph} including parent state graphs recursively
*/
- public static List<State> getAllStatesRecursive(StateGraph sg) {
+ public List<State> getAllStatesRecursive(StateGraph sg) {
return getAllStateGraphItems(sg, RoomPackage.eINSTANCE.getStateGraph_States(), true);
}
@@ -847,7 +848,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return all {@link TrPoint}s of a {@link StateGraph} including parent state graphs recursively
*/
- public static List<TrPoint> getAllTrPoints(StateGraph sg) {
+ public List<TrPoint> getAllTrPoints(StateGraph sg) {
return getAllStateGraphItems(sg, RoomPackage.eINSTANCE.getStateGraph_TrPoints(), false);
}
@@ -859,7 +860,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return all {@link TrPoint}s of a {@link StateGraph} including parent state graphs recursively
*/
- public static List<TrPoint> getAllTrPointsRecursive(StateGraph sg) {
+ public List<TrPoint> getAllTrPointsRecursive(StateGraph sg) {
return getAllStateGraphItems(sg, RoomPackage.eINSTANCE.getStateGraph_TrPoints(), true);
}
@@ -870,7 +871,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return all {@link ChoicePoint}s of a {@link StateGraph} including parent state graphs recursively
*/
- public static List<ChoicePoint> getAllChoicePoints(StateGraph sg) {
+ public List<ChoicePoint> getAllChoicePoints(StateGraph sg) {
return getAllStateGraphItems(sg, RoomPackage.eINSTANCE.getStateGraph_ChPoints(), false);
}
@@ -881,7 +882,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return all {@link Transition}s of a {@link StateGraph} including parent state graphs recursively
*/
- public static List<Transition> getAllTransitions(StateGraph sg) {
+ public List<Transition> getAllTransitions(StateGraph sg) {
return getAllStateGraphItems(sg, RoomPackage.eINSTANCE.getStateGraph_Transitions(), false);
}
@@ -893,12 +894,12 @@ public class RoomHelpers extends BaseHelpers {
*
* @return all {@link Transition}s of a {@link StateGraph} including parent state graphs recursively
*/
- public static List<Transition> getAllTransitionsRecursive(StateGraph sg) {
+ public List<Transition> getAllTransitionsRecursive(StateGraph sg) {
return getAllStateGraphItems(sg, RoomPackage.eINSTANCE.getStateGraph_Transitions(), true);
}
@SuppressWarnings("unchecked")
- private static <T extends StateGraphItem> List<T> getAllStateGraphItems(StateGraph sg, EReference feature, boolean recurse) {
+ private <T extends StateGraphItem> List<T> getAllStateGraphItems(StateGraph sg, EReference feature, boolean recurse) {
ArrayList<T> result = new ArrayList<T>();
while (sg!=null) {
@@ -942,7 +943,7 @@ public class RoomHelpers extends BaseHelpers {
* @see org.eclipse.etrice.core.room.util.RoomHelpers#getAllNames(StateGraph, StateGraphItem)
* getAllNames(StateGraph, StateGraphItem)
*/
- public static Set<String> getAllNames(StateGraph sg) {
+ public Set<String> getAllNames(StateGraph sg) {
return getAllNames(sg, null);
}
@@ -956,7 +957,7 @@ public class RoomHelpers extends BaseHelpers {
* @return a complete list of all names used by the {@link StateGraphItem}s of a {@link StateGraph}
* including parent state graphs recursively
*/
- public static Set<String> getAllNames(StateGraph sg, StateGraphItem skip) {
+ public Set<String> getAllNames(StateGraph sg, StateGraphItem skip) {
HashSet<String> result = new HashSet<String>();
do {
for (State st : sg.getStates()) {
@@ -1004,7 +1005,7 @@ public class RoomHelpers extends BaseHelpers {
* @see org.eclipse.etrice.core.room.util.RoomHelpers#getAllStateNames(StateGraph, State)
* getAllStateNames(StateGraph, State)
*/
- public static Set<String> getAllStateNames(StateGraph sg) {
+ public Set<String> getAllStateNames(StateGraph sg) {
return getAllNames(sg, null, RoomPackage.eINSTANCE.getStateGraph_States());
}
@@ -1018,7 +1019,7 @@ public class RoomHelpers extends BaseHelpers {
* @return a complete list of all names used by the {@link State}s of a {@link StateGraph}
* including parent state graphs recursively
*/
- public static Set<String> getAllStateNames(StateGraph sg, State skip) {
+ public Set<String> getAllStateNames(StateGraph sg, State skip) {
return getAllNames(sg, skip, RoomPackage.eINSTANCE.getStateGraph_States());
}
@@ -1034,7 +1035,7 @@ public class RoomHelpers extends BaseHelpers {
* @see org.eclipse.etrice.core.room.util.RoomHelpers#getAllTrPointNames(StateGraph, TrPoint)
* getAllStateNames(StateGraph, TrPoint)
*/
- public static Set<String> getAllTrPointNames(StateGraph sg) {
+ public Set<String> getAllTrPointNames(StateGraph sg) {
return getAllNames(sg, null, RoomPackage.eINSTANCE.getStateGraph_TrPoints());
}
@@ -1048,7 +1049,7 @@ public class RoomHelpers extends BaseHelpers {
* @return a complete list of all names used by the {@link TrPoint}s of a {@link StateGraph}
* including parent state graphs recursively
*/
- public static Set<String> getAllTrPointNames(StateGraph sg, TrPoint skip) {
+ public Set<String> getAllTrPointNames(StateGraph sg, TrPoint skip) {
return getAllNames(sg, skip, RoomPackage.eINSTANCE.getStateGraph_TrPoints());
}
@@ -1064,7 +1065,7 @@ public class RoomHelpers extends BaseHelpers {
* @see org.eclipse.etrice.core.room.util.RoomHelpers#getAllChoicePointNames(StateGraph, ChoicePoint)
* getAllChoicePointNames(StateGraph, ChoicePoint)
*/
- public static Set<String> getAllChoicePointNames(StateGraph sg) {
+ public Set<String> getAllChoicePointNames(StateGraph sg) {
return getAllNames(sg, null, RoomPackage.eINSTANCE.getStateGraph_ChPoints());
}
@@ -1078,7 +1079,7 @@ public class RoomHelpers extends BaseHelpers {
* @return a complete list of all names used by the {@link ChoicePoint}s of a {@link StateGraph}
* including parent state graphs recursively
*/
- public static Set<String> getAllChoicePointNames(StateGraph sg, ChoicePoint skip) {
+ public Set<String> getAllChoicePointNames(StateGraph sg, ChoicePoint skip) {
return getAllNames(sg, skip, RoomPackage.eINSTANCE.getStateGraph_ChPoints());
}
@@ -1094,7 +1095,7 @@ public class RoomHelpers extends BaseHelpers {
* @see org.eclipse.etrice.core.room.util.RoomHelpers#getAllTransitionNames(StateGraph, Transition)
* getAllTransitionNames(StateGraph, Transition)
*/
- public static Set<String> getAllTransitionNames(StateGraph sg) {
+ public Set<String> getAllTransitionNames(StateGraph sg) {
return getAllNames(sg, null, RoomPackage.eINSTANCE.getStateGraph_Transitions());
}
@@ -1108,12 +1109,12 @@ public class RoomHelpers extends BaseHelpers {
* @return a complete list of all names used by the {@link Transition}s of a {@link StateGraph}
* including parent state graphs recursively
*/
- public static Set<String> getAllTransitionNames(StateGraph sg, Transition skip) {
+ public Set<String> getAllTransitionNames(StateGraph sg, Transition skip) {
return getAllNames(sg, skip, RoomPackage.eINSTANCE.getStateGraph_Transitions());
}
- private static <T extends StateGraphItem> Set<String> getAllNames(StateGraph sg, T skip, EReference feature) {
- List<T> items = RoomHelpers.getAllStateGraphItems(sg, feature, false);
+ private <T extends StateGraphItem> Set<String> getAllNames(StateGraph sg, T skip, EReference feature) {
+ List<T> items = getAllStateGraphItems(sg, feature, false);
HashSet<String> names = new HashSet<String>();
for (T item : items) {
@@ -1128,7 +1129,7 @@ public class RoomHelpers extends BaseHelpers {
* @param pc a {@link ProtocolClass}
* @return all incoming {@link Message}s including base class with base class messages first
*/
- public static List<Message> getAllIncomingMessages(ProtocolClass pc) {
+ public List<Message> getAllIncomingMessages(ProtocolClass pc) {
return getAllMessages(pc, true);
}
@@ -1136,7 +1137,7 @@ public class RoomHelpers extends BaseHelpers {
* @param pc a {@link ProtocolClass}
* @return all outgoing {@link Message}s including base class with base class messages first
*/
- public static List<Message> getAllOutgoingMessages(ProtocolClass pc) {
+ public List<Message> getAllOutgoingMessages(ProtocolClass pc) {
return getAllMessages(pc, false);
}
@@ -1149,7 +1150,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a list of all {@link Message}s of one direction a {@link ProtocolClass} including base classes
*/
- public static List<Message> getAllMessages(ProtocolClass pc, boolean incoming) {
+ public List<Message> getAllMessages(ProtocolClass pc, boolean incoming) {
ArrayList<Message> result = new ArrayList<Message>();
while (pc!=null) {
@@ -1168,7 +1169,7 @@ public class RoomHelpers extends BaseHelpers {
* @param item an {@link InterfaceItem}
* @return a list of all incoming {@link Message}s of this item
*/
- public static List<Message> getIncoming(InterfaceItem item) {
+ public List<Message> getIncoming(InterfaceItem item) {
if (getProtocol(item)!=null)
return getAllMessages(getProtocol(item), !isConjugated(item));
else
@@ -1179,7 +1180,7 @@ public class RoomHelpers extends BaseHelpers {
* @param item an {@link InterfaceItem}
* @return a list of all outgoing {@link Message}s of this item
*/
- public static List<Message> getOutgoing(InterfaceItem item) {
+ public List<Message> getOutgoing(InterfaceItem item) {
if (getProtocol(item)!=null)
return getAllMessages(getProtocol(item), isConjugated(item));
else
@@ -1190,7 +1191,7 @@ public class RoomHelpers extends BaseHelpers {
* @param item an {@link InterfaceItem}
* @return <code>true</code> if the item is logically conjugate
*/
- public static boolean isConjugated(InterfaceItem item) {
+ public boolean isConjugated(InterfaceItem item) {
if (item instanceof Port)
return ((Port) item).isConjugated();
else if (item instanceof SAP)
@@ -1210,7 +1211,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a list of all {@link Attribute}s of an {@link ActorClass}
*/
- public static List<Attribute> getAllAttributes(ActorClass ac) {
+ public List<Attribute> getAllAttributes(ActorClass ac) {
ArrayList<Attribute> result = new ArrayList<Attribute>();
while (ac!=null) {
@@ -1230,7 +1231,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a list of all {@link Attribute}s of a {@link DataClass}
*/
- public static List<Attribute> getAllAttributes(DataClass dc) {
+ public List<Attribute> getAllAttributes(DataClass dc) {
ArrayList<Attribute> result = new ArrayList<Attribute>();
while (dc!=null) {
@@ -1250,7 +1251,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a list of all {@link Operation}s of an {@link ActorClass}
*/
- public static List<Operation> getAllOperations(ActorClass ac) {
+ public List<Operation> getAllOperations(ActorClass ac) {
ArrayList<Operation> result = new ArrayList<Operation>();
while (ac!=null) {
@@ -1270,7 +1271,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a list of all {@link Operation}s of a {@link DataClass}
*/
- public static List<Operation> getAllOperations(DataClass dc) {
+ public List<Operation> getAllOperations(DataClass dc) {
ArrayList<Operation> result = new ArrayList<Operation>();
while (dc!=null) {
@@ -1289,7 +1290,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a list of the end {@link Port}s of an {@link ActorClass}
*/
- public static List<Port> getEndPorts(ActorClass ac) {
+ public List<Port> getEndPorts(ActorClass ac) {
ArrayList<Port> result = new ArrayList<Port>(ac.getInternalPorts());
// to preserve the order of external ports we use insertAt
@@ -1310,7 +1311,7 @@ public class RoomHelpers extends BaseHelpers {
* @return a list of all end {@link SAP}s of an {@link ActorClass}
* with base class items first
*/
- public static List<SAP> getAllSAPs(ActorClass ac) {
+ public List<SAP> getAllSAPs(ActorClass ac) {
ArrayList<SAP> result = new ArrayList<SAP>();
while (ac!=null) {
@@ -1330,7 +1331,7 @@ public class RoomHelpers extends BaseHelpers {
* @return a list of all end {@link ServiceImplementation}s of an {@link ActorClass}
* with base class items first
*/
- public static List<ServiceImplementation> getAllServiceImplementations(ActorClass ac) {
+ public List<ServiceImplementation> getAllServiceImplementations(ActorClass ac) {
ArrayList<ServiceImplementation> result = new ArrayList<ServiceImplementation>();
while (ac!=null) {
@@ -1350,7 +1351,7 @@ public class RoomHelpers extends BaseHelpers {
* @return a list of all end {@link Port}s of an {@link ActorClass}
* with base class items first
*/
- public static List<Port> getAllEndPorts(ActorClass ac) {
+ public List<Port> getAllEndPorts(ActorClass ac) {
ArrayList<Port> result = new ArrayList<Port>();
while (ac!=null) {
@@ -1372,7 +1373,7 @@ public class RoomHelpers extends BaseHelpers {
* @param ac an {@link ActorClass}
* @return a list of the interface ports
*/
- public static List<Port> getInterfacePorts(ActorContainerClass ac) {
+ public List<Port> getInterfacePorts(ActorContainerClass ac) {
if (ac instanceof ActorClass)
return ((ActorClass) ac).getInterfacePorts();
else if (ac instanceof SubSystemClass)
@@ -1388,7 +1389,7 @@ public class RoomHelpers extends BaseHelpers {
* class ports first
* @see #getInterfaceItems(ActorClass)
*/
- public static List<Port> getAllInterfacePorts(ActorContainerClass ac) {
+ public List<Port> getAllInterfacePorts(ActorContainerClass ac) {
if (ac instanceof ActorClass) {
ArrayList<Port> result = new ArrayList<Port>();
ActorClass curr = (ActorClass) ac;
@@ -1409,7 +1410,7 @@ public class RoomHelpers extends BaseHelpers {
* @return a list of all interface items <i>without</i> inherited ones
* @see #getAllInterfaceItems(ActorClass)
*/
- public static List<InterfaceItem> getInterfaceItems(ActorClass ac) {
+ public List<InterfaceItem> getInterfaceItems(ActorClass ac) {
ArrayList<InterfaceItem> result = new ArrayList<InterfaceItem>();
result.addAll(ac.getInternalPorts());
@@ -1425,7 +1426,7 @@ public class RoomHelpers extends BaseHelpers {
* @return a list of {@link MessageFromIf} that may come in through one of the
* event driven interface items of this actor class (<i>without</i> inherited ones)
*/
- public static List<MessageFromIf> getMessagesFromInterfaces(ActorClass ac) {
+ public List<MessageFromIf> getMessagesFromInterfaces(ActorClass ac) {
ArrayList<MessageFromIf> result = new ArrayList<MessageFromIf>();
List<InterfaceItem> items = getInterfaceItems(ac);
@@ -1451,7 +1452,7 @@ public class RoomHelpers extends BaseHelpers {
* @return a list of {@link MessageFromIf} that may come in through one of the
* event driven interface items of this actor class (<i>with</i> inherited ones as far as a base class has its own state machine)
*/
- public static List<MessageFromIf> getOwnMessagesFromInterfaces(ActorClass ac) {
+ public List<MessageFromIf> getOwnMessagesFromInterfaces(ActorClass ac) {
ArrayList<MessageFromIf> result = new ArrayList<MessageFromIf>();
result.addAll(getMessagesFromInterfaces(ac));
@@ -1486,7 +1487,7 @@ public class RoomHelpers extends BaseHelpers {
* @return a list of {@link MessageFromIf} that may come in through one of the
* event driven interface items of this actor class(<i>including</i> inherited ones)
*/
- public static List<MessageFromIf> getAllMessagesFromInterfaces(ActorClass ac) {
+ public List<MessageFromIf> getAllMessagesFromInterfaces(ActorClass ac) {
ArrayList<MessageFromIf> result = new ArrayList<MessageFromIf>();
while (ac!=null) {
@@ -1510,6 +1511,63 @@ public class RoomHelpers extends BaseHelpers {
return result;
}
+
+ /**
+ * @param ac the actor class to check
+ * @return {@code true} if the class hierarchy is circular (i.e. a base class refers to one of its sub classes)
+ */
+ public boolean isCircularClassHierarchy(ActorClass ac) {
+ HashSet<ActorClass> classes = new HashSet<ActorClass>();
+ classes.add(ac);
+
+ while (ac.getBase()!=null) {
+ ac = ac.getBase();
+ if (classes.contains(ac))
+ return true;
+
+ classes.add(ac);
+ }
+
+ return false;
+ }
+
+ /**
+ * @param dc the data class to check
+ * @return {@code true} if the class hierarchy is circular (i.e. a base class refers to one of its sub classes)
+ */
+ public boolean isCircularClassHierarchy(DataClass dc) {
+ HashSet<DataClass> classes = new HashSet<DataClass>();
+ classes.add(dc);
+
+ while (dc.getBase()!=null) {
+ dc = dc.getBase();
+ if (classes.contains(dc))
+ return true;
+
+ classes.add(dc);
+ }
+
+ return false;
+ }
+
+ /**
+ * @param pc the protocol class to check
+ * @return {@code true} if the class hierarchy is circular (i.e. a base class refers to one of its sub classes)
+ */
+ public boolean isCircularClassHierarchy(ProtocolClass pc) {
+ HashSet<ProtocolClass> classes = new HashSet<ProtocolClass>();
+ classes.add(pc);
+
+ while (pc.getBase()!=null) {
+ pc = pc.getBase();
+ if (classes.contains(pc))
+ return true;
+
+ classes.add(pc);
+ }
+
+ return false;
+ }
/**
* Returns a list of all end {@link InterfaceItem}s of an {@link ActorClass}
@@ -1519,9 +1577,9 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a list of all end {@link InterfaceItem}s of an {@link ActorClass}
*/
- public static List<InterfaceItem> getAllInterfaceItems(ActorClass ac) {
+ public List<InterfaceItem> getAllInterfaceItems(ActorClass ac) {
ArrayList<InterfaceItem> result = new ArrayList<InterfaceItem>();
- if (ValidationUtil.isCircularClassHierarchy(ac))
+ if (isCircularClassHierarchy(ac))
return result;
while (ac!=null) {
@@ -1544,9 +1602,9 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a list of all {@link Port}s of an {@link ActorClass}
*/
- public static List<Port> getAllPorts(ActorClass ac) {
+ public List<Port> getAllPorts(ActorClass ac) {
ArrayList<Port> result = new ArrayList<Port>();
- if (ValidationUtil.isCircularClassHierarchy(ac))
+ if (isCircularClassHierarchy(ac))
return result;
while (ac!=null) {
@@ -1559,7 +1617,7 @@ public class RoomHelpers extends BaseHelpers {
return result;
}
- public static List<ActorContainerRef> getAllActorContainerRefs(StructureClass sc) {
+ public List<ActorContainerRef> getAllActorContainerRefs(StructureClass sc) {
List<ActorContainerRef> refs = new ArrayList<ActorContainerRef>();
if(sc instanceof LogicalSystem)
@@ -1584,9 +1642,9 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a list of all {@link Binding}s of an {@link ActorClass}
*/
- public static List<Binding> getAllBindings(ActorClass ac) {
+ public List<Binding> getAllBindings(ActorClass ac) {
ArrayList<Binding> result = new ArrayList<Binding>();
- if (ValidationUtil.isCircularClassHierarchy(ac))
+ if (isCircularClassHierarchy(ac))
return result;
while (ac!=null) {
@@ -1606,9 +1664,9 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a list of all {@link LayerConnection}s of an {@link ActorClass}
*/
- public static List<LayerConnection> getAllLayerConnections(ActorClass ac) {
+ public List<LayerConnection> getAllLayerConnections(ActorClass ac) {
ArrayList<LayerConnection> result = new ArrayList<LayerConnection>();
- if (ValidationUtil.isCircularClassHierarchy(ac))
+ if (isCircularClassHierarchy(ac))
return result;
while (ac!=null) {
@@ -1627,7 +1685,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the parent {@link ActorClass} of a {@link StateGraphItem}
*/
- public static ActorClass getActorClass(StateGraphItem item) {
+ public ActorClass getActorClass(StateGraphItem item) {
EObject parent = item;
while (parent!=null) {
parent = parent.eContainer();
@@ -1645,7 +1703,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the parent {@link ActorClass} of an arbitrary EObject (result may be null)
*/
- public static ActorClass getActorClass(EObject obj) {
+ public ActorClass getActorClass(EObject obj) {
EObject parent = obj;
while (parent!=null) {
parent = parent.eContainer();
@@ -1662,7 +1720,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the parent {@link ProtocolClass} of an arbitrary EObject (result may be null)
*/
- public static ProtocolClass getProtocolClass(EObject obj) {
+ public ProtocolClass getProtocolClass(EObject obj) {
EObject ctx = obj.eContainer();
while (!(ctx instanceof ProtocolClass) && ctx.eContainer()!=null)
ctx = ctx.eContainer();
@@ -1680,7 +1738,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return <code>true</code> if the named annotation is present in the {@link ActorClass}
*/
- public static boolean isAnnotationPresent(ActorClass ac, String name) {
+ public boolean isAnnotationPresent(ActorClass ac, String name) {
return isAnnotationPresent(ac.getAnnotations(), name);
}
@@ -1694,7 +1752,7 @@ public class RoomHelpers extends BaseHelpers {
* @return <code>true</code> if the named annotation is present in the <em>behavior</em>
* of the {@link ActorClass}
*/
- public static boolean isBehaviorAnnotationPresent(ActorClass ac, String name) {
+ public boolean isBehaviorAnnotationPresent(ActorClass ac, String name) {
return isAnnotationPresent(ac.getBehaviorAnnotations(), name);
}
@@ -1707,7 +1765,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a list of the {@link Annotation} attributes of the named annotation
*/
- public static List<KeyValue> getAttributes(ActorClass ac, String name) {
+ public List<KeyValue> getAttributes(ActorClass ac, String name) {
return getAttributes(ac.getAnnotations(), name);
}
@@ -1721,7 +1779,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a list of the {@link Annotation} attributes of the named annotation
*/
- public static List<KeyValue> getBehaviorAttributes(ActorClass ac, String name) {
+ public List<KeyValue> getBehaviorAttributes(ActorClass ac, String name) {
return getAttributes(ac.getBehaviorAnnotations(), name);
}
@@ -1736,7 +1794,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @see #isBehaviorAttributePresent(ActorClass, String, String)
*/
- public static boolean isAttributePresent(ActorClass ac, String name, String key) {
+ public boolean isAttributePresent(ActorClass ac, String name, String key) {
return isAttributePresent(ac.getAnnotations(), name, key);
}
@@ -1751,7 +1809,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @see #isAttributePresent(ActorClass, String, String)
*/
- public static boolean isBehaviorAttributePresent(ActorClass ac, String name, String key) {
+ public boolean isBehaviorAttributePresent(ActorClass ac, String name, String key) {
return isAttributePresent(ac.getBehaviorAnnotations(), name, key);
}
@@ -1764,7 +1822,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the string value of the attribute or an empty string if not found
*/
- public static String getAttribute(ActorClass ac, String name, String key) {
+ public String getAttribute(ActorClass ac, String name, String key) {
return getAttribute(ac.getAnnotations(), name, key);
}
@@ -1777,7 +1835,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the string value of the attribute or an empty string if not found
*/
- public static String getBehaviorAttribute(ActorClass ac, String name, String key) {
+ public String getBehaviorAttribute(ActorClass ac, String name, String key) {
return getAttribute(ac.getBehaviorAnnotations(), name, key);
}
@@ -1789,7 +1847,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return <code>true</code> if the state machine is flat
*/
- public static boolean hasFlatStateMachine(ActorClass ac) {
+ public boolean hasFlatStateMachine(ActorClass ac) {
if (isEmpty(ac.getStateMachine()))
return false;
@@ -1815,7 +1873,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @see #getAllMessages(ProtocolClass, boolean)
*/
- public static List<Message> getMessageListDeep(InterfaceItem item, boolean outgoing) {
+ public List<Message> getMessageListDeep(InterfaceItem item, boolean outgoing) {
ProtocolClass protocol = null;
if (item instanceof Port) {
if (!(((Port) item).getProtocol() instanceof ProtocolClass)) {
@@ -1840,7 +1898,7 @@ public class RoomHelpers extends BaseHelpers {
return null;
}
- return RoomHelpers.getAllMessages(protocol, !outgoing);
+ return getAllMessages(protocol, !outgoing);
}
/**
@@ -1852,7 +1910,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the PortClass or null if not defined
*/
- public static PortClass getPortClass(InterfaceItem item) {
+ public PortClass getPortClass(InterfaceItem item) {
ProtocolClass protocol = null;
boolean conjugated = false;
if (item instanceof Port) {
@@ -1886,7 +1944,7 @@ public class RoomHelpers extends BaseHelpers {
* @param port
* @return true if relay port
*/
- public static boolean isRelay(Port port) {
+ public boolean isRelay(Port port) {
ActorContainerClass acc = (ActorContainerClass) port.eContainer();
if (acc instanceof ActorClass) {
if (((ActorClass)acc).getInterfacePorts().contains(port)) {
@@ -1908,7 +1966,7 @@ public class RoomHelpers extends BaseHelpers {
* @param port
* @return true if internal port
*/
- public static boolean isInternal(Port port) {
+ public boolean isInternal(Port port) {
ActorContainerClass acc = (ActorContainerClass) port.eContainer();
if (acc instanceof ActorClass) {
if (((ActorClass)acc).getInternalPorts().contains(port)) {
@@ -1926,7 +1984,7 @@ public class RoomHelpers extends BaseHelpers {
* @param port
* @return true if external port
*/
- public static boolean isExternal(Port port) {
+ public boolean isExternal(Port port) {
ActorContainerClass acc = (ActorContainerClass) port.eContainer();
if (acc instanceof ActorClass) {
for (ExternalPort ep : ((ActorClass)acc).getExternalPorts()) {
@@ -1947,7 +2005,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return <code>true</code> if the operation is a constructor
*/
- public static boolean isConstructor(Operation op) {
+ public boolean isConstructor(Operation op) {
if (op instanceof PortOperation)
return false;
@@ -1967,7 +2025,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return <code>true</code> if the operation is a destructor
*/
- public static boolean isDestructor(Operation op) {
+ public boolean isDestructor(Operation op) {
if (op instanceof PortOperation)
return false;
@@ -1985,7 +2043,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return <code>true</code> if the actor class has a constructor
*/
- public static boolean hasConstructor(ActorClass ac) {
+ public boolean hasConstructor(ActorClass ac) {
for (StandardOperation op : ac.getOperations()) {
if (op.getName().equals(ac.getName()))
if (!op.isDestructor())
@@ -2002,7 +2060,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return <code>true</code> if the actor class has a destructor
*/
- public static boolean hasDestructor(ActorClass ac) {
+ public boolean hasDestructor(ActorClass ac) {
for (StandardOperation op : ac.getOperations()) {
if (op.getName().equals(ac.getName()))
if (op.isDestructor())
@@ -2013,71 +2071,11 @@ public class RoomHelpers extends BaseHelpers {
}
/**
- * Returns an operation's typed argument list as a string.
- *
- * @param op the operation
- *
- * @return the argument list string
- */
- public static String getTypedArgumentList(Operation op) {
- String signature = "";
- for (VarDecl arg : op.getArguments()) {
- if (signature.isEmpty())
- signature = arg.getName()+": "+arg.getRefType().getType().getName();
- else
- signature += ", "+arg.getName()+": "+arg.getRefType().getType().getName();
- }
- signature = "("+signature+")";
- return signature;
- }
-
- /**
- * Returns an operation's signature as a string.
- *
- * @param op the operation
- *
- * @return the signature string
- */
- public static String getSignature(Operation op) {
- String signature = "";
- for (VarDecl arg : op.getArguments()) {
- if (signature.isEmpty())
- signature = arg.getName()+": "+arg.getRefType().getType().getName();
- else
- signature += ", "+arg.getName()+": "+arg.getRefType().getType().getName();
- }
- String rt = op.getReturnType()!=null? ": "+op.getReturnType().getType().getName():"";
- if (op instanceof PortOperation && ((PortOperation) op).getSendsMsg()!=null)
- rt = " sends "+((PortOperation) op).getSendsMsg().getName();
- signature = op.getName()+"("+signature+")"+rt;
- return signature;
- }
-
- /**
- * Returns an operation's argument list as a string.
- *
- * @param op the operation
- *
- * @return the argument list string
- */
- public static String getArguments(Operation op) {
- String signature = "";
- for (VarDecl arg : op.getArguments()) {
- if (signature.isEmpty())
- signature = arg.getName();
- else
- signature += ", "+arg.getName();
- }
- signature = "("+signature+")";
- return signature;
- }
-
- /**
* return the {@link SimpleState} of a {@link State}
* @param s
* @return the state itself if a SimpleState or the base state for a {@link RefinedState}
*/
- public static SimpleState getBaseState(State s) {
+ public SimpleState getBaseState(State s) {
if (s instanceof SimpleState)
return (SimpleState) s;
else if (s instanceof RefinedState)
@@ -2093,7 +2091,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a list of target states of a {@link RefinedState} recursively
*/
- public static List<State> getReferencedStatesRecursively(RefinedState rs) {
+ public List<State> getReferencedStatesRecursively(RefinedState rs) {
ArrayList<State> result = new ArrayList<State>();
State target = rs.getTarget();
@@ -2115,7 +2113,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return <code>true</code> if a state is referenced recursively by a refined state
*/
- public static boolean referencesStateRecursively(RefinedState rs, State referenced) {
+ public boolean referencesStateRecursively(RefinedState rs, State referenced) {
State target = rs.getTarget();
if (target==referenced)
return true;
@@ -2137,10 +2135,11 @@ public class RoomHelpers extends BaseHelpers {
* are checked if they are semantically nested in another state of the same state machine.
*
* @param ac the actor class
+ * @param nameProvider a function that returns the full path of a refined state
*
* @return a map of refined states to potential parent refined states
*/
- public static Map<RefinedState, RefinedState> getRefinedStatesToRelocate(ActorClass ac) {
+ public Map<RefinedState, RefinedState> getRefinedStatesToRelocate(ActorClass ac, Function<RefinedState, String> nameProvider) {
// collect RefinedStates and some information
ArrayList<RefinedState> refinedStates = new ArrayList<RefinedState>();
@@ -2151,7 +2150,7 @@ public class RoomHelpers extends BaseHelpers {
EObject obj = it.next();
if (obj instanceof RefinedState) {
refinedStates.add((RefinedState) obj);
- String path = RoomNameProvider.getFullPath((RefinedState) obj);
+ String path = nameProvider.apply((RefinedState) obj);
paths.add(path);
path2rs.put(path, (RefinedState) obj);
}
@@ -2163,7 +2162,7 @@ public class RoomHelpers extends BaseHelpers {
// find the best matching context
HashMap<RefinedState, RefinedState> rs2parent = new HashMap<RefinedState, RefinedState>();
for (RefinedState rs : refinedStates) {
- String fullPath = RoomNameProvider.getFullPath(rs);
+ String fullPath = nameProvider.apply(rs);
for (String path : paths) {
if (!fullPath.equals(path) && fullPath.startsWith(path) && fullPath.charAt(path.length())==RoomNameProvider.PATH_SEP.charAt(0)) {
RefinedState parent = path2rs.get(path);
@@ -2184,7 +2183,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the {@link ProtocolClass} of an {@link InterfaceItem}
*/
- public static ProtocolClass getProtocol(InterfaceItem item) {
+ public ProtocolClass getProtocol(InterfaceItem item) {
GeneralProtocolClass pc = getGeneralProtocol(item);
if (pc instanceof ProtocolClass)
return (ProtocolClass) pc;
@@ -2198,7 +2197,7 @@ public class RoomHelpers extends BaseHelpers {
* @param item an {@link InterfaceItem}
* @return {@code true} if the interface item is data driven (i.e. has a data driven {@link ProtocolClass}
*/
- public static boolean isDataDriven(InterfaceItem item) {
+ public boolean isDataDriven(InterfaceItem item) {
ProtocolClass pc = getProtocol(item);
if (pc!=null && pc.getCommType()==CommunicationType.DATA_DRIVEN)
return true;
@@ -2213,7 +2212,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the {@link GeneralProtocolClass} of an {@link InterfaceItem}
*/
- public static GeneralProtocolClass getGeneralProtocol(InterfaceItem item) {
+ public GeneralProtocolClass getGeneralProtocol(InterfaceItem item) {
if (item instanceof Port) {
return ((Port)item).getProtocol();
}
@@ -2233,7 +2232,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the recursive base class entry code of a {@link RefinedState} as string
*/
- public static String getBaseEntryCode(RefinedState state) {
+ public String getBaseEntryCode(RefinedState state) {
return getBaseCode(state, RoomPackage.Literals.STATE__ENTRY_CODE);
}
@@ -2244,7 +2243,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the recursive base class exit code of a {@link RefinedState} as string
*/
- public static String getBaseExitCode(RefinedState state) {
+ public String getBaseExitCode(RefinedState state) {
return getBaseCode(state, RoomPackage.Literals.STATE__EXIT_CODE);
}
@@ -2255,11 +2254,11 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the recursive base class do code of a {@link RefinedState} as string
*/
- public static String getBaseDoCode(RefinedState state) {
+ public String getBaseDoCode(RefinedState state) {
return getBaseCode(state, RoomPackage.Literals.STATE__DO_CODE);
}
- private static String getBaseCode(RefinedState state, EStructuralFeature feat) {
+ private String getBaseCode(RefinedState state, EStructuralFeature feat) {
StringBuilder result = new StringBuilder();
State base = state.getTarget();
@@ -2282,7 +2281,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the last common super type of a list of types or <code>null</code> if no such exists
*/
- public static RefableType getLastCommonSuperType(List<RefableType> types) {
+ public RefableType getLastCommonSuperType(List<RefableType> types) {
int nref = 0;
int ndc = 0;
for (RefableType rt : types) {
@@ -2362,7 +2361,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the recursive base class code of a transition
*/
- public static String getInheritedActionCode(Transition trans, ActorClass ac) {
+ public String getInheritedActionCode(Transition trans, ActorClass ac) {
return getActionCode(trans, ac, false);
}
@@ -2370,7 +2369,7 @@ public class RoomHelpers extends BaseHelpers {
* @param sg a {@link StateGraph}
* @return the initial transition or <code>null</code> if no such is available
*/
- public static Transition getInitTransition(StateGraph sg) {
+ public Transition getInitTransition(StateGraph sg) {
for (Transition tr : sg.getTransitions()) {
if (tr instanceof InitialTransition)
return tr;
@@ -2382,7 +2381,7 @@ public class RoomHelpers extends BaseHelpers {
* @param sg a {@link StateGraph}
* @return <code>true</code> if an initial transition is available
*/
- public static boolean hasInitTransition(StateGraph sg) {
+ public boolean hasInitTransition(StateGraph sg) {
return getInitTransition(sg)!=null;
}
@@ -2394,11 +2393,11 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the complete action code including base class code of a {@link Transition}
*/
- public static String getAllActionCode(Transition trans, ActorClass ac) {
+ public String getAllActionCode(Transition trans, ActorClass ac) {
return getActionCode(trans, ac, true);
}
- private static String getActionCode(Transition trans, ActorClass ac, boolean includeOwn) {
+ private String getActionCode(Transition trans, ActorClass ac, boolean includeOwn) {
StringBuilder result = new StringBuilder();
ActorClass baseAC = getActorClass(trans);
@@ -2434,7 +2433,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the parent container of an {@link ActorInstanceMapping}
*/
- public static ActorContainerClass getParentContainer(ActorInstanceMapping aim) {
+ public ActorContainerClass getParentContainer(ActorInstanceMapping aim) {
ActorContainerClass root = null;
if (aim.eContainer() instanceof ActorInstanceMapping) {
ActorInstanceMapping parent = (ActorInstanceMapping) aim.eContainer();
@@ -2453,12 +2452,12 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the target {@link ActorContainerClass} of an instance mapping
*/
- public static ActorContainerClass getActorContainerClass(ActorInstanceMapping aim) {
+ public ActorContainerClass getActorContainerClass(ActorInstanceMapping aim) {
// follow segments
ActorContainerClass result = getParentContainer(aim);
for (RefSegment ref : aim.getPath().getRefs()) {
ActorRef match = null;
- for (ActorContainerRef actor : RoomHelpers.getRefs(result, true)) {
+ for (ActorContainerRef actor : getRefs(result, true)) {
if (actor instanceof ActorRef && actor.getName().equals(ref.getRef())) {
match = (ActorRef) actor;
break;
@@ -2481,7 +2480,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return a {@link RefPath} as string
*/
- public static String asString(RefPath path) {
+ public String asString(RefPath path) {
StringBuilder sb = new StringBuilder();
for (RefSegment ref : path.getRefs()) {
sb.append("/"+ref);
@@ -2498,7 +2497,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return the last {@link ActorRef} of a {@link RefPath}
*/
- public static ActorRef getLastActorRef(ActorContainerClass root, RefPath path) {
+ public ActorRef getLastActorRef(ActorContainerClass root, RefPath path) {
if (path.getRefs().isEmpty())
return null;
@@ -2506,7 +2505,7 @@ public class RoomHelpers extends BaseHelpers {
ActorContainerClass result = root;
for (RefSegment ref : path.getRefs()) {
ActorRef match = null;
- for (ActorContainerRef actor : RoomHelpers.getRefs(result, true)) {
+ for (ActorContainerRef actor : getRefs(result, true)) {
if (actor instanceof ActorRef && actor.getName().equals(ref.getRef())) {
match = (ActorRef) actor;
break;
@@ -2530,7 +2529,7 @@ public class RoomHelpers extends BaseHelpers {
* @param path
* @return first invalid path segment else {@code null}
*/
- public static String checkPath(ActorContainerClass root, RefPath path) {
+ public String checkPath(ActorContainerClass root, RefPath path) {
if (path == null)
return null;
@@ -2590,7 +2589,7 @@ public class RoomHelpers extends BaseHelpers {
*
* @return true if pc1 is derived from pc2
*/
- public static boolean isDerivedFrom(ProtocolClass pc1, ProtocolClass pc2) {
+ public boolean isDerivedFrom(ProtocolClass pc1, ProtocolClass pc2) {
if (pc1==pc2)
return false;
@@ -2608,9 +2607,12 @@ public class RoomHelpers extends BaseHelpers {
* @param ac2
* @return <code>true</code> if ac1 or one of its base types is identical to ac2
*/
- public static boolean isKindOf(ActorClass ac1, ActorClass ac2) {
+ public boolean isKindOf(ActorClass ac1, ActorClass ac2) {
if (ac2==null)
return false;
+
+ if (ac1==null || isCircularClassHierarchy(ac1))
+ return false;
while (ac1!=null) {
if (ac2==ac1)
@@ -2620,4 +2622,36 @@ public class RoomHelpers extends BaseHelpers {
}
return false;
}
+
+ /**
+ * check if ref recursively is referencing ac
+ * @param ref
+ * @param ac
+ * @return <code>true</code> if ref recursively is referencing ac
+ */
+ public boolean isReferencing(ActorClass ref, ActorClass ac) {
+ if (isKindOf(ref,ac))
+ return true;
+
+ Set<ActorClass> visited = new HashSet<ActorClass>();
+ LinkedList<ActorClass> stack = new LinkedList<ActorClass>();
+ visited.add(ac);
+ stack.push(ref);
+
+ ActorClass next;
+ while(!stack.isEmpty()){
+ next = stack.pop();
+ if(visited.contains(next))
+ continue;
+
+ for (ActorRef ar : next.getActorRefs()) {
+ if (isKindOf(ar.getType(), ac) || isKindOf(next, ar.getType()))
+ return true;
+ stack.push(ar.getType());
+ }
+ visited.add(next);
+ }
+
+ return false;
+ }
}
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomUtil.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomUtil.java
new file mode 100644
index 000000000..eae2d3245
--- /dev/null
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomUtil.java
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * Copyright (c) 2014 protos software gmbh (http://www.protos.de).
+ * All rights reserved. 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.room.util;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.ActorContainerClass;
+import org.eclipse.etrice.core.room.ActorContainerRef;
+import org.eclipse.etrice.core.room.ActorRef;
+import org.eclipse.etrice.core.room.ChoicePoint;
+import org.eclipse.etrice.core.room.InitialTransition;
+import org.eclipse.etrice.core.room.InterfaceItem;
+import org.eclipse.etrice.core.room.LogicalSystem;
+import org.eclipse.etrice.core.room.Port;
+import org.eclipse.etrice.core.room.SAP;
+import org.eclipse.etrice.core.room.SPP;
+import org.eclipse.etrice.core.room.State;
+import org.eclipse.etrice.core.room.StateGraph;
+import org.eclipse.etrice.core.room.StateGraphItem;
+import org.eclipse.etrice.core.room.StructureClass;
+import org.eclipse.etrice.core.room.SubSystemClass;
+import org.eclipse.etrice.core.room.SubSystemRef;
+import org.eclipse.etrice.core.room.TrPoint;
+import org.eclipse.etrice.core.room.Transition;
+
+import com.google.inject.Inject;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public class RoomUtil {
+
+ @Inject
+ private RoomHelpers roomHelpers;
+
+ /**
+ * @param sg a {@link StateGraph} serving as name space
+ * @return a unique name for a new {@link Transition} (has to be unique among
+ * all {@link StateGraphItem}s of the state graph)
+ */
+ public String getUniqueTransitionName(StateGraph sg) {
+ Set<String> names = roomHelpers.getAllNames(sg);
+
+ for (int i = 0; i < 1000; i++) {
+ String name = "tr"+i;
+ if (!names.contains(name))
+ return name;
+ }
+
+ return "not_unique";
+ }
+
+ /**
+ * @param sg a {@link StateGraph} serving as name space
+ * @return a unique name for a new {@link InitialTransition} (has to be unique among
+ * all {@link StateGraphItem}s of the state graph)
+ */
+ public String getUniqueInitialTransitionName(StateGraph sg) {
+ Set<String> names = roomHelpers.getAllNames(sg);
+
+ if (!names.contains("init"))
+ return "init";
+
+ for (int i = 0; i < 1000; i++) {
+ String name = "init"+i;
+ if (!names.contains(name))
+ return name;
+ }
+
+ return "not_unique";
+ }
+
+ /**
+ * @param sg a {@link StateGraph} serving as name space
+ * @return a unique name for a new {@link ChoicePoint} (has to be unique among
+ * all {@link StateGraphItem}s of the state graph)
+ */
+ public String getUniqueChoicePointName(StateGraph sg) {
+ Set<String> names = roomHelpers.getAllNames(sg);
+
+ for (int i = 0; i < 1000; i++) {
+ String name = "cp"+i;
+ if (!names.contains(name))
+ return name;
+ }
+
+ return "not_unique";
+ }
+
+ /**
+ * @param sg a {@link StateGraph} serving as name space
+ * @return a unique name for a new {@link TrPoint} (has to be unique among
+ * all {@link StateGraphItem}s of the state graph)
+ */
+ public String getUniqueTrPointName(StateGraph sg) {
+ Set<String> names = roomHelpers.getAllNames(sg);
+
+ for (int i = 0; i < 1000; i++) {
+ String name = "tp"+i;
+ if (!names.contains(name))
+ return name;
+ }
+
+ return "not_unique";
+ }
+
+ /**
+ * @param sg a {@link StateGraph} serving as name space
+ * @return a unique name for a new {@link State} (has to be unique among
+ * all {@link StateGraphItem}s of the state graph)
+ */
+ public String getUniqueStateName(StateGraph sg) {
+ Set<String> names = roomHelpers.getAllNames(sg);
+
+ for (int i = 0; i < 1000; i++) {
+ String name = "state"+i;
+ if (!names.contains(name))
+ return name;
+ }
+
+ return "not_unique";
+ }
+
+ /**
+ * @param sc a {@link StructureClass}
+ * @return a unique name for a new {@link ActorContainerRef}
+ */
+ public String getUniqueActorContainerRefName(StructureClass sc) {
+ HashSet<String> names = new HashSet<String>();
+ if (sc instanceof ActorContainerClass) {
+ for (ActorRef ar : ((ActorContainerClass) sc).getActorRefs()) {
+ names.add(ar.getName());
+ }
+ }
+ else if (sc instanceof LogicalSystem) {
+ for (SubSystemRef ar : ((LogicalSystem) sc).getSubSystems()) {
+ names.add(ar.getName());
+ }
+ }
+
+ for (int i = 0; i < 1000; i++) {
+ String name = "ref"+i;
+ if (!names.contains(name))
+ return name;
+ }
+
+ return "not_unique";
+ }
+
+ /**
+ * @param prefix a prefix (e.g. to distinguish ports, SAPs, SPPs)
+ * @param acc a {@link ActorContainerClass}
+ * @return a unique name for a new {@link InterfaceItem} of the actor container class
+ */
+ public String getUniqueInterfaceItemName(String prefix, ActorContainerClass acc) {
+ HashSet<String> names = new HashSet<String>();
+ if (acc instanceof ActorClass) {
+ ActorClass ac = (ActorClass) acc;
+ do {
+ for (Port p : ac.getInterfacePorts()) {
+ names.add(p.getName());
+ }
+ for (Port p : ac.getInternalPorts()) {
+ names.add(p.getName());
+ }
+ for (SAP sap : ac.getServiceAccessPoints()) {
+ names.add(sap.getName());
+ }
+ for (SPP spp : ac.getServiceProvisionPoints()) {
+ names.add(spp.getName());
+ }
+
+ ac = ac.getBase();
+ }
+ while (ac!=null);
+ }
+ else if (acc instanceof SubSystemClass) {
+ for (Port p : ((SubSystemClass) acc).getRelayPorts()) {
+ names.add(p.getName());
+ }
+ for (SPP spp : ((SubSystemClass) acc).getServiceProvisionPoints()) {
+ names.add(spp.getName());
+ }
+ }
+
+ for (int i = 0; i < 1000; i++) {
+ String name = prefix+i;
+ if (!names.contains(name))
+ return name;
+ }
+
+ return "not_unique";
+ }
+
+}
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/ActorRefFilter.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/ActorRefFilter.java
index 19bd15d1b..b849536fb 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/ActorRefFilter.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/ActorRefFilter.java
@@ -14,14 +14,18 @@ package org.eclipse.etrice.core.scoping;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.etrice.core.room.ActorClass;
-import org.eclipse.etrice.core.validation.ValidationUtil;
+import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.xtext.resource.IEObjectDescription;
import com.google.common.base.Predicate;
+import com.google.inject.Inject;
public class ActorRefFilter implements Predicate<IEObjectDescription> {
+ @Inject
+ private RoomHelpers roomHelpers;
+
private ActorClass ac;
public ActorRefFilter(ActorClass ac) {
@@ -42,7 +46,7 @@ public class ActorRefFilter implements Predicate<IEObjectDescription> {
if (ref.getName()==null)
return true;
- return !ValidationUtil.isReferencing(ref, ac);
+ return !roomHelpers.isReferencing(ref, ac);
}
return true;
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java
index bf62e3ab0..25a779397 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java
@@ -83,6 +83,9 @@ import com.google.inject.Inject;
*
*/
public class RoomScopeProvider extends AbstractDeclarativeScopeProvider {
+
+ @Inject
+ private RoomHelpers roomHelpers;
public static final String STATE_PATH_DELIMITER = ".";
@@ -225,13 +228,13 @@ public class RoomScopeProvider extends AbstractDeclarativeScopeProvider {
* @param scopes
*/
private void getStateScopes(StateGraph parent, final List<IEObjectDescription> scopes) {
- List<State> states = RoomHelpers.getAllStates(parent);
+ List<State> states = roomHelpers.getAllStates(parent);
HashMap<String, SimpleState> name2state = new HashMap<String, SimpleState>();
for (State s : states) {
// returning SimpleStates only simplifies the relocation task in the generator model:
// there we shuffle RefinedState contents to SimpleStates and remove the RefinedStates.
// If we had references to RefinedStates we had to redirect those
- name2state.put(s.getName(), RoomHelpers.getBaseState(s));
+ name2state.put(s.getName(), roomHelpers.getBaseState(s));
}
for (Entry<String, SimpleState> entry : name2state.entrySet()) {
scopes.add(EObjectDescription.create(entry.getKey(), entry.getValue()));
@@ -248,7 +251,7 @@ public class RoomScopeProvider extends AbstractDeclarativeScopeProvider {
final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
StateGraph parent = getStateGraph(ep);
- List<TrPoint> tps = RoomHelpers.getAllTrPoints(parent);
+ List<TrPoint> tps = roomHelpers.getAllTrPoints(parent);
for (TrPoint tp : tps) {
scopes.add(EObjectDescription.create(tp.getName(), tp));
}
@@ -270,10 +273,10 @@ public class RoomScopeProvider extends AbstractDeclarativeScopeProvider {
State epState = ep.getState();
// check if there is a refined state for this state
- epState = RoomHelpers.getRefinedStateFor(parent, epState);
+ epState = roomHelpers.getRefinedStateFor(parent, epState);
if (epState.getSubgraph()!=null) {
- List<TrPoint> tps = RoomHelpers.getAllTrPoints(epState.getSubgraph());
+ List<TrPoint> tps = roomHelpers.getAllTrPoints(epState.getSubgraph());
for (TrPoint tp : tps) {
scopes.add(EObjectDescription.create(tp.getName(), tp));
}
@@ -310,7 +313,7 @@ public class RoomScopeProvider extends AbstractDeclarativeScopeProvider {
// first state graph in container hierarchy
StateGraph parent = getStateGraph(ct);
- List<ChoicePoint> choicePoints = RoomHelpers.getAllChoicePoints(parent);
+ List<ChoicePoint> choicePoints = roomHelpers.getAllChoicePoints(parent);
for (ChoicePoint cp : choicePoints) {
scopes.add(EObjectDescription.create(cp.getName(), cp));
}
@@ -345,7 +348,7 @@ public class RoomScopeProvider extends AbstractDeclarativeScopeProvider {
}
if (protocol!=null)
- for (Message msg : conjugated?RoomHelpers.getAllMessages(protocol,false):RoomHelpers.getAllMessages(protocol,true)) {
+ for (Message msg : conjugated?roomHelpers.getAllMessages(protocol,false):roomHelpers.getAllMessages(protocol,true)) {
scopes.add(EObjectDescription.create(msg.getName(), msg));
}
}
@@ -383,7 +386,7 @@ public class RoomScopeProvider extends AbstractDeclarativeScopeProvider {
final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
ActorClass ac = getActorClass(mfi);
- List<InterfaceItem> items = RoomHelpers.getAllInterfaceItems(ac);
+ List<InterfaceItem> items = roomHelpers.getAllInterfaceItems(ac);
for (InterfaceItem item : items) {
scopes.add(EObjectDescription.create(item.getName(), item));
@@ -599,7 +602,7 @@ public class RoomScopeProvider extends AbstractDeclarativeScopeProvider {
public IScope scope_SemanticsRule_msg(SemanticsRule sr, EReference ref) {
final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
- ProtocolClass pc = RoomHelpers.getProtocolClass(sr);
+ ProtocolClass pc = roomHelpers.getProtocolClass(sr);
LinkedList<ProtocolClass> classes = getBaseClasses(pc);
for (ProtocolClass bpc : classes) {
if (sr instanceof InSemanticsRule)
@@ -722,7 +725,7 @@ public class RoomScopeProvider extends AbstractDeclarativeScopeProvider {
public IScope scope_MessageHandler_msg(MessageHandler handler, EReference ref) {
final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
- ProtocolClass pc = RoomHelpers.getProtocolClass(handler);
+ ProtocolClass pc = roomHelpers.getProtocolClass(handler);
if (pc!=null) {
if (handler instanceof InMessageHandler)
for (Message m : pc.getIncomingMessages()) {
@@ -741,7 +744,7 @@ public class RoomScopeProvider extends AbstractDeclarativeScopeProvider {
final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
PortClass pcls = (PortClass) op.eContainer();
- ProtocolClass pc = RoomHelpers.getProtocolClass(op);
+ ProtocolClass pc = roomHelpers.getProtocolClass(op);
if (pc!=null) {
if (pcls==pc.getConjugated())
for (Message m : pc.getIncomingMessages()) {
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/RoomJavaValidator.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/RoomJavaValidator.java
index 73bbda6c0..7f132134c 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/RoomJavaValidator.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/RoomJavaValidator.java
@@ -86,6 +86,15 @@ import com.google.inject.Inject;
public class RoomJavaValidator extends AbstractRoomJavaValidator {
+ @Inject
+ private RoomHelpers roomHelpers;
+
+ @Inject
+ private RoomNameProvider roomNameProvider;
+
+ @Inject
+ private ValidationUtil ValidationUtil;
+
/* message strings */
public static final String OPTIONAL_REFS_HAVE_TO_HAVE_MULTIPLICITY_ANY = "optional refs have to have multiplicity any [*]";
public static final String MULTIPLICITY_ANY_REQUIRES_OPTIONAL = "multiplicity any [*] requires optional";
@@ -156,7 +165,7 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
if (ar.eContainer() instanceof ActorClass) {
ActorClass ac = (ActorClass) ar.eContainer();
- if (ValidationUtil.isReferencing(ar.getType(), ac)) {
+ if (roomHelpers.isReferencing(ar.getType(), ac)) {
error("Actor reference is circular", RoomPackage.eINSTANCE.getActorRef_Type());
}
}
@@ -203,7 +212,7 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
if (dc==null)
return;
- if (ValidationUtil.isCircularClassHierarchy(dc))
+ if (roomHelpers.isCircularClassHierarchy(dc))
error("Base classes are circular", RoomPackage.eINSTANCE.getDataClass_Base());
}
@@ -223,7 +232,7 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
}
DataClass dc = (DataClass) att.eContainer();
- if (ValidationUtil.isCircularClassHierarchy(dc))
+ if (roomHelpers.isCircularClassHierarchy(dc))
return;
while (dc!=null) {
@@ -256,7 +265,7 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
if (pc==null)
return;
- if (ValidationUtil.isCircularClassHierarchy(pc))
+ if (roomHelpers.isCircularClassHierarchy(pc))
error("Base classes are circular", RoomPackage.eINSTANCE.getProtocolClass_Base());
}
@@ -265,13 +274,13 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
if (ac==null)
return;
- if (ValidationUtil.isCircularClassHierarchy(ac))
+ if (roomHelpers.isCircularClassHierarchy(ac))
error("Base classes are circular", RoomPackage.eINSTANCE.getActorClass_Base());
}
@Check
public void checkUniqueNames(ActorClass ac) {
- if (ValidationUtil.isCircularClassHierarchy(ac))
+ if (roomHelpers.isCircularClassHierarchy(ac))
return;
HashMap<String, EObject> name2obj = new HashMap<String, EObject>();
@@ -279,22 +288,22 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
// first add all base class objects (we'll add no errors for them)
if (ac.getBase()!=null) {
ActorClass base = ac.getBase();
- List<InterfaceItem> items = RoomHelpers.getAllInterfaceItems(base);
+ List<InterfaceItem> items = roomHelpers.getAllInterfaceItems(base);
for (InterfaceItem item : items) {
name2obj.put(item.getName(), item);
}
- List<ActorContainerRef> refs = RoomHelpers.getAllActorContainerRefs(base);
+ List<ActorContainerRef> refs = roomHelpers.getAllActorContainerRefs(base);
for (ActorContainerRef ref : refs) {
name2obj.put(ref.getName(), ref);
}
}
// now we check our own items and refs
- List<InterfaceItem> items = RoomHelpers.getInterfaceItems(ac);
+ List<InterfaceItem> items = roomHelpers.getInterfaceItems(ac);
for (InterfaceItem item : items) {
if (name2obj.containsKey(item.getName())) {
EObject duplicate = name2obj.get(item.getName());
- String location = RoomNameProvider.getLocation(duplicate);
+ String location = roomNameProvider.getLocation(duplicate);
EObject parent = item.eContainer();
@SuppressWarnings("unchecked")
int idx = ((List<EObject>)parent.eGet(item.eContainingFeature())).indexOf(item);
@@ -304,11 +313,11 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
name2obj.put(item.getName(), item);
}
- List<ActorContainerRef> refs = RoomHelpers.getRefs(ac, false);
+ List<ActorContainerRef> refs = roomHelpers.getRefs(ac, false);
for (ActorContainerRef ref : refs) {
if (name2obj.containsKey(ref.getName())) {
EObject duplicate = name2obj.get(ref.getName());
- String location = RoomNameProvider.getLocation(duplicate);
+ String location = roomNameProvider.getLocation(duplicate);
EObject parent = ref.eContainer();
@SuppressWarnings("unchecked")
int idx = ((List<EObject>)parent.eGet(ref.eContainingFeature())).indexOf(ref);
@@ -321,7 +330,7 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
@Check
public void checkExecModelConsistent(ActorClass ac) {
- if (ValidationUtil.isCircularClassHierarchy(ac))
+ if (roomHelpers.isCircularClassHierarchy(ac))
return;
ActorCommunicationType commType = ac.getCommType();
@@ -396,16 +405,16 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
@Check
public void checkActorInstanceMapping(ActorInstanceMapping aim) {
- ActorContainerClass root = RoomHelpers.getParentContainer(aim);
+ ActorContainerClass root = roomHelpers.getParentContainer(aim);
if (root != null && !root.eIsProxy()) {
RefPath path = aim.getPath();
if (path != null) {
- String invalidSegment = RoomHelpers.checkPath(root, path);
+ String invalidSegment = roomHelpers.checkPath(root, path);
if (invalidSegment != null)
error("no match for segment '" + invalidSegment + "'",
RoomPackage.Literals.ACTOR_INSTANCE_MAPPING__PATH);
else {
- ActorRef aRef = RoomHelpers.getLastActorRef(root, path);
+ ActorRef aRef = roomHelpers.getLastActorRef(root, path);
if (aRef == null)
error("invalid actor reference",
RoomPackage.Literals.ACTOR_INSTANCE_MAPPING__PATH);
@@ -517,7 +526,7 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
//boolean synchronous = ac.getCommType() == ActorCommunicationType.SYNCHRONOUS;
for(InterfaceItem item : items){
- ProtocolClass pc = RoomHelpers.getProtocol(item);
+ ProtocolClass pc = roomHelpers.getProtocol(item);
if (pc!=null)
switch(pc.getCommType()){
case DATA_DRIVEN:
@@ -547,22 +556,22 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
@Check
public void checkProtocol(ProtocolClass pc) {
- if (ValidationUtil.isCircularClassHierarchy(pc))
+ if (roomHelpers.isCircularClassHierarchy(pc))
return;
switch (pc.getCommType()) {
case DATA_DRIVEN:
if (pc.getBase()!=null && pc.getBase().getCommType()!=CommunicationType.DATA_DRIVEN)
error("super protocol has to have same communication type", RoomPackage.Literals.PROTOCOL_CLASS__COMM_TYPE);
- if (RoomHelpers.getAllMessages(pc, true).isEmpty())
+ if (roomHelpers.getAllMessages(pc, true).isEmpty())
error("at least one incoming message must be defined", RoomPackage.Literals.PROTOCOL_CLASS__INCOMING_MESSAGES);
- if (!RoomHelpers.getAllMessages(pc, false).isEmpty())
+ if (!roomHelpers.getAllMessages(pc, false).isEmpty())
error("data driven protocols must have no outgoing messages", RoomPackage.Literals.PROTOCOL_CLASS__OUTGOING_MESSAGES);
break;
case EVENT_DRIVEN:
if (pc.getBase()!=null && pc.getBase().getCommType()!=CommunicationType.EVENT_DRIVEN)
error("super protocol has to have same communication type", RoomPackage.Literals.PROTOCOL_CLASS__COMM_TYPE);
- if (RoomHelpers.getAllMessages(pc, true).isEmpty() && RoomHelpers.getAllMessages(pc, false).isEmpty())
+ if (roomHelpers.getAllMessages(pc, true).isEmpty() && roomHelpers.getAllMessages(pc, false).isEmpty())
error("at least one message (incoming or outgoing) must be defined", RoomPackage.Literals.PROTOCOL_CLASS__INCOMING_MESSAGES);
break;
case SYNCHRONOUS:
@@ -577,7 +586,7 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
warning("a derived protocol should add either incoming or outgoing messages, not both", RoomPackage.Literals.PROTOCOL_CLASS__OUTGOING_MESSAGES);
{
- List<Message> incoming = RoomHelpers.getAllMessages(pc, true);
+ List<Message> incoming = roomHelpers.getAllMessages(pc, true);
HashSet<String> inNames = new HashSet<String>();
for (Message in : incoming) {
if (!inNames.add(in.getName())) {
@@ -589,7 +598,7 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
}
{
- List<Message> outgoing = RoomHelpers.getAllMessages(pc, true);
+ List<Message> outgoing = roomHelpers.getAllMessages(pc, true);
HashSet<String> outNames = new HashSet<String>();
for (Message out : outgoing) {
if (!outNames.add(out.getName())) {
@@ -613,20 +622,20 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
@Check
public void checkMessageFromIf(MessageFromIf mfi){
if(mfi.getFrom() != null){
- if(RoomHelpers.getProtocol(mfi.getFrom()).getCommType() != CommunicationType.EVENT_DRIVEN)
+ if(roomHelpers.getProtocol(mfi.getFrom()).getCommType() != CommunicationType.EVENT_DRIVEN)
error("port must have event driven protocol", mfi, RoomPackage.eINSTANCE.getMessageFromIf_From());
}
}
@Check
public void checkOperation(StandardOperation op) {
- if (RoomHelpers.isConstructor(op)) {
+ if (roomHelpers.isConstructor(op)) {
if (!op.getArguments().isEmpty())
error("Constructor must have no arguments", RoomPackage.Literals.OPERATION__ARGUMENTS);
if (op.getReturnType()!=null)
error("Constructor must have no return type", RoomPackage.Literals.OPERATION__RETURN_TYPE);
}
- else if (RoomHelpers.isDestructor(op)) {
+ else if (roomHelpers.isDestructor(op)) {
if (!op.getArguments().isEmpty())
error("Destructor must have no arguments", RoomPackage.Literals.OPERATION__ARGUMENTS);
if (op.getReturnType()!=null)
@@ -679,7 +688,7 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
if (att.eContainer() instanceof ActorClass) {
ActorClass ac = (ActorClass) att.eContainer();
- if (ValidationUtil.isCircularClassHierarchy(ac))
+ if (roomHelpers.isCircularClassHierarchy(ac))
// is checked elsewhere
return;
@@ -691,7 +700,7 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
}
else if (att.eContainer() instanceof DataClass) {
DataClass dc = (DataClass) att.eContainer();
- if (ValidationUtil.isCircularClassHierarchy(dc))
+ if (roomHelpers.isCircularClassHierarchy(dc))
// is checked elsewhere
return;
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidationUtil.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidationUtil.java
index a00a075f9..b88f54c10 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidationUtil.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidationUtil.java
@@ -37,7 +37,6 @@ import org.eclipse.etrice.core.room.ChoicepointTerminal;
import org.eclipse.etrice.core.room.CommunicationType;
import org.eclipse.etrice.core.room.CompoundProtocolClass;
import org.eclipse.etrice.core.room.ContinuationTransition;
-import org.eclipse.etrice.core.room.DataClass;
import org.eclipse.etrice.core.room.EntryPoint;
import org.eclipse.etrice.core.room.ExitPoint;
import org.eclipse.etrice.core.room.ExternalPort;
@@ -77,12 +76,18 @@ import org.eclipse.etrice.core.room.util.CompoundProtocolHelpers;
import org.eclipse.etrice.core.room.util.CompoundProtocolHelpers.Match;
import org.eclipse.etrice.core.room.util.RoomHelpers;
-public class ValidationUtil {
+import com.google.common.base.Function;
+import com.google.inject.Inject;
- /**
- *
- */
+public class ValidationUtil {
+
public static final String CONNECTED_SUB_COMPONENT_PORTS_MUST_BE_CONJUGATED_TO_EACH_OTHER = "connected sub component ports must be conjugated to each other";
+
+ @Inject
+ private RoomHelpers roomHelpers;
+
+ @Inject
+ private RoomNameProvider roomNameProvider;
public static class Result {
private boolean ok;
@@ -128,113 +133,14 @@ public class ValidationUtil {
return index;
}
}
-
- public static boolean isCircularClassHierarchy(DataClass dc) {
- HashSet<DataClass> classes = new HashSet<DataClass>();
- classes.add(dc);
-
- while (dc.getBase()!=null) {
- dc = dc.getBase();
- if (classes.contains(dc))
- return true;
-
- classes.add(dc);
- }
-
- return false;
- }
-
- public static boolean isCircularClassHierarchy(ProtocolClass pc) {
- HashSet<ProtocolClass> classes = new HashSet<ProtocolClass>();
- classes.add(pc);
-
- while (pc.getBase()!=null) {
- pc = pc.getBase();
- if (classes.contains(pc))
- return true;
-
- classes.add(pc);
- }
-
- return false;
- }
-
- /**
- * check whether ac2 is super type of ac1
- * @param ac1
- * @param ac2
- * @return <code>true</code> if ac1 or one of its base types is identical to ac2
- */
- private static boolean isKindOf(ActorClass ac1, ActorClass ac2) {
- if (ac2==null)
- return false;
-
- if (ac1==null || isCircularClassHierarchy(ac1))
- return false;
-
- while (ac1!=null) {
- if (ac2==ac1)
- return true;
-
- ac1 = ac1.getBase();
- }
- return false;
- }
- public static boolean isCircularClassHierarchy(ActorClass ac) {
- HashSet<ActorClass> classes = new HashSet<ActorClass>();
- classes.add(ac);
-
- while (ac.getBase()!=null) {
- ac = ac.getBase();
- if (classes.contains(ac))
- return true;
-
- classes.add(ac);
- }
-
- return false;
- }
-
- /**
- * check if ref recursively is referencing ac
- * @param ref
- * @param ac
- * @return <code>true</code> if ref recursively is referencing ac
- */
- public static boolean isReferencing(ActorClass ref, ActorClass ac) {
- if (isKindOf(ref,ac))
- return true;
-
- Set<ActorClass> visited = new HashSet<ActorClass>();
- LinkedList<ActorClass> stack = new LinkedList<ActorClass>();
- visited.add(ac);
- stack.push(ref);
-
- ActorClass next;
- while(!stack.isEmpty()){
- next = stack.pop();
- if(visited.contains(next))
- continue;
-
- for (ActorRef ar : next.getActorRefs()) {
- if (isKindOf(ar.getType(), ac) || isKindOf(next, ar.getType()))
- return true;
- stack.push(ar.getType());
- }
- visited.add(next);
- }
-
- return false;
- }
-
/**
* check if compound protocol is circular
* @param ref
* @param cpc
* @return <code>true</code> if cpc contains a cycle
*/
- public static boolean isCircular(CompoundProtocolClass ref, CompoundProtocolClass cpc) {
+ public boolean isCircular(CompoundProtocolClass ref, CompoundProtocolClass cpc) {
Set<CompoundProtocolClass> visited = new HashSet<CompoundProtocolClass>();
LinkedList<CompoundProtocolClass> stack = new LinkedList<CompoundProtocolClass>();
visited.add(cpc);
@@ -265,11 +171,11 @@ public class ValidationUtil {
* @param port
* @return ok if connectable
*/
- public static Result isConnectable(Port port, ActorContainerRef ref, StructureClass acc) {
+ public Result isConnectable(Port port, ActorContainerRef ref, StructureClass acc) {
return isConnectable(port, ref, acc, null);
}
- public static Result isConnectable(Port port, ActorContainerRef ref, StructureClass acc, Binding exclude) {
+ public Result isConnectable(Port port, ActorContainerRef ref, StructureClass acc, Binding exclude) {
if (!isMultipleConnectable(port, ref) && isConnected(port, ref, acc, exclude))
return Result.error("port with multiplicity 1 is already connected");
@@ -283,20 +189,20 @@ public class ValidationUtil {
return Result.ok();
}
- public static boolean isMultipleConnectable(Port port, ActorContainerRef ref) {
+ public boolean isMultipleConnectable(Port port, ActorContainerRef ref) {
if (port.isReplicated())
return true;
if (ref!=null && ref instanceof ActorRef && ((ActorRef)ref).getMultiplicity()>1)
return true;
- if (RoomHelpers.isRelay(port) && port.getProtocol() instanceof CompoundProtocolClass)
+ if (roomHelpers.isRelay(port) && port.getProtocol() instanceof CompoundProtocolClass)
return true;
if (port.getProtocol() instanceof ProtocolClass && ((ProtocolClass)port.getProtocol()).getCommType() == CommunicationType.DATA_DRIVEN) {
if (ref == null) {
// this port is local in the structure class
- if (RoomHelpers.isRelay(port))
+ if (roomHelpers.isRelay(port))
return !port.isConjugated();
else
return port.isConjugated();
@@ -308,24 +214,24 @@ public class ValidationUtil {
return false;
}
- public static Result isValid(Binding bind) {
+ public Result isValid(Binding bind) {
return isConnectable(
bind.getEndpoint1().getPort(), bind.getEndpoint1().getActorRef(), bind.getEndpoint1().getSub(),
bind.getEndpoint2().getPort(), bind.getEndpoint2().getActorRef(), bind.getEndpoint2().getSub(),
(StructureClass)bind.eContainer(), bind, true);
}
- public static Result isConnectable(BindingEndPoint ep1, BindingEndPoint ep2, StructureClass sc) {
+ public Result isConnectable(BindingEndPoint ep1, BindingEndPoint ep2, StructureClass sc) {
return isConnectable(ep1.getPort(), ep1.getActorRef(), ep1.getSub(), ep2.getPort(), ep2.getActorRef(), ep2.getSub(), sc);
}
- public static Result isConnectable(
+ public Result isConnectable(
Port p1, ActorContainerRef ref1, SubProtocol sub1,
Port p2, ActorContainerRef ref2, SubProtocol sub2, StructureClass sc) {
return isConnectable(p1, ref1, sub1, p2, ref2, sub2, sc, null, true);
}
- public static Result isConnectable(
+ public Result isConnectable(
Port p1, ActorContainerRef ref1, SubProtocol sub1,
Port p2, ActorContainerRef ref2, SubProtocol sub2,
StructureClass sc, Binding exclude,
@@ -378,19 +284,19 @@ public class ValidationUtil {
if (!(pc1 instanceof ProtocolClass && pc2 instanceof ProtocolClass))
return Result.error("protocols don't match");
- if (RoomHelpers.isDerivedFrom((ProtocolClass)pc1, (ProtocolClass)pc2)) {
- if (RoomHelpers.getAllMessages((ProtocolClass)pc1,true).size() > RoomHelpers.getAllMessages((ProtocolClass)pc2,true).size())
+ if (roomHelpers.isDerivedFrom((ProtocolClass)pc1, (ProtocolClass)pc2)) {
+ if (roomHelpers.getAllMessages((ProtocolClass)pc1,true).size() > roomHelpers.getAllMessages((ProtocolClass)pc2,true).size())
pc1extendsIncoming = true;
- if (RoomHelpers.getAllMessages((ProtocolClass)pc1,false).size()>RoomHelpers.getAllMessages((ProtocolClass)pc2,false).size())
+ if (roomHelpers.getAllMessages((ProtocolClass)pc1,false).size()>roomHelpers.getAllMessages((ProtocolClass)pc2,false).size())
pc1extendsOutgoing = true;
if (pc1extendsIncoming && pc1extendsOutgoing)
return Result.error("derived protocols not connectable (both directions extended)");
}
- else if (RoomHelpers.isDerivedFrom((ProtocolClass)pc2, (ProtocolClass)pc1)) {
- if (RoomHelpers.getAllMessages((ProtocolClass)pc2,true).size()>RoomHelpers.getAllMessages((ProtocolClass)pc1,true).size())
+ else if (roomHelpers.isDerivedFrom((ProtocolClass)pc2, (ProtocolClass)pc1)) {
+ if (roomHelpers.getAllMessages((ProtocolClass)pc2,true).size()>roomHelpers.getAllMessages((ProtocolClass)pc1,true).size())
pc2extendsIncoming = true;
- if (RoomHelpers.getAllMessages((ProtocolClass)pc2,false).size()>RoomHelpers.getAllMessages((ProtocolClass)pc1,false).size())
+ if (roomHelpers.getAllMessages((ProtocolClass)pc2,false).size()>roomHelpers.getAllMessages((ProtocolClass)pc1,false).size())
pc2extendsOutgoing = true;
if (pc2extendsIncoming && pc2extendsOutgoing)
return Result.error("derived protocols not connectable (both directions extended)");
@@ -484,7 +390,7 @@ public class ValidationUtil {
return Result.error("local port '"+local.getName()+"' must have multiplicity any");
}
}
- if (RoomHelpers.isRelay(local)) {
+ if (roomHelpers.isRelay(local)) {
if (local.isConjugated()!=sub.isConjugated())
return Result.error("relay port must have same direction as local port");
@@ -553,7 +459,7 @@ public class ValidationUtil {
* @param exclude
* @return
*/
- private static boolean alreadyConnected(Port p1, ActorContainerRef ref1,
+ private boolean alreadyConnected(Port p1, ActorContainerRef ref1,
Port p2, ActorContainerRef ref2, StructureClass sc, Binding exclude) {
HashSet<String> bindings = new HashSet<String>();
@@ -571,7 +477,7 @@ public class ValidationUtil {
return false;
}
- private static String getKey(Port p1, ActorContainerRef ref1, Port p2, ActorContainerRef ref2) {
+ private String getKey(Port p1, ActorContainerRef ref1, Port p2, ActorContainerRef ref2) {
String ep1 = getEndpointName(p1, ref1);
String ep2 = getEndpointName(p2, ref2);
// we order endpoint names to be able to identify bindings with exchanged endpoints
@@ -582,14 +488,14 @@ public class ValidationUtil {
* @param ref1
* @return
*/
- private static String getEndpointName(Port p1, ActorContainerRef ref1) {
+ private String getEndpointName(Port p1, ActorContainerRef ref1) {
if (ref1==null)
return p1.getName()+"#.";
else
return p1.getName()+"#"+ref1.getName();
}
- public static Result isFreeOfReferences(Port port) {
+ public Result isFreeOfReferences(Port port) {
Collection<Setting> refs = EcoreUtil.UsageCrossReferencer.find(port, port.eResource().getResourceSet());
boolean bound = false;
boolean usedByFSM = false;
@@ -610,7 +516,7 @@ public class ValidationUtil {
return Result.ok();
}
- public static boolean isReferencedAsReplicatedInModel(ActorClass ac) {
+ public boolean isReferencedAsReplicatedInModel(ActorClass ac) {
Collection<Setting> refs = EcoreUtil.UsageCrossReferencer.find(ac, ac.eResource().getResourceSet());
for (Setting ref : refs) {
if (ref.getEObject() instanceof ActorRef)
@@ -620,11 +526,11 @@ public class ValidationUtil {
return false;
}
- public static boolean isConnected(Port port, ActorContainerRef ref, StructureClass sc) {
+ public boolean isConnected(Port port, ActorContainerRef ref, StructureClass sc) {
return isConnected(port, ref, sc, null);
}
- public static boolean isConnected(Port port, ActorContainerRef ref, StructureClass sc, Binding exclude) {
+ public boolean isConnected(Port port, ActorContainerRef ref, StructureClass sc, Binding exclude) {
for (Binding bind : sc.getBindings()) {
if (bind!=exclude) {
if (isEndpoint(bind.getEndpoint1(), port, ref))
@@ -641,11 +547,11 @@ public class ValidationUtil {
return false;
}
- private static boolean isEndpoint(BindingEndPoint ep, Port port, ActorContainerRef ref) {
+ private boolean isEndpoint(BindingEndPoint ep, Port port, ActorContainerRef ref) {
return ep.getActorRef()==ref && ep.getPort()==port;
}
- public static boolean isRelay(SPP spp) {
+ public boolean isRelay(SPP spp) {
ActorContainerClass acc = (ActorContainerClass) spp.eContainer();
if (acc instanceof ActorClass) {
ActorClass ac = (ActorClass) acc;
@@ -657,7 +563,7 @@ public class ValidationUtil {
return true;
}
- public static Result isValid(LayerConnection lc) {
+ public Result isValid(LayerConnection lc) {
if (lc.getFrom() instanceof RelaySAPoint)
return isConnectable(((RelaySAPoint)lc.getFrom()).getRelay(), null, lc.getTo().getService(), lc.getTo().getRef(), (StructureClass)lc.eContainer(), lc);
else if (lc.getFrom() instanceof RefSAPoint)
@@ -668,12 +574,12 @@ public class ValidationUtil {
}
}
- public static Result isConnectable(SPP src, ActorContainerRef srcRef,
+ public Result isConnectable(SPP src, ActorContainerRef srcRef,
SPP tgt, ActorContainerRef tgtRef, StructureClass ac) {
return isConnectable(src, srcRef, tgt, tgtRef, ac, null);
}
- public static Result isConnectable(SPP src, ActorContainerRef srcRef,
+ public Result isConnectable(SPP src, ActorContainerRef srcRef,
SPP dst, ActorContainerRef dstRef, StructureClass sc, LayerConnection exclude) {
if (sc==null) {
@@ -697,12 +603,12 @@ public class ValidationUtil {
return Result.ok();
}
- public static boolean isConnectableSrc(SPP src, ActorContainerRef ref,
+ public boolean isConnectableSrc(SPP src, ActorContainerRef ref,
StructureClass sc) {
return isConnectableSrc(src, ref, sc, null);
}
- public static boolean isConnectableSrc(SPP src, ActorContainerRef ref,
+ public boolean isConnectableSrc(SPP src, ActorContainerRef ref,
StructureClass sc, LayerConnection exclude) {
if (sc==null) {
@@ -728,7 +634,7 @@ public class ValidationUtil {
return true;
}
- public static boolean isReferencedInModel(SPP spp) {
+ public boolean isReferencedInModel(SPP spp) {
Collection<Setting> refs = EcoreUtil.UsageCrossReferencer.find(spp, spp.eResource().getResourceSet());
for (Setting ref : refs) {
if (ref.getEObject() instanceof ServiceImplementation)
@@ -742,11 +648,11 @@ public class ValidationUtil {
return false;
}
- public static boolean isConnectedSrc(SPP src, StructureClass sc) {
+ public boolean isConnectedSrc(SPP src, StructureClass sc) {
return isConnectedSrc(src, sc, null);
}
- public static boolean isConnectedSrc(SPP src, StructureClass sc, LayerConnection exclude) {
+ public boolean isConnectedSrc(SPP src, StructureClass sc, LayerConnection exclude) {
for (LayerConnection lc : sc.getConnections()) {
if (lc!=exclude)
if (lc.getFrom() instanceof RelaySAPoint) {
@@ -771,12 +677,12 @@ public class ValidationUtil {
return false;
}
- public static boolean isConnectableDst(SPP src, ActorContainerRef ref,
+ public boolean isConnectableDst(SPP src, ActorContainerRef ref,
StructureClass sc) {
return isConnectableDst(src, ref, sc, null);
}
- public static boolean isConnectableDst(SPP dst, ActorContainerRef ref,
+ public boolean isConnectableDst(SPP dst, ActorContainerRef ref,
StructureClass sc, LayerConnection exclude) {
if (sc==null) {
@@ -794,11 +700,11 @@ public class ValidationUtil {
return true;
}
- public static boolean isConnectedDst(SPP src, ActorContainerRef acr, StructureClass sc) {
+ public boolean isConnectedDst(SPP src, ActorContainerRef acr, StructureClass sc) {
return isConnectedDst(src, acr, sc, null);
}
- public static boolean isConnectedDst(SPP src, ActorContainerRef acr, StructureClass sc, LayerConnection exclude) {
+ public boolean isConnectedDst(SPP src, ActorContainerRef acr, StructureClass sc, LayerConnection exclude) {
for (LayerConnection lc : sc.getConnections()) {
if (lc!=exclude)
if (lc.getTo().getService()==src && lc.getTo().getRef()==acr)
@@ -812,11 +718,11 @@ public class ValidationUtil {
return false;
}
- public static Result isConnectable(TransitionTerminal src, TransitionTerminal tgt, StateGraph sg) {
+ public Result isConnectable(TransitionTerminal src, TransitionTerminal tgt, StateGraph sg) {
return isConnectable(src, tgt, null, sg);
}
- public static Result isConnectable(TransitionTerminal src, TransitionTerminal tgt, Transition trans, StateGraph sg) {
+ public Result isConnectable(TransitionTerminal src, TransitionTerminal tgt, Transition trans, StateGraph sg) {
Result result = isConnectableSrc(src, trans, sg);
if (!result.isOk())
return result;
@@ -872,11 +778,11 @@ public class ValidationUtil {
return Result.ok();
}
- public static Result isConnectable(TransitionTerminal src, StateGraph sg) {
+ public Result isConnectable(TransitionTerminal src, StateGraph sg) {
return isConnectableSrc(src, null, sg);
}
- public static Result isConnectableSrc(TransitionTerminal src, Transition trans, StateGraph sg) {
+ public Result isConnectableSrc(TransitionTerminal src, Transition trans, StateGraph sg) {
if (src==null) {
for (Transition t : sg.getTransitions()) {
if (t==trans)
@@ -927,7 +833,7 @@ public class ValidationUtil {
return Result.ok();
}
- public static Result isValid(TrPoint tp) {
+ public Result isValid(TrPoint tp) {
if (!isUniqueName(tp, tp.getName()).isOk())
return Result.error("name is not unique", tp, RoomPackage.Literals.TR_POINT__NAME);
@@ -943,11 +849,11 @@ public class ValidationUtil {
}
- public static Result isUniqueName(InterfaceItem item) {
+ public Result isUniqueName(InterfaceItem item) {
return isUniqueName(item, item.getName());
}
- public static boolean isConnectedOutside(TrPoint tp) {
+ public boolean isConnectedOutside(TrPoint tp) {
if (tp instanceof TransitionPoint)
return false;
@@ -970,7 +876,7 @@ public class ValidationUtil {
return false;
}
- public static Result isUniqueName(InterfaceItem item, String name) {
+ public Result isUniqueName(InterfaceItem item, String name) {
if (name.isEmpty())
return Result.error("name must not be empty");
@@ -980,7 +886,7 @@ public class ValidationUtil {
if (item.eContainer() instanceof ActorClass) {
ArrayList<InterfaceItem> all = new ArrayList<InterfaceItem>();
ActorClass ac = (ActorClass) item.eContainer();
- if (isCircularClassHierarchy(ac))
+ if (roomHelpers.isCircularClassHierarchy(ac))
return Result.ok();
do {
@@ -1018,7 +924,7 @@ public class ValidationUtil {
return Result.ok();
}
- public static Result isUniqueName(StateGraphItem s, String name) {
+ public Result isUniqueName(StateGraphItem s, String name) {
if (name.trim().isEmpty())
return Result.error("name must not be empty");
@@ -1026,7 +932,7 @@ public class ValidationUtil {
return Result.error("name is no valid ID");
StateGraph sg = (StateGraph) s.eContainer();
- Set<String> names = RoomHelpers.getAllNames(sg, s);
+ Set<String> names = roomHelpers.getAllNames(sg, s);
if (names.contains(name))
return Result.error("name already used");
@@ -1038,8 +944,8 @@ public class ValidationUtil {
* @param tr
* @return the {@link Result} of the check
*/
- public static Result checkTransition(Transition tr) {
- ActorClass ac = RoomHelpers.getActorClass(tr);
+ public Result checkTransition(Transition tr) {
+ ActorClass ac = roomHelpers.getActorClass(tr);
if (ac.getCommType()==ActorCommunicationType.DATA_DRIVEN) {
if (tr instanceof TriggeredTransition)
return Result.error("data driven state machine must not contain triggered transition",
@@ -1056,7 +962,7 @@ public class ValidationUtil {
((StateGraph)tr.eContainer()).getTransitions().indexOf(tr));
}
else if (tr instanceof GuardedTransition)
- if (!RoomHelpers.hasDetailCode(((GuardedTransition) tr).getGuard()))
+ if (!roomHelpers.hasDetailCode(((GuardedTransition) tr).getGuard()))
return Result.error("guard must not be empty", tr, RoomPackage.eINSTANCE.getGuardedTransition_Guard());
}
else if (ac.getCommType()==ActorCommunicationType.EVENT_DRIVEN) {
@@ -1090,9 +996,9 @@ public class ValidationUtil {
return Result.ok();
}
- public static Result checkState(State state) {
+ public Result checkState(State state) {
if (state.getDoCode()!=null) {
- ActorClass ac = RoomHelpers.getActorClass(state);
+ ActorClass ac = roomHelpers.getActorClass(state);
if (ac.getCommType()==ActorCommunicationType.EVENT_DRIVEN) {
return Result.error("event driven state machines must not have 'do' action code",
state,
@@ -1102,15 +1008,16 @@ public class ValidationUtil {
return Result.ok();
}
- public static List<Result> checkTopLevelRefinedStates(ActorClass ac) {
+ public List<Result> checkTopLevelRefinedStates(ActorClass ac) {
ArrayList<Result> errors = new ArrayList<ValidationUtil.Result>();
if (ac.getStateMachine()==null)
return errors;
- Map<RefinedState, RefinedState> rs2parent = RoomHelpers.getRefinedStatesToRelocate(ac);
+ Function<RefinedState, String> nameProvider = roomNameProvider.getRefinedStateNameProvider();
+ Map<RefinedState, RefinedState> rs2parent = roomHelpers.getRefinedStatesToRelocate(ac, nameProvider);
for (RefinedState rs : rs2parent.keySet()) {
RefinedState parent = rs2parent.get(rs);
- String path = RoomNameProvider.getFullPath(parent);
+ String path = roomNameProvider.getFullPath(parent);
int idx = ((StateGraph)rs.eContainer()).getStates().indexOf(rs);
errors.add(Result.error(
"RefinedState has to be in the context of "+path,
@@ -1122,7 +1029,7 @@ public class ValidationUtil {
return errors;
}
- public static boolean isValidID(String name) {
+ public boolean isValidID(String name) {
return name.matches("\\^?[a-zA-Z_][a-zA-Z_0-9]*");
}
}
diff --git a/plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostprocessor.java b/plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostprocessor.java
index c3954aabc..b10a9c689 100644
--- a/plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostprocessor.java
+++ b/plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostprocessor.java
@@ -89,7 +89,6 @@ public class ImplPostprocessor {
PostprocessingHelpers.addOperation(interfaceItem, "getGeneralProtocol", _eClassifier_3, Integer.valueOf(1), _builder_3.toString());
final EClass actorClass = PostprocessingHelpers.getClass(roomPackage, "ActorClass");
EClassifier _eClassifier_4 = roomPackage.getEClassifier("Port");
- int _minus = (-1);
StringConcatenation _builder_4 = new StringConcatenation();
_builder_4.append("EList<Port> ports = new org.eclipse.emf.common.util.BasicEList<Port>();");
_builder_4.newLine();
@@ -102,9 +101,8 @@ public class ImplPostprocessor {
_builder_4.newLine();
_builder_4.append("return ports;");
_builder_4.newLine();
- PostprocessingHelpers.addOperation(actorClass, "getExternalEndPorts", _eClassifier_4, Integer.valueOf(_minus), _builder_4.toString());
+ PostprocessingHelpers.addOperation(actorClass, "getExternalEndPorts", _eClassifier_4, Integer.valueOf((-1)), _builder_4.toString());
EClassifier _eClassifier_5 = roomPackage.getEClassifier("Port");
- int _minus_1 = (-1);
StringConcatenation _builder_5 = new StringConcatenation();
_builder_5.append("EList<Port> ports = new org.eclipse.emf.common.util.BasicEList<Port>(getInterfacePorts());");
_builder_5.newLine();
@@ -117,9 +115,8 @@ public class ImplPostprocessor {
_builder_5.newLine();
_builder_5.append("return ports;");
_builder_5.newLine();
- PostprocessingHelpers.addOperation(actorClass, "getRelayPorts", _eClassifier_5, Integer.valueOf(_minus_1), _builder_5.toString());
+ PostprocessingHelpers.addOperation(actorClass, "getRelayPorts", _eClassifier_5, Integer.valueOf((-1)), _builder_5.toString());
EClassifier _eClassifier_6 = roomPackage.getEClassifier("SPP");
- int _minus_2 = (-1);
StringConcatenation _builder_6 = new StringConcatenation();
_builder_6.append("EList<SPP> spps = new org.eclipse.emf.common.util.BasicEList<SPP>();");
_builder_6.newLine();
@@ -132,7 +129,7 @@ public class ImplPostprocessor {
_builder_6.newLine();
_builder_6.append("return spps;");
_builder_6.newLine();
- PostprocessingHelpers.addOperation(actorClass, "getImplementedSPPs", _eClassifier_6, Integer.valueOf(_minus_2), _builder_6.toString());
+ PostprocessingHelpers.addOperation(actorClass, "getImplementedSPPs", _eClassifier_6, Integer.valueOf((-1)), _builder_6.toString());
final EClass actorContainerRef = PostprocessingHelpers.getClass(roomPackage, "ActorContainerRef");
EClassifier _eClassifier_7 = roomPackage.getEClassifier("StructureClass");
StringConcatenation _builder_7 = new StringConcatenation();
@@ -212,10 +209,9 @@ public class ImplPostprocessor {
_builder_11.newLine();
_builder_11.append("return et.getName() + \".\" + this.getName();");
_builder_11.newLine();
- boolean _addOperation = PostprocessingHelpers.addOperation(enumLiteral,
+ _xblockexpression = PostprocessingHelpers.addOperation(enumLiteral,
"getFullName", _eClassifier_11,
Integer.valueOf(1), _builder_11.toString());
- _xblockexpression = (_addOperation);
}
return _xblockexpression;
}
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
index 16af40b6f..91eb3586a 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
@@ -38,13 +38,14 @@ import org.eclipse.etrice.generator.generic.ILanguageExtension
import org.eclipse.xtext.util.Pair
import org.eclipse.etrice.core.room.EnumerationType
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
+import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.etrice.core.room.EnumLiteral
@Singleton
class CExtensions implements ILanguageExtension {
- @Inject IDiagnostician diagnostician
+ @Inject protected IDiagnostician diagnostician
+ @Inject protected extension RoomHelpers
override String getTypedDataDefinition(Message m) {
generateArglistAndTypedData(m.data).get(1)
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/DataClassGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/DataClassGen.xtend
index 812df2dab..a2e513e2b 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/DataClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/DataClassGen.xtend
@@ -22,7 +22,7 @@ import org.eclipse.etrice.generator.base.IGeneratorFileIo
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
+import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.etrice.core.room.RoomModel
import org.eclipse.etrice.core.room.Operation
@@ -30,6 +30,7 @@ import org.eclipse.etrice.core.room.Operation
class DataClassGen {
@Inject IGeneratorFileIo fileIO
+ @Inject extension RoomHelpers
@Inject extension CExtensions
@Inject extension RoomExtensions
@Inject extension ProcedureHelpers
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Initialization.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Initialization.xtend
index a85e217b6..49c9edc77 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Initialization.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Initialization.xtend
@@ -26,12 +26,12 @@ import org.eclipse.etrice.core.room.PrimitiveType
import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
import org.eclipse.etrice.core.room.EnumerationType
class Initialization {
@Inject CExtensions languageExt
+ @Inject extension RoomHelpers
@Inject extension RoomExtensions
@Inject extension TypeHelpers
@@ -97,7 +97,7 @@ class Initialization {
if(value == null)
value = switch instance {
ActorInstance: path.getAttrClassConfigValue(instance.actorClass, true)
- InterfaceItemInstance: path.getAttrClassConfigValue(RoomHelpers::getPortClass(instance.interfaceItem))
+ InterfaceItemInstance: path.getAttrClassConfigValue(getPortClass(instance.interfaceItem))
}
if(value == null)
value = path.last.defaultValueLiteral
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend
index a5b2eb2de..817e0601b 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend
@@ -45,14 +45,14 @@ import org.eclipse.etrice.generator.generic.ILanguageExtension
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
+import org.eclipse.etrice.core.room.util.RoomHelpers
-import static extension org.eclipse.etrice.core.common.base.util.BaseHelpers.*
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
import org.eclipse.etrice.core.common.converter.TimeConverter
@Singleton
class NodeGen {
+ @Inject extension RoomHelpers
@Inject extension CExtensions
@Inject extension RoomExtensions
@Inject extension TypeHelpers
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.xtend
index 67b3f9717..ca03d681c 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.xtend
@@ -20,12 +20,12 @@ import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance
import org.eclipse.xtext.generator.JavaIoFileSystemAccess
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.core.etmap.util.ETMapUtil
-
-import static extension org.eclipse.etrice.core.common.base.util.BaseHelpers.*
+import org.eclipse.etrice.core.common.base.util.BaseHelpers
@Singleton
class NodeRunnerGen {
+ @Inject extension BaseHelpers
@Inject extension JavaIoFileSystemAccess fileAccess
@Inject extension CExtensions
@Inject extension RoomExtensions
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java
index 7be25a985..6e1af3c37 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java
@@ -38,7 +38,6 @@ import org.eclipse.etrice.core.room.ServiceImplementation;
import org.eclipse.etrice.core.room.StandardOperation;
import org.eclipse.etrice.core.room.StateGraph;
import org.eclipse.etrice.core.room.VarDecl;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.generator.base.GlobalGeneratorSettings;
import org.eclipse.etrice.generator.base.IGeneratorFileIo;
import org.eclipse.etrice.generator.c.Main;
@@ -105,7 +104,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
CharSequence _generateUtilsFile = this.generateUtilsFile(root, xpac);
this.fileIO.generateFile("generating ActorClass utils", path, infopath, file, _generateUtilsFile);
ActorClass _actorClass_6 = xpac.getActorClass();
- boolean _isBehaviorAnnotationPresent = RoomHelpers.isBehaviorAnnotationPresent(_actorClass_6, "BehaviorManual");
+ boolean _isBehaviorAnnotationPresent = this._roomHelpers.isBehaviorAnnotationPresent(_actorClass_6, "BehaviorManual");
if (_isBehaviorAnnotationPresent) {
ActorClass _actorClass_7 = xpac.getActorClass();
String _name = _actorClass_7.getName();
@@ -127,7 +126,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
CharSequence _xblockexpression = null;
{
final ActorClass ac = xpac.getActorClass();
- List<Port> _allEndPorts = RoomHelpers.getAllEndPorts(ac);
+ List<Port> _allEndPorts = this._roomHelpers.getAllEndPorts(ac);
final Function1<Port, Boolean> _function = new Function1<Port, Boolean>() {
public Boolean apply(final Port p) {
GeneralProtocolClass _protocol = p.getProtocol();
@@ -136,7 +135,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
}
};
final Iterable<Port> eventPorts = IterableExtensions.<Port>filter(_allEndPorts, _function);
- List<Port> _allEndPorts_1 = RoomHelpers.getAllEndPorts(ac);
+ List<Port> _allEndPorts_1 = this._roomHelpers.getAllEndPorts(ac);
final Function1<Port, Boolean> _function_1 = new Function1<Port, Boolean>() {
public Boolean apply(final Port p) {
boolean _and = false;
@@ -153,7 +152,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
}
};
final Iterable<Port> sendPorts = IterableExtensions.<Port>filter(_allEndPorts_1, _function_1);
- List<Port> _allEndPorts_2 = RoomHelpers.getAllEndPorts(ac);
+ List<Port> _allEndPorts_2 = this._roomHelpers.getAllEndPorts(ac);
final Function1<Port, Boolean> _function_2 = new Function1<Port, Boolean>() {
public Boolean apply(final Port p) {
boolean _and = false;
@@ -189,14 +188,14 @@ public class ActorClassGen extends GenericActorClassGenerator {
if (!_and_2) {
_and_1 = false;
} else {
- List<SAP> _allSAPs = RoomHelpers.getAllSAPs(ac);
+ List<SAP> _allSAPs = this._roomHelpers.getAllSAPs(ac);
boolean _isEmpty_2 = _allSAPs.isEmpty();
_and_1 = _isEmpty_2;
}
if (!_and_1) {
_and = false;
} else {
- List<ServiceImplementation> _allServiceImplementations = RoomHelpers.getAllServiceImplementations(ac);
+ List<ServiceImplementation> _allServiceImplementations = this._roomHelpers.getAllServiceImplementations(ac);
boolean _isEmpty_3 = _allServiceImplementations.isEmpty();
_and = _isEmpty_3;
}
@@ -216,7 +215,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
if (!_isEmpty_4) {
_and_5 = false;
} else {
- List<Attribute> _allAttributes = RoomHelpers.getAllAttributes(ac);
+ List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(ac);
boolean _isEmpty_5 = _allAttributes.isEmpty();
_and_5 = _isEmpty_5;
}
@@ -224,7 +223,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_and_4 = false;
} else {
StateGraph _stateMachine = xpac.getStateMachine();
- boolean _isEmpty_6 = RoomHelpers.isEmpty(_stateMachine);
+ boolean _isEmpty_6 = this._roomHelpers.isEmpty(_stateMachine);
_and_4 = _isEmpty_6;
}
if (!_and_4) {
@@ -375,7 +374,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append("/* saps */");
_builder.newLine();
{
- List<SAP> _allSAPs_1 = RoomHelpers.getAllSAPs(ac);
+ List<SAP> _allSAPs_1 = this._roomHelpers.getAllSAPs(ac);
for(final SAP sap : _allSAPs_1) {
_builder.append("\t");
_builder.append("const ");
@@ -394,7 +393,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append("/* replicated ports */");
_builder.newLine();
{
- List<Port> _allEndPorts_3 = RoomHelpers.getAllEndPorts(ac);
+ List<Port> _allEndPorts_3 = this._roomHelpers.getAllEndPorts(ac);
for(final Port ep_2 : _allEndPorts_3) {
{
int _multiplicity_2 = ep_2.getMultiplicity();
@@ -416,7 +415,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append("/* services */");
_builder.newLine();
{
- List<ServiceImplementation> _allServiceImplementations_1 = RoomHelpers.getAllServiceImplementations(ac);
+ List<ServiceImplementation> _allServiceImplementations_1 = this._roomHelpers.getAllServiceImplementations(ac);
for(final ServiceImplementation svc : _allServiceImplementations_1) {
_builder.append("\t");
_builder.append("const etReplPort ");
@@ -440,7 +439,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.newLine();
{
StateGraph _stateMachine_1 = xpac.getStateMachine();
- boolean _isEmpty_7 = RoomHelpers.isEmpty(_stateMachine_1);
+ boolean _isEmpty_7 = this._roomHelpers.isEmpty(_stateMachine_1);
boolean _not_1 = (!_isEmpty_7);
if (_not_1) {
_builder.newLine();
@@ -495,7 +494,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
- List<Attribute> _allAttributes_1 = RoomHelpers.getAllAttributes(ac);
+ List<Attribute> _allAttributes_1 = this._roomHelpers.getAllAttributes(ac);
CharSequence _attributes = this._procedureHelpers.attributes(_allAttributes_1);
_builder.append(_attributes, "\t");
_builder.newLineIfNotEmpty();
@@ -503,7 +502,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.newLine();
{
StateGraph _stateMachine_2 = xpac.getStateMachine();
- boolean _isEmpty_8 = RoomHelpers.isEmpty(_stateMachine_2);
+ boolean _isEmpty_8 = this._roomHelpers.isEmpty(_stateMachine_2);
boolean _not_2 = (!_isEmpty_8);
if (_not_2) {
_builder.append("\t");
@@ -599,7 +598,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
CharSequence _xblockexpression = null;
{
final ActorClass ac = xpac.getActorClass();
- List<Port> _allEndPorts = RoomHelpers.getAllEndPorts(ac);
+ List<Port> _allEndPorts = this._roomHelpers.getAllEndPorts(ac);
final Function1<Port, Boolean> _function = new Function1<Port, Boolean>() {
public Boolean apply(final Port p) {
GeneralProtocolClass _protocol = p.getProtocol();
@@ -615,7 +614,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
}
};
final Iterable<Port> replEventPorts = IterableExtensions.<Port>filter(eventPorts, _function_1);
- List<Port> _allEndPorts_1 = RoomHelpers.getAllEndPorts(ac);
+ List<Port> _allEndPorts_1 = this._roomHelpers.getAllEndPorts(ac);
final Function1<Port, Boolean> _function_2 = new Function1<Port, Boolean>() {
public Boolean apply(final Port p) {
boolean _and = false;
@@ -640,7 +639,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
}
};
final Iterable<Port> sendPorts = IterableExtensions.<Port>filter(_allEndPorts_1, _function_2);
- List<Port> _allEndPorts_2 = RoomHelpers.getAllEndPorts(ac);
+ List<Port> _allEndPorts_2 = this._roomHelpers.getAllEndPorts(ac);
final Function1<Port, Boolean> _function_3 = new Function1<Port, Boolean>() {
public Boolean apply(final Port p) {
boolean _and = false;
@@ -723,7 +722,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
Iterable<Port> _filter = IterableExtensions.<Port>filter(eventPorts, _function_4);
for(final Port ep : _filter) {
{
- List<Message> _outgoing = RoomHelpers.getOutgoing(ep);
+ List<Message> _outgoing = this._roomHelpers.getOutgoing(ep);
for(final Message msg : _outgoing) {
String _xifexpression = null;
VarDecl _data = msg.getData();
@@ -775,7 +774,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
{
for(final Port ep_1 : recvPorts) {
{
- List<Message> _incoming = RoomHelpers.getIncoming(ep_1);
+ List<Message> _incoming = this._roomHelpers.getIncoming(ep_1);
for(final Message msg_1 : _incoming) {
_builder.append("#define ");
String _name_7 = ep_1.getName();
@@ -804,7 +803,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
{
for(final Port ep_2 : sendPorts) {
{
- List<Message> _outgoing_1 = RoomHelpers.getOutgoing(ep_2);
+ List<Message> _outgoing_1 = this._roomHelpers.getOutgoing(ep_2);
for(final Message msg_2 : _outgoing_1) {
String _xifexpression_2 = null;
VarDecl _data_2 = msg_2.getData();
@@ -854,10 +853,10 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append("/* saps */");
_builder.newLine();
{
- List<SAP> _allSAPs = RoomHelpers.getAllSAPs(ac);
+ List<SAP> _allSAPs = this._roomHelpers.getAllSAPs(ac);
for(final SAP sap : _allSAPs) {
{
- List<Message> _outgoing_2 = RoomHelpers.getOutgoing(sap);
+ List<Message> _outgoing_2 = this._roomHelpers.getOutgoing(sap);
for(final Message msg_3 : _outgoing_2) {
String _xifexpression_4 = null;
VarDecl _data_4 = msg_3.getData();
@@ -917,7 +916,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
{
for(final Port ep_3 : replEventPorts) {
{
- List<Message> _outgoing_3 = RoomHelpers.getOutgoing(ep_3);
+ List<Message> _outgoing_3 = this._roomHelpers.getOutgoing(ep_3);
for(final Message msg_4 : _outgoing_3) {
String _xifexpression_6 = null;
VarDecl _data_6 = msg_4.getData();
@@ -988,11 +987,11 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append("/* services */");
_builder.newLine();
{
- List<ServiceImplementation> _allServiceImplementations = RoomHelpers.getAllServiceImplementations(ac);
+ List<ServiceImplementation> _allServiceImplementations = this._roomHelpers.getAllServiceImplementations(ac);
for(final ServiceImplementation svc : _allServiceImplementations) {
{
SPP _spp = svc.getSpp();
- List<Message> _outgoing_4 = RoomHelpers.getOutgoing(_spp);
+ List<Message> _outgoing_4 = this._roomHelpers.getOutgoing(_spp);
for(final Message msg_5 : _outgoing_4) {
String _xifexpression_8 = null;
VarDecl _data_8 = msg_5.getData();
@@ -1069,7 +1068,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append("/* operations */");
_builder.newLine();
{
- List<Operation> _allOperations = RoomHelpers.getAllOperations(ac);
+ List<Operation> _allOperations = this._roomHelpers.getAllOperations(ac);
for(final Operation op : _allOperations) {
final CharSequence args = this.argList(op);
_builder.newLineIfNotEmpty();
@@ -1102,7 +1101,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append("/* attributes */");
_builder.newLine();
{
- List<Attribute> _allAttributes = RoomHelpers.getAllAttributes(ac);
+ List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(ac);
for(final Attribute a : _allAttributes) {
_builder.append("#define ");
String _name_38 = a.getName();
@@ -1225,7 +1224,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.newLine();
{
StateGraph _stateMachine = xpac.getStateMachine();
- boolean _isEmpty = RoomHelpers.isEmpty(_stateMachine);
+ boolean _isEmpty = this._roomHelpers.isEmpty(_stateMachine);
boolean _not = (!_isEmpty);
if (_not) {
CharSequence _genStateMachine = this._stateMachineGen.genStateMachine(xpac);
@@ -1250,7 +1249,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.newLineIfNotEmpty();
{
StateGraph _stateMachine_1 = xpac.getStateMachine();
- boolean _isEmpty_1 = RoomHelpers.isEmpty(_stateMachine_1);
+ boolean _isEmpty_1 = this._roomHelpers.isEmpty(_stateMachine_1);
boolean _not_1 = (!_isEmpty_1);
if (_not_1) {
_builder.append("\t");
@@ -1279,7 +1278,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.newLineIfNotEmpty();
{
StateGraph _stateMachine_2 = xpac.getStateMachine();
- boolean _isEmpty_2 = RoomHelpers.isEmpty(_stateMachine_2);
+ boolean _isEmpty_2 = this._roomHelpers.isEmpty(_stateMachine_2);
boolean _not_2 = (!_isEmpty_2);
if (_not_2) {
_builder.append("\t");
@@ -1330,7 +1329,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.newLineIfNotEmpty();
{
StateGraph _stateMachine_3 = xpac.getStateMachine();
- boolean _isEmpty_3 = RoomHelpers.isEmpty(_stateMachine_3);
+ boolean _isEmpty_3 = this._roomHelpers.isEmpty(_stateMachine_3);
boolean _not_3 = (!_isEmpty_3);
if (_not_3) {
_builder.append("\t");
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java
index 0bfdc1248..bb21a9db1 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java
@@ -40,12 +40,17 @@ import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.util.Pair;
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
import org.eclipse.xtext.xbase.lib.Conversions;
+import org.eclipse.xtext.xbase.lib.Extension;
@Singleton
@SuppressWarnings("all")
public class CExtensions implements ILanguageExtension {
@Inject
- private IDiagnostician diagnostician;
+ protected IDiagnostician diagnostician;
+
+ @Inject
+ @Extension
+ protected RoomHelpers _roomHelpers;
public String getTypedDataDefinition(final Message m) {
VarDecl _data = m.getData();
@@ -506,7 +511,7 @@ public class CExtensions implements ILanguageExtension {
_builder.append("{");
_builder.newLine();
{
- List<Attribute> _allAttributes = RoomHelpers.getAllAttributes(((DataClass)dt));
+ List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(((DataClass)dt));
boolean _hasElements = false;
for(final Attribute att : _allAttributes) {
if (!_hasElements) {
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/DataClassGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/DataClassGen.java
index e98a63712..38a78d78a 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/DataClassGen.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/DataClassGen.java
@@ -42,6 +42,10 @@ public class DataClassGen {
@Inject
@Extension
+ private RoomHelpers _roomHelpers;
+
+ @Inject
+ @Extension
private CExtensions _cExtensions;
@Inject
@@ -136,7 +140,7 @@ public class DataClassGen {
_builder.append("typedef struct {");
_builder.newLine();
_builder.append("\t");
- List<Attribute> _allAttributes = RoomHelpers.getAllAttributes(dc);
+ List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(dc);
CharSequence _attributes = this._procedureHelpers.attributes(_allAttributes);
_builder.append(_attributes, "\t");
_builder.newLineIfNotEmpty();
@@ -147,7 +151,7 @@ public class DataClassGen {
_builder.newLineIfNotEmpty();
_builder.newLine();
{
- List<Attribute> _allAttributes_1 = RoomHelpers.getAllAttributes(dc);
+ List<Attribute> _allAttributes_1 = this._roomHelpers.getAllAttributes(dc);
for(final Attribute a : _allAttributes_1) {
{
String _defaultValueLiteral = a.getDefaultValueLiteral();
@@ -248,7 +252,7 @@ public class DataClassGen {
_builder.append("/* operations */");
_builder.newLine();
{
- List<Operation> _allOperations = RoomHelpers.getAllOperations(dc);
+ List<Operation> _allOperations = this._roomHelpers.getAllOperations(dc);
for(final Operation op : _allOperations) {
final CharSequence args = this.argList(op);
_builder.newLineIfNotEmpty();
@@ -281,7 +285,7 @@ public class DataClassGen {
_builder.append("/* attributes */");
_builder.newLine();
{
- List<Attribute> _allAttributes = RoomHelpers.getAllAttributes(dc);
+ List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(dc);
for(final Attribute a : _allAttributes) {
_builder.append("#define ");
String _name_6 = a.getName();
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java
index 727cedcc2..a0213edf8 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java
@@ -43,6 +43,10 @@ public class Initialization {
@Inject
@Extension
+ private RoomHelpers _roomHelpers;
+
+ @Inject
+ @Extension
private RoomExtensions _roomExtensions;
@Inject
@@ -169,7 +173,7 @@ public class Initialization {
_builder.append("{");
_builder.newLine();
{
- List<Attribute> _allAttributes = RoomHelpers.getAllAttributes(((DataClass) aType));
+ List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(((DataClass) aType));
boolean _hasElements = false;
for(final Attribute subA : _allAttributes) {
if (!_hasElements) {
@@ -320,7 +324,7 @@ public class Initialization {
if (instance instanceof InterfaceItemInstance) {
_matched=true;
InterfaceItem _interfaceItem = ((InterfaceItemInstance)instance).getInterfaceItem();
- PortClass _portClass = RoomHelpers.getPortClass(_interfaceItem);
+ PortClass _portClass = this._roomHelpers.getPortClass(_interfaceItem);
_switchResult = this._typeHelpers.getAttrClassConfigValue(path, _portClass);
}
}
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java
index 39e9db45d..3ac722b4b 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java
@@ -27,7 +27,6 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.etrice.core.common.base.Annotation;
import org.eclipse.etrice.core.common.base.LiteralType;
-import org.eclipse.etrice.core.common.base.util.BaseHelpers;
import org.eclipse.etrice.core.common.converter.TimeConverter;
import org.eclipse.etrice.core.etmap.util.ETMapUtil;
import org.eclipse.etrice.core.etphys.eTPhys.ExecMode;
@@ -89,6 +88,10 @@ import org.eclipse.xtext.xbase.lib.ListExtensions;
public class NodeGen {
@Inject
@Extension
+ private RoomHelpers _roomHelpers;
+
+ @Inject
+ @Extension
private CExtensions _cExtensions;
@Inject
@@ -277,7 +280,7 @@ public class NodeGen {
};
final Iterable<PhysicalThread> threads = IterableExtensions.<PhysicalThread>filter(_threads, _function);
EList<Annotation> _annotations = ssc.getAnnotations();
- final boolean logData = BaseHelpers.isAnnotationPresent(_annotations, "DataLogging");
+ final boolean logData = this._roomHelpers.isAnnotationPresent(_annotations, "DataLogging");
StringConcatenation _builder = new StringConcatenation();
_builder.append("/**");
_builder.newLine();
@@ -915,7 +918,7 @@ public class NodeGen {
EList<StandardOperation> _operations_1 = _actorClass_3.getOperations();
final Function1<StandardOperation, Boolean> _function_3 = new Function1<StandardOperation, Boolean>() {
public Boolean apply(final StandardOperation op) {
- return Boolean.valueOf(RoomHelpers.isConstructor(op));
+ return Boolean.valueOf(NodeGen.this._roomHelpers.isConstructor(op));
}
};
Iterable<StandardOperation> _filter_1 = IterableExtensions.<StandardOperation>filter(_operations_1, _function_3);
@@ -1193,7 +1196,7 @@ public class NodeGen {
}
_builder.append("\t");
InterfaceItem _interfaceItem = pi.getInterfaceItem();
- PortClass _portClass_1 = RoomHelpers.getPortClass(_interfaceItem);
+ PortClass _portClass_1 = this._roomHelpers.getPortClass(_interfaceItem);
EList<Attribute> _attributes_1 = _portClass_1.getAttributes();
CharSequence _generateAttributeInit = this.attrInitGenAddon.generateAttributeInit(pi, _attributes_1);
_builder.append(_generateAttributeInit, "\t");
@@ -1614,7 +1617,7 @@ public class NodeGen {
_builder.newLine();
_builder.append("\t");
ActorClass _actorClass_2 = ai.getActorClass();
- List<Attribute> _allAttributes = RoomHelpers.getAllAttributes(_actorClass_2);
+ List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(_actorClass_2);
CharSequence _generateAttributeInit = this.attrInitGenAddon.generateAttributeInit(ai, _allAttributes);
_builder.append(_generateAttributeInit, "\t");
_builder.newLineIfNotEmpty();
@@ -1673,7 +1676,7 @@ public class NodeGen {
final Function1<PortInstance, Boolean> _function_3 = new Function1<PortInstance, Boolean>() {
public Boolean apply(final PortInstance p) {
Port _port = p.getPort();
- List<Message> _outgoing = RoomHelpers.getOutgoing(_port);
+ List<Message> _outgoing = NodeGen.this._roomHelpers.getOutgoing(_port);
final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() {
public Boolean apply(final Message m) {
boolean _or = false;
@@ -1842,7 +1845,7 @@ public class NodeGen {
Port _port = ((PortInstance) pi).getPort();
GeneralProtocolClass _protocol = _port.getProtocol();
final ProtocolClass pc = ((ProtocolClass) _protocol);
- List<Message> _allIncomingMessages = RoomHelpers.getAllIncomingMessages(pc);
+ List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc);
final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() {
public Boolean apply(final Message m) {
VarDecl _data = m.getData();
@@ -1969,7 +1972,7 @@ public class NodeGen {
String _xblockexpression = null;
{
InterfaceItem _interfaceItem = pi.getInterfaceItem();
- List<Message> _incoming = RoomHelpers.getIncoming(_interfaceItem);
+ List<Message> _incoming = this._roomHelpers.getIncoming(_interfaceItem);
final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() {
public Boolean apply(final Message m) {
VarDecl _data = m.getData();
@@ -2147,7 +2150,7 @@ public class NodeGen {
final ArrayList<PortInstance> loggedPorts = this.loggedPorts(ssi);
SubSystemClass _subSystemClass = ssi.getSubSystemClass();
EList<Annotation> _annotations = _subSystemClass.getAnnotations();
- final boolean logData = BaseHelpers.isAnnotationPresent(_annotations, "DataLogging");
+ final boolean logData = this._roomHelpers.isAnnotationPresent(_annotations, "DataLogging");
StringConcatenation _builder = new StringConcatenation();
_builder.append("/**");
_builder.newLine();
@@ -2911,12 +2914,12 @@ public class NodeGen {
final ArrayList<PortInstance> result = CollectionLiterals.<PortInstance>newArrayList();
SubSystemClass _subSystemClass = ssi.getSubSystemClass();
EList<Annotation> _annotations = _subSystemClass.getAnnotations();
- boolean _isAnnotationPresent = BaseHelpers.isAnnotationPresent(_annotations, "DataLogging");
+ boolean _isAnnotationPresent = this._roomHelpers.isAnnotationPresent(_annotations, "DataLogging");
if (_isAnnotationPresent) {
this.logger.logInfo("Data Logging is configured by annotation");
SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass();
EList<Annotation> _annotations_1 = _subSystemClass_1.getAnnotations();
- final String filters = BaseHelpers.getAttribute(_annotations_1, "DataLogging", "pathlist");
+ final String filters = this._roomHelpers.getAttribute(_annotations_1, "DataLogging", "pathlist");
final String[] filterList = filters.split(",");
for (final String filter : filterList) {
this.logger.logInfo((" filter: " + filter));
@@ -2932,7 +2935,7 @@ public class NodeGen {
if ((obj instanceof PortInstance)) {
final PortInstance pi = ((PortInstance) obj);
Port _port = pi.getPort();
- boolean _isRelay = RoomHelpers.isRelay(_port);
+ boolean _isRelay = this._roomHelpers.isRelay(_port);
boolean _not = (!_isRelay);
if (_not) {
ProtocolClass _protocol = pi.getProtocol();
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.java
index cce988efd..c5c6896e5 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.java
@@ -36,6 +36,10 @@ import org.eclipse.xtext.xbase.lib.Extension;
public class NodeRunnerGen {
@Inject
@Extension
+ private BaseHelpers _baseHelpers;
+
+ @Inject
+ @Extension
private JavaIoFileSystemAccess fileAccess;
@Inject
@@ -86,7 +90,7 @@ public class NodeRunnerGen {
final String clsname = (_plus + _name_1);
SubSystemClass _subSystemClass = ssi.getSubSystemClass();
EList<Annotation> _annotations = _subSystemClass.getAnnotations();
- final boolean logData = BaseHelpers.isAnnotationPresent(_annotations, "DataLogging");
+ final boolean logData = this._baseHelpers.isAnnotationPresent(_annotations, "DataLogging");
StringConcatenation _builder = new StringConcatenation();
_builder.append("/**");
_builder.newLine();
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java
index dbef230cc..50633c411 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java
@@ -34,7 +34,6 @@ import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.RefableType;
import org.eclipse.etrice.core.room.RoomModel;
import org.eclipse.etrice.core.room.VarDecl;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.generator.base.AbstractGenerator;
import org.eclipse.etrice.generator.base.GlobalGeneratorSettings;
import org.eclipse.etrice.generator.base.IGeneratorFileIo;
@@ -477,9 +476,9 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
String replPortClassName = this._roomExtensions.getPortClassName(pc, (conj).booleanValue(), true);
List<Message> _xifexpression = null;
if ((conj).booleanValue()) {
- _xifexpression = RoomHelpers.getAllIncomingMessages(pc);
+ _xifexpression = this._roomHelpers.getAllIncomingMessages(pc);
} else {
- _xifexpression = RoomHelpers.getAllOutgoingMessages(pc);
+ _xifexpression = this._roomHelpers.getAllOutgoingMessages(pc);
}
List<Message> messages = _xifexpression;
StringConcatenation _builder = new StringConcatenation();
@@ -660,7 +659,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
private CharSequence genDataDrivenPortHeaders(final ProtocolClass pc) {
CharSequence _xblockexpression = null;
{
- List<Message> _allIncomingMessages = RoomHelpers.getAllIncomingMessages(pc);
+ List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc);
final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() {
public Boolean apply(final Message m) {
VarDecl _data = m.getData();
@@ -933,7 +932,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
private CharSequence genDataDrivenPortSources(final ProtocolClass pc) {
CharSequence _xblockexpression = null;
{
- List<Message> _allIncomingMessages = RoomHelpers.getAllIncomingMessages(pc);
+ List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc);
final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() {
public Boolean apply(final Message m) {
VarDecl _data = m.getData();
@@ -1158,9 +1157,9 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
final String replPortClassName = this._roomExtensions.getPortClassName(pc, (conj).booleanValue(), true);
List<Message> _xifexpression = null;
if ((conj).booleanValue()) {
- _xifexpression = RoomHelpers.getAllIncomingMessages(pc);
+ _xifexpression = this._roomHelpers.getAllIncomingMessages(pc);
} else {
- _xifexpression = RoomHelpers.getAllOutgoingMessages(pc);
+ _xifexpression = this._roomHelpers.getAllOutgoingMessages(pc);
}
final List<Message> messages = _xifexpression;
String _xifexpression_1 = null;
@@ -1595,7 +1594,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append(_name, "");
_builder.append("_messageStrings[] = {\"MIN\", ");
{
- List<Message> _allOutgoingMessages = RoomHelpers.getAllOutgoingMessages(pc);
+ List<Message> _allOutgoingMessages = this._roomHelpers.getAllOutgoingMessages(pc);
for(final Message m : _allOutgoingMessages) {
_builder.append("\"");
String _name_1 = m.getName();
@@ -1604,7 +1603,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
}
}
{
- List<Message> _allIncomingMessages = RoomHelpers.getAllIncomingMessages(pc);
+ List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc);
for(final Message m_1 : _allIncomingMessages) {
_builder.append("\"");
String _name_2 = m_1.getName();
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java
index d52ca5f27..a524395e8 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java
@@ -17,8 +17,6 @@ import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.StateGraph;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
-import org.eclipse.etrice.generator.base.CodegenHelpers;
import org.eclipse.etrice.generator.base.GlobalGeneratorSettings;
import org.eclipse.etrice.generator.c.Main;
import org.eclipse.etrice.generator.generic.GenericStateMachineGenerator;
@@ -38,10 +36,10 @@ public class StateMachineGen extends GenericStateMachineGenerator {
{
final ActorClass ac = xpac.getActorClass();
StateGraph _stateMachine = xpac.getStateMachine();
- List<State> _baseStateList = RoomHelpers.getBaseStateList(_stateMachine);
+ List<State> _baseStateList = this._roomHelpers.getBaseStateList(_stateMachine);
int _size = _baseStateList.size();
StateGraph _stateMachine_1 = xpac.getStateMachine();
- List<State> _leafStateList = RoomHelpers.getLeafStateList(_stateMachine_1);
+ List<State> _leafStateList = this._roomHelpers.getLeafStateList(_stateMachine_1);
int _size_1 = _leafStateList.size();
int _minus = (_size - _size_1);
final int historySize = (_minus + 2);
@@ -119,7 +117,7 @@ public class StateMachineGen extends GenericStateMachineGenerator {
{
final ActorClass ac = xpac.getActorClass();
StateGraph _stateMachine = xpac.getStateMachine();
- List<State> _baseStateList = RoomHelpers.getBaseStateList(_stateMachine);
+ List<State> _baseStateList = this._roomHelpers.getBaseStateList(_stateMachine);
final List<State> states = this._roomExtensions.getLeafStatesLast(_baseStateList);
StringConcatenation _builder = new StringConcatenation();
{
@@ -138,7 +136,7 @@ public class StateMachineGen extends GenericStateMachineGenerator {
_builder.appendImmediate(",", "");
}
_builder.append("\"");
- String _genStatePathName = CodegenHelpers.getGenStatePathName(state);
+ String _genStatePathName = this._codegenHelpers.getGenStatePathName(state);
_builder.append(_genStatePathName, "");
_builder.append("\"");
_builder.newLineIfNotEmpty();
diff --git a/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend b/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend
index b762b63b9..cd4e7a2aa 100644
--- a/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend
+++ b/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend
@@ -41,6 +41,9 @@ import org.eclipse.xtext.scoping.impl.ImportUriResolver
class DataConfiguration implements IDataConfiguration {
@Inject
+ protected extension DataConfigurationHelper
+
+ @Inject
protected ILogger logger;
@Inject
@@ -53,7 +56,7 @@ class DataConfiguration implements IDataConfiguration {
}
override setResources(ResourceSet resource, ILogger logger) {
- DataConfigurationHelper::setConfigModels(resource, logger)
+ setConfigModels(resource, logger)
}
// static
@@ -71,12 +74,12 @@ class DataConfiguration implements IDataConfiguration {
def private getAttrClassConfig(ActorClass actor, List<Attribute> path) {
var id = '''/«actor.name»/«path.toStringPath»'''.toString
- DataConfigurationHelper::actorClassAttrMap.get(id)
+ actorClassAttrMap.get(id)
}
override getAttrClassConfigValue(ProtocolClass pc, boolean regular, List<Attribute> path) {
var id = '''/«pc.name»/«IF regular»regular«ELSE»conjugated«ENDIF»/«path.toStringPath»'''.toString
- DataConfigurationHelper::protocolClassAttrMap.get(id)?.value?.toStringExpr
+ protocolClassAttrMap.get(id)?.value?.toStringExpr
}
def private toStringPath(List<Attribute> path) {
@@ -85,11 +88,11 @@ class DataConfiguration implements IDataConfiguration {
override getAttrInstanceConfigValue(ActorInstance ai, List<Attribute> path) {
var id = ai.path + "/" + path.toStringPath
- DataConfigurationHelper::actorInstanceAttrMap.get(id)?.value?.toStringExpr
+ actorInstanceAttrMap.get(id)?.value?.toStringExpr
}
override getAttrInstanceConfigValue(InterfaceItemInstance item, List<Attribute> path) {
- DataConfigurationHelper::actorInstanceAttrMap.get(item.path + "/" + path.toStringPath)?.value?.toStringExpr
+ actorInstanceAttrMap.get(item.path + "/" + path.toStringPath)?.value?.toStringExpr
}
// dynamic
@@ -117,7 +120,7 @@ class DataConfiguration implements IDataConfiguration {
override getDynConfigReadAttributes(ActorInstance ai) {
val result = new ArrayList<Attribute>
- var configs = DataConfigurationHelper::dynActorInstanceAttrMap.get(ai.path)
+ var configs = dynActorInstanceAttrMap.get(ai.path)
configs?.forEach(c|if(c.readOnly) result.add(c.attribute))
return result
@@ -125,7 +128,7 @@ class DataConfiguration implements IDataConfiguration {
override getDynConfigWriteAttributes(ActorInstance ai) {
val result = new ArrayList<Attribute>
- var configs = DataConfigurationHelper::dynActorInstanceAttrMap.get(ai.path)
+ var configs = dynActorInstanceAttrMap.get(ai.path)
configs?.forEach(c|if(!c.readOnly) result.add(c.attribute))
return result
@@ -156,19 +159,19 @@ class DataConfiguration implements IDataConfiguration {
}
def private getConfig(SubSystemInstance cc) {
- DataConfigurationHelper::subSystemConfigMap.get(cc.path)
+ subSystemConfigMap.get(cc.path)
}
override getDynConfigReadAttributes(ActorClass actor) {
val result = new HashSet<Attribute>
- var configs = DataConfigurationHelper::dynActorClassAttrMap.get(actor)
+ val configs = dynActorClassAttrMap.get(actor)
configs?.forEach(c|if(c.readOnly) result.add(c.attribute))
return result.toList
}
override getDynConfigWriteAttributes(ActorClass actor) {
val result = new HashSet<Attribute>
- var configs = DataConfigurationHelper::dynActorClassAttrMap.get(actor)
+ val configs = dynActorClassAttrMap.get(actor)
configs?.forEach(c|if(!c.readOnly) result.add(c.attribute))
return result.toList
}
diff --git a/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/util/DataConfigurationHelper.java b/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/util/DataConfigurationHelper.java
index da8d187b4..2a8612f66 100644
--- a/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/util/DataConfigurationHelper.java
+++ b/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/util/DataConfigurationHelper.java
@@ -36,19 +36,26 @@ import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.DataClass;
import org.eclipse.etrice.core.room.ProtocolClass;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+
+@Singleton
public class DataConfigurationHelper {
+ @Inject
+ private ConfigUtil ConfigUtil;
+
// static
- public static Map<String, AttrClassConfig> actorClassAttrMap = new HashMap<String, AttrClassConfig>();
- public static Map<String, AttrClassConfig> protocolClassAttrMap = new HashMap<String, AttrClassConfig>();
- public static Map<String, AttrInstanceConfig> actorInstanceAttrMap = new HashMap<String, AttrInstanceConfig>();
+ public Map<String, AttrClassConfig> actorClassAttrMap = new HashMap<String, AttrClassConfig>();
+ public Map<String, AttrClassConfig> protocolClassAttrMap = new HashMap<String, AttrClassConfig>();
+ public Map<String, AttrInstanceConfig> actorInstanceAttrMap = new HashMap<String, AttrInstanceConfig>();
// dynamic
- public static Map<String, SubSystemConfig> subSystemConfigMap = new HashMap<String, SubSystemConfig>();
- public static Map<String, List<AttrInstanceConfig>> dynActorInstanceAttrMap = new HashMap<String, List<AttrInstanceConfig>>();
- public static Map<ActorClass, List<AttrInstanceConfig>> dynActorClassAttrMap = new HashMap<ActorClass, List<AttrInstanceConfig>>();
+ public Map<String, SubSystemConfig> subSystemConfigMap = new HashMap<String, SubSystemConfig>();
+ public Map<String, List<AttrInstanceConfig>> dynActorInstanceAttrMap = new HashMap<String, List<AttrInstanceConfig>>();
+ public Map<ActorClass, List<AttrInstanceConfig>> dynActorClassAttrMap = new HashMap<ActorClass, List<AttrInstanceConfig>>();
- public static boolean setConfigModels(ResourceSet rs, ILogger logger) {
+ public boolean setConfigModels(ResourceSet rs, ILogger logger) {
actorClassAttrMap.clear();
protocolClassAttrMap.clear();
actorInstanceAttrMap.clear();
@@ -121,7 +128,7 @@ public class DataConfigurationHelper {
return !error;
}
- private static void collectConfigs(ActorInstanceConfig actorConfig,
+ private void collectConfigs(ActorInstanceConfig actorConfig,
String path, Map<String, AttrInstanceConfig> map) {
for (AttrInstanceConfig c : actorConfig.getAttributes()) {
collectConfigs(c, path + "/" + c.getAttribute().getName(), map);
@@ -150,7 +157,7 @@ public class DataConfigurationHelper {
}
}
- private static void collectConfigs(ProtocolClassConfig protocolConfig,
+ private void collectConfigs(ProtocolClassConfig protocolConfig,
Map<String, AttrClassConfig> map) {
String path = "/" + protocolConfig.getProtocol().getName();
if (protocolConfig.getRegular() != null)
@@ -165,14 +172,14 @@ public class DataConfigurationHelper {
+ c.getAttribute().getName(), map);
}
- private static void collectConfigs(ActorClassConfig actorConfig,
+ private void collectConfigs(ActorClassConfig actorConfig,
Map<String, AttrClassConfig> map) {
String path = "/" + actorConfig.getActor().getName();
for (AttrClassConfig c : actorConfig.getAttributes())
collectConfigs(c, path + "/" + c.getAttribute().getName(), map);
}
- private static void collectConfigs(AttrClassConfig config, String path,
+ private void collectConfigs(AttrClassConfig config, String path,
Map<String, AttrClassConfig> map) {
Attribute a = config.getAttribute();
if (a.getType().getType() instanceof DataClass)
@@ -181,7 +188,7 @@ public class DataConfigurationHelper {
map.put(path, config);
}
- private static void collectConfigs(AttrInstanceConfig config, String path,
+ private void collectConfigs(AttrInstanceConfig config, String path,
Map<String, AttrInstanceConfig> map) {
Attribute a = config.getAttribute();
if (a.getType().getType() instanceof DataClass)
@@ -190,7 +197,7 @@ public class DataConfigurationHelper {
map.put(path, config);
}
- public static String toStringPath(Iterable<String> path, String pathDelim) {
+ public String toStringPath(Iterable<String> path, String pathDelim) {
StringBuilder b = new StringBuilder();
for (String p : path)
b.append(pathDelim + p);
diff --git a/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java b/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java
index 1b0ca915c..4344aef1d 100644
--- a/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java
+++ b/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java
@@ -45,12 +45,17 @@ import org.eclipse.etrice.generator.base.IDataConfiguration;
import org.eclipse.etrice.generator.config.util.DataConfigurationHelper;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.scoping.impl.ImportUriResolver;
+import org.eclipse.xtext.xbase.lib.Extension;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
@SuppressWarnings("all")
public class DataConfiguration implements IDataConfiguration {
@Inject
+ @Extension
+ protected DataConfigurationHelper _dataConfigurationHelper;
+
+ @Inject
protected ILogger logger;
@Inject
@@ -63,7 +68,7 @@ public class DataConfiguration implements IDataConfiguration {
}
public boolean setResources(final ResourceSet resource, final ILogger logger) {
- return DataConfigurationHelper.setConfigModels(resource, logger);
+ return this._dataConfigurationHelper.setConfigModels(resource, logger);
}
public String getAttrClassConfigValue(final ActorClass actor, final List<Attribute> path) {
@@ -116,7 +121,7 @@ public class DataConfiguration implements IDataConfiguration {
String _stringPath = this.toStringPath(path);
_builder.append(_stringPath, "");
String id = _builder.toString();
- _xblockexpression = DataConfigurationHelper.actorClassAttrMap.get(id);
+ _xblockexpression = this._dataConfigurationHelper.actorClassAttrMap.get(id);
}
return _xblockexpression;
}
@@ -140,7 +145,7 @@ public class DataConfiguration implements IDataConfiguration {
String _stringPath = this.toStringPath(path);
_builder.append(_stringPath, "");
String id = _builder.toString();
- AttrClassConfig _get = DataConfigurationHelper.protocolClassAttrMap.get(id);
+ AttrClassConfig _get = this._dataConfigurationHelper.protocolClassAttrMap.get(id);
ConfigValueArray _value = null;
if (_get!=null) {
_value=_get.getValue();
@@ -178,7 +183,7 @@ public class DataConfiguration implements IDataConfiguration {
String _plus = (_path + "/");
String _stringPath = this.toStringPath(path);
String id = (_plus + _stringPath);
- AttrInstanceConfig _get = DataConfigurationHelper.actorInstanceAttrMap.get(id);
+ AttrInstanceConfig _get = this._dataConfigurationHelper.actorInstanceAttrMap.get(id);
ConfigValueArray _value = null;
if (_get!=null) {
_value=_get.getValue();
@@ -197,7 +202,7 @@ public class DataConfiguration implements IDataConfiguration {
String _plus = (_path + "/");
String _stringPath = this.toStringPath(path);
String _plus_1 = (_plus + _stringPath);
- AttrInstanceConfig _get = DataConfigurationHelper.actorInstanceAttrMap.get(_plus_1);
+ AttrInstanceConfig _get = this._dataConfigurationHelper.actorInstanceAttrMap.get(_plus_1);
ConfigValueArray _value = null;
if (_get!=null) {
_value=_get.getValue();
@@ -288,7 +293,7 @@ public class DataConfiguration implements IDataConfiguration {
public List<Attribute> getDynConfigReadAttributes(final ActorInstance ai) {
final ArrayList<Attribute> result = new ArrayList<Attribute>();
String _path = ai.getPath();
- List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorInstanceAttrMap.get(_path);
+ List<AttrInstanceConfig> configs = this._dataConfigurationHelper.dynActorInstanceAttrMap.get(_path);
if (configs!=null) {
final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
public void apply(final AttrInstanceConfig c) {
@@ -307,7 +312,7 @@ public class DataConfiguration implements IDataConfiguration {
public List<Attribute> getDynConfigWriteAttributes(final ActorInstance ai) {
final ArrayList<Attribute> result = new ArrayList<Attribute>();
String _path = ai.getPath();
- List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorInstanceAttrMap.get(_path);
+ List<AttrInstanceConfig> configs = this._dataConfigurationHelper.dynActorInstanceAttrMap.get(_path);
if (configs!=null) {
final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
public void apply(final AttrInstanceConfig c) {
@@ -407,12 +412,12 @@ public class DataConfiguration implements IDataConfiguration {
private SubSystemConfig getConfig(final SubSystemInstance cc) {
String _path = cc.getPath();
- return DataConfigurationHelper.subSystemConfigMap.get(_path);
+ return this._dataConfigurationHelper.subSystemConfigMap.get(_path);
}
public List<Attribute> getDynConfigReadAttributes(final ActorClass actor) {
final HashSet<Attribute> result = new HashSet<Attribute>();
- List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorClassAttrMap.get(actor);
+ final List<AttrInstanceConfig> configs = this._dataConfigurationHelper.dynActorClassAttrMap.get(actor);
if (configs!=null) {
final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
public void apply(final AttrInstanceConfig c) {
@@ -430,7 +435,7 @@ public class DataConfiguration implements IDataConfiguration {
public List<Attribute> getDynConfigWriteAttributes(final ActorClass actor) {
final HashSet<Attribute> result = new HashSet<Attribute>();
- List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorClassAttrMap.get(actor);
+ final List<AttrInstanceConfig> configs = this._dataConfigurationHelper.dynActorClassAttrMap.get(actor);
if (configs!=null) {
final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
public void apply(final AttrInstanceConfig c) {
diff --git a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/DocGen.xtend b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/DocGen.xtend
index 5ea017f89..16780af63 100644
--- a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/DocGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/DocGen.xtend
@@ -32,14 +32,16 @@ import org.eclipse.etrice.core.room.SubSystemClass
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.xtext.generator.JavaIoFileSystemAccess
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
-import static extension org.eclipse.etrice.generator.base.CodegenHelpers.*
+import org.eclipse.etrice.core.room.util.RoomHelpers
+import org.eclipse.etrice.generator.base.CodegenHelpers
import org.eclipse.etrice.core.room.EnumerationType
import org.eclipse.etrice.core.room.Port
@Singleton
class DocGen {
+ @Inject extension RoomHelpers
+ @Inject extension CodegenHelpers
@Inject extension JavaIoFileSystemAccess fileAccess
@Inject extension RoomExtensions roomExt
@Inject ILogger logger
diff --git a/plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/DocGen.java b/plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/DocGen.java
index 6a2b21fe0..349c9137e 100644
--- a/plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/DocGen.java
+++ b/plugins/org.eclipse.etrice.generator.doc/xtend-gen/org/eclipse/etrice/generator/doc/gen/DocGen.java
@@ -54,6 +54,14 @@ import org.eclipse.xtext.xbase.lib.Extension;
public class DocGen {
@Inject
@Extension
+ private RoomHelpers _roomHelpers;
+
+ @Inject
+ @Extension
+ private CodegenHelpers _codegenHelpers;
+
+ @Inject
+ @Extension
private JavaIoFileSystemAccess fileAccess;
@Inject
@@ -558,7 +566,7 @@ public class DocGen {
_builder.append("Message & Data & Description\\\\");
_builder.newLine();
{
- List<Message> _allIncomingMessages = RoomHelpers.getAllIncomingMessages(pc);
+ List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc);
for(final Message ims : _allIncomingMessages) {
_builder.append("\t");
_builder.append("\\hline");
@@ -609,7 +617,7 @@ public class DocGen {
_builder.append("Message & Data & Description\\\\");
_builder.newLine();
{
- List<Message> _allOutgoingMessages = RoomHelpers.getAllOutgoingMessages(pc);
+ List<Message> _allOutgoingMessages = this._roomHelpers.getAllOutgoingMessages(pc);
for(final Message oms : _allOutgoingMessages) {
_builder.append("\t");
_builder.append("\\hline");
@@ -744,7 +752,7 @@ public class DocGen {
}
_builder.newLine();
{
- List<Port> _allPorts = RoomHelpers.getAllPorts(ac);
+ List<Port> _allPorts = this._roomHelpers.getAllPorts(ac);
boolean _isEmpty = _allPorts.isEmpty();
boolean _not = (!_isEmpty);
if (_not) {
@@ -757,7 +765,7 @@ public class DocGen {
}
_builder.newLine();
{
- boolean _hasNonEmptyStateMachine = RoomHelpers.hasNonEmptyStateMachine(ac);
+ boolean _hasNonEmptyStateMachine = this._roomHelpers.hasNonEmptyStateMachine(ac);
if (_hasNonEmptyStateMachine) {
_builder.append("\\level{3}{Statemachine}");
_builder.newLine();
@@ -836,7 +844,7 @@ public class DocGen {
boolean _notEquals = (!Objects.equal(_docu, null));
if (_notEquals) {
_builder.append("\\textbf{State description} \\textit{");
- String _genStatePathName = CodegenHelpers.getGenStatePathName(s);
+ String _genStatePathName = this._codegenHelpers.getGenStatePathName(s);
String _replaceAll_1 = _genStatePathName.replaceAll("_", "\\\\_");
_builder.append(_replaceAll_1, "");
_builder.append("}:");
@@ -888,7 +896,7 @@ public class DocGen {
EList<State> _states_1 = _stateMachine_2.getStates();
for(final State s_1 : _states_1) {
{
- boolean _isLeaf = RoomHelpers.isLeaf(s_1);
+ boolean _isLeaf = this._roomHelpers.isLeaf(s_1);
boolean _not = (!_isLeaf);
if (_not) {
String _generateStateDoc = this.generateStateDoc(model, ac, s_1);
@@ -916,17 +924,17 @@ public class DocGen {
private String getKind(final Port p) {
String _xifexpression = null;
- boolean _isInternal = RoomHelpers.isInternal(p);
+ boolean _isInternal = this._roomHelpers.isInternal(p);
if (_isInternal) {
_xifexpression = "internal";
} else {
String _xifexpression_1 = null;
- boolean _isExternal = RoomHelpers.isExternal(p);
+ boolean _isExternal = this._roomHelpers.isExternal(p);
if (_isExternal) {
_xifexpression_1 = "external";
} else {
String _xifexpression_2 = null;
- boolean _isRelay = RoomHelpers.isRelay(p);
+ boolean _isRelay = this._roomHelpers.isRelay(p);
if (_isRelay) {
_xifexpression_2 = "relay";
} else {
@@ -961,7 +969,7 @@ public class DocGen {
_builder.append("\\textbf{Name} & \\textbf{Protocol} & \\textbf{Type} & \\textbf{Kind} & \\textbf{Multiplicity} & \\textbf{Description}\\\\");
_builder.newLine();
{
- List<Port> _allPorts = RoomHelpers.getAllPorts(ac);
+ List<Port> _allPorts = this._roomHelpers.getAllPorts(ac);
for(final Port at : _allPorts) {
_builder.append("\\hline");
_builder.newLine();
@@ -1005,7 +1013,7 @@ public class DocGen {
String _name = ac.getName();
String _plus_1 = (_plus + _name);
String _plus_2 = (_plus_1 + "_");
- String _genStatePathName = CodegenHelpers.getGenStatePathName(state);
+ String _genStatePathName = this._codegenHelpers.getGenStatePathName(state);
String _plus_3 = (_plus_2 + _genStatePathName);
String filename = (_plus_3 + "_behavior.jpg");
String _replaceAll = filename.replaceAll("\\\\", "/");
@@ -1014,7 +1022,7 @@ public class DocGen {
this.logger.logInfo(("Gen Filename: " + filename));
StringConcatenation _builder = new StringConcatenation();
_builder.append("\\level{4}{Subgraph ");
- String _genStatePathName_1 = CodegenHelpers.getGenStatePathName(state);
+ String _genStatePathName_1 = this._codegenHelpers.getGenStatePathName(state);
String _replaceAll_1 = _genStatePathName_1.replaceAll("_", "\\\\_");
_builder.append(_replaceAll_1, "");
_builder.append("}");
@@ -1025,7 +1033,7 @@ public class DocGen {
if (_equals) {
String _name_1 = ac.getName();
String _plus_4 = (_name_1 + "_");
- String _genStatePathName_2 = CodegenHelpers.getGenStatePathName(state);
+ String _genStatePathName_2 = this._codegenHelpers.getGenStatePathName(state);
String _plus_5 = (_plus_4 + _genStatePathName_2);
CharSequence _includeGraphics = this.includeGraphics(latexFilename, "0.4", _plus_5);
_builder.append(_includeGraphics, "");
@@ -1044,7 +1052,7 @@ public class DocGen {
boolean _notEquals = (!Objects.equal(_docu, null));
if (_notEquals) {
_builder.append("\\textbf{State description} \\textit{");
- String _genStatePathName_3 = CodegenHelpers.getGenStatePathName(s);
+ String _genStatePathName_3 = this._codegenHelpers.getGenStatePathName(s);
String _replaceAll_2 = _genStatePathName_3.replaceAll("_", "\\\\_");
_builder.append(_replaceAll_2, "");
_builder.append("}:");
@@ -1097,7 +1105,7 @@ public class DocGen {
EList<State> _states_1 = _subgraph_2.getStates();
for(final State s_1 : _states_1) {
{
- boolean _isLeaf = RoomHelpers.isLeaf(s_1);
+ boolean _isLeaf = this._roomHelpers.isLeaf(s_1);
boolean _not = (!_isLeaf);
if (_not) {
String _generateStateDoc = this.generateStateDoc(model, ac, s_1);
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.xtend
index 13c28882b..6b5fd08fc 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.xtend
@@ -24,12 +24,13 @@ import org.eclipse.etrice.generator.base.IGeneratorFileIo
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
+import org.eclipse.etrice.core.room.util.RoomHelpers
@Singleton
class ActorClassDataGen {
@Inject IGeneratorFileIo fileIO
+ @Inject extension RoomHelpers
@Inject extension RoomExtensions
@Inject extension FileSystemHelpers
@Inject extension ProcedureHelpers
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend
index 0795e4576..03277bb19 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend
@@ -34,8 +34,6 @@ import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
import org.eclipse.etrice.generator.java.Main
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
-
@Singleton
class ActorClassGen extends GenericActorClassGenerator {
@@ -43,7 +41,7 @@ class ActorClassGen extends GenericActorClassGenerator {
@Inject extension JavaExtensions
@Inject extension RoomExtensions
@Inject IDataConfiguration dataConfigExt
- @Inject ConfigGenAddon configGenAddon
+ final ConfigGenAddon configGenAddon
@Inject extension ProcedureHelpers
@Inject extension Initialization
@@ -51,6 +49,11 @@ class ActorClassGen extends GenericActorClassGenerator {
@Inject extension TypeHelpers
@Inject extension FileSystemHelpers
+ @Inject
+ new (ConfigGenAddon configGenAddon) {
+ this.configGenAddon = configGenAddon
+ }
+
def doGenerate(Root root) {
val HashMap<ActorClass, WiredActorClass> ac2wired = new HashMap<ActorClass, WiredActorClass>
root.wiredInstances.filter(w|w instanceof WiredActorClass).forEach[w|ac2wired.put((w as WiredActorClass).actorClass, w as WiredActorClass)]
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend
index 854e77d16..2dc1894dc 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend
@@ -20,14 +20,13 @@ import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase
import org.eclipse.etrice.core.room.ActorClass
import org.eclipse.etrice.core.room.Attribute
import org.eclipse.etrice.core.room.DataClass
+import org.eclipse.etrice.core.room.EnumerationType
import org.eclipse.etrice.core.room.PrimitiveType
import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.etrice.generator.base.IDataConfiguration
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
-import org.eclipse.etrice.core.room.EnumerationType
class ConfigGenAddon {
@@ -35,6 +34,7 @@ class ConfigGenAddon {
@Inject extension TypeHelpers typeHelpers
@Inject extension ProcedureHelpers helpers
@Inject IDataConfiguration dataConfigExt
+ @Inject extension RoomHelpers
@Inject extension RoomExtensions
@Inject Initialization initGen
@@ -45,7 +45,7 @@ class ConfigGenAddon {
«applyInstanceConfig(ai, aiVariableName, new ArrayList<Attribute>().union(a))»
«ENDFOR»
«FOR pi : ai.orderedIfItemInstances»
- «var attribs = RoomHelpers::getPortClass(pi.interfaceItem)?.attributes»
+ «var attribs = getPortClass(pi.interfaceItem)?.attributes»
«IF attribs != null»
«FOR a : attribs»
«applyInstanceConfig(pi, aiVariableName+"."+invokeGetter(pi.name, null), new ArrayList<Attribute>().union(a))»
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend
index 1c47d719d..8df706752 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend
@@ -22,14 +22,15 @@ import org.eclipse.etrice.core.room.DataClass
import org.eclipse.etrice.generator.base.IGeneratorFileIo
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
+import org.eclipse.etrice.core.room.util.RoomHelpers
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
import org.eclipse.etrice.generator.base.FileSystemHelpers
@Singleton
class DataClassGen {
@Inject IGeneratorFileIo fileIO
+ @Inject extension RoomHelpers
@Inject extension JavaExtensions
@Inject extension RoomExtensions
@Inject extension ProcedureHelpers
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Initialization.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Initialization.xtend
index 7f5aecc30..f1506768c 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Initialization.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Initialization.xtend
@@ -24,14 +24,15 @@ import org.eclipse.etrice.core.room.PrimitiveType
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
+import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.etrice.core.room.EnumerationType
@Singleton
class Initialization {
- @Inject extension TypeHelpers typeHelpers
+ @Inject extension RoomHelpers
@Inject extension RoomExtensions
+ @Inject extension TypeHelpers typeHelpers
@Inject extension JavaExtensions languageExt
@Inject extension ProcedureHelpers procedureHelpers
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.xtend
index cbee24d89..089127144 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.xtend
@@ -15,6 +15,7 @@ import org.eclipse.etrice.generator.base.FileSystemHelpers
class OptionalActorFactoryGen {
@Inject IGeneratorFileIo fileIO
+ @Inject extension RoomHelpers
@Inject extension JavaExtensions
@Inject extension RoomExtensions
@Inject extension FileSystemHelpers
@@ -50,11 +51,11 @@ class OptionalActorFactoryGen {
«ac.name» actor = new «ac.name»(ai, name);
// wiring
- «FOR port: RoomHelpers::getAllEndPorts(ac).filter(p|RoomHelpers::isExternal(p))»
- «if (RoomHelpers::isDataDriven(port)) "DataPortBase" else "InterfaceItemBase"».connect(ai, "«port.name»", name+"/«port.name»");
+ «FOR port: getAllEndPorts(ac).filter(p|isExternal(p))»
+ «if (isDataDriven(port)) "DataPortBase" else "InterfaceItemBase"».connect(ai, "«port.name»", name+"/«port.name»");
«ENDFOR»
«FOR open: wired.openBindings»
- «if (RoomHelpers::isDataDriven(open.port)) "DataPortBase" else "InterfaceItemBase"».connect(ai, "«open.port.name»", name+"/«open.path.join('/')»");
+ «if (isDataDriven(open.port)) "DataPortBase" else "InterfaceItemBase"».connect(ai, "«open.port.name»", name+"/«open.path.join('/')»");
«ENDFOR»
«FOR req: wired.requiredServices»
«if (req.protocol.commType==CommunicationType::DATA_DRIVEN) "DataPortBase" else "InterfaceItemBase"».connect(ai, "«req.protocol.fullyQualifiedName»", name+"/«req.path.join('/')»");
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.xtend
index c68714258..d6bef84c7 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.xtend
@@ -12,17 +12,15 @@
package org.eclipse.etrice.generator.java.gen
-import com.google.inject.Singleton
import com.google.inject.Inject
-import org.eclipse.etrice.generator.base.IGeneratorFileIo
-import org.eclipse.etrice.generator.generic.RoomExtensions
+import com.google.inject.Singleton
import org.eclipse.etrice.core.genmodel.etricegen.Root
-
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
-import org.eclipse.etrice.generator.generic.GenericActorClassGenerator
import org.eclipse.etrice.core.room.ActorClass
-import org.eclipse.etrice.generator.java.Main
import org.eclipse.etrice.generator.base.FileSystemHelpers
+import org.eclipse.etrice.generator.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.generic.GenericActorClassGenerator
+import org.eclipse.etrice.generator.generic.RoomExtensions
+import org.eclipse.etrice.generator.java.Main
@Singleton
class OptionalActorInterfaceGen extends GenericActorClassGenerator {
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend
index 2901df84c..dd13ee706 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend
@@ -20,15 +20,13 @@ import org.eclipse.etrice.core.room.CommunicationType
import org.eclipse.etrice.core.room.DataClass
import org.eclipse.etrice.core.room.Message
import org.eclipse.etrice.core.room.ProtocolClass
+import org.eclipse.etrice.generator.base.FileSystemHelpers
import org.eclipse.etrice.generator.base.IGeneratorFileIo
import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
-
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
import org.eclipse.etrice.generator.java.Main
-import org.eclipse.etrice.generator.base.FileSystemHelpers
@Singleton
class ProtocolClassGen extends GenericProtocolClassGenerator {
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/StateMachineGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/StateMachineGen.xtend
index c4df9521e..8ab8490c3 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/StateMachineGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/StateMachineGen.xtend
@@ -13,13 +13,10 @@
package org.eclipse.etrice.generator.java.gen
import com.google.inject.Singleton
+import java.util.ArrayList
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass
-import org.eclipse.etrice.generator.generic.GenericStateMachineGenerator
-
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
-import static extension org.eclipse.etrice.generator.base.CodegenHelpers.*
import org.eclipse.etrice.core.room.State
-import java.util.ArrayList
+import org.eclipse.etrice.generator.generic.GenericStateMachineGenerator
import org.eclipse.etrice.generator.java.Main
@Singleton
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend
index 106d70a6c..acaf72d70 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend
@@ -32,8 +32,8 @@ import org.eclipse.etrice.generator.base.IGeneratorFileIo
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
+import org.eclipse.etrice.core.room.util.RoomHelpers
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
import org.eclipse.etrice.core.etmap.util.ETMapUtil
import org.eclipse.etrice.core.common.converter.TimeConverter
@@ -46,7 +46,8 @@ class VariableServiceGen {
@Inject IDataConfiguration configExt
@Inject extension ProcedureHelpers helpers
@Inject extension TypeHelpers
-
+ @Inject extension RoomHelpers
+
def doGenerate(Root root, SubSystemInstance ssi) {
val nr = ETMapUtil::getNodeRef(ssi)
val clsname = nr.getJavaClassName(ssi)
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.java
index eda118236..5181ecd67 100644
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.java
+++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.java
@@ -41,6 +41,10 @@ public class ActorClassDataGen {
@Inject
@Extension
+ private RoomHelpers _roomHelpers;
+
+ @Inject
+ @Extension
private RoomExtensions _roomExtensions;
@Inject
@@ -145,7 +149,7 @@ public class ActorClassDataGen {
_builder.append("\t");
_builder.newLine();
{
- boolean _hasNonEmptyStateMachine = RoomHelpers.hasNonEmptyStateMachine(ac);
+ boolean _hasNonEmptyStateMachine = this._roomHelpers.hasNonEmptyStateMachine(ac);
if (_hasNonEmptyStateMachine) {
_builder.append("\t");
_builder.append("// state and history");
@@ -168,7 +172,7 @@ public class ActorClassDataGen {
_builder.append("\t");
_builder.newLine();
{
- boolean _hasNonEmptyStateMachine_1 = RoomHelpers.hasNonEmptyStateMachine(ac);
+ boolean _hasNonEmptyStateMachine_1 = this._roomHelpers.hasNonEmptyStateMachine(ac);
if (_hasNonEmptyStateMachine_1) {
_builder.append("\t");
_builder.append("public int getState() {");
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java
index 4033a30df..2da83fa4d 100644
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java
+++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java
@@ -43,7 +43,6 @@ import org.eclipse.etrice.core.room.ServiceImplementation;
import org.eclipse.etrice.core.room.StandardOperation;
import org.eclipse.etrice.core.room.StateGraph;
import org.eclipse.etrice.core.room.VarDecl;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.generator.base.AbstractGenerator;
import org.eclipse.etrice.generator.base.FileSystemHelpers;
import org.eclipse.etrice.generator.base.IDataConfiguration;
@@ -82,8 +81,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
@Inject
private IDataConfiguration dataConfigExt;
- @Inject
- private ConfigGenAddon configGenAddon;
+ private final ConfigGenAddon configGenAddon;
@Inject
@Extension
@@ -105,6 +103,11 @@ public class ActorClassGen extends GenericActorClassGenerator {
@Extension
private FileSystemHelpers _fileSystemHelpers;
+ @Inject
+ public ActorClassGen(final ConfigGenAddon configGenAddon) {
+ this.configGenAddon = configGenAddon;
+ }
+
public void doGenerate(final Root root) {
final HashMap<ActorClass, WiredActorClass> ac2wired = new HashMap<ActorClass, WiredActorClass>();
EList<WiredStructureClass> _wiredInstances = root.getWiredInstances();
@@ -134,7 +137,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
ActorClass _actorClass = xpac.getActorClass();
final WiredActorClass wired = ac2wired.get(_actorClass);
ActorClass _actorClass_1 = xpac.getActorClass();
- final boolean manualBehavior = RoomHelpers.isBehaviorAnnotationPresent(_actorClass_1, "BehaviorManual");
+ final boolean manualBehavior = this._roomHelpers.isBehaviorAnnotationPresent(_actorClass_1, "BehaviorManual");
ActorClass _actorClass_2 = xpac.getActorClass();
String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_actorClass_2);
ActorClass _actorClass_3 = xpac.getActorClass();
@@ -171,7 +174,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
EList<StandardOperation> _operations = ac.getOperations();
final Function1<StandardOperation, Boolean> _function = new Function1<StandardOperation, Boolean>() {
public Boolean apply(final StandardOperation op) {
- return Boolean.valueOf(RoomHelpers.isConstructor(op));
+ return Boolean.valueOf(ActorClassGen.this._roomHelpers.isConstructor(op));
}
};
Iterable<StandardOperation> _filter = IterableExtensions.<StandardOperation>filter(_operations, _function);
@@ -204,11 +207,11 @@ public class ActorClassGen extends GenericActorClassGenerator {
_xifexpression_2 = _base_1.getName();
} else {
String _xifexpression_3 = null;
- String _attribute = RoomHelpers.getAttribute(ac, "ActorBaseClass", "class");
+ String _attribute = this._roomHelpers.getAttribute(ac, "ActorBaseClass", "class");
boolean _isEmpty = _attribute.isEmpty();
boolean _not = (!_isEmpty);
if (_not) {
- _xifexpression_3 = RoomHelpers.getAttribute(ac, "ActorBaseClass", "class");
+ _xifexpression_3 = this._roomHelpers.getAttribute(ac, "ActorBaseClass", "class");
} else {
String _xifexpression_4 = null;
GlobalSettings _settings_1 = Main.getSettings();
@@ -353,7 +356,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append("//--------------------- ports");
_builder.newLine();
{
- List<Port> _endPorts = RoomHelpers.getEndPorts(ac);
+ List<Port> _endPorts = this._roomHelpers.getEndPorts(ac);
for(final Port ep : _endPorts) {
_builder.append("\t");
_builder.append("protected ");
@@ -504,7 +507,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append("// own ports");
_builder.newLine();
{
- List<Port> _endPorts_1 = RoomHelpers.getEndPorts(ac);
+ List<Port> _endPorts_1 = this._roomHelpers.getEndPorts(ac);
for(final Port ep_1 : _endPorts_1) {
_builder.append("\t\t");
String _name_12 = ep_1.getName();
@@ -801,7 +804,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append("//--------------------- port getters");
_builder.newLine();
{
- List<Port> _endPorts_2 = RoomHelpers.getEndPorts(ac);
+ List<Port> _endPorts_2 = this._roomHelpers.getEndPorts(ac);
for(final Port ep_2 : _endPorts_2) {
_builder.append("\t");
String _portClassName_6 = this._roomExtensions.getPortClassName(ep_2);
@@ -955,7 +958,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append("public void receiveEvent(InterfaceItemBase ifitem, int evt, Object generic_data) {");
_builder.newLine();
{
- List<InterfaceItem> _allInterfaceItems = RoomHelpers.getAllInterfaceItems(ac);
+ List<InterfaceItem> _allInterfaceItems = this._roomHelpers.getAllInterfaceItems(ac);
boolean _hasElements = false;
for(final InterfaceItem ifitem : _allInterfaceItems) {
if (!_hasElements) {
@@ -976,13 +979,13 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append("switch (evt) {");
_builder.newLine();
{
- List<Message> _incoming = RoomHelpers.getIncoming(ifitem);
+ List<Message> _incoming = this._roomHelpers.getIncoming(ifitem);
for(final Message msg : _incoming) {
_builder.append("\t");
_builder.append("\t");
_builder.append("\t\t");
_builder.append("case ");
- ProtocolClass _protocolClass = RoomHelpers.getProtocolClass(msg);
+ ProtocolClass _protocolClass = this._roomHelpers.getProtocolClass(msg);
String _name_40 = _protocolClass.getName();
_builder.append(_name_40, "\t\t\t\t");
_builder.append(".");
@@ -1070,10 +1073,10 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append("}");
_builder.newLine();
{
- List<InterfaceItem> _allInterfaceItems_1 = RoomHelpers.getAllInterfaceItems(ac);
+ List<InterfaceItem> _allInterfaceItems_1 = this._roomHelpers.getAllInterfaceItems(ac);
for(final InterfaceItem ifitem_1 : _allInterfaceItems_1) {
{
- List<Message> _incoming_1 = RoomHelpers.getIncoming(ifitem_1);
+ List<Message> _incoming_1 = this._roomHelpers.getIncoming(ifitem_1);
for(final Message msg_1 : _incoming_1) {
_builder.append("\t");
_builder.append("protected void on_");
@@ -1106,7 +1109,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.newLine();
} else {
{
- boolean _hasNonEmptyStateMachine = RoomHelpers.hasNonEmptyStateMachine(ac);
+ boolean _hasNonEmptyStateMachine = this._roomHelpers.hasNonEmptyStateMachine(ac);
if (_hasNonEmptyStateMachine) {
_builder.append("\t");
CharSequence _genStateMachine = this._stateMachineGen.genStateMachine(xpac);
@@ -1130,7 +1133,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
}
} else {
StateGraph _stateMachine = xpac.getStateMachine();
- boolean _isEmpty_4 = RoomHelpers.isEmpty(_stateMachine);
+ boolean _isEmpty_4 = this._roomHelpers.isEmpty(_stateMachine);
if (_isEmpty_4) {
_builder.append("\t");
_builder.append("//--------------------- no state machine");
@@ -1339,7 +1342,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
}
}
{
- boolean _hasNonEmptyStateMachine_1 = RoomHelpers.hasNonEmptyStateMachine(ac);
+ boolean _hasNonEmptyStateMachine_1 = this._roomHelpers.hasNonEmptyStateMachine(ac);
if (_hasNonEmptyStateMachine_1) {
_builder.append("\t");
_builder.append("\t");
@@ -1506,7 +1509,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
}
}
{
- boolean _hasNonEmptyStateMachine_2 = RoomHelpers.hasNonEmptyStateMachine(ac);
+ boolean _hasNonEmptyStateMachine_2 = this._roomHelpers.hasNonEmptyStateMachine(ac);
if (_hasNonEmptyStateMachine_2) {
_builder.append("\t");
_builder.append("\t");
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java
index ba94be2bc..ea43b064e 100644
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java
+++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java
@@ -58,6 +58,10 @@ public class ConfigGenAddon {
@Inject
@Extension
+ private RoomHelpers _roomHelpers;
+
+ @Inject
+ @Extension
private RoomExtensions _roomExtensions;
@Inject
@@ -67,7 +71,7 @@ public class ConfigGenAddon {
StringConcatenation _builder = new StringConcatenation();
{
ActorClass _actorClass = ai.getActorClass();
- List<Attribute> _allAttributes = RoomHelpers.getAllAttributes(_actorClass);
+ List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(_actorClass);
for(final Attribute a : _allAttributes) {
ArrayList<Attribute> _arrayList = new ArrayList<Attribute>();
List<Attribute> _union = this._roomExtensions.<Attribute>union(_arrayList, a);
@@ -80,7 +84,7 @@ public class ConfigGenAddon {
EList<InterfaceItemInstance> _orderedIfItemInstances = ai.getOrderedIfItemInstances();
for(final InterfaceItemInstance pi : _orderedIfItemInstances) {
InterfaceItem _interfaceItem = pi.getInterfaceItem();
- PortClass _portClass = RoomHelpers.getPortClass(_interfaceItem);
+ PortClass _portClass = this._roomHelpers.getPortClass(_interfaceItem);
EList<Attribute> _attributes = null;
if (_portClass!=null) {
_attributes=_portClass.getAttributes();
@@ -155,7 +159,7 @@ public class ConfigGenAddon {
_matched=true;
StringConcatenation _builder = new StringConcatenation();
{
- List<Attribute> _allAttributes = RoomHelpers.getAllAttributes(((DataClass) aType));
+ List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(((DataClass) aType));
for(final Attribute e : _allAttributes) {
String _name = a.getName();
CharSequence _invokeGetter = this.helpers.invokeGetter(_name, null);
@@ -357,7 +361,7 @@ public class ConfigGenAddon {
public String genMinMaxConstants(final ActorClass ac) {
StringConcatenation _builder = new StringConcatenation();
{
- List<Attribute> _allAttributes = RoomHelpers.getAllAttributes(ac);
+ List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(ac);
for(final Attribute a : _allAttributes) {
String _name = a.getName();
ArrayList<Attribute> _arrayList = new ArrayList<Attribute>();
@@ -392,7 +396,7 @@ public class ConfigGenAddon {
_matched=true;
StringConcatenation _builder = new StringConcatenation();
{
- List<Attribute> _allAttributes = RoomHelpers.getAllAttributes(((DataClass) aType));
+ List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(((DataClass) aType));
for(final Attribute e : _allAttributes) {
String _name = e.getName();
String _plus = ((varNamePath + "_") + _name);
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java
index 37c49bd9b..834244124 100644
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java
+++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java
@@ -44,6 +44,10 @@ public class DataClassGen {
@Inject
@Extension
+ private RoomHelpers _roomHelpers;
+
+ @Inject
+ @Extension
private JavaExtensions _javaExtensions;
@Inject
@@ -91,7 +95,7 @@ public class DataClassGen {
EList<StandardOperation> _operations = dc.getOperations();
final Function1<StandardOperation, Boolean> _function = new Function1<StandardOperation, Boolean>() {
public Boolean apply(final StandardOperation op) {
- return Boolean.valueOf(RoomHelpers.isConstructor(op));
+ return Boolean.valueOf(DataClassGen.this._roomHelpers.isConstructor(op));
}
};
Iterable<StandardOperation> _filter = IterableExtensions.<StandardOperation>filter(_operations, _function);
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java
index 183e43b39..49a734d0e 100644
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java
+++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java
@@ -38,7 +38,7 @@ import org.eclipse.xtext.xbase.lib.IterableExtensions;
public class Initialization {
@Inject
@Extension
- private TypeHelpers typeHelpers;
+ private RoomHelpers _roomHelpers;
@Inject
@Extension
@@ -46,6 +46,10 @@ public class Initialization {
@Inject
@Extension
+ private TypeHelpers typeHelpers;
+
+ @Inject
+ @Extension
private JavaExtensions languageExt;
@Inject
@@ -203,7 +207,7 @@ public class Initialization {
_matched=true;
StringConcatenation _builder = new StringConcatenation();
{
- List<Attribute> _allAttributes = RoomHelpers.getAllAttributes(((DataClass) aType));
+ List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(((DataClass) aType));
for(final Attribute e : _allAttributes) {
List<Attribute> _union = this._roomExtensions.<Attribute>union(path, e);
CharSequence _attributeInitPrimitiveRec = this.attributeInitPrimitiveRec(_union, roomClass);
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.java
index 0b325f74c..b3289fb53 100644
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.java
+++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.java
@@ -33,6 +33,10 @@ public class OptionalActorFactoryGen {
@Inject
@Extension
+ private RoomHelpers _roomHelpers;
+
+ @Inject
+ @Extension
private JavaExtensions _javaExtensions;
@Inject
@@ -140,17 +144,17 @@ public class OptionalActorFactoryGen {
_builder.append("// wiring");
_builder.newLine();
{
- List<Port> _allEndPorts = RoomHelpers.getAllEndPorts(ac);
+ List<Port> _allEndPorts = this._roomHelpers.getAllEndPorts(ac);
final Function1<Port, Boolean> _function = new Function1<Port, Boolean>() {
public Boolean apply(final Port p) {
- return Boolean.valueOf(RoomHelpers.isExternal(p));
+ return Boolean.valueOf(OptionalActorFactoryGen.this._roomHelpers.isExternal(p));
}
};
Iterable<Port> _filter = IterableExtensions.<Port>filter(_allEndPorts, _function);
for(final Port port : _filter) {
_builder.append("\t\t");
String _xifexpression = null;
- boolean _isDataDriven = RoomHelpers.isDataDriven(port);
+ boolean _isDataDriven = this._roomHelpers.isDataDriven(port);
if (_isDataDriven) {
_xifexpression = "DataPortBase";
} else {
@@ -173,7 +177,7 @@ public class OptionalActorFactoryGen {
_builder.append("\t\t");
String _xifexpression_1 = null;
Port _port = open.getPort();
- boolean _isDataDriven_1 = RoomHelpers.isDataDriven(_port);
+ boolean _isDataDriven_1 = this._roomHelpers.isDataDriven(_port);
if (_isDataDriven_1) {
_xifexpression_1 = "DataPortBase";
} else {
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.java
index 187a04dcb..b500bfba9 100644
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.java
+++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.java
@@ -17,7 +17,6 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.etrice.core.genmodel.etricegen.Root;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.Port;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.generator.base.FileSystemHelpers;
import org.eclipse.etrice.generator.base.IGeneratorFileIo;
import org.eclipse.etrice.generator.generic.GenericActorClassGenerator;
@@ -120,7 +119,7 @@ public class OptionalActorInterfaceGen extends GenericActorClassGenerator {
_builder.append("//--------------------- brokers for ports on the interface");
_builder.newLine();
{
- List<Port> _allInterfacePorts = RoomHelpers.getAllInterfacePorts(ac);
+ List<Port> _allInterfacePorts = this._roomHelpers.getAllInterfacePorts(ac);
for(final Port ep : _allInterfacePorts) {
_builder.append("\t");
_builder.append("protected InterfaceItemBroker ");
@@ -158,7 +157,7 @@ public class OptionalActorInterfaceGen extends GenericActorClassGenerator {
_builder.append("\t\t");
_builder.newLine();
{
- List<Port> _allInterfacePorts_1 = RoomHelpers.getAllInterfacePorts(ac);
+ List<Port> _allInterfacePorts_1 = this._roomHelpers.getAllInterfacePorts(ac);
for(final Port ep_1 : _allInterfacePorts_1) {
{
boolean _isReplicated = ep_1.isReplicated();
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java
index 403094cde..e38ec5a33 100644
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java
+++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java
@@ -30,7 +30,6 @@ import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.RefableType;
import org.eclipse.etrice.core.room.RoomModel;
import org.eclipse.etrice.core.room.VarDecl;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.generator.base.FileSystemHelpers;
import org.eclipse.etrice.generator.base.IGeneratorFileIo;
import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator;
@@ -200,7 +199,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("\t");
_builder.append("private static String messageStrings[] = {\"MIN\", ");
{
- List<Message> _allOutgoingMessages = RoomHelpers.getAllOutgoingMessages(pc);
+ List<Message> _allOutgoingMessages = this._roomHelpers.getAllOutgoingMessages(pc);
for(final Message m : _allOutgoingMessages) {
_builder.append("\"");
String _name_2 = m.getName();
@@ -210,7 +209,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
}
_builder.append(" ");
{
- List<Message> _allIncomingMessages = RoomHelpers.getAllIncomingMessages(pc);
+ List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc);
for(final Message m_1 : _allIncomingMessages) {
_builder.append("\"");
String _name_3 = m_1.getName();
@@ -480,7 +479,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("// sent messages");
_builder.newLine();
{
- List<Message> _allMessages = RoomHelpers.getAllMessages(pc, (conj).booleanValue());
+ List<Message> _allMessages = this._roomHelpers.getAllMessages(pc, (conj).booleanValue());
for(final Message m : _allMessages) {
_builder.append("\t");
CharSequence _sendMessage = this.sendMessage(m, (conj).booleanValue());
@@ -567,7 +566,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("// incoming messages");
_builder.newLine();
{
- List<Message> _allIncomingMessages = RoomHelpers.getAllIncomingMessages(pc);
+ List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc);
for(final Message m_1 : _allIncomingMessages) {
_builder.append("\t");
CharSequence _messageSignature = this.messageSignature(m_1);
@@ -601,7 +600,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("// outgoing messages");
_builder.newLine();
{
- List<Message> _allOutgoingMessages = RoomHelpers.getAllOutgoingMessages(pc);
+ List<Message> _allOutgoingMessages = this._roomHelpers.getAllOutgoingMessages(pc);
for(final Message m_2 : _allOutgoingMessages) {
_builder.append("\t");
CharSequence _messageSignature_1 = this.messageSignature(m_2);
@@ -858,7 +857,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
public CharSequence generateDataDriven(final Root root, final ProtocolClass pc) {
CharSequence _xblockexpression = null;
{
- List<Message> _allIncomingMessages = RoomHelpers.getAllIncomingMessages(pc);
+ List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc);
final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() {
public Boolean apply(final Message m) {
VarDecl _data = m.getData();
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/StateMachineGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/StateMachineGen.java
index 557ab94bc..8be8d6a80 100644
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/StateMachineGen.java
+++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/StateMachineGen.java
@@ -17,8 +17,6 @@ import java.util.List;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.State;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
-import org.eclipse.etrice.generator.base.CodegenHelpers;
import org.eclipse.etrice.generator.generic.GenericStateMachineGenerator;
import org.eclipse.etrice.generator.java.Main;
import org.eclipse.etrice.generator.java.gen.GlobalSettings;
@@ -36,7 +34,7 @@ public class StateMachineGen extends GenericStateMachineGenerator {
boolean _while = _notEquals;
while (_while) {
{
- List<State> _allBaseStates = RoomHelpers.getAllBaseStates(ac);
+ List<State> _allBaseStates = this._roomHelpers.getAllBaseStates(ac);
List<State> _leafStatesLast = this._roomExtensions.getLeafStatesLast(_allBaseStates);
states.addAll(0, _leafStatesLast);
ActorClass _base = ac.getBase();
@@ -78,7 +76,7 @@ public class StateMachineGen extends GenericStateMachineGenerator {
}
_builder.append("\t");
_builder.append("\"");
- String _genStatePathName = CodegenHelpers.getGenStatePathName(state);
+ String _genStatePathName = this._codegenHelpers.getGenStatePathName(state);
_builder.append(_genStatePathName, "\t");
_builder.append("\"");
_builder.newLineIfNotEmpty();
@@ -160,7 +158,7 @@ public class StateMachineGen extends GenericStateMachineGenerator {
public int getHistorySize(final ExpandedActorClass xpac) {
ActorClass _actorClass = xpac.getActorClass();
- List<State> _allBaseStates = RoomHelpers.getAllBaseStates(_actorClass);
+ List<State> _allBaseStates = this._roomHelpers.getAllBaseStates(_actorClass);
int _size = _allBaseStates.size();
return (_size + 2);
}
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java
index dad112e09..59436985b 100644
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java
+++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java
@@ -75,6 +75,10 @@ public class VariableServiceGen {
@Extension
private TypeHelpers _typeHelpers;
+ @Inject
+ @Extension
+ private RoomHelpers _roomHelpers;
+
public void doGenerate(final Root root, final SubSystemInstance ssi) {
final NodeRef nr = ETMapUtil.getNodeRef(ssi);
final String clsname = this.stdExt.getJavaClassName(nr, ssi);
@@ -406,7 +410,7 @@ public class VariableServiceGen {
_builder.append(" object, Map<String, Object> map){");
_builder.newLineIfNotEmpty();
{
- List<Attribute> _allAttributes = RoomHelpers.getAllAttributes(dc_1);
+ List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(dc_1);
for(final Attribute a_2 : _allAttributes) {
{
RefableType _type = a_2.getType();
@@ -591,7 +595,7 @@ public class VariableServiceGen {
while (_while) {
{
DataClass dc = visit.pop();
- List<Attribute> _allAttributes = RoomHelpers.getAllAttributes(dc);
+ List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(dc);
final Procedure1<Attribute> _function = new Procedure1<Attribute>() {
public void apply(final Attribute a) {
RefableType _type = a.getType();
@@ -708,7 +712,7 @@ public class VariableServiceGen {
DataClass dataClass = ((DataClass) _type_5);
StringConcatenation _builder_1 = new StringConcatenation();
{
- List<Attribute> _allAttributes = RoomHelpers.getAllAttributes(dataClass);
+ List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(dataClass);
for(final Attribute at : _allAttributes) {
List<Attribute> _union = this.roomExt.<Attribute>union(path, at);
CharSequence _genGetAttributeValues = this.genGetAttributeValues(_union, ai);
@@ -858,7 +862,7 @@ public class VariableServiceGen {
DataClass dataClass = ((DataClass) _type_15);
StringConcatenation _builder_1 = new StringConcatenation();
{
- List<Attribute> _allAttributes = RoomHelpers.getAllAttributes(dataClass);
+ List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(dataClass);
for(final Attribute at : _allAttributes) {
List<Attribute> _union = this.roomExt.<Attribute>union(path, at);
CharSequence _genSetAttributeValues1 = this.genSetAttributeValues1(_union, ai);
@@ -945,7 +949,7 @@ public class VariableServiceGen {
final DataClass dataClass = ((DataClass) _type_5);
StringConcatenation _builder = new StringConcatenation();
{
- List<Attribute> _allAttributes = RoomHelpers.getAllAttributes(dataClass);
+ List<Attribute> _allAttributes = this._roomHelpers.getAllAttributes(dataClass);
for(final Attribute at : _allAttributes) {
List<Attribute> _union = this.roomExt.<Attribute>union(path, at);
CharSequence _genSetAttributeValues2 = this.genSetAttributeValues2(_union, ai);
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/MappingBuilder.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/MappingBuilder.java
index 1e46cfe13..f41b16fc0 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/MappingBuilder.java
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/MappingBuilder.java
@@ -53,7 +53,8 @@ public class MappingBuilder {
private ETPhysFactory physFactory = ETPhysFactory.eINSTANCE;
private BaseFactory baseFactory = BaseFactory.eINSTANCE;
private Map<SubSystemClass, NodeClass> nodeMap = Maps.newHashMap();
-
+ private RoomHelpers roomHelpers = new RoomHelpers();
+
XtextResourceSet resourceSet = null;
XtextResource etPhysRes = null;
XtextResource etMapRes = null;
@@ -161,7 +162,7 @@ public class MappingBuilder {
if (!aim.getThread().equals(logThread))
continue;
- ActorContainerClass ac = RoomHelpers.getActorContainerClass(aim);
+ ActorContainerClass ac = roomHelpers.getActorContainerClass(aim);
if (ac instanceof ActorClass) {
eventOnly &= ((ActorClass) ac).getCommType() == ActorCommunicationType.EVENT_DRIVEN;
dataOnly &= ((ActorClass) ac).getCommType() == ActorCommunicationType.DATA_DRIVEN;
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/CodegenHelpers.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/CodegenHelpers.java
index b58f0c659..c660f2963 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/CodegenHelpers.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/CodegenHelpers.java
@@ -24,19 +24,22 @@ import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain;
*/
public class CodegenHelpers {
+ private RoomHelpers roomHelpers = new RoomHelpers();
+ private RoomNameProvider roomNameProvider = new RoomNameProvider();
+
/**
* @param t a {@link Transition}
* @return a name for the action code operation the generator will generate
*/
- public static String getActionCodeOperationName(Transition t) {
- return "action_"+RoomNameProvider.getFullPath(t);
+ public String getActionCodeOperationName(Transition t) {
+ return "action_"+roomNameProvider.getFullPath(t);
}
/**
* @param s a {@link State}
* @return a name for the entry code operation the generator will generate
*/
- public static String getEntryCodeOperationName(State s) {
+ public String getEntryCodeOperationName(State s) {
return "entry_"+getGenStatePathName(s);
}
@@ -44,7 +47,7 @@ public class CodegenHelpers {
* @param s a {@link State}
* @return a name for the exit code operation the generator will generate
*/
- public static String getExitCodeOperationName(State s) {
+ public String getExitCodeOperationName(State s) {
return "exit_"+getGenStatePathName(s);
}
@@ -52,7 +55,7 @@ public class CodegenHelpers {
* @param s a {@link State}
* @return a name for the do code operation the generator will generate
*/
- public static String getDoCodeOperationName(State s) {
+ public String getDoCodeOperationName(State s) {
return "do_"+getGenStatePathName(s);
}
@@ -60,8 +63,8 @@ public class CodegenHelpers {
* @param tc a {@link TransitionChain}
* @return a name for the constant transition chain ID the generator will generate
*/
- public static String getGenChainId(TransitionChain tc) {
- return "CHAIN_"+RoomNameProvider.getFullPath(tc.getTransition());
+ public String getGenChainId(TransitionChain tc) {
+ return "CHAIN_"+roomNameProvider.getFullPath(tc.getTransition());
}
/**
@@ -70,19 +73,19 @@ public class CodegenHelpers {
*
* @see org.eclipse.etrice.core.naming.RoomNameProvider#getFullPath(StateGraphItem)
*/
- public static String getGenStatePathName(State s) {
- return RoomNameProvider.getFullPath(s);
+ public String getGenStatePathName(State s) {
+ return roomNameProvider.getFullPath(s);
}
/**
* @param s a {@link State} (may be <code>null</code>)
* @return a unique identifier used by the generator for state IDs
*/
- public static String getGenStateId(State s) {
+ public String getGenStateId(State s) {
if (s==null)
- return "STATE_"+RoomNameProvider.getStateName(s);
+ return "STATE_"+roomNameProvider.getStateName(s);
else
- return "STATE_"+RoomNameProvider.getFullPath(s);
+ return "STATE_"+roomNameProvider.getFullPath(s);
}
/**
@@ -90,8 +93,8 @@ public class CodegenHelpers {
* @return an ID for the parent state of s
* @see #getGenStateId(State)
*/
- public static String getParentStateId(State s) {
- return getGenStateId(RoomHelpers.getParentState(s));
+ public String getParentStateId(State s) {
+ return getGenStateId(roomHelpers.getParentState(s));
}
}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DefaultTranslationProvider.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DefaultTranslationProvider.java
index e6bed9b6f..868e13478 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DefaultTranslationProvider.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DefaultTranslationProvider.java
@@ -39,6 +39,11 @@ public class DefaultTranslationProvider implements ITranslationProvider {
* the logger used for issuing informations
*/
@Inject ILogger logger;
+
+ /**
+ * the name provider for model objects
+ */
+ @Inject RoomNameProvider roomNameProvider;
/**
* @return <code>false</code>
@@ -115,12 +120,12 @@ public class DefaultTranslationProvider implements ITranslationProvider {
@Override
public String translateTag(String tag, DetailCode code) {
if (tag.equals("MODEL_LOCATION")) {
- return RoomNameProvider.getDetailCodeLocation(code);
+ return roomNameProvider.getDetailCodeLocation(code);
}
logger.logInfo("unrecognized tag '"+tag+"' in "
- +RoomNameProvider.getDetailCodeLocation(code)+" of "
- +RoomNameProvider.getClassLocation(RoomNameProvider.getModelClass(code)));
+ +roomNameProvider.getDetailCodeLocation(code)+" of "
+ +roomNameProvider.getClassLocation(roomNameProvider.getModelClass(code)));
return TAG_START+"?"+tag+"?"+TAG_END;
}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DetailCodeTranslator.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DetailCodeTranslator.java
index 7b78606a4..1bb5e0c9d 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DetailCodeTranslator.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DetailCodeTranslator.java
@@ -63,6 +63,7 @@ public class DetailCodeTranslator {
int pos = 0;
}
+ private RoomHelpers roomHelpers = new RoomHelpers();
private ITranslationProvider provider;
private HashMap<String, InterfaceItem> name2item = new HashMap<String, InterfaceItem>();
private HashMap<String, Attribute> name2attr = new HashMap<String, Attribute>();
@@ -357,7 +358,7 @@ public class DetailCodeTranslator {
String token = getToken(text, curr);
- List<Message> messages = RoomHelpers.getMessageListDeep(item, outgoing);
+ List<Message> messages = roomHelpers.getMessageListDeep(item, outgoing);
for (Message message : messages) {
if (message.getName().equals(token))
return message;
@@ -485,7 +486,7 @@ public class DetailCodeTranslator {
if (container instanceof ActorClass) {
ActorClass ac = (ActorClass) container;
- List<InterfaceItem> items = RoomHelpers.getAllInterfaceItems(ac);
+ List<InterfaceItem> items = roomHelpers.getAllInterfaceItems(ac);
for (InterfaceItem item : items) {
name2item.put(item.getName(), item);
}
@@ -493,9 +494,9 @@ public class DetailCodeTranslator {
List<Attribute> attributes = null;
if (container instanceof ActorClass)
- attributes = RoomHelpers.getAllAttributes((ActorClass) container);
+ attributes = roomHelpers.getAllAttributes((ActorClass) container);
else if (container instanceof DataClass)
- attributes = RoomHelpers.getAllAttributes((DataClass) container);
+ attributes = roomHelpers.getAllAttributes((DataClass) container);
else if (container instanceof PortClass)
attributes = ((PortClass) container).getAttributes();
if (attributes!=null)
@@ -505,9 +506,9 @@ public class DetailCodeTranslator {
List<? extends Operation> operations = null;
if (container instanceof ActorClass)
- operations = RoomHelpers.getAllOperations((ActorClass) container);
+ operations = roomHelpers.getAllOperations((ActorClass) container);
else if (container instanceof DataClass)
- operations = RoomHelpers.getAllOperations((DataClass) container);
+ operations = roomHelpers.getAllOperations((DataClass) container);
else if (container instanceof PortClass)
operations = ((PortClass) container).getOperations();
if (operations!=null)
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/Diagnostician.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/Diagnostician.java
index 1a14c36b5..d61f46637 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/Diagnostician.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/Diagnostician.java
@@ -32,6 +32,9 @@ public class Diagnostician implements IDiagnostician {
@Inject
private ILineOutputLogger logger;
+ @Inject
+ private RoomNameProvider roomNameProvider;
+
public void warning(String msg, EObject source, EStructuralFeature feature) {
logger.logInfo("Validation warning: " + getMsgTxt(msg, source, feature, INSIGNIFICANT_INDEX));
}
@@ -59,10 +62,10 @@ public class Diagnostician implements IDiagnostician {
return msg;
if (idx==INSIGNIFICANT_INDEX)
- return msg + " (" + RoomNameProvider.getName(source) + ", "
+ return msg + " (" + roomNameProvider.getName(source) + ", "
+ feature.getName()+")";
else
- return msg + " (" + RoomNameProvider.getName(source) + ", "
+ return msg + " (" + roomNameProvider.getName(source) + ", "
+ feature.getName() + " at index "+idx+")";
}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.xtend
index a200188cd..7c95a077c 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.xtend
@@ -18,7 +18,7 @@ import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.xtext.util.Pair
import static org.eclipse.xtext.util.Tuples.*
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
+import org.eclipse.etrice.core.room.util.RoomHelpers
import static extension org.eclipse.etrice.generator.base.Indexed.*
import org.eclipse.etrice.core.room.ActorClass
@@ -28,6 +28,7 @@ import org.eclipse.etrice.core.room.ActorClass
*/
class GenericActorClassGenerator {
+ @Inject protected extension RoomHelpers
@Inject protected extension RoomExtensions
@Inject protected ILanguageExtension langExt
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.xtend
index 64309a526..207990b20 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.xtend
@@ -24,13 +24,14 @@ import org.eclipse.etrice.core.room.MessageFromIf
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.xtext.util.Pair
import static org.eclipse.xtext.util.Tuples.*
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
+import org.eclipse.etrice.core.room.util.RoomHelpers
/**
* Target language independent protocol class generator.
*/
class GenericProtocolClassGenerator {
+ @Inject protected extension RoomHelpers
@Inject protected extension ILanguageExtension
@Inject protected extension RoomExtensions
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend
index 28fbad54e..c4abdad25 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend
@@ -15,32 +15,32 @@ package org.eclipse.etrice.generator.generic
import com.google.inject.Inject
import java.util.ArrayList
import java.util.List
+import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState
+import org.eclipse.etrice.core.genmodel.etricegen.util.ETriceGenUtil
import org.eclipse.etrice.core.room.ActorCommunicationType
+import org.eclipse.etrice.core.room.GuardedTransition
+import org.eclipse.etrice.core.room.NonInitialTransition
import org.eclipse.etrice.core.room.State
import org.eclipse.etrice.core.room.Transition
-import org.eclipse.etrice.core.room.GuardedTransition
+import org.eclipse.etrice.core.room.TransitionPoint
import org.eclipse.etrice.core.room.TriggeredTransition
-import org.eclipse.etrice.core.room.NonInitialTransition
-import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass
-import org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState
-import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger
-import org.eclipse.etrice.generator.generic.RoomExtensions
+import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.etrice.generator.base.AbstractGenerator
+import org.eclipse.etrice.generator.base.CodegenHelpers
import org.eclipse.xtext.util.Pair
-import org.eclipse.etrice.generator.generic.TransitionChainGenerator
-import org.eclipse.etrice.core.room.TransitionPoint
import static org.eclipse.xtext.util.Tuples.*
-import static extension org.eclipse.etrice.generator.base.CodegenHelpers.*
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
-import static extension org.eclipse.etrice.core.genmodel.etricegen.util.ETriceGenUtil.*
-
/**
* A target language independent generator of the state machine implementation-
*/
class GenericStateMachineGenerator {
+ @Inject protected extension RoomHelpers
+ @Inject protected extension ETriceGenUtil
+ @Inject protected extension CodegenHelpers
@Inject protected extension RoomExtensions
@Inject protected ILanguageExtension langExt
@Inject protected GenericProtocolClassGenerator pcGen
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend
index 6ef85f92b..d5e3c9bb5 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend
@@ -29,7 +29,7 @@ import org.eclipse.etrice.core.room.RefableType
import org.eclipse.etrice.core.room.VarDecl
import org.eclipse.etrice.generator.base.AbstractGenerator
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
+import org.eclipse.etrice.core.room.util.RoomHelpers
/**
* A collection of methods for generation of user code, attributes with getters and setters
@@ -38,9 +38,10 @@ import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
@Singleton
class ProcedureHelpers {
- @Inject extension TypeHelpers
- @Inject ILanguageExtension languageExt
- @Inject ILogger logger
+ @Inject protected extension RoomHelpers
+ @Inject protected extension TypeHelpers
+ @Inject protected ILanguageExtension languageExt
+ @Inject protected ILogger logger
/**
* @param dc a {@link DataClass}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend
index 0ce66de15..4601b41e6 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend
@@ -38,12 +38,13 @@ import org.eclipse.etrice.core.room.StateGraph
import org.eclipse.etrice.core.room.Transition
import org.eclipse.etrice.core.room.TransitionPoint
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
+import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.emf.common.util.BasicEList
import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance
import org.eclipse.etrice.core.genmodel.etricegen.AbstractInstance
import org.eclipse.emf.common.util.TreeIterator
import org.eclipse.etrice.generator.base.FileSystemHelpers
+import javax.inject.Inject
/**
collection of convenience functions for code generation
@@ -55,6 +56,8 @@ class RoomExtensions {
private static String genInfoDir = "/src-gen-info/"
private static String genDocDir = "/doc-gen/"
+ @Inject protected extension RoomHelpers
+
def static setDefaultGenDir() {
genDir = "/src-gen/"
}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TransitionChainVisitor.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TransitionChainVisitor.java
index 271962ccd..234832fa1 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TransitionChainVisitor.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TransitionChainVisitor.java
@@ -36,6 +36,7 @@ import com.google.inject.Inject;
public class TransitionChainVisitor implements ITransitionChainVisitor {
@Inject private ILanguageExtension langExt;
+ @Inject private CodegenHelpers codegenHelpers;
private ExpandedActorClass xpac;
private boolean dataDriven;
@@ -65,25 +66,25 @@ public class TransitionChainVisitor implements ITransitionChainVisitor {
if (tr.getAction()!=null && !tr.getAction().getLines().isEmpty()) {
if (tr instanceof InitialTransition)
- return CodegenHelpers.getActionCodeOperationName(tr)+"("+langExt.selfPointer(false)+");\n";
+ return codegenHelpers.getActionCodeOperationName(tr)+"("+langExt.selfPointer(false)+");\n";
else if (dataDriven)
- return CodegenHelpers.getActionCodeOperationName(tr)+"("+langExt.selfPointer(false)+");\n";
+ return codegenHelpers.getActionCodeOperationName(tr)+"("+langExt.selfPointer(false)+");\n";
else {
String[] result = langExt.generateArglistAndTypedData(xpac.getData(tr));
String dataArg = result[0];
- return CodegenHelpers.getActionCodeOperationName(tr)+"("+langExt.selfPointer(true)+"ifitem"+dataArg+");\n";
+ return codegenHelpers.getActionCodeOperationName(tr)+"("+langExt.selfPointer(true)+"ifitem"+dataArg+");\n";
}
}
return "";
}
public String genEntryOperationCall(State state) {
- return CodegenHelpers.getEntryCodeOperationName(state)+"("+langExt.selfPointer(false)+");\n";
+ return codegenHelpers.getEntryCodeOperationName(state)+"("+langExt.selfPointer(false)+");\n";
}
public String genExitOperationCall(State state) {
- return CodegenHelpers.getExitCodeOperationName(state)+"("+langExt.selfPointer(false)+");\n";
+ return codegenHelpers.getExitCodeOperationName(state)+"("+langExt.selfPointer(false)+");\n";
}
public String genElseIfBranch(CPBranchTransition tr, boolean isFirst) {
@@ -108,9 +109,9 @@ public class TransitionChainVisitor implements ITransitionChainVisitor {
public String genReturnState(State state, boolean executeEntryCode) {
if (executeEntryCode)
- return "return " + CodegenHelpers.getGenStateId(state) + ";";
+ return "return " + codegenHelpers.getGenStateId(state) + ";";
else
- return "return " + CodegenHelpers.getGenStateId(state) + " + STATE_MAX;";
+ return "return " + codegenHelpers.getGenStateId(state) + " + STATE_MAX;";
}
public String genTypedData(TransitionChain tc) {
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TypeHelpers.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TypeHelpers.xtend
index 081787bde..5a708a006 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TypeHelpers.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TypeHelpers.xtend
@@ -41,6 +41,7 @@ import org.eclipse.etrice.core.room.EnumerationType
@Singleton
class TypeHelpers {
+ @Inject protected extension RoomHelpers
@Inject ILanguageExtension languageExt
@Inject IDataConfiguration dataConfigExt
@@ -155,7 +156,7 @@ class TypeHelpers {
}
def String getAttrClassConfigValue(List<Attribute> attributePath, PortClass port){
- var pc = RoomHelpers::getProtocolClass(port)
+ var pc = port.protocolClass
if(pc == null)
return null
return dataConfigExt.getAttrClassConfigValue(pc, port.equals(pc.regular), attributePath)
diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.java
index 93715f74d..4faadbe16 100644
--- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.java
+++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericActorClassGenerator.java
@@ -35,6 +35,10 @@ import org.eclipse.xtext.xbase.lib.Extension;
public class GenericActorClassGenerator {
@Inject
@Extension
+ protected RoomHelpers _roomHelpers;
+
+ @Inject
+ @Extension
protected RoomExtensions _roomExtensions;
@Inject
@@ -52,9 +56,9 @@ public class GenericActorClassGenerator {
List<Port> _xifexpression = null;
boolean _usesInheritance = this.langExt.usesInheritance();
if (_usesInheritance) {
- _xifexpression = RoomHelpers.getEndPorts(ac);
+ _xifexpression = this._roomHelpers.getEndPorts(ac);
} else {
- _xifexpression = RoomHelpers.getAllEndPorts(ac);
+ _xifexpression = this._roomHelpers.getAllEndPorts(ac);
}
final List<Port> endPorts = _xifexpression;
List<SAP> _xifexpression_1 = null;
@@ -62,7 +66,7 @@ public class GenericActorClassGenerator {
if (_usesInheritance_1) {
_xifexpression_1 = ac.getServiceAccessPoints();
} else {
- _xifexpression_1 = RoomHelpers.getAllSAPs(ac);
+ _xifexpression_1 = this._roomHelpers.getAllSAPs(ac);
}
final List<SAP> strSAPs = _xifexpression_1;
List<ServiceImplementation> _xifexpression_2 = null;
@@ -70,7 +74,7 @@ public class GenericActorClassGenerator {
if (_usesInheritance_2) {
_xifexpression_2 = ac.getServiceImplementations();
} else {
- _xifexpression_2 = RoomHelpers.getAllServiceImplementations(ac);
+ _xifexpression_2 = this._roomHelpers.getAllServiceImplementations(ac);
}
final List<ServiceImplementation> svcImpls = _xifexpression_2;
final ArrayList<Pair<String, String>> list = new ArrayList<Pair<String, String>>();
@@ -107,7 +111,7 @@ public class GenericActorClassGenerator {
}
public String genInterfaceItemConstantsForOptionalActor(final ActorClass ac) {
- final List<Port> ports = RoomHelpers.getAllInterfacePorts(ac);
+ final List<Port> ports = this._roomHelpers.getAllInterfacePorts(ac);
final ArrayList<Pair<String, String>> list = new ArrayList<Pair<String, String>>();
Iterable<Indexed<Port>> _indexed = Indexed.<Port>indexed(ports);
for (final Indexed<Port> ep : _indexed) {
diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.java
index cc28d5870..fbe4b0d5c 100644
--- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.java
+++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericProtocolClassGenerator.java
@@ -35,6 +35,10 @@ import org.eclipse.xtext.xbase.lib.Extension;
public class GenericProtocolClassGenerator {
@Inject
@Extension
+ protected RoomHelpers _roomHelpers;
+
+ @Inject
+ @Extension
protected ILanguageExtension _iLanguageExtension;
@Inject
@@ -55,7 +59,7 @@ public class GenericProtocolClassGenerator {
String _string = Integer.valueOf(offset).toString();
Pair<String, String> _pair = Tuples.<String, String>pair(_memberInDeclaration, _string);
list.add(_pair);
- List<Message> _allOutgoingMessages = RoomHelpers.getAllOutgoingMessages(pc);
+ List<Message> _allOutgoingMessages = this._roomHelpers.getAllOutgoingMessages(pc);
for (final Message msg : _allOutgoingMessages) {
{
offset = (offset + 1);
@@ -68,7 +72,7 @@ public class GenericProtocolClassGenerator {
list.add(_pair_1);
}
}
- List<Message> _allIncomingMessages = RoomHelpers.getAllIncomingMessages(pc);
+ List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc);
for (final Message msg_1 : _allIncomingMessages) {
{
offset = (offset + 1);
diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java
index adaa83659..82c5f397f 100644
--- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java
+++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java
@@ -59,6 +59,18 @@ import org.eclipse.xtext.xbase.lib.IterableExtensions;
public class GenericStateMachineGenerator {
@Inject
@Extension
+ protected RoomHelpers _roomHelpers;
+
+ @Inject
+ @Extension
+ protected ETriceGenUtil _eTriceGenUtil;
+
+ @Inject
+ @Extension
+ protected CodegenHelpers _codegenHelpers;
+
+ @Inject
+ @Extension
protected RoomExtensions _roomExtensions;
@Inject
@@ -91,10 +103,10 @@ public class GenericStateMachineGenerator {
boolean _usesInheritance_1 = this.langExt.usesInheritance();
if (_usesInheritance_1) {
StateGraph _stateMachine = ac.getStateMachine();
- _xifexpression_1 = RoomHelpers.getBaseStateList(_stateMachine);
+ _xifexpression_1 = this._roomHelpers.getBaseStateList(_stateMachine);
} else {
StateGraph _stateMachine_1 = xpac.getStateMachine();
- _xifexpression_1 = RoomHelpers.getBaseStateList(_stateMachine_1);
+ _xifexpression_1 = this._roomHelpers.getBaseStateList(_stateMachine_1);
}
List<State> baseStates = _xifexpression_1;
List<State> _leafStatesLast = this._roomExtensions.getLeafStatesLast(baseStates);
@@ -110,7 +122,7 @@ public class GenericStateMachineGenerator {
}
for (final State state : baseStates) {
{
- String _genStateId = CodegenHelpers.getGenStateId(state);
+ String _genStateId = this._codegenHelpers.getGenStateId(state);
String _string = Integer.valueOf(offset).toString();
Pair<String, String> _pair_2 = Tuples.<String, String>pair(_genStateId, _string);
list.add(_pair_2);
@@ -154,7 +166,7 @@ public class GenericStateMachineGenerator {
for (final TransitionChain chain : chains) {
{
offset = (offset + 1);
- String _genChainId = CodegenHelpers.getGenChainId(chain);
+ String _genChainId = this._codegenHelpers.getGenChainId(chain);
String _string = Integer.valueOf(offset).toString();
Pair<String, String> _pair = Tuples.<String, String>pair(_genChainId, _string);
list.add(_pair);
@@ -175,10 +187,10 @@ public class GenericStateMachineGenerator {
boolean _usesInheritance = this.langExt.usesInheritance();
if (_usesInheritance) {
ActorClass _actorClass = xpac.getActorClass();
- _xifexpression = RoomHelpers.getOwnMessagesFromInterfaces(_actorClass);
+ _xifexpression = this._roomHelpers.getOwnMessagesFromInterfaces(_actorClass);
} else {
ActorClass _actorClass_1 = xpac.getActorClass();
- _xifexpression = RoomHelpers.getAllMessagesFromInterfaces(_actorClass_1);
+ _xifexpression = this._roomHelpers.getAllMessagesFromInterfaces(_actorClass_1);
}
final List<MessageFromIf> triggers = _xifexpression;
final ArrayList<Pair<String, String>> list = new ArrayList<Pair<String, String>>();
@@ -313,7 +325,7 @@ public class GenericStateMachineGenerator {
_builder.newLine();
{
StateGraph _stateMachine = xpac.getStateMachine();
- List<State> _stateList = RoomHelpers.getStateList(_stateMachine);
+ List<State> _stateList = this._roomHelpers.getStateList(_stateMachine);
for(final State state : _stateList) {
{
boolean _or_1 = false;
@@ -338,7 +350,7 @@ public class GenericStateMachineGenerator {
_builder.newLine();
{
StateGraph _stateMachine_1 = xpac.getStateMachine();
- List<Transition> _allTransitionsRecursive = RoomHelpers.getAllTransitionsRecursive(_stateMachine_1);
+ List<Transition> _allTransitionsRecursive = this._roomHelpers.getAllTransitionsRecursive(_stateMachine_1);
for(final Transition tr : _allTransitionsRecursive) {
{
boolean _and = false;
@@ -355,7 +367,7 @@ public class GenericStateMachineGenerator {
_and = false;
} else {
DetailCode _action = tr.getAction();
- boolean _hasDetailCode = RoomHelpers.hasDetailCode(_action);
+ boolean _hasDetailCode = this._roomHelpers.hasDetailCode(_action);
_and = _hasDetailCode;
}
if (_and) {
@@ -378,7 +390,7 @@ public class GenericStateMachineGenerator {
_builder.append(_accessLevelProtected, "");
_builder.append("void ");
_builder.append(opScopePriv, "");
- String _actionCodeOperationName = CodegenHelpers.getActionCodeOperationName(tr);
+ String _actionCodeOperationName = this._codegenHelpers.getActionCodeOperationName(tr);
_builder.append(_actionCodeOperationName, "");
_builder.append("(");
String _name_3 = ac.getName();
@@ -460,25 +472,25 @@ public class GenericStateMachineGenerator {
_builder.newLine();
{
StateGraph _stateMachine_2 = xpac.getStateMachine();
- List<State> _baseStateList = RoomHelpers.getBaseStateList(_stateMachine_2);
+ List<State> _baseStateList = this._roomHelpers.getBaseStateList(_stateMachine_2);
for(final State state_1 : _baseStateList) {
_builder.append("\t\t\t");
_builder.append("case ");
- String _genStateId = CodegenHelpers.getGenStateId(state_1);
+ String _genStateId = this._codegenHelpers.getGenStateId(state_1);
_builder.append(_genStateId, "\t\t\t");
_builder.append(":");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t");
_builder.append("\t");
{
- boolean _hasExitCode = RoomHelpers.hasExitCode(state_1, true);
+ boolean _hasExitCode = this._roomHelpers.hasExitCode(state_1, true);
if (_hasExitCode) {
{
if (usesHdlr) {
_builder.append("if (!handler__et) ");
}
}
- String _exitCodeOperationName = CodegenHelpers.getExitCodeOperationName(state_1);
+ String _exitCodeOperationName = this._codegenHelpers.getExitCodeOperationName(state_1);
_builder.append(_exitCodeOperationName, "\t\t\t\t");
_builder.append("(");
String _selfPointer_1 = this.langExt.selfPointer(false);
@@ -489,8 +501,8 @@ public class GenericStateMachineGenerator {
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t");
_builder.append("\t");
- String _parentStateId = CodegenHelpers.getParentStateId(state_1);
- String _genStateId_1 = CodegenHelpers.getGenStateId(state_1);
+ String _parentStateId = this._codegenHelpers.getParentStateId(state_1);
+ String _genStateId_1 = this._codegenHelpers.getGenStateId(state_1);
String _setHistory = this.setHistory(_parentStateId, _genStateId_1);
_builder.append(_setHistory, "\t\t\t\t");
_builder.append(";");
@@ -498,7 +510,7 @@ public class GenericStateMachineGenerator {
_builder.append("\t\t\t");
_builder.append("\t");
_builder.append("current__et = ");
- String _parentStateId_1 = CodegenHelpers.getParentStateId(state_1);
+ String _parentStateId_1 = this._codegenHelpers.getParentStateId(state_1);
_builder.append(_parentStateId_1, "\t\t\t\t");
_builder.append(";");
_builder.newLineIfNotEmpty();
@@ -576,7 +588,7 @@ public class GenericStateMachineGenerator {
for(final TransitionChain tc : allchains) {
_builder.append("\t\t");
_builder.append("case ");
- String _genChainId = CodegenHelpers.getGenChainId(tc);
+ String _genChainId = this._codegenHelpers.getGenChainId(tc);
_builder.append(_genChainId, "\t\t");
_builder.append(":");
_builder.newLineIfNotEmpty();
@@ -697,18 +709,18 @@ public class GenericStateMachineGenerator {
_builder.newLine();
{
StateGraph _stateMachine_3 = xpac.getStateMachine();
- List<State> _baseStateList_1 = RoomHelpers.getBaseStateList(_stateMachine_3);
+ List<State> _baseStateList_1 = this._roomHelpers.getBaseStateList(_stateMachine_3);
for(final State state_2 : _baseStateList_1) {
_builder.append("\t\t\t");
_builder.append("case ");
- String _genStateId_2 = CodegenHelpers.getGenStateId(state_2);
+ String _genStateId_2 = this._codegenHelpers.getGenStateId(state_2);
_builder.append(_genStateId_2, "\t\t\t");
_builder.append(":");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t");
_builder.append("\t");
{
- boolean _hasEntryCode = RoomHelpers.hasEntryCode(state_2, true);
+ boolean _hasEntryCode = this._roomHelpers.hasEntryCode(state_2, true);
if (_hasEntryCode) {
_builder.append("if (!(skip_entry__et");
{
@@ -717,7 +729,7 @@ public class GenericStateMachineGenerator {
}
}
_builder.append(")) ");
- String _entryCodeOperationName = CodegenHelpers.getEntryCodeOperationName(state_2);
+ String _entryCodeOperationName = this._codegenHelpers.getEntryCodeOperationName(state_2);
_builder.append(_entryCodeOperationName, "\t\t\t\t");
_builder.append("(");
String _selfPointer_2 = this.langExt.selfPointer(false);
@@ -727,7 +739,7 @@ public class GenericStateMachineGenerator {
}
_builder.newLineIfNotEmpty();
{
- boolean _isLeaf = RoomHelpers.isLeaf(state_2);
+ boolean _isLeaf = this._roomHelpers.isLeaf(state_2);
if (_isLeaf) {
_builder.append("\t\t\t");
_builder.append("\t");
@@ -736,7 +748,7 @@ public class GenericStateMachineGenerator {
_builder.append("\t\t\t");
_builder.append("\t");
_builder.append("return ");
- String _genStateId_3 = CodegenHelpers.getGenStateId(state_2);
+ String _genStateId_3 = this._codegenHelpers.getGenStateId(state_2);
_builder.append(_genStateId_3, "\t\t\t\t");
_builder.append(";");
_builder.newLineIfNotEmpty();
@@ -747,7 +759,7 @@ public class GenericStateMachineGenerator {
_builder.newLine();
{
StateGraph _subgraph = state_2.getSubgraph();
- boolean _hasInitTransition = RoomHelpers.hasInitTransition(_subgraph);
+ boolean _hasInitTransition = this._roomHelpers.hasInitTransition(_subgraph);
if (_hasInitTransition) {
_builder.append("\t\t\t");
_builder.append("\t");
@@ -756,7 +768,7 @@ public class GenericStateMachineGenerator {
_builder.append("\t\t\t");
_builder.append("\t");
_builder.append("if (");
- String _genStateId_4 = CodegenHelpers.getGenStateId(state_2);
+ String _genStateId_4 = this._codegenHelpers.getGenStateId(state_2);
String _history = this.getHistory(_genStateId_4);
_builder.append(_history, "\t\t\t\t");
_builder.append("==NO_STATE) {");
@@ -765,7 +777,7 @@ public class GenericStateMachineGenerator {
_builder.append("\t");
_builder.append("\t");
StateGraph _subgraph_1 = state_2.getSubgraph();
- Transition sub_initt = RoomHelpers.getInitTransition(_subgraph_1);
+ Transition sub_initt = this._roomHelpers.getInitTransition(_subgraph_1);
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t");
_builder.append("\t");
@@ -774,7 +786,7 @@ public class GenericStateMachineGenerator {
String _selfPointer_3 = this.langExt.selfPointer(true);
_builder.append(_selfPointer_3, "\t\t\t\t\t");
TransitionChain _chain_1 = xpac.getChain(sub_initt);
- String _genChainId_1 = CodegenHelpers.getGenChainId(_chain_1);
+ String _genChainId_1 = this._codegenHelpers.getGenChainId(_chain_1);
_builder.append(_genChainId_1, "\t\t\t\t\t");
{
if (handleEvents) {
@@ -800,7 +812,7 @@ public class GenericStateMachineGenerator {
_builder.append("\t");
_builder.append("\t");
_builder.append("state__et = ");
- String _genStateId_5 = CodegenHelpers.getGenStateId(state_2);
+ String _genStateId_5 = this._codegenHelpers.getGenStateId(state_2);
String _history_1 = this.getHistory(_genStateId_5);
_builder.append(_history_1, "\t\t\t\t\t");
_builder.append(";");
@@ -817,7 +829,7 @@ public class GenericStateMachineGenerator {
_builder.append("\t\t\t");
_builder.append("\t");
_builder.append("state__et = ");
- String _genStateId_6 = CodegenHelpers.getGenStateId(state_2);
+ String _genStateId_6 = this._codegenHelpers.getGenStateId(state_2);
String _history_2 = this.getHistory(_genStateId_6);
_builder.append(_history_2, "\t\t\t\t");
_builder.append(";");
@@ -881,12 +893,12 @@ public class GenericStateMachineGenerator {
_builder.newLineIfNotEmpty();
_builder.append("\t");
StateGraph _stateMachine_4 = xpac.getStateMachine();
- Transition initt = RoomHelpers.getInitTransition(_stateMachine_4);
+ Transition initt = this._roomHelpers.getInitTransition(_stateMachine_4);
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("int chain__et = ");
TransitionChain _chain_2 = xpac.getChain(initt);
- String _genChainId_2 = CodegenHelpers.getGenChainId(_chain_2);
+ String _genChainId_2 = this._codegenHelpers.getGenChainId(_chain_2);
_builder.append(_genChainId_2, "\t");
_builder.append(";");
_builder.newLineIfNotEmpty();
@@ -1152,11 +1164,11 @@ public class GenericStateMachineGenerator {
_builder.newLineIfNotEmpty();
{
StateGraph _stateMachine = xpac.getStateMachine();
- List<State> _leafStateList = RoomHelpers.getLeafStateList(_stateMachine);
+ List<State> _leafStateList = this._roomHelpers.getLeafStateList(_stateMachine);
for(final State state : _leafStateList) {
_builder.append("\t");
_builder.append("case ");
- String _genStateId = CodegenHelpers.getGenStateId(state);
+ String _genStateId = this._codegenHelpers.getGenStateId(state);
_builder.append(_genStateId, "\t");
_builder.append(":");
_builder.newLineIfNotEmpty();
@@ -1305,14 +1317,14 @@ public class GenericStateMachineGenerator {
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("chain__et = ");
- String _genChainId = CodegenHelpers.getGenChainId(chain);
+ String _genChainId = this._codegenHelpers.getGenChainId(chain);
_builder.append(_genChainId, "\t");
_builder.append(";");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("catching_state__et = ");
State _stateContext = chain.getStateContext();
- String _genStateId = CodegenHelpers.getGenStateId(_stateContext);
+ String _genStateId = this._codegenHelpers.getGenStateId(_stateContext);
_builder.append(_genStateId, "\t");
_builder.append(";");
_builder.newLineIfNotEmpty();
@@ -1365,7 +1377,7 @@ public class GenericStateMachineGenerator {
_builder.append(":");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- boolean needData = ETriceGenUtil.hasGuard(at);
+ boolean needData = this._eTriceGenUtil.hasGuard(at);
_builder.newLineIfNotEmpty();
_builder.append("\t");
{
@@ -1401,7 +1413,7 @@ public class GenericStateMachineGenerator {
_builder.append("\t");
_builder.append("\t");
_builder.append("chain__et = ");
- String _genChainId = CodegenHelpers.getGenChainId(chain);
+ String _genChainId = this._codegenHelpers.getGenChainId(chain);
_builder.append(_genChainId, "\t\t");
_builder.append(";");
_builder.newLineIfNotEmpty();
@@ -1409,7 +1421,7 @@ public class GenericStateMachineGenerator {
_builder.append("\t");
_builder.append("catching_state__et = ");
State _stateContext = chain.getStateContext();
- String _genStateId = CodegenHelpers.getGenStateId(_stateContext);
+ String _genStateId = this._codegenHelpers.getGenStateId(_stateContext);
_builder.append(_genStateId, "\t\t");
_builder.append(";");
_builder.newLineIfNotEmpty();
@@ -1553,7 +1565,7 @@ public class GenericStateMachineGenerator {
final Trigger tr = IterableExtensions.<Trigger>findFirst(_triggers, _function);
StringConcatenation _builder = new StringConcatenation();
{
- boolean _hasGuard = RoomHelpers.hasGuard(tr);
+ boolean _hasGuard = this._roomHelpers.hasGuard(tr);
if (_hasGuard) {
_builder.append("if (");
AbstractGenerator _instance = AbstractGenerator.getInstance();
@@ -1589,9 +1601,9 @@ public class GenericStateMachineGenerator {
protected String genDoCodes(final State state) {
StringConcatenation _builder = new StringConcatenation();
{
- boolean _hasDoCode = RoomHelpers.hasDoCode(state, true);
+ boolean _hasDoCode = this._roomHelpers.hasDoCode(state, true);
if (_hasDoCode) {
- String _doCodeOperationName = CodegenHelpers.getDoCodeOperationName(state);
+ String _doCodeOperationName = this._codegenHelpers.getDoCodeOperationName(state);
_builder.append(_doCodeOperationName, "");
_builder.append("(");
String _selfPointer = this.langExt.selfPointer(false);
@@ -1650,9 +1662,9 @@ public class GenericStateMachineGenerator {
_xifexpression = "";
}
final String opScopePriv = _xifexpression;
- final String entryOp = CodegenHelpers.getEntryCodeOperationName(state);
- final String exitOp = CodegenHelpers.getExitCodeOperationName(state);
- final String doOp = CodegenHelpers.getDoCodeOperationName(state);
+ final String entryOp = this._codegenHelpers.getEntryCodeOperationName(state);
+ final String exitOp = this._codegenHelpers.getExitCodeOperationName(state);
+ final String doOp = this._codegenHelpers.getDoCodeOperationName(state);
AbstractGenerator _instance = AbstractGenerator.getInstance();
DetailCode _entryCode = state.getEntryCode();
String entry = _instance.getTranslatedCode(_entryCode);
@@ -1679,21 +1691,21 @@ public class GenericStateMachineGenerator {
ActorClass _base = _actorClass_1.getBase();
final String baseName = _base.getName();
DetailCode _inheritedEntry_1 = rs.getInheritedEntry();
- boolean _hasDetailCode = RoomHelpers.hasDetailCode(_inheritedEntry_1);
+ boolean _hasDetailCode = this._roomHelpers.hasDetailCode(_inheritedEntry_1);
if (_hasDetailCode) {
String _superCall = this.langExt.superCall(baseName, entryOp, "");
String _plus = (_superCall + entry);
entry = _plus;
}
DetailCode _inheritedExit_1 = rs.getInheritedExit();
- boolean _hasDetailCode_1 = RoomHelpers.hasDetailCode(_inheritedExit_1);
+ boolean _hasDetailCode_1 = this._roomHelpers.hasDetailCode(_inheritedExit_1);
if (_hasDetailCode_1) {
String _superCall_1 = this.langExt.superCall(baseName, exitOp, "");
String _plus_1 = (exit + _superCall_1);
exit = _plus_1;
}
DetailCode _inheritedDo_1 = rs.getInheritedDo();
- boolean _hasDetailCode_2 = RoomHelpers.hasDetailCode(_inheritedDo_1);
+ boolean _hasDetailCode_2 = this._roomHelpers.hasDetailCode(_inheritedDo_1);
if (_hasDetailCode_2) {
String _superCall_2 = this.langExt.superCall(baseName, doOp, "");
String _plus_2 = (_superCall_2 + docode);
@@ -1870,7 +1882,7 @@ public class GenericStateMachineGenerator {
_builder.newLine();
{
StateGraph _stateMachine = xpac.getStateMachine();
- List<State> _stateList = RoomHelpers.getStateList(_stateMachine);
+ List<State> _stateList = this._roomHelpers.getStateList(_stateMachine);
for(final State state : _stateList) {
{
boolean _or_1 = false;
@@ -1895,7 +1907,7 @@ public class GenericStateMachineGenerator {
_builder.newLine();
{
StateGraph _stateMachine_1 = xpac.getStateMachine();
- List<Transition> _allTransitionsRecursive = RoomHelpers.getAllTransitionsRecursive(_stateMachine_1);
+ List<Transition> _allTransitionsRecursive = this._roomHelpers.getAllTransitionsRecursive(_stateMachine_1);
for(final Transition tr : _allTransitionsRecursive) {
{
boolean _and = false;
@@ -1912,7 +1924,7 @@ public class GenericStateMachineGenerator {
_and = false;
} else {
DetailCode _action = tr.getAction();
- boolean _hasDetailCode = RoomHelpers.hasDetailCode(_action);
+ boolean _hasDetailCode = this._roomHelpers.hasDetailCode(_action);
_and = _hasDetailCode;
}
if (_and) {
@@ -1930,7 +1942,7 @@ public class GenericStateMachineGenerator {
String _accessLevelProtected = this.langExt.accessLevelProtected();
_builder.append(_accessLevelProtected, "");
_builder.append("void ");
- String _actionCodeOperationName = CodegenHelpers.getActionCodeOperationName(tr);
+ String _actionCodeOperationName = this._codegenHelpers.getActionCodeOperationName(tr);
_builder.append(_actionCodeOperationName, "");
_builder.append("(");
String _name_1 = ac.getName();
@@ -2118,12 +2130,12 @@ public class GenericStateMachineGenerator {
boolean _xblockexpression = false;
{
StateGraph _stateMachine = xpac.getStateMachine();
- boolean _isEmpty = RoomHelpers.isEmpty(_stateMachine);
+ boolean _isEmpty = this._roomHelpers.isEmpty(_stateMachine);
if (_isEmpty) {
return false;
}
StateGraph _stateMachine_1 = xpac.getStateMachine();
- List<TrPoint> _allTrPointsRecursive = RoomHelpers.getAllTrPointsRecursive(_stateMachine_1);
+ List<TrPoint> _allTrPointsRecursive = this._roomHelpers.getAllTrPointsRecursive(_stateMachine_1);
final Function1<TrPoint, Boolean> _function = new Function1<TrPoint, Boolean>() {
public Boolean apply(final TrPoint t) {
boolean _and = false;
diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java
index fdc48219f..a8a4515cc 100644
--- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java
+++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java
@@ -46,13 +46,17 @@ import org.eclipse.xtext.xbase.lib.StringExtensions;
public class ProcedureHelpers {
@Inject
@Extension
- private TypeHelpers _typeHelpers;
+ protected RoomHelpers _roomHelpers;
@Inject
- private ILanguageExtension languageExt;
+ @Extension
+ protected TypeHelpers _typeHelpers;
+
+ @Inject
+ protected ILanguageExtension languageExt;
@Inject
- private ILogger logger;
+ protected ILogger logger;
/**
* @param dc a {@link DataClass}
@@ -63,15 +67,15 @@ public class ProcedureHelpers {
CharSequence _switchResult = null;
switch (id) {
case 1:
- String _deepUserCode1 = RoomHelpers.getDeepUserCode1(dc);
+ String _deepUserCode1 = this._roomHelpers.getDeepUserCode1(dc);
_switchResult = this.userCode(_deepUserCode1);
break;
case 2:
- String _deepUserCode2 = RoomHelpers.getDeepUserCode2(dc);
+ String _deepUserCode2 = this._roomHelpers.getDeepUserCode2(dc);
_switchResult = this.userCode(_deepUserCode2);
break;
case 3:
- String _deepUserCode3 = RoomHelpers.getDeepUserCode3(dc);
+ String _deepUserCode3 = this._roomHelpers.getDeepUserCode3(dc);
_switchResult = this.userCode(_deepUserCode3);
break;
}
@@ -87,15 +91,15 @@ public class ProcedureHelpers {
CharSequence _switchResult = null;
switch (id) {
case 1:
- String _deepUserCode1 = RoomHelpers.getDeepUserCode1(pc);
+ String _deepUserCode1 = this._roomHelpers.getDeepUserCode1(pc);
_switchResult = this.userCode(_deepUserCode1);
break;
case 2:
- String _deepUserCode2 = RoomHelpers.getDeepUserCode2(pc);
+ String _deepUserCode2 = this._roomHelpers.getDeepUserCode2(pc);
_switchResult = this.userCode(_deepUserCode2);
break;
case 3:
- String _deepUserCode3 = RoomHelpers.getDeepUserCode3(pc);
+ String _deepUserCode3 = this._roomHelpers.getDeepUserCode3(pc);
_switchResult = this.userCode(_deepUserCode3);
break;
}
@@ -113,15 +117,15 @@ public class ProcedureHelpers {
CharSequence _switchResult = null;
switch (id) {
case 1:
- String _deepUserCode1 = RoomHelpers.getDeepUserCode1(ac);
+ String _deepUserCode1 = this._roomHelpers.getDeepUserCode1(ac);
_switchResult = this.userCode(_deepUserCode1);
break;
case 2:
- String _deepUserCode2 = RoomHelpers.getDeepUserCode2(ac);
+ String _deepUserCode2 = this._roomHelpers.getDeepUserCode2(ac);
_switchResult = this.userCode(_deepUserCode2);
break;
case 3:
- String _deepUserCode3 = RoomHelpers.getDeepUserCode3(ac);
+ String _deepUserCode3 = this._roomHelpers.getDeepUserCode3(ac);
_switchResult = this.userCode(_deepUserCode3);
break;
}
@@ -153,7 +157,7 @@ public class ProcedureHelpers {
* comments (no tag replacement will happen)
*/
public CharSequence userCode(final DetailCode dc) {
- String _detailCode = RoomHelpers.getDetailCode(dc);
+ String _detailCode = this._roomHelpers.getDetailCode(dc);
return this.userCode(_detailCode);
}
@@ -575,7 +579,7 @@ public class ProcedureHelpers {
if (!_usesInheritance) {
_and = false;
} else {
- boolean _isConstructor = RoomHelpers.isConstructor(operation);
+ boolean _isConstructor = this._roomHelpers.isConstructor(operation);
_and = _isConstructor;
}
boolean _not = (!_and);
@@ -608,7 +612,7 @@ public class ProcedureHelpers {
if (!_usesInheritance) {
_and = false;
} else {
- boolean _isConstructor = RoomHelpers.isConstructor(operation);
+ boolean _isConstructor = this._roomHelpers.isConstructor(operation);
_and = _isConstructor;
}
boolean _not = (!_and);
@@ -658,14 +662,14 @@ public class ProcedureHelpers {
*/
private CharSequence operationSignature(final Operation operation, final String classname) {
CharSequence _xifexpression = null;
- boolean _isConstructor = RoomHelpers.isConstructor(operation);
+ boolean _isConstructor = this._roomHelpers.isConstructor(operation);
if (_isConstructor) {
String _constructorName = this.languageExt.constructorName(classname);
String _constructorReturnType = this.languageExt.constructorReturnType();
_xifexpression = this.classOperationSignature(classname, _constructorName, "", _constructorReturnType);
} else {
CharSequence _xifexpression_1 = null;
- boolean _isDestructor = RoomHelpers.isDestructor(operation);
+ boolean _isDestructor = this._roomHelpers.isDestructor(operation);
if (_isDestructor) {
String _destructorName = this.languageExt.destructorName(classname);
String _destructorReturnType = this.languageExt.destructorReturnType();
diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java
index a815e03c6..3564be8c1 100644
--- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java
+++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java
@@ -16,6 +16,7 @@ import com.google.inject.Singleton;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import javax.inject.Inject;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
@@ -52,6 +53,7 @@ import org.eclipse.etrice.core.room.TransitionPoint;
import org.eclipse.etrice.core.room.VarDecl;
import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.generator.base.FileSystemHelpers;
+import org.eclipse.xtext.xbase.lib.Extension;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
@@ -68,6 +70,10 @@ public class RoomExtensions {
private static String genDocDir = "/doc-gen/";
+ @Inject
+ @Extension
+ protected RoomHelpers _roomHelpers;
+
public static String setDefaultGenDir() {
return RoomExtensions.genDir = "/src-gen/";
}
@@ -399,7 +405,7 @@ public class RoomExtensions {
PortClass _portClass_1 = this.getPortClass(pc, conj);
EList<MessageHandler> _msgHandlers = _portClass_1.getMsgHandlers();
for (final MessageHandler hdlr : _msgHandlers) {
- List<Message> _allMessages = RoomHelpers.getAllMessages(pc, conj);
+ List<Message> _allMessages = this._roomHelpers.getAllMessages(pc, conj);
Message _msg = hdlr.getMsg();
boolean _contains = _allMessages.contains(_msg);
if (_contains) {
@@ -424,7 +430,7 @@ public class RoomExtensions {
PortClass _portClass_1 = this.getPortClass(pc, conj);
EList<MessageHandler> _msgHandlers = _portClass_1.getMsgHandlers();
for (final MessageHandler hdlr : _msgHandlers) {
- List<Message> _allMessages = RoomHelpers.getAllMessages(pc, (!conj));
+ List<Message> _allMessages = this._roomHelpers.getAllMessages(pc, (!conj));
Message _msg = hdlr.getMsg();
boolean _contains = _allMessages.contains(_msg);
if (_contains) {
@@ -471,7 +477,7 @@ public class RoomExtensions {
PortClass _portClass_1 = this.getPortClass(pc, conj);
EList<MessageHandler> _msgHandlers = _portClass_1.getMsgHandlers();
for (final MessageHandler hdlr : _msgHandlers) {
- List<Message> _allMessages = RoomHelpers.getAllMessages(pc, (!conj));
+ List<Message> _allMessages = this._roomHelpers.getAllMessages(pc, (!conj));
Message _msg = hdlr.getMsg();
boolean _contains = _allMessages.contains(_msg);
if (_contains) {
@@ -497,7 +503,7 @@ public class RoomExtensions {
PortClass _portClass_1 = this.getPortClass(pc, conj);
EList<MessageHandler> _msgHandlers = _portClass_1.getMsgHandlers();
for (final MessageHandler hdlr : _msgHandlers) {
- List<Message> _allMessages = RoomHelpers.getAllMessages(pc, conj);
+ List<Message> _allMessages = this._roomHelpers.getAllMessages(pc, conj);
Message _msg = hdlr.getMsg();
boolean _contains = _allMessages.contains(_msg);
if (_contains) {
@@ -531,7 +537,7 @@ public class RoomExtensions {
*/
public boolean isIncoming(final Message m) {
EObject _eContainer = m.eContainer();
- List<Message> _allIncomingMessages = RoomHelpers.getAllIncomingMessages(((ProtocolClass) _eContainer));
+ List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(((ProtocolClass) _eContainer));
return _allIncomingMessages.contains(m);
}
@@ -560,13 +566,13 @@ public class RoomExtensions {
{
final Function1<State, Boolean> _function = new Function1<State, Boolean>() {
public Boolean apply(final State s) {
- return Boolean.valueOf(RoomHelpers.isLeaf(s));
+ return Boolean.valueOf(RoomExtensions.this._roomHelpers.isLeaf(s));
}
};
final Iterable<State> leaf = IterableExtensions.<State>filter(states, _function);
final Function1<State, Boolean> _function_1 = new Function1<State, Boolean>() {
public Boolean apply(final State s) {
- boolean _isLeaf = RoomHelpers.isLeaf(s);
+ boolean _isLeaf = RoomExtensions.this._roomHelpers.isLeaf(s);
return Boolean.valueOf((!_isLeaf));
}
};
@@ -582,7 +588,7 @@ public class RoomExtensions {
*/
public List<State> getAllLeafStates(final ActorClass ac) {
StateGraph _stateMachine = ac.getStateMachine();
- return RoomHelpers.getLeafStateList(_stateMachine);
+ return this._roomHelpers.getLeafStateList(_stateMachine);
}
/**
@@ -590,7 +596,7 @@ public class RoomExtensions {
* @return a list of simple states with leaf states last
*/
public List<State> getAllBaseStatesLeavesLast(final ActorClass ac) {
- List<State> _allBaseStates = RoomHelpers.getAllBaseStates(ac);
+ List<State> _allBaseStates = this._roomHelpers.getAllBaseStates(ac);
return this.getLeafStatesLast(_allBaseStates);
}
@@ -656,7 +662,7 @@ public class RoomExtensions {
} else {
ActorClass _base_1 = ac.getBase();
StateGraph _stateMachine = _base_1.getStateMachine();
- List<State> _stateList = RoomHelpers.getStateList(_stateMachine);
+ List<State> _stateList = this._roomHelpers.getStateList(_stateMachine);
int _size = _stateList.size();
ActorClass _base_2 = ac.getBase();
int _numberOfInheritedStates = this.getNumberOfInheritedStates(_base_2);
@@ -676,7 +682,7 @@ public class RoomExtensions {
} else {
ActorClass _base_1 = ac.getBase();
StateGraph _stateMachine = _base_1.getStateMachine();
- List<State> _baseStateList = RoomHelpers.getBaseStateList(_stateMachine);
+ List<State> _baseStateList = this._roomHelpers.getBaseStateList(_stateMachine);
int _size = _baseStateList.size();
ActorClass _base_2 = ac.getBase();
int _numberOfInheritedBaseStates = this.getNumberOfInheritedBaseStates(_base_2);
diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java
index be92d54bd..f4a92022d 100644
--- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java
+++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java
@@ -33,11 +33,16 @@ import org.eclipse.etrice.core.room.VarDecl;
import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.generator.base.IDataConfiguration;
import org.eclipse.etrice.generator.generic.ILanguageExtension;
+import org.eclipse.xtext.xbase.lib.Extension;
@Singleton
@SuppressWarnings("all")
public class TypeHelpers {
@Inject
+ @Extension
+ protected RoomHelpers _roomHelpers;
+
+ @Inject
private ILanguageExtension languageExt;
@Inject
@@ -231,7 +236,7 @@ public class TypeHelpers {
}
public String getAttrClassConfigValue(final List<Attribute> attributePath, final PortClass port) {
- ProtocolClass pc = RoomHelpers.getProtocolClass(port);
+ ProtocolClass pc = this._roomHelpers.getProtocolClass(port);
boolean _equals = Objects.equal(pc, null);
if (_equals) {
return null;
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/commands/PopulateDiagramCommand.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/commands/PopulateDiagramCommand.java
index d9de44cb6..4fd693f59 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/commands/PopulateDiagramCommand.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/commands/PopulateDiagramCommand.java
@@ -47,7 +47,7 @@ public class PopulateDiagramCommand extends RecordingCommand {
StateGraphContext tree = StateGraphContext.createContextTree(ac);
//System.out.println(tree);
- SupportUtil.addStateGraph(tree, diagram, fp);
+ SupportUtil.getInstance().addStateGraph(tree, diagram, fp);
ContextSwitcher.switchTop(diagram);
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/commands/StateGraphContext.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/commands/StateGraphContext.java
index 60ab4730b..cf1b88721 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/commands/StateGraphContext.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/commands/StateGraphContext.java
@@ -15,9 +15,9 @@ import org.eclipse.etrice.core.room.StateGraph;
import org.eclipse.etrice.core.room.StateGraphItem;
import org.eclipse.etrice.core.room.TrPoint;
import org.eclipse.etrice.core.room.Transition;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.ui.behavior.support.DefaultPositionProvider;
import org.eclipse.etrice.ui.behavior.support.IPositionProvider;
+import org.eclipse.etrice.ui.behavior.support.SupportUtil;
public class StateGraphContext {
private ArrayList<StateGraphContext> children = new ArrayList<StateGraphContext>();
@@ -139,7 +139,7 @@ public class StateGraphContext {
obj2ctx.put(refined, this);
// merge sub contexts
- if (RoomHelpers.hasDirectSubStructure(base)) {
+ if (SupportUtil.getInstance().getRoomHelpers().hasDirectSubStructure(base)) {
StateGraphContext basesub = null;
for (StateGraphContext bs : ctx.getChildren()) {
if (bs.getParentState()==base) {
@@ -148,7 +148,7 @@ public class StateGraphContext {
}
}
if (basesub!=null) {
- if (RoomHelpers.hasDirectSubStructure(refined)) {
+ if (SupportUtil.getInstance().getRoomHelpers().hasDirectSubStructure(refined)) {
basesub.merge(refined.getSubgraph());
}
}
@@ -156,7 +156,7 @@ public class StateGraphContext {
assert(false): "context not found";
}
}
- else if (RoomHelpers.hasDirectSubStructure(refined)) {
+ else if (SupportUtil.getInstance().getRoomHelpers().hasDirectSubStructure(refined)) {
StateGraphContext sub = new StateGraphContext(refined.getSubgraph(), obj2ctx);
ctx.getChildren().add(sub);
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/AbstractMemberAwarePropertyDialog.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/AbstractMemberAwarePropertyDialog.java
index 2ca093b78..c537d3167 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/AbstractMemberAwarePropertyDialog.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/AbstractMemberAwarePropertyDialog.java
@@ -18,9 +18,9 @@ import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.Operation;
import org.eclipse.etrice.core.room.Port;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.ui.behavior.dialogs.PortMessageSelectionDialog.MsgItemPair;
import org.eclipse.etrice.ui.behavior.dialogs.PortMessageSelectionDialog.OperationItemPair;
+import org.eclipse.etrice.ui.behavior.support.SupportUtil;
import org.eclipse.etrice.ui.common.dialogs.AbstractPropertyDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
@@ -153,8 +153,10 @@ public abstract class AbstractMemberAwarePropertyDialog extends AbstractProperty
Object selected = dlg.getSelected();
if (selected instanceof Attribute)
insertText(((Attribute)selected).getName());
- else if (selected instanceof Operation)
- insertText(((Operation)selected).getName()+RoomHelpers.getTypedArgumentList((Operation) selected));
+ else if (selected instanceof Operation) {
+ String typedArgumentList = SupportUtil.getInstance().getRoomNameProvider().getTypedArgumentList((Operation) selected);
+ insertText(((Operation)selected).getName()+typedArgumentList);
+ }
}
}
@@ -177,7 +179,7 @@ public abstract class AbstractMemberAwarePropertyDialog extends AbstractProperty
}
if (dlg.getMethodItemPair() instanceof OperationItemPair) {
OperationItemPair pair = (OperationItemPair) dlg.getMethodItemPair();
- String arglist = RoomHelpers.getArguments(pair.op);
+ String arglist = SupportUtil.getInstance().getRoomNameProvider().getArguments(pair.op);
insertText(pair.item.getName()+"."+pair.op.getName()+arglist);
}
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/ChoicePointPropertyDialog.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/ChoicePointPropertyDialog.java
index c87526b42..a33c85ef0 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/ChoicePointPropertyDialog.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/ChoicePointPropertyDialog.java
@@ -7,9 +7,9 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.etrice.core.room.ChoicePoint;
import org.eclipse.etrice.core.room.RoomPackage;
-import org.eclipse.etrice.core.validation.ValidationUtil;
import org.eclipse.etrice.core.validation.ValidationUtil.Result;
import org.eclipse.etrice.ui.behavior.Activator;
+import org.eclipse.etrice.ui.behavior.support.SupportUtil;
import org.eclipse.etrice.ui.common.dialogs.AbstractPropertyDialog;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
@@ -26,7 +26,7 @@ public class ChoicePointPropertyDialog extends AbstractPropertyDialog {
if (value instanceof String) {
String name = (String) value;
- Result result = ValidationUtil.isUniqueName(cp, name);
+ Result result = SupportUtil.getInstance().getValidationUtil().isUniqueName(cp, name);
if (!result.isOk())
return ValidationStatus.error(result.getMsg());
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/MemberSelectionDialog.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/MemberSelectionDialog.java
index 63b62307d..b3fd204e7 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/MemberSelectionDialog.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/MemberSelectionDialog.java
@@ -17,9 +17,9 @@ import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.Operation;
import org.eclipse.etrice.core.room.StandardOperation;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.core.ui.RoomUiModule;
import org.eclipse.etrice.ui.behavior.Activator;
+import org.eclipse.etrice.ui.behavior.support.SupportUtil;
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.DoubleClickEvent;
@@ -111,7 +111,7 @@ public class MemberSelectionDialog extends FormDialog {
break;
case 2:
if (element instanceof Operation)
- return RoomHelpers.getTypedArgumentList((Operation) element);
+ return SupportUtil.getInstance().getRoomNameProvider().getTypedArgumentList((Operation) element);
}
return null;
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/PortMessageSelectionDialog.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/PortMessageSelectionDialog.java
index b0bb6e62f..cf6dac703 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/PortMessageSelectionDialog.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/PortMessageSelectionDialog.java
@@ -25,6 +25,7 @@ import org.eclipse.etrice.core.room.PortOperation;
import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.core.ui.RoomUiModule;
import org.eclipse.etrice.ui.behavior.Activator;
+import org.eclipse.etrice.ui.behavior.support.SupportUtil;
import org.eclipse.jface.layout.TreeColumnLayout;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.DoubleClickEvent;
@@ -100,24 +101,25 @@ public class PortMessageSelectionDialog extends FormDialog {
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
item2pairs = new HashMap<InterfaceItem, ArrayList<MethodItemPair>>();
- List<InterfaceItem> items = RoomHelpers.getAllInterfaceItems(ac);
+ RoomHelpers roomHelpers = SupportUtil.getInstance().getRoomHelpers();
+ List<InterfaceItem> items = roomHelpers.getAllInterfaceItems(ac);
for (InterfaceItem item : items) {
ArrayList<MethodItemPair> pairs = new ArrayList<MethodItemPair>();
- List<Message> out = RoomHelpers.getMessageListDeep(item, true);
+ List<Message> out = roomHelpers.getMessageListDeep(item, true);
if (!recvOnly) {
for (Message msg : out) {
if (!msg.isPriv())
pairs.add(new MsgItemPair(item, msg, true));
}
}
- if (RoomHelpers.getProtocol(item).getCommType()==CommunicationType.DATA_DRIVEN) {
- List<Message> in = RoomHelpers.getMessageListDeep(item, false);
+ if (roomHelpers.getProtocol(item).getCommType()==CommunicationType.DATA_DRIVEN) {
+ List<Message> in = roomHelpers.getMessageListDeep(item, false);
for (Message msg : in) {
if (!msg.isPriv())
pairs.add(new MsgItemPair(item, msg, false));
}
}
- PortClass pcls = RoomHelpers.getPortClass(item);
+ PortClass pcls = roomHelpers.getPortClass(item);
if (pcls!=null) {
for (PortOperation op : pcls.getOperations()) {
if (op.getSendsMsg()!=null)
@@ -134,7 +136,7 @@ public class PortMessageSelectionDialog extends FormDialog {
@Override
public Object[] getElements(Object inputElement) {
- return RoomHelpers.getAllInterfaceItems(ac).toArray();
+ return SupportUtil.getInstance().getRoomHelpers().getAllInterfaceItems(ac).toArray();
}
@Override
@@ -158,11 +160,11 @@ public class PortMessageSelectionDialog extends FormDialog {
public boolean hasChildren(Object element) {
if (element instanceof InterfaceItem) {
InterfaceItem item = (InterfaceItem)element;
- if (!RoomHelpers.getMessageListDeep(item, true).isEmpty())
+ if (!SupportUtil.getInstance().getRoomHelpers().getMessageListDeep(item, true).isEmpty())
return true;
- if (RoomHelpers.getProtocol(item).getCommType()==CommunicationType.DATA_DRIVEN)
- if (!RoomHelpers.getMessageListDeep(item, false).isEmpty())
+ if (SupportUtil.getInstance().getRoomHelpers().getProtocol(item).getCommType()==CommunicationType.DATA_DRIVEN)
+ if (!SupportUtil.getInstance().getRoomHelpers().getMessageListDeep(item, false).isEmpty())
return true;
}
@@ -224,7 +226,7 @@ public class PortMessageSelectionDialog extends FormDialog {
return msg.getData().getName()+" : "+msg.getData().getRefType().getType().getName();
}
else if (element instanceof OperationItemPair) {
- String sig = RoomHelpers.getTypedArgumentList(((OperationItemPair) element).op);
+ String sig = SupportUtil.getInstance().getRoomNameProvider().getTypedArgumentList(((OperationItemPair) element).op);
return sig.substring(1, sig.length()-1); // omit round brackets
}
break;
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/StatePropertyDialog.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/StatePropertyDialog.java
index dc1eaa4cb..e10710ec2 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/StatePropertyDialog.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/StatePropertyDialog.java
@@ -14,9 +14,9 @@ import org.eclipse.etrice.core.room.RoomPackage;
import org.eclipse.etrice.core.room.SimpleState;
import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.util.RoomHelpers;
-import org.eclipse.etrice.core.validation.ValidationUtil;
import org.eclipse.etrice.core.validation.ValidationUtil.Result;
import org.eclipse.etrice.ui.behavior.Activator;
+import org.eclipse.etrice.ui.behavior.support.SupportUtil;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
@@ -34,7 +34,7 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog {
if (value instanceof String) {
String name = (String) value;
- Result result = ValidationUtil.isUniqueName(state, name);
+ Result result = SupportUtil.getInstance().getValidationUtil().isUniqueName(state, name);
if (!result.isOk())
return ValidationStatus.error(result.getMsg());
}
@@ -66,7 +66,7 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog {
super(shell, edit?"Edit State":"View State", ac);
this.state = s;
- inherited = RoomHelpers.getActorClass(s)!=ac;
+ inherited = SupportUtil.getInstance().getRoomHelpers().getActorClass(s)!=ac;
}
@Override
@@ -99,10 +99,12 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog {
DetailCodeToString m2s = new DetailCodeToString();
StringToDetailCode s2m = new StringToDetailCode();
+ RoomHelpers roomHelpers = SupportUtil.getInstance().getRoomHelpers();
+
if (inherited) {
- String code = RoomHelpers.getDetailCode(state.getEntryCode());
+ String code = roomHelpers.getDetailCode(state.getEntryCode());
if (state instanceof RefinedState)
- code += RoomHelpers.getBaseEntryCode((RefinedState)state);
+ code += roomHelpers.getBaseEntryCode((RefinedState)state);
Text entry = createFixedText(body, "Entry Code:", code, true);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 100;
@@ -117,7 +119,7 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog {
else {
if (state instanceof RefinedState)
{
- String code = RoomHelpers.getBaseEntryCode((RefinedState)state);
+ String code = roomHelpers.getBaseEntryCode((RefinedState)state);
Text entry = createFixedText(body, "Base Entry Code:", code, true);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 100;
@@ -146,9 +148,9 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog {
}
if (inherited) {
- String code = RoomHelpers.getDetailCode(state.getExitCode());
+ String code = roomHelpers.getDetailCode(state.getExitCode());
if (state instanceof RefinedState)
- code = RoomHelpers.getBaseExitCode((RefinedState)state) + code;
+ code = roomHelpers.getBaseExitCode((RefinedState)state) + code;
Text entry = createFixedText(body, "Exit Code:", code, true);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 100;
@@ -177,7 +179,7 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog {
if (state instanceof RefinedState)
{
- String code = RoomHelpers.getBaseExitCode((RefinedState)state);
+ String code = roomHelpers.getBaseExitCode((RefinedState)state);
Text entry = createFixedText(body, "Base Exit Code:", code, true);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 100;
@@ -191,7 +193,7 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog {
}
}
- ActorClass ac = RoomHelpers.getActorClass(state);
+ ActorClass ac = roomHelpers.getActorClass(state);
if (ac.getCommType()!=ActorCommunicationType.EVENT_DRIVEN)
{
Text dotxt = createText(body, "&Do Code:", state, RoomPackage.eINSTANCE.getState_DoCode(), null, s2m, m2s, true);
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TrPointPropertyDialog.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TrPointPropertyDialog.java
index 0b52a5fc5..693591c52 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TrPointPropertyDialog.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TrPointPropertyDialog.java
@@ -8,9 +8,9 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.etrice.core.room.RoomPackage;
import org.eclipse.etrice.core.room.TrPoint;
import org.eclipse.etrice.core.room.TransitionPoint;
-import org.eclipse.etrice.core.validation.ValidationUtil;
import org.eclipse.etrice.core.validation.ValidationUtil.Result;
import org.eclipse.etrice.ui.behavior.Activator;
+import org.eclipse.etrice.ui.behavior.support.SupportUtil;
import org.eclipse.etrice.ui.common.dialogs.AbstractPropertyDialog;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
@@ -27,7 +27,7 @@ public class TrPointPropertyDialog extends AbstractPropertyDialog {
if (value instanceof String) {
String name = (String) value;
- Result result = ValidationUtil.isUniqueName(tp, name);
+ Result result = SupportUtil.getInstance().getValidationUtil().isUniqueName(tp, name);
if (!result.isOk())
return ValidationStatus.error(result.getMsg());
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TransitionPropertyDialog.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TransitionPropertyDialog.java
index 9d13d374b..4d1144a7a 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TransitionPropertyDialog.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TransitionPropertyDialog.java
@@ -9,7 +9,6 @@ import org.eclipse.core.databinding.validation.ValidationStatus;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.util.EList;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.CPBranchTransition;
import org.eclipse.etrice.core.room.CommunicationType;
@@ -28,9 +27,9 @@ import org.eclipse.etrice.core.room.Transition;
import org.eclipse.etrice.core.room.Trigger;
import org.eclipse.etrice.core.room.TriggeredTransition;
import org.eclipse.etrice.core.room.util.RoomHelpers;
-import org.eclipse.etrice.core.validation.ValidationUtil;
import org.eclipse.etrice.core.validation.ValidationUtil.Result;
import org.eclipse.etrice.ui.behavior.Activator;
+import org.eclipse.etrice.ui.behavior.support.SupportUtil;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IBaseLabelProvider;
@@ -87,7 +86,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
public String getText(Object element) {
if (element instanceof Trigger) {
Trigger trig = (Trigger) element;
- return RoomNameProvider.getTriggerLabel(trig);
+ return SupportUtil.getInstance().getRoomNameProvider().getTriggerLabel(trig);
}
return super.getText(element);
}
@@ -126,7 +125,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
public String getText(Object element) {
if (element instanceof MessageFromIf) {
MessageFromIf mif = (MessageFromIf) element;
- return RoomNameProvider.getMsgFromIfLabel(mif);
+ return SupportUtil.getInstance().getRoomNameProvider().getMsgFromIfLabel(mif);
}
return super.getText(element);
}
@@ -139,7 +138,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
if (value instanceof String) {
String name = (String) value;
- Result result = ValidationUtil.isUniqueName(trans, name);
+ Result result = SupportUtil.getInstance().getValidationUtil().isUniqueName(trans, name);
if (!result.isOk())
return ValidationStatus.error(result.getMsg());
}
@@ -162,7 +161,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
return ValidationStatus.error(text);
}
else if (value instanceof DetailCode) {
- if (RoomHelpers.getDetailCode((DetailCode)value).trim().isEmpty())
+ if (SupportUtil.getInstance().getRoomHelpers().getDetailCode((DetailCode)value).trim().isEmpty())
return ValidationStatus.error(text);
}
return Status.OK_STATUS;
@@ -199,13 +198,14 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
s2m_not_null = new StringToDetailCode(false);
interfaceItems = new ArrayList<InterfaceItem>();
- for(InterfaceItem item : RoomHelpers.getAllInterfaceItems(ac)){
- ProtocolClass pc = RoomHelpers.getProtocol(item);
+ RoomHelpers roomHelpers = SupportUtil.getInstance().getRoomHelpers();
+ for(InterfaceItem item : roomHelpers.getAllInterfaceItems(ac)){
+ ProtocolClass pc = roomHelpers.getProtocol(item);
if(pc != null && pc.getCommType() == CommunicationType.EVENT_DRIVEN)
interfaceItems.add(item);
}
- inherited = RoomHelpers.getActorClass(trans)!=ac;
+ inherited = roomHelpers.getActorClass(trans)!=ac;
refined = null;
if (inherited) {
@@ -270,10 +270,12 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
triggerError = true;
}
}
+
+ RoomHelpers roomHelpers = SupportUtil.getInstance().getRoomHelpers();
if (trans instanceof GuardedTransition) {
if (inherited) {
- String code = RoomHelpers.getDetailCode(((GuardedTransition) trans).getGuard());
+ String code = roomHelpers.getDetailCode(((GuardedTransition) trans).getGuard());
createFixedText(body, "&Guard:", code, true);
}
else {
@@ -291,7 +293,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
if (trans instanceof CPBranchTransition) {
if (inherited) {
- String code = RoomHelpers.getDetailCode(((CPBranchTransition) trans).getCondition());
+ String code = roomHelpers.getDetailCode(((CPBranchTransition) trans).getCondition());
createFixedText(body, "&Condition", code, true);
}
else {
@@ -308,7 +310,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
}
{
- String code = RoomHelpers.getInheritedActionCode(trans, getActorClass());
+ String code = roomHelpers.getInheritedActionCode(trans, getActorClass());
if (code!=null){
Text baseActionCode = createFixedText(body, "Base Action Code:", code, true);
setTextSelectionAndFocus(baseActionCode, codeSelectionString);
@@ -360,7 +362,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
return false;
for (InterfaceItem item : interfaceItems) {
- if (!RoomHelpers.getMessageListDeep(item, false).isEmpty())
+ if (!SupportUtil.getInstance().getRoomHelpers().getMessageListDeep(item, false).isEmpty())
return true;
}
return false;
@@ -656,7 +658,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
for (int i = 0; i < items.length; i++) {
if (items[i].equals(mif.getFrom().getName())) {
interfaceCombo.select(i);
- currentMsgs = RoomHelpers.getMessageListDeep(mif.getFrom(), false);
+ currentMsgs = SupportUtil.getInstance().getRoomHelpers().getMessageListDeep(mif.getFrom(), false);
int pos = 0;
int idx = -1;
for (Message message : currentMsgs) {
@@ -696,7 +698,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
private MessageFromIf createDefaultMif() {
MessageFromIf mif = RoomFactory.eINSTANCE.createMessageFromIf();
for (InterfaceItem item : interfaceItems) {
- List<Message> msgs = RoomHelpers.getMessageListDeep(item, false);
+ List<Message> msgs = SupportUtil.getInstance().getRoomHelpers().getMessageListDeep(item, false);
if (!msgs.isEmpty()) {
mif.setFrom(item);
mif.setMessage(msgs.get(0));
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/editor/BehaviorEditor.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/editor/BehaviorEditor.java
index 28259a370..629cad0d7 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/editor/BehaviorEditor.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/editor/BehaviorEditor.java
@@ -40,6 +40,8 @@ import org.eclipse.graphiti.mm.pictograms.Shape;
import org.eclipse.graphiti.services.Graphiti;
import org.eclipse.swt.graphics.Image;
+import com.google.common.base.Function;
+
public class BehaviorEditor extends RoomDiagramEditor {
@@ -135,7 +137,7 @@ public class BehaviorEditor extends RoomDiagramEditor {
*/
protected void removeUnusedRefinedStates() {
Diagram diagram = getDiagramTypeProvider().getDiagram();
- ActorClass ac = SupportUtil.getActorClass(diagram);
+ ActorClass ac = SupportUtil.getInstance().getActorClass(diagram);
if (ac.getStateMachine()!=null) {
ArrayList<RefinedState> toBeRemoved = new ArrayList<RefinedState>();
@@ -155,11 +157,12 @@ public class BehaviorEditor extends RoomDiagramEditor {
* @return
*/
private boolean isUnused(RefinedState s) {
- if (RoomHelpers.hasDirectSubStructure(s))
+ RoomHelpers roomHelpers = SupportUtil.getInstance().getRoomHelpers();
+ if (roomHelpers.hasDirectSubStructure(s))
return false;
- if (RoomHelpers.hasDetailCode(s.getEntryCode()))
+ if (roomHelpers.hasDetailCode(s.getEntryCode()))
return false;
- if (RoomHelpers.hasDetailCode(s.getExitCode()))
+ if (roomHelpers.hasDetailCode(s.getExitCode()))
return false;
return true;
@@ -167,12 +170,13 @@ public class BehaviorEditor extends RoomDiagramEditor {
protected void removeEmptySubgraphs() {
Diagram diagram = getDiagramTypeProvider().getDiagram();
+ RoomHelpers roomHelpers = SupportUtil.getInstance().getRoomHelpers();
// if our current context is an empty state graph we go one level up
StateGraph current = ContextSwitcher.getCurrentStateGraph(diagram);
if (current!=null && current.eContainer() instanceof State) {
State s = (State) current.eContainer();
- if (!RoomHelpers.hasDirectSubStructure(s)) {
+ if (!roomHelpers.hasDirectSubStructure(s)) {
ContextSwitcher.goUp(diagram, current);
}
}
@@ -190,7 +194,7 @@ public class BehaviorEditor extends RoomDiagramEditor {
StateGraph sg = (StateGraph) bo;
if (sg.eContainer() instanceof State) {
State s = (State) sg.eContainer();
- if (!RoomHelpers.hasDirectSubStructure(s)) {
+ if (!roomHelpers.hasDirectSubStructure(s)) {
EcoreUtil.delete(sg);
toBeRemoved.add(ctxShape);
}
@@ -209,7 +213,8 @@ public class BehaviorEditor extends RoomDiagramEditor {
if (ac.getStateMachine()==null)
return;
- Map<RefinedState, RefinedState> rs2parent = RoomHelpers.getRefinedStatesToRelocate(ac);
+ Function<RefinedState, String> nameProvider = SupportUtil.getInstance().getRoomNameProvider().getRefinedStateNameProvider();
+ Map<RefinedState, RefinedState> rs2parent = SupportUtil.getInstance().getRoomHelpers().getRefinedStatesToRelocate(ac, nameProvider);
// move all to the new context
for (RefinedState rs : rs2parent.keySet()) {
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/editor/BehaviorExporter.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/editor/BehaviorExporter.java
index b9a18482f..f80220db6 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/editor/BehaviorExporter.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/editor/BehaviorExporter.java
@@ -14,12 +14,11 @@ package org.eclipse.etrice.ui.behavior.editor;
import java.io.File;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.StateGraph;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.ui.behavior.DiagramAccess;
+import org.eclipse.etrice.ui.behavior.support.SupportUtil;
import org.eclipse.etrice.ui.common.editor.DiagramExporter;
import org.eclipse.ui.PlatformUI;
@@ -53,9 +52,9 @@ public class BehaviorExporter {
return;
for (State state : sg.getStates()) {
- if (RoomHelpers.hasDirectSubStructure(state)) {
+ if (SupportUtil.getInstance().getRoomHelpers().hasDirectSubStructure(state)) {
if (editor.showStateGraph(state.getSubgraph())) {
- String filename = basename+"_"+RoomNameProvider.getStatePathName(state)+SUFFIX;
+ String filename = basename+"_"+SupportUtil.getInstance().getRoomNameProvider().getStatePathName(state)+SUFFIX;
DiagramExporter.export(editor, filename);
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/quickfix/BehaviorQuickfixProvider.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/quickfix/BehaviorQuickfixProvider.java
index 5cdaed391..dec5a11f5 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/quickfix/BehaviorQuickfixProvider.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/quickfix/BehaviorQuickfixProvider.java
@@ -19,7 +19,6 @@ import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.etrice.abstractexec.behavior.AbstractExecutionValidator;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.InterfaceItem;
import org.eclipse.etrice.core.room.Message;
@@ -31,7 +30,6 @@ import org.eclipse.etrice.core.room.Transition;
import org.eclipse.etrice.core.room.TransitionTerminal;
import org.eclipse.etrice.core.room.Trigger;
import org.eclipse.etrice.core.room.TriggeredTransition;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.ui.behavior.dialogs.StatePropertyDialog;
import org.eclipse.etrice.ui.behavior.dialogs.StatePropertyDialog.Where;
import org.eclipse.etrice.ui.behavior.dialogs.TransitionPropertyDialog;
@@ -98,16 +96,16 @@ public class BehaviorQuickfixProvider extends AbstractQuickfixProvider {
return false;
// find matching interface item and message
- ActorClass ac = SupportUtil.getActorClass(diagram);
+ ActorClass ac = SupportUtil.getInstance().getActorClass(diagram);
// it is crucial that we consider all emitters of
// messages (port, saps, spps)
// including base classes
- List<InterfaceItem> items = RoomHelpers
+ List<InterfaceItem> items = SupportUtil.getInstance().getRoomHelpers()
.getAllInterfaceItems(ac);
for (InterfaceItem item : items) {
if (item.getName().equals(ifItemName)) {
- List<Message> msgs = RoomHelpers
+ List<Message> msgs = SupportUtil.getInstance().getRoomHelpers()
.getIncoming(item);
for (Message msg : msgs) {
if (msg.getName().equals(msgName)) {
@@ -115,7 +113,7 @@ public class BehaviorQuickfixProvider extends AbstractQuickfixProvider {
// trigger and add it to the state graph
TriggeredTransition trans = RoomFactory.eINSTANCE
.createTriggeredTransition();
- trans.setName(RoomNameProvider
+ trans.setName(SupportUtil.getInstance().getRoomUtil()
.getUniqueTransitionName((StateGraph) state
.eContainer()));
Trigger tri = RoomFactory.eINSTANCE
@@ -139,12 +137,10 @@ public class BehaviorQuickfixProvider extends AbstractQuickfixProvider {
.get(0);
Anchor anchor = shape.getAnchors().get(
0);
- TransitionTerminal src = SupportUtil
- .getTransitionTerminal(anchor,
- fp);
- TransitionTerminal tgt = SupportUtil
- .getTransitionTerminal(anchor,
- fp);
+ TransitionTerminal src = SupportUtil.getInstance()
+ .getTransitionTerminal(anchor, fp);
+ TransitionTerminal tgt = SupportUtil.getInstance()
+ .getTransitionTerminal(anchor, fp);
trans.setFrom(src);
trans.setTo(tgt);
@@ -196,7 +192,7 @@ public class BehaviorQuickfixProvider extends AbstractQuickfixProvider {
return false;
// Open StatePropertyDialog, add line, select added line
- ActorClass ac = SupportUtil.getActorClass(diagram);
+ ActorClass ac = SupportUtil.getInstance().getActorClass(diagram);
Shell shell = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell();
StatePropertyDialog dlg = new StatePropertyDialog(
@@ -240,7 +236,7 @@ public class BehaviorQuickfixProvider extends AbstractQuickfixProvider {
return false;
// Open StatePropertyDialog, add line, select added line
- ActorClass ac = SupportUtil.getActorClass(diagram);
+ ActorClass ac = SupportUtil.getInstance().getActorClass(diagram);
Shell shell = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell();
StatePropertyDialog dlg = new StatePropertyDialog(
@@ -385,7 +381,7 @@ public class BehaviorQuickfixProvider extends AbstractQuickfixProvider {
// Open StatePropertyDialog & select the offending
// code
- ActorClass ac = SupportUtil.getActorClass(diagram);
+ ActorClass ac = SupportUtil.getInstance().getActorClass(diagram);
Shell shell = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell();
StatePropertyDialog dlg = new StatePropertyDialog(
@@ -421,7 +417,7 @@ public class BehaviorQuickfixProvider extends AbstractQuickfixProvider {
Shell shell = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell();
TransitionPropertyDialog dlg = new TransitionPropertyDialog(
- shell, SupportUtil.getActorClass(diagram),
+ shell, SupportUtil.getInstance().getActorClass(diagram),
transition);
dlg.setCodeSelectionString(codeString);
dlg.setMessageDialogContents(
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/ChoicePointSupport.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/ChoicePointSupport.java
index 65ce4e0ab..e6c7bcd33 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/ChoicePointSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/ChoicePointSupport.java
@@ -17,17 +17,16 @@ import java.util.ArrayList;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.ChoicePoint;
import org.eclipse.etrice.core.room.RoomFactory;
import org.eclipse.etrice.core.room.StateGraph;
import org.eclipse.etrice.ui.behavior.ImageProvider;
import org.eclipse.etrice.ui.behavior.dialogs.ChoicePointPropertyDialog;
-import org.eclipse.etrice.ui.common.support.ChangeAwareCreateFeature;
-import org.eclipse.etrice.ui.common.support.ChangeAwareCustomFeature;
import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor;
import org.eclipse.etrice.ui.behavior.markers.DecoratorUtil;
+import org.eclipse.etrice.ui.common.support.ChangeAwareCreateFeature;
+import org.eclipse.etrice.ui.common.support.ChangeAwareCustomFeature;
import org.eclipse.etrice.ui.common.support.CommonSupportUtil;
import org.eclipse.etrice.ui.common.support.DeleteWithoutConfirmFeature;
import org.eclipse.etrice.ui.common.support.NoResizeFeature;
@@ -116,16 +115,16 @@ public class ChoicePointSupport {
ContainerShape targetContainer = context.getTargetContainer();
StateGraph sg = (StateGraph) targetContainer.getLink().getBusinessObjects().get(0);
- ActorClass ac = SupportUtil.getActorClass(getDiagram());
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagram());
- boolean inherited = SupportUtil.isInherited(getDiagram(), sg);
+ boolean inherited = SupportUtil.getInstance().isInherited(getDiagram(), sg);
if (inherited) {
- sg = SupportUtil.insertRefinedState(sg, ac, targetContainer, getFeatureProvider());
+ sg = SupportUtil.getInstance().insertRefinedState(sg, ac, targetContainer, getFeatureProvider());
}
// create choice point and add it
ChoicePoint cp = RoomFactory.eINSTANCE.createChoicePoint();
- cp.setName(RoomNameProvider.getUniqueChoicePointName(sg));
+ cp.setName(SupportUtil.getInstance().getRoomUtil().getUniqueChoicePointName(sg));
sg.getChPoints().add(cp);
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
@@ -177,7 +176,7 @@ public class ChoicePointSupport {
public PictogramElement add(IAddContext context) {
ChoicePoint cp = (ChoicePoint) context.getNewObject();
ContainerShape sgShape = context.getTargetContainer();
- boolean inherited = SupportUtil.isInherited(cp, sgShape);
+ boolean inherited = SupportUtil.getInstance().isInherited(cp, sgShape);
// CONTAINER SHAPE WITH RECTANGLE
IPeCreateService peCreateService = Graphiti.getPeCreateService();
@@ -245,7 +244,7 @@ public class ChoicePointSupport {
ChoicePoint cp = (ChoicePoint) bo;
ContainerShape acShape = context.getTargetContainer();
- if (SupportUtil.isInherited(cp, acShape))
+ if (SupportUtil.getInstance().isInherited(cp, acShape))
return false;
return true;
@@ -284,7 +283,7 @@ public class ChoicePointSupport {
if (pes != null && pes.length == 1 && pes[0] instanceof ContainerShape) {
Object bo = getBusinessObjectForPictogramElement(pes[0]);
if (bo instanceof ChoicePoint) {
- return !SupportUtil.isInherited(getDiagram(), (ChoicePoint)bo);
+ return !SupportUtil.getInstance().isInherited(getDiagram(), (ChoicePoint)bo);
}
}
return false;
@@ -367,7 +366,7 @@ public class ChoicePointSupport {
}
ChoicePoint cp = (ChoicePoint) bo;
- boolean inherited = SupportUtil.isInherited(cp, (ContainerShape)containerShape.eContainer());
+ boolean inherited = SupportUtil.getInstance().isInherited(cp, (ContainerShape)containerShape.eContainer());
Color dark = manageColor(inherited? INHERITED_COLOR:DARK_COLOR);
updateFigure(cp, containerShape, dark, manageColor(BRIGHT_COLOR));
@@ -399,7 +398,7 @@ public class ChoicePointSupport {
if (bo instanceof ChoicePoint) {
ChoicePoint cp = (ChoicePoint) bo;
- return !SupportUtil.isInherited(getDiagram(), cp);
+ return !SupportUtil.getInstance().isInherited(getDiagram(), cp);
}
return false;
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/ContextSwitcher.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/ContextSwitcher.java
index 14016df25..c7e5bca7a 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/ContextSwitcher.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/ContextSwitcher.java
@@ -22,7 +22,7 @@ public class ContextSwitcher {
public static void goUp(Diagram diagram, StateGraph sg) {
// if the container is a state we can go up, else we are already on top
if (sg.eContainer() instanceof State) {
- ActorClass ac = SupportUtil.getActorClass(diagram);
+ ActorClass ac = SupportUtil.getInstance().getActorClass(diagram);
StateGraph parent = getVirtualParent(sg, ac);
if (parent.eContainer() instanceof ActorClass)
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/DefaultPositionProvider.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/DefaultPositionProvider.java
index cca29c64f..6f2d328f8 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/DefaultPositionProvider.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/DefaultPositionProvider.java
@@ -80,7 +80,7 @@ public class DefaultPositionProvider implements IPositionProvider {
}
public PosAndSize getPosition(StateGraphNode node) {
- Position pos = obj2pos.get(RoomNameProvider.getFullPath(node));
+ Position pos = obj2pos.get(SupportUtil.getInstance().getRoomNameProvider().getFullPath(node));
if (pos==null)
return null;
@@ -99,7 +99,7 @@ public class DefaultPositionProvider implements IPositionProvider {
EObject container = graph.eContainer();
String path = "#init";
if(container instanceof StateGraphNode)
- path = RoomNameProvider.getFullPath((StateGraphNode)container) + path;
+ path = SupportUtil.getInstance().getRoomNameProvider().getFullPath((StateGraphNode)container) + path;
Position pos = obj2pos.get(path);
if (pos==null)
@@ -118,7 +118,7 @@ public class DefaultPositionProvider implements IPositionProvider {
public List<Pos> getPoints(Transition trans) {
ArrayList<Pos> result = new ArrayList<Pos>();
- ArrayList<Position> list = trans2points.get(RoomNameProvider.getFullPath(trans));
+ ArrayList<Position> list = trans2points.get(SupportUtil.getInstance().getRoomNameProvider().getFullPath(trans));
if (list!=null) {
int i = 0;
for (Position p : list) {
@@ -200,7 +200,8 @@ public class DefaultPositionProvider implements IPositionProvider {
if (diagram==null)
return;
- StateGraphContext tree = StateGraphContext.createContextTree(SupportUtil.getActorClass(diagram));
+ StateGraphContext tree = StateGraphContext.createContextTree(SupportUtil.getInstance().getActorClass(diagram));
+ RoomNameProvider roomNameProvider = SupportUtil.getInstance().getRoomNameProvider();
ILinkService linkService = Graphiti.getLinkService();
for (Shape sgShape : diagram.getChildren()) {
@@ -213,7 +214,7 @@ public class DefaultPositionProvider implements IPositionProvider {
PosAndSize sz = new PosAndSize(
sgShape.getGraphicsAlgorithm().getX(), sgShape.getGraphicsAlgorithm().getY(),
borderRect.getWidth(), borderRect.getHeight());
- sg2sz.put(RoomNameProvider.getFullPath((StateGraph) obj), sz);
+ sg2sz.put(roomNameProvider.getFullPath((StateGraph) obj), sz);
for (Shape sgItemShape : ((ContainerShape)sgShape).getChildren()) {
// this is the level of States, TrPoints and ChoicePoints
obj = linkService.getBusinessObjectForLinkedPictogramElement(sgItemShape);
@@ -225,14 +226,14 @@ public class DefaultPositionProvider implements IPositionProvider {
if (obj instanceof StateGraphNode) {
StateGraphNode node = (StateGraphNode)obj;
margin = getMargin(node);
- path = RoomNameProvider.getFullPath((StateGraphItem) obj);
+ path = roomNameProvider.getFullPath((StateGraphItem) obj);
} else if(obj instanceof StateGraph){
StateGraph graph = (StateGraph)obj;
margin = getMargin(graph);
EObject container = graph.eContainer();
path = "#init";
if(container instanceof StateGraphNode)
- path = RoomNameProvider.getFullPath((StateGraphNode)container) + path;
+ path = roomNameProvider.getFullPath((StateGraphNode)container) + path;
initialPointObj.put(path, graph);
}
if(path != null){
@@ -258,9 +259,9 @@ public class DefaultPositionProvider implements IPositionProvider {
StateGraph sg = tree.getContext(trans).getStateGraph();
// graph size
- PosAndSize sz = sg2sz.get(RoomNameProvider.getFullPath(sg));
+ PosAndSize sz = sg2sz.get(roomNameProvider.getFullPath(sg));
ArrayList<Position> points = new ArrayList<Position>();
- trans2points.put(RoomNameProvider.getFullPath((Transition) obj), points);
+ trans2points.put(roomNameProvider.getFullPath((Transition) obj), points);
// label position
Position pos = new Position();
@@ -302,7 +303,7 @@ public class DefaultPositionProvider implements IPositionProvider {
EObject container = graph.eContainer();
String path = "#init";
if(container instanceof StateGraphNode)
- path = RoomNameProvider.getFullPath((StateGraphNode)container) + path;
+ path = SupportUtil.getInstance().getRoomNameProvider().getFullPath((StateGraphNode)container) + path;
return initialPointObj.get(path);
}
@@ -311,6 +312,6 @@ public class DefaultPositionProvider implements IPositionProvider {
*/
@Override
public PosAndSize getGraphPosAndSize(StateGraph sg) {
- return sg2sz.get(RoomNameProvider.getFullPath(sg));
+ return sg2sz.get(SupportUtil.getInstance().getRoomNameProvider().getFullPath(sg));
}
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/DiagramUpdateFeature.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/DiagramUpdateFeature.java
index e1910f0db..d0668acd8 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/DiagramUpdateFeature.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/DiagramUpdateFeature.java
@@ -60,7 +60,7 @@ public class DiagramUpdateFeature extends AbstractUpdateFeature {
*/
@Override
public IReason updateNeeded(IUpdateContext context) {
- ActorClass ac = SupportUtil.getActorClass(getDiagram());
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagram());
StateGraphContext tree = StateGraphContext.createContextTree(ac);
usedShapes.clear();
@@ -104,7 +104,7 @@ public class DiagramUpdateFeature extends AbstractUpdateFeature {
*/
@Override
public boolean update(IUpdateContext context) {
- ActorClass ac = SupportUtil.getActorClass(getDiagram());
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagram());
StateGraphContext tree = StateGraphContext.createContextTree(ac);
usedShapes.clear();
@@ -206,7 +206,7 @@ public class DiagramUpdateFeature extends AbstractUpdateFeature {
ContainerShape cont = findStateGraphContainer(sg);
if (cont==null) {
// create
- cont = SupportUtil.addStateGraph(ctx, getDiagram(), getFeatureProvider());
+ cont = SupportUtil.getInstance().addStateGraph(ctx, getDiagram(), getFeatureProvider());
changed = true;
usedShapes.add(cont);
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/InitialPointSupport.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/InitialPointSupport.java
index 363837738..705114cb0 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/InitialPointSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/InitialPointSupport.java
@@ -17,7 +17,6 @@ import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.InitialTransition;
import org.eclipse.etrice.core.room.StateGraph;
import org.eclipse.etrice.core.room.Transition;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.ui.behavior.ImageProvider;
import org.eclipse.etrice.ui.common.support.CommonSupportUtil;
import org.eclipse.etrice.ui.common.support.DeleteWithoutConfirmFeature;
@@ -94,10 +93,10 @@ public class InitialPointSupport {
ContainerShape targetContainer = context.getTargetContainer();
StateGraph sg = (StateGraph) targetContainer.getLink().getBusinessObjects().get(0);
- boolean inherited = SupportUtil.isInherited(getDiagram(), sg);
+ boolean inherited = SupportUtil.getInstance().isInherited(getDiagram(), sg);
if (inherited) {
- ActorClass ac = SupportUtil.getActorClass(getDiagram());
- sg = SupportUtil.insertRefinedState(sg, ac, targetContainer, getFeatureProvider());
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagram());
+ sg = SupportUtil.getInstance().insertRefinedState(sg, ac, targetContainer, getFeatureProvider());
}
// We don't create anything here since in the model the initial point is
@@ -120,7 +119,7 @@ public class InitialPointSupport {
ContainerShape parent = context.getTargetContainer().getContainer();
if (! (parent instanceof StateGraph)) {
StateGraph sg = (StateGraph) obj;
- for (Transition t : RoomHelpers.getAllTransitions(sg)) {
+ for (Transition t : SupportUtil.getInstance().getRoomHelpers().getAllTransitions(sg)) {
if (t instanceof InitialTransition)
return false;
}
@@ -156,7 +155,7 @@ public class InitialPointSupport {
ContainerShape sgShape = context.getTargetContainer();
StateGraph sg = (StateGraph) context.getNewObject();
- boolean inherited = SupportUtil.isInherited(getDiagram(), sg);
+ boolean inherited = SupportUtil.getInstance().isInherited(getDiagram(), sg);
// CONTAINER SHAPE WITH RECTANGLE
IPeCreateService peCreateService = Graphiti.getPeCreateService();
@@ -216,7 +215,7 @@ public class InitialPointSupport {
if (canMove) {
Object bo = getBusinessObjectForPictogramElement(context.getPictogramElement());
if (bo instanceof StateGraph) {
- return !SupportUtil.isInherited(getDiagram(), (StateGraph)bo);
+ return !SupportUtil.getInstance().isInherited(getDiagram(), (StateGraph)bo);
}
return false;
}
@@ -234,7 +233,7 @@ public class InitialPointSupport {
public boolean canRemove(IRemoveContext context) {
Object bo = getBusinessObjectForPictogramElement(context.getPictogramElement());
if (bo instanceof StateGraph) {
- return !SupportUtil.isInherited(getDiagram(), (StateGraph) bo);
+ return !SupportUtil.getInstance().isInherited(getDiagram(), (StateGraph) bo);
}
return false;
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateGraphSupport.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateGraphSupport.java
index 600dd15a2..7951a0f42 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateGraphSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateGraphSupport.java
@@ -18,7 +18,6 @@ import java.util.List;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.ChoicePoint;
import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.StateGraph;
@@ -151,7 +150,8 @@ public class StateGraphSupport {
{
Shape labelShape = peCreateService.createShape(containerShape, false);
- Text label = gaService.createDefaultText(getDiagram(), labelShape, RoomNameProvider.getStateGraphLabel(sg));
+ Text label = gaService.createDefaultText(getDiagram(), labelShape,
+ SupportUtil.getInstance().getRoomNameProvider().getStateGraphLabel(sg));
label.setForeground(manageColor(LINE_COLOR));
label.setBackground(manageColor(LINE_COLOR));
label.setHorizontalAlignment(Orientation.ALIGNMENT_RIGHT);
@@ -316,7 +316,7 @@ public class StateGraphSupport {
// check for states added in model not present in diagram (including inherited)
{
List<State> expectedStates = ctx.getStates();
- List<State> presentStates = SupportUtil.getStates(shape, fp);
+ List<State> presentStates = SupportUtil.getInstance().getStates(shape, fp);
for (State state : expectedStates) {
if (!presentStates.contains(state))
++missing;
@@ -329,7 +329,7 @@ public class StateGraphSupport {
{
missing = 0;
List<TrPoint> expectedTrPoints = ctx.getTrPoints();
- List<TrPoint> presentTrPoints = SupportUtil.getTrPoints(sg, shape, fp);
+ List<TrPoint> presentTrPoints = SupportUtil.getInstance().getTrPoints(sg, shape, fp);
for (TrPoint tp : expectedTrPoints) {
if (!presentTrPoints.contains(tp))
++missing;
@@ -342,7 +342,7 @@ public class StateGraphSupport {
{
missing = 0;
List<ChoicePoint> expectedCPs = ctx.getChPoints();
- List<ChoicePoint> presentCPs = SupportUtil.getChoicePoints(shape, fp);
+ List<ChoicePoint> presentCPs = SupportUtil.getInstance().getChoicePoints(shape, fp);
for (ChoicePoint cp : expectedCPs) {
if (!presentCPs.contains(cp))
++missing;
@@ -355,7 +355,7 @@ public class StateGraphSupport {
{
missing = 0;
List<Transition> expectedTrans = ctx.getTransitions();
- List<Transition> presentTrans = SupportUtil.getTransitions(getDiagram(), fp);
+ List<Transition> presentTrans = SupportUtil.getInstance().getTransitions(getDiagram(), fp);
for (Transition trans : expectedTrans) {
if (!presentTrans.contains(trans))
++missing;
@@ -370,7 +370,7 @@ public class StateGraphSupport {
Shape labelShape = shape.getChildren().get(0);
GraphicsAlgorithm ga = labelShape.getGraphicsAlgorithm();
if (ga instanceof Text)
- if (!RoomNameProvider.getStateGraphLabel(sg).equals(((Text)ga).getValue()))
+ if (!SupportUtil.getInstance().getRoomNameProvider().getStateGraphLabel(sg).equals(((Text)ga).getValue()))
reason += "state graph label changed\n";
}
@@ -402,14 +402,14 @@ public class StateGraphSupport {
if (context instanceof StateGraphUpdateContext) {
StateGraphContext ctx = ((StateGraphUpdateContext)context).getContext();
- SupportUtil.updateStateGraph(sg, ctx, sgShape, fp);
+ SupportUtil.getInstance().updateStateGraph(sg, ctx, sgShape, fp);
}
if (!sgShape.getChildren().isEmpty()) {
Shape labelShape = sgShape.getChildren().get(0);
GraphicsAlgorithm ga = labelShape.getGraphicsAlgorithm();
if (ga instanceof Text)
- ((Text)ga).setValue(RoomNameProvider.getStateGraphLabel(sg));
+ ((Text)ga).setValue(SupportUtil.getInstance().getRoomNameProvider().getStateGraphLabel(sg));
}
return true;
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java
index cbec75c3b..cbaa354a2 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java
@@ -17,7 +17,6 @@ import java.util.ArrayList;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.RefinedState;
import org.eclipse.etrice.core.room.RoomFactory;
@@ -25,7 +24,6 @@ import org.eclipse.etrice.core.room.SimpleState;
import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.StateGraph;
import org.eclipse.etrice.core.room.TrPoint;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.ui.behavior.ImageProvider;
import org.eclipse.etrice.ui.behavior.dialogs.StatePropertyDialog;
import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor;
@@ -147,17 +145,17 @@ public class StateSupport {
public Object[] doCreate(ICreateContext context) {
ContainerShape targetContainer = context.getTargetContainer();
- ActorClass ac = SupportUtil.getActorClass(getDiagram());
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagram());
StateGraph sg = (StateGraph) targetContainer.getLink().getBusinessObjects().get(0);
- boolean inherited = SupportUtil.isInherited(getDiagram(), sg);
+ boolean inherited = SupportUtil.getInstance().isInherited(getDiagram(), sg);
if (inherited) {
- sg = SupportUtil.insertRefinedState(sg, ac, targetContainer, getFeatureProvider());
+ sg = SupportUtil.getInstance().insertRefinedState(sg, ac, targetContainer, getFeatureProvider());
}
// create new State and add it
SimpleState s = RoomFactory.eINSTANCE.createSimpleState();
- s.setName(RoomNameProvider.getUniqueStateName(sg));
+ s.setName(SupportUtil.getInstance().getRoomUtil().getUniqueStateName(sg));
sg.getStates().add(s);
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
@@ -224,7 +222,7 @@ public class StateSupport {
else
y += height/2;
- boolean showInherited = SupportUtil.showAsInherited(getDiagram(), s);
+ boolean showInherited = SupportUtil.getInstance().showAsInherited(getDiagram(), s);
Color lineColor = manageColor(showInherited?INHERITED_COLOR:LINE_COLOR);
Color bgColor = manageColor(showInherited?INHERITED_BACKGROUND:BACKGROUND);
IGaService gaService = Graphiti.getGaService();
@@ -306,7 +304,7 @@ public class StateSupport {
while (!borderGA.getGraphicsAlgorithmChildren().isEmpty()) {
EcoreUtil.delete(borderGA.getGraphicsAlgorithmChildren().get(0), true);
}
- Color lineColor = manageColor(SupportUtil.showAsInherited(getDiagram(), s)?INHERITED_COLOR:LINE_COLOR);
+ Color lineColor = manageColor(SupportUtil.getInstance().showAsInherited(getDiagram(), s)?INHERITED_COLOR:LINE_COLOR);
addHints(s, (RoundedRectangle) borderGA, lineColor);
}
@@ -358,7 +356,7 @@ public class StateSupport {
@Override
public boolean doExecute(ICustomContext context) {
- ActorClass ac = SupportUtil.getActorClass(getDiagram());
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagram());
State s = (State) getBusinessObjectForPictogramElement(context.getPictogramElements()[0]);
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
@@ -378,14 +376,14 @@ public class StateSupport {
// the name hasn't changed, nothing to do
return;
- if (RoomHelpers.hasDirectSubStructure(s)) {
+ if (SupportUtil.getInstance().getRoomHelpers().hasDirectSubStructure(s)) {
// update the path text in the sub graph
ContainerShape subShape = ContextSwitcher.getContext(getDiagram(), s.getSubgraph());
if (subShape!=null && !subShape.getChildren().isEmpty()) {
Shape labelShape = subShape.getChildren().get(0);
GraphicsAlgorithm ga = labelShape.getGraphicsAlgorithm();
if (ga instanceof Text)
- ((Text)ga).setValue(RoomNameProvider.getStateGraphLabel(s.getSubgraph()));
+ ((Text)ga).setValue(SupportUtil.getInstance().getRoomNameProvider().getStateGraphLabel(s.getSubgraph()));
}
if (s.getSubgraph()!=null)
for (State sub : s.getSubgraph().getStates()) {
@@ -403,7 +401,7 @@ public class StateSupport {
EcoreUtil.delete(invisibleRect.getGraphicsAlgorithmChildren().get(0), true);
}
- boolean showInherite = SupportUtil.showAsInherited(getDiagram(), s);
+ boolean showInherite = SupportUtil.getInstance().showAsInherited(getDiagram(), s);
Color lineColor = manageColor(showInherite?INHERITED_COLOR:LINE_COLOR);
Color bgColor = manageColor(showInherite?INHERITED_BACKGROUND:BACKGROUND);
createFigure(s, invisibleRect, lineColor, bgColor);
@@ -441,7 +439,8 @@ public class StateSupport {
// State targetting = SupportUtil.getTargettingState((State) bo, getDiagram());
// if (targetting.getSubgraph()!=null)
// return true;
- if (RoomHelpers.hasSubStructure((State) bo, SupportUtil.getActorClass(getDiagram())))
+ if (SupportUtil.getInstance().getRoomHelpers().hasSubStructure((State) bo,
+ SupportUtil.getInstance().getActorClass(getDiagram())))
return true;
}
return false;
@@ -455,7 +454,7 @@ public class StateSupport {
if (bo instanceof State) {
//State targetting = SupportUtil.getTargettingState((State) bo, getDiagram());
State hasSub = (State) bo;
- while (!RoomHelpers.hasDirectSubStructure(hasSub)) {
+ while (!SupportUtil.getInstance().getRoomHelpers().hasDirectSubStructure(hasSub)) {
if (hasSub instanceof RefinedState)
hasSub = ((RefinedState) hasSub).getTarget();
else
@@ -495,9 +494,9 @@ public class StateSupport {
PictogramElement pe = context.getPictogramElements()[0];
Object bo = getBusinessObjectForPictogramElement(pe);
if (bo instanceof State) {
- ActorClass ac = SupportUtil.getActorClass(getDiagram());
- boolean isBaseClassState = RoomHelpers.getActorClass((State) bo)!=ac;
- return isBaseClassState || !RoomHelpers.hasSubStructure((State) bo, ac);
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagram());
+ boolean isBaseClassState = SupportUtil.getInstance().getRoomHelpers().getActorClass((State) bo)!=ac;
+ return isBaseClassState || !SupportUtil.getInstance().getRoomHelpers().hasSubStructure((State) bo, ac);
}
return false;
}
@@ -513,9 +512,9 @@ public class StateSupport {
StateGraph newSG = null;
- boolean isBaseClassState = RoomHelpers.getActorClass(s)!=SupportUtil.getActorClass(getDiagram());
+ boolean isBaseClassState = SupportUtil.getInstance().getRoomHelpers().getActorClass(s)!=SupportUtil.getInstance().getActorClass(getDiagram());
if (isBaseClassState) {
- newSG = SupportUtil.getSubGraphOfRefinedStateFor(s, SupportUtil.getActorClass(getDiagram()));
+ newSG = SupportUtil.getInstance().getSubGraphOfRefinedStateFor(s, SupportUtil.getInstance().getActorClass(getDiagram()));
s = (State) newSG.eContainer();
// replace old business object with new refined state
@@ -564,8 +563,8 @@ public class StateSupport {
PictogramElement pe = context.getPictogramElements()[0];
Object bo = getBusinessObjectForPictogramElement(pe);
if (bo instanceof State) {
- ActorClass ac = SupportUtil.getActorClass(getDiagram());
- boolean isBaseClassState = RoomHelpers.getActorClass((State) bo)!=ac;
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagram());
+ boolean isBaseClassState = SupportUtil.getInstance().getRoomHelpers().getActorClass((State) bo)!=ac;
return isBaseClassState;
}
return false;
@@ -578,7 +577,7 @@ public class StateSupport {
ContainerShape container = (ContainerShape)context.getPictogramElements()[0];
Object bo = getBusinessObjectForPictogramElement(container);
State s = (State) bo;
- RefinedState rs = SupportUtil.getRefinedStateFor(s, SupportUtil.getActorClass(getDiagram()));
+ RefinedState rs = SupportUtil.getInstance().getRefinedStateFor(s, SupportUtil.getInstance().getActorClass(getDiagram()));
// replace old business object with new refined state
link(container, rs);
@@ -616,11 +615,11 @@ public class StateSupport {
return Reason.createTrueReason("State deleted from model");
}
State s = (State) bo;
- ActorClass mainAc = SupportUtil.getActorClass(getDiagram());
+ ActorClass mainAc = SupportUtil.getInstance().getActorClass(getDiagram());
// check if state still owned/inherited
{
- ActorClass ac = RoomHelpers.getActorClass(s);
+ ActorClass ac = SupportUtil.getInstance().getRoomHelpers().getActorClass(s);
ActorClass tmp = mainAc;
boolean found = false;
do {
@@ -636,7 +635,7 @@ public class StateSupport {
// check sub structure hint
{
- boolean hasSubStruct = RoomHelpers.hasSubStructure(s, mainAc);
+ boolean hasSubStruct = SupportUtil.getInstance().getRoomHelpers().hasSubStructure(s, mainAc);
GraphicsAlgorithm invisibleRect = containerShape.getGraphicsAlgorithm();
if (!invisibleRect.getGraphicsAlgorithmChildren().isEmpty()) {
GraphicsAlgorithm borderRect = invisibleRect.getGraphicsAlgorithmChildren().get(0);
@@ -718,7 +717,7 @@ public class StateSupport {
// TODOHRR: also check coordinates (no overlap with state graph boundaries)
- return !SupportUtil.isInherited(getDiagram(), s);
+ return !SupportUtil.getInstance().isInherited(getDiagram(), s);
}
}
@@ -741,7 +740,7 @@ public class StateSupport {
if (bo instanceof State) {
State s = (State) bo;
- if (SupportUtil.isInherited(getDiagram(), s))
+ if (SupportUtil.getInstance().isInherited(getDiagram(), s))
return false;
int width = context.getWidth()-MARGIN;
@@ -815,7 +814,7 @@ public class StateSupport {
Object bo = getBusinessObjectForPictogramElement(context.getPictogramElement());
if (bo instanceof State) {
State state = (State) bo;
- return !SupportUtil.isInherited(getDiagram(), state);
+ return !SupportUtil.getInstance().isInherited(getDiagram(), state);
}
return false;
}
@@ -833,8 +832,8 @@ public class StateSupport {
State s = (State) getBusinessObjectForPictogramElement(context.getPictogramElement());
IFeatureProvider fp = getFeatureProvider();
Diagram diagram = getDiagram();
- ActorClass ac = RoomHelpers.getActorClass(s);
- SupportUtil.deleteSubStructureRecursive(s, ac, diagram, fp);
+ ActorClass ac = SupportUtil.getInstance().getRoomHelpers().getActorClass(s);
+ SupportUtil.getInstance().deleteSubStructureRecursive(s, ac, diagram, fp);
ContainerShape container = (ContainerShape) context.getPictogramElement();
CommonSupportUtil.deleteConnectionsRecursive(container, fp);
@@ -915,14 +914,14 @@ public class StateSupport {
if (bo instanceof State) {
State s = (State) bo;
- ActorClass ac = SupportUtil.getActorClass(getDiagramTypeProvider().getDiagram());
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagramTypeProvider().getDiagram());
//boolean inherited = SupportUtil.isInherited(getDiagramTypeProvider().getDiagram(), s);
- boolean editable = RoomHelpers.getActorClass(s)==ac;
+ boolean editable = SupportUtil.getInstance().getRoomHelpers().getActorClass(s)==ac;
result.add(new PropertyFeature(fp, editable));
if (!editable)
result.add(new CreateRefinedStateFeature(fp));
- if (RoomHelpers.hasSubStructure(s, ac))
+ if (SupportUtil.getInstance().getRoomHelpers().hasSubStructure(s, ac))
result.add(new GoDownFeature(fp));
else
result.add(new CreateSubGraphFeature(fp));
@@ -971,10 +970,10 @@ public class StateSupport {
EObject bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
if (bo instanceof State) {
- ActorClass ac = SupportUtil.getActorClass(SupportUtil.getDiagram(pe));
+ ActorClass ac = SupportUtil.getInstance().getActorClass(SupportUtil.getInstance().getDiagram(pe));
State s = (State) bo;
- if (!RoomHelpers.hasSubStructure(s, ac)) {
- boolean editable = RoomHelpers.getActorClass(s)==ac;
+ if (!SupportUtil.getInstance().getRoomHelpers().hasSubStructure(s, ac)) {
+ boolean editable = SupportUtil.getInstance().getRoomHelpers().getActorClass(s)==ac;
return new FeatureProvider.PropertyFeature(getDiagramTypeProvider().getFeatureProvider(), editable);
}
}
@@ -994,9 +993,9 @@ public class StateSupport {
{
String entry = "";
if (s instanceof RefinedState)
- entry += RoomHelpers.getBaseEntryCode((RefinedState) s);
- if (RoomHelpers.hasDetailCode(s.getEntryCode()))
- entry += RoomHelpers.getDetailCode(s.getEntryCode());
+ entry += SupportUtil.getInstance().getRoomHelpers().getBaseEntryCode((RefinedState) s);
+ if (SupportUtil.getInstance().getRoomHelpers().hasDetailCode(s.getEntryCode()))
+ entry += SupportUtil.getInstance().getRoomHelpers().getDetailCode(s.getEntryCode());
if (!entry.isEmpty())
label += "entry:\n"+entry;
@@ -1004,10 +1003,10 @@ public class StateSupport {
{
String exit = "";
- if (RoomHelpers.hasDetailCode(s.getExitCode()))
- exit += RoomHelpers.getDetailCode(s.getExitCode());
+ if (SupportUtil.getInstance().getRoomHelpers().hasDetailCode(s.getExitCode()))
+ exit += SupportUtil.getInstance().getRoomHelpers().getDetailCode(s.getExitCode());
if (s instanceof RefinedState)
- exit += RoomHelpers.getBaseExitCode((RefinedState) s);
+ exit += SupportUtil.getInstance().getRoomHelpers().getBaseExitCode((RefinedState) s);
if (!exit.isEmpty()) {
if (!label.isEmpty())
@@ -1018,10 +1017,10 @@ public class StateSupport {
{
String doCode = "";
- if (RoomHelpers.hasDetailCode(s.getDoCode()))
- doCode += "do:\n"+RoomHelpers.getDetailCode(s.getDoCode());
+ if (SupportUtil.getInstance().getRoomHelpers().hasDetailCode(s.getDoCode()))
+ doCode += "do:\n"+SupportUtil.getInstance().getRoomHelpers().getDetailCode(s.getDoCode());
if (s instanceof RefinedState)
- doCode += RoomHelpers.getBaseDoCode((RefinedState) s);
+ doCode += SupportUtil.getInstance().getRoomHelpers().getBaseDoCode((RefinedState) s);
if (!doCode.isEmpty()) {
if (!label.isEmpty())
@@ -1142,8 +1141,8 @@ public class StateSupport {
hint.setLineWidth(LINE_WIDTH);
gaService.setLocationAndSize(hint, x, y, 15, 8);
- ActorClass ac = SupportUtil.getActorClass(SupportUtil.getDiagram(border));
- if (!RoomHelpers.hasSubStructure(s, ac)) {
+ ActorClass ac = SupportUtil.getInstance().getActorClass(SupportUtil.getInstance().getDiagram(border));
+ if (!SupportUtil.getInstance().getRoomHelpers().hasSubStructure(s, ac)) {
hint.setLineVisible(false);
}
}
@@ -1172,33 +1171,33 @@ public class StateSupport {
doHint.setLineWidth(LINE_WIDTH);
gaService.setLocation(doHint, x, y);
- if (!RoomHelpers.hasEntryCode(s, true)) {
+ if (!SupportUtil.getInstance().getRoomHelpers().hasEntryCode(s, true)) {
entryHint.setLineVisible(false);
}
- if (!RoomHelpers.hasExitCode(s, true)) {
+ if (!SupportUtil.getInstance().getRoomHelpers().hasExitCode(s, true)) {
exitHint.setLineVisible(false);
}
- if (!RoomHelpers.hasDoCode(s, true)) {
+ if (!SupportUtil.getInstance().getRoomHelpers().hasDoCode(s, true)) {
doHint.setLineVisible(false);
}
}
}
protected static void updateHints(State s, GraphicsAlgorithm border) {
- ActorClass ac = SupportUtil.getActorClass(SupportUtil.getDiagram(border));
+ ActorClass ac = SupportUtil.getInstance().getActorClass(SupportUtil.getInstance().getDiagram(border));
// sub structure
GraphicsAlgorithm hint = border.getGraphicsAlgorithmChildren().get(0);
- hint.setLineVisible(RoomHelpers.hasSubStructure(s, ac));
+ hint.setLineVisible(SupportUtil.getInstance().getRoomHelpers().hasSubStructure(s, ac));
// entry and exit code
hint = border.getGraphicsAlgorithmChildren().get(1);
- hint.setLineVisible(RoomHelpers.hasEntryCode(s, true));
+ hint.setLineVisible(SupportUtil.getInstance().getRoomHelpers().hasEntryCode(s, true));
hint = border.getGraphicsAlgorithmChildren().get(2);
- hint.setLineVisible(RoomHelpers.hasExitCode(s, true));
+ hint.setLineVisible(SupportUtil.getInstance().getRoomHelpers().hasExitCode(s, true));
hint = border.getGraphicsAlgorithmChildren().get(3);
- hint.setLineVisible(RoomHelpers.hasDoCode(s, true));
+ hint.setLineVisible(SupportUtil.getInstance().getRoomHelpers().hasDoCode(s, true));
}
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/SupportUtil.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/SupportUtil.java
index 5591055ff..96989f9ee 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/SupportUtil.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/SupportUtil.java
@@ -40,6 +40,8 @@ import org.eclipse.etrice.core.room.TrPointTerminal;
import org.eclipse.etrice.core.room.Transition;
import org.eclipse.etrice.core.room.TransitionTerminal;
import org.eclipse.etrice.core.room.util.RoomHelpers;
+import org.eclipse.etrice.core.room.util.RoomUtil;
+import org.eclipse.etrice.core.ui.RoomUiModule;
import org.eclipse.etrice.core.validation.ValidationUtil;
import org.eclipse.etrice.ui.behavior.commands.StateGraphContext;
import org.eclipse.etrice.ui.behavior.support.IPositionProvider.Pos;
@@ -65,6 +67,9 @@ import org.eclipse.graphiti.services.IGaService;
import org.eclipse.graphiti.services.ILinkService;
import org.eclipse.core.runtime.Assert;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+
/**
* @author Henrik Rentz-Reichert - Initial contribution and API
*
@@ -77,14 +82,65 @@ public class SupportUtil {
private static final String CP = "cp:";
private static final String SEP = ".";
- public static EObject getOwnObject(EObject obj, ResourceSet rs) {
+ private static SupportUtil instance = null;
+
+
+ /**
+ * @return the instance
+ */
+ public static SupportUtil getInstance() {
+ if (instance==null) {
+ Injector injector = RoomUiModule.getInjector();
+ instance = injector.getInstance(SupportUtil.class);
+ }
+ return instance;
+ }
+
+ @Inject
+ private RoomHelpers roomHelpers;
+ @Inject
+ private ValidationUtil validationUtil;
+ @Inject
+ private RoomNameProvider roomNameProvider;
+ @Inject
+ private RoomUtil roomUtil;
+
+ /**
+ * @return the roomHelpers
+ */
+ public RoomHelpers getRoomHelpers() {
+ return roomHelpers;
+ }
+
+ /**
+ * @return the validationUtil
+ */
+ public ValidationUtil getValidationUtil() {
+ return validationUtil;
+ }
+
+ /**
+ * @return the roomUtil
+ */
+ public RoomUtil getRoomUtil() {
+ return roomUtil;
+ }
+
+ /**
+ * @return the roomNameProvider
+ */
+ public RoomNameProvider getRoomNameProvider() {
+ return roomNameProvider;
+ }
+
+ public EObject getOwnObject(EObject obj, ResourceSet rs) {
URI uri = EcoreUtil.getURI(obj);
EObject own = rs.getEObject(uri, true);
assert(own!=null): "own object must exist";
return own;
}
- public static boolean isInherited(StateGraphItem item, ContainerShape cs) {
+ public boolean isInherited(StateGraphItem item, ContainerShape cs) {
EObject container = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(cs);
if (container instanceof StateGraph) {
StateGraph sg = (StateGraph) container;
@@ -103,19 +159,19 @@ public class SupportUtil {
return false;
}
- public static boolean isInherited(Diagram diag, EObject obj) {
- return RoomHelpers.getActorClass(obj)!=getActorClass(diag);
+ public boolean isInherited(Diagram diag, EObject obj) {
+ return roomHelpers.getActorClass(obj)!=getActorClass(diag);
}
- public static boolean showAsInherited(Diagram diag, State obj) {
+ public boolean showAsInherited(Diagram diag, State obj) {
if (obj instanceof RefinedState)
return true;
- return RoomHelpers.getActorClass(obj)!=getActorClass(diag);
+ return roomHelpers.getActorClass(obj)!=getActorClass(diag);
}
- public static Diagram getDiagram(GraphicsAlgorithm ga) {
+ public Diagram getDiagram(GraphicsAlgorithm ga) {
if (ga.eContainer() instanceof GraphicsAlgorithm)
return getDiagram((GraphicsAlgorithm)ga.eContainer());
return getDiagram(ga.getPictogramElement());
@@ -125,7 +181,7 @@ public class SupportUtil {
* @param pictogramElement
* @return
*/
- public static Diagram getDiagram(PictogramElement pe) {
+ public Diagram getDiagram(PictogramElement pe) {
while (pe.eContainer()!=null) {
if (pe.eContainer() instanceof Diagram)
return (Diagram) pe.eContainer();
@@ -134,7 +190,7 @@ public class SupportUtil {
return null;
}
- public static ActorClass getActorClass(Diagram diag) {
+ public ActorClass getActorClass(Diagram diag) {
EObject bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(diag);
if (bo instanceof ActorClass)
return (ActorClass) bo;
@@ -148,7 +204,7 @@ public class SupportUtil {
* @param fp
* @return
*/
- public static StateGraph insertRefinedState(StateGraph sg, ActorClass ac, ContainerShape targetContainer, IFeatureProvider fp) {
+ public StateGraph insertRefinedState(StateGraph sg, ActorClass ac, ContainerShape targetContainer, IFeatureProvider fp) {
sg = getSubGraphOfRefinedStateFor((State) sg.eContainer(), ac);
fp.link(targetContainer, sg);
return sg;
@@ -159,12 +215,12 @@ public class SupportUtil {
* @param ac
* @param targetContainer
*/
- public static void undoInsertRefinedState(StateGraph sg, ActorClass ac,
+ public void undoInsertRefinedState(StateGraph sg, ActorClass ac,
ContainerShape targetContainer, IFeatureProvider fp) {
RefinedState rs = (RefinedState) sg.eContainer();
fp.link(targetContainer, rs.getTarget().getSubgraph());
- if (!(RoomHelpers.hasDetailCode(rs.getEntryCode()) || RoomHelpers.hasDetailCode(rs.getExitCode()))) {
+ if (!(roomHelpers.hasDetailCode(rs.getEntryCode()) || roomHelpers.hasDetailCode(rs.getExitCode()))) {
ac.getStateMachine().getStates().remove(rs);
}
}
@@ -174,7 +230,7 @@ public class SupportUtil {
* @param ac
* @return
*/
- public static StateGraph getSubGraphOfRefinedStateFor(State s, ActorClass ac) {
+ public StateGraph getSubGraphOfRefinedStateFor(State s, ActorClass ac) {
RefinedState rs = getRefinedStateFor(s, ac);
if (rs.getSubgraph()==null)
@@ -183,7 +239,7 @@ public class SupportUtil {
return rs.getSubgraph();
}
- public static RefinedState getRefinedStateFor(State s, ActorClass ac) {
+ public RefinedState getRefinedStateFor(State s, ActorClass ac) {
HashMap<State, RefinedState> target2rs = new HashMap<State, RefinedState>();
for (State st : ac.getStateMachine().getStates()) {
if (st instanceof RefinedState)
@@ -226,9 +282,9 @@ public class SupportUtil {
* @param diagram
* @return
*/
- public static State getTargettingState(State state, Diagram diagram) {
- ActorClass ac = SupportUtil.getActorClass(diagram);
- return RoomHelpers.getTargettingState(state, ac);
+ public State getTargettingState(State state, Diagram diagram) {
+ ActorClass ac = getActorClass(diagram);
+ return roomHelpers.getTargettingState(state, ac);
}
/**
@@ -238,7 +294,7 @@ public class SupportUtil {
* @param shape
* @return the container shape that is associated with the state graph of the diagram
*/
- public static ContainerShape getStateGraphContainer(ContainerShape shape) {
+ public ContainerShape getStateGraphContainer(ContainerShape shape) {
while (shape!=null) {
ContainerShape parent = shape.getContainer();
if (parent instanceof Diagram)
@@ -248,7 +304,7 @@ public class SupportUtil {
return null;
}
- public static StateGraph getStateGraph(ContainerShape cs, IFeatureProvider fp) {
+ public StateGraph getStateGraph(ContainerShape cs, IFeatureProvider fp) {
ContainerShape shape = getStateGraphContainer(cs);
Object bo = fp.getBusinessObjectForPictogramElement(shape);
if (bo instanceof StateGraph)
@@ -259,7 +315,7 @@ public class SupportUtil {
return null;
}
- public static TransitionTerminal getTransitionTerminal(Anchor anchor, IFeatureProvider fp) {
+ public TransitionTerminal getTransitionTerminal(Anchor anchor, IFeatureProvider fp) {
if (anchor != null) {
Object obj = fp.getBusinessObjectForPictogramElement(anchor.getParent());
if (obj instanceof TrPoint) {
@@ -292,7 +348,7 @@ public class SupportUtil {
return null;
}
- public static boolean isInitialPoint(Anchor anchor, IFeatureProvider fp) {
+ public boolean isInitialPoint(Anchor anchor, IFeatureProvider fp) {
if (anchor!=null) {
Object obj = fp.getBusinessObjectForPictogramElement(anchor.getParent());
if (obj instanceof StateGraph) {
@@ -304,24 +360,24 @@ public class SupportUtil {
return false;
}
- public static boolean canConnect(Anchor asrc, Anchor atgt, ContainerShape cs, IFeatureProvider fp) {
+ public boolean canConnect(Anchor asrc, Anchor atgt, ContainerShape cs, IFeatureProvider fp) {
return canConnect(asrc, atgt, null, cs, fp);
}
- public static boolean canConnect(Anchor asrc, Anchor atgt, Transition trans, ContainerShape cs, IFeatureProvider fp) {
- TransitionTerminal src = SupportUtil.getTransitionTerminal(asrc, fp);
- TransitionTerminal tgt = SupportUtil.getTransitionTerminal(atgt, fp);
+ public boolean canConnect(Anchor asrc, Anchor atgt, Transition trans, ContainerShape cs, IFeatureProvider fp) {
+ TransitionTerminal src = getTransitionTerminal(asrc, fp);
+ TransitionTerminal tgt = getTransitionTerminal(atgt, fp);
if (src==null && !isInitialPoint(asrc, fp))
return false;
if (tgt==null)
return false;
- StateGraph sg = SupportUtil.getStateGraph(cs, fp);
+ StateGraph sg = getStateGraph(cs, fp);
if (sg==null)
return false;
- return ValidationUtil.isConnectable(src, tgt, trans, sg).isOk();
+ return validationUtil.isConnectable(src, tgt, trans, sg).isOk();
}
/**
@@ -330,8 +386,8 @@ public class SupportUtil {
* @param diagram the current diagram
* @param fp the feature provider
*/
- public static void deleteSubStructureRecursive(State s, ActorClass ac, Diagram diagram, IFeatureProvider fp) {
- if (RoomHelpers.hasSubStructure(s, ac)) {
+ public void deleteSubStructureRecursive(State s, ActorClass ac, Diagram diagram, IFeatureProvider fp) {
+ if (roomHelpers.hasSubStructure(s, ac)) {
StateGraph subgraph = s.getSubgraph();
// depth first
@@ -345,11 +401,11 @@ public class SupportUtil {
}
}
- public static List<State> getStates(ContainerShape shape, IFeatureProvider fp) {
+ public List<State> getStates(ContainerShape shape, IFeatureProvider fp) {
return getStates(shape, fp, null, null);
}
- private static List<State> getStates(ContainerShape shape, IFeatureProvider fp, Map<String, Anchor> item2anchor, List<Shape> stateShapes) {
+ private List<State> getStates(ContainerShape shape, IFeatureProvider fp, Map<String, Anchor> item2anchor, List<Shape> stateShapes) {
List<State> items = new ArrayList<State>();
for (Shape ch : shape.getChildren()) {
Object bo = fp.getBusinessObjectForPictogramElement(ch);
@@ -364,11 +420,11 @@ public class SupportUtil {
return items;
}
- public static List<ChoicePoint> getChoicePoints(ContainerShape shape, IFeatureProvider fp) {
+ public List<ChoicePoint> getChoicePoints(ContainerShape shape, IFeatureProvider fp) {
return getChoicePoints(shape, fp, null, null);
}
- private static List<ChoicePoint> getChoicePoints(ContainerShape shape, IFeatureProvider fp, Map<String, Anchor> item2anchor, List<Shape> cpShapes) {
+ private List<ChoicePoint> getChoicePoints(ContainerShape shape, IFeatureProvider fp, Map<String, Anchor> item2anchor, List<Shape> cpShapes) {
List<ChoicePoint> items = new ArrayList<ChoicePoint>();
for (Shape ch : shape.getChildren()) {
Object bo = fp.getBusinessObjectForPictogramElement(ch);
@@ -383,11 +439,11 @@ public class SupportUtil {
return items;
}
- public static List<TrPoint> getTrPoints(StateGraph sg, ContainerShape shape, IFeatureProvider fp) {
+ public List<TrPoint> getTrPoints(StateGraph sg, ContainerShape shape, IFeatureProvider fp) {
return getTrPoints(sg, shape, fp, null, null);
}
- private static List<TrPoint> getTrPoints(StateGraph sg, ContainerShape shape, IFeatureProvider fp, Map<String, Anchor> item2anchor, List<Shape> tpShapes) {
+ private List<TrPoint> getTrPoints(StateGraph sg, ContainerShape shape, IFeatureProvider fp, Map<String, Anchor> item2anchor, List<Shape> tpShapes) {
List<TrPoint> items = new ArrayList<TrPoint>();
for (Shape ch : shape.getChildren()) {
Object bo = fp.getBusinessObjectForPictogramElement(ch);
@@ -407,7 +463,7 @@ public class SupportUtil {
* @param fp
* @return
*/
- public static List<Transition> getTransitions(Diagram diagram, IFeatureProvider fp) {
+ public List<Transition> getTransitions(Diagram diagram, IFeatureProvider fp) {
List<Transition> transitions = new ArrayList<Transition>();
for (Connection conn : diagram.getConnections()) {
Object bo = fp.getBusinessObjectForPictogramElement(conn);
@@ -417,7 +473,7 @@ public class SupportUtil {
return transitions;
}
- private static Map<Transition, Connection> getTransitionsMap(ContainerShape sgShape, IFeatureProvider fp) {
+ private Map<Transition, Connection> getTransitionsMap(ContainerShape sgShape, IFeatureProvider fp) {
Diagram diagram = (Diagram) sgShape.eContainer();
Map<Transition, Connection> transitions = new HashMap<Transition, Connection>();
for (Connection conn : diagram.getConnections()) {
@@ -434,7 +490,7 @@ public class SupportUtil {
* @param sgShape
* @param node2anchor
*/
- private static void getSubTpAnchors(ContainerShape sgShape, HashMap<String, Anchor> node2anchor) {
+ private void getSubTpAnchors(ContainerShape sgShape, HashMap<String, Anchor> node2anchor) {
for (Shape childShape : sgShape.getChildren()) {
EObject bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(childShape);
if (bo instanceof State)
@@ -442,7 +498,7 @@ public class SupportUtil {
}
}
- public static ContainerShape addStateGraph(StateGraphContext ctx, Diagram diagram, IFeatureProvider fp) {
+ public ContainerShape addStateGraph(StateGraphContext ctx, Diagram diagram, IFeatureProvider fp) {
AddContext addContext = new AddContext();
addContext.setNewObject(ctx.getStateGraph());
addContext.setTargetContainer(diagram);
@@ -484,7 +540,7 @@ public class SupportUtil {
return sgShape;
}
- private static void addInitialPointIff(StateGraphContext ctx, IPositionProvider positionProvider, ContainerShape sgShape, IFeatureProvider fp,
+ private void addInitialPointIff(StateGraphContext ctx, IPositionProvider positionProvider, ContainerShape sgShape, IFeatureProvider fp,
HashMap<String, Anchor> node2anchor) {
// model
@@ -517,7 +573,7 @@ public class SupportUtil {
node2anchor.put(INITIAL, pe.getAnchors().get(0));
}
- public static void updateStateGraph(StateGraph sg, StateGraphContext ctx, ContainerShape sgShape, IFeatureProvider fp) {
+ public void updateStateGraph(StateGraph sg, StateGraphContext ctx, ContainerShape sgShape, IFeatureProvider fp) {
HashMap<String, Anchor> node2anchor = new HashMap<String, Anchor>();
@@ -528,7 +584,7 @@ public class SupportUtil {
// states
{
ArrayList<Shape> shapes = new ArrayList<Shape>();
- List<State> present = SupportUtil.getStates(sgShape, fp, node2anchor, shapes);
+ List<State> present = getStates(sgShape, fp, node2anchor, shapes);
checkDuplicates(present);
List<State> expected = ctx.getStates();
List<State> toAdd = new ArrayList<State>();
@@ -539,14 +595,14 @@ public class SupportUtil {
else
toAdd.add(item);
}
- SupportUtil.addStateGraphNodes(toAdd, ctx.getPositionProvider(), sgShape, fp, node2anchor);
- SupportUtil.updateStateGraphNodes(toUpdate, shapes, ctx.getPositionProvider(), fp);
+ addStateGraphNodes(toAdd, ctx.getPositionProvider(), sgShape, fp, node2anchor);
+ updateStateGraphNodes(toUpdate, shapes, ctx.getPositionProvider(), fp);
}
// transition points
{
ArrayList<Shape> shapes = new ArrayList<Shape>();
- List<TrPoint> present = SupportUtil.getTrPoints(sg, sgShape, fp, node2anchor, shapes);
+ List<TrPoint> present = getTrPoints(sg, sgShape, fp, node2anchor, shapes);
checkDuplicates(present);
List<TrPoint> expected = ctx.getTrPoints();
List<TrPoint> toAdd = new ArrayList<TrPoint>();
@@ -557,14 +613,14 @@ public class SupportUtil {
else
toAdd.add(item);
}
- SupportUtil.addStateGraphNodes(toAdd, ctx.getPositionProvider(), sgShape, fp, node2anchor);
- SupportUtil.updateStateGraphNodes(toUpdate, shapes, ctx.getPositionProvider(), fp);
+ addStateGraphNodes(toAdd, ctx.getPositionProvider(), sgShape, fp, node2anchor);
+ updateStateGraphNodes(toUpdate, shapes, ctx.getPositionProvider(), fp);
}
// choice points
{
ArrayList<Shape> shapes = new ArrayList<Shape>();
- List<ChoicePoint> present = SupportUtil.getChoicePoints(sgShape, fp, node2anchor, shapes);
+ List<ChoicePoint> present = getChoicePoints(sgShape, fp, node2anchor, shapes);
checkDuplicates(present);
List<ChoicePoint> expected = ctx.getChPoints();
List<ChoicePoint> toAdd = new ArrayList<ChoicePoint>();
@@ -575,11 +631,11 @@ public class SupportUtil {
else
toAdd.add(item);
}
- SupportUtil.addStateGraphNodes(toAdd, ctx.getPositionProvider(), sgShape, fp, node2anchor);
- SupportUtil.updateStateGraphNodes(toUpdate, shapes, ctx.getPositionProvider(), fp);
+ addStateGraphNodes(toAdd, ctx.getPositionProvider(), sgShape, fp, node2anchor);
+ updateStateGraphNodes(toUpdate, shapes, ctx.getPositionProvider(), fp);
}
- SupportUtil.getSubTpAnchors(sgShape, node2anchor);
+ getSubTpAnchors(sgShape, node2anchor);
// initial point
{
@@ -600,39 +656,39 @@ public class SupportUtil {
if(expected != null && present == null)
addInitialPointIff(ctx, ctx.getPositionProvider(), sgShape, fp, node2anchor);
else
- SupportUtil.updateInitialPoint(present, ctx.getPositionProvider(), fp);
+ updateInitialPoint(present, ctx.getPositionProvider(), fp);
}
// transitions
{
// get transitions that belong to our state graph
// (for other connections we might not have the node anchors yet)
- Map<Transition, Connection> present = SupportUtil.getTransitionsMap(sgShape, fp);
+ Map<Transition, Connection> present = getTransitionsMap(sgShape, fp);
List<Transition> expected = ctx.getTransitions();
List<Transition> toAdd = new ArrayList<Transition>();
for (Transition trans : expected)
if (!present.containsKey(trans))
toAdd.add(trans);
- SupportUtil.addTransitions(toAdd, ctx.getPositionProvider(), sgShape, fp, node2anchor);
- SupportUtil.updateTransitions(present, ctx.getPositionProvider(), sgShape, fp, node2anchor);
+ addTransitions(toAdd, ctx.getPositionProvider(), sgShape, fp, node2anchor);
+ updateTransitions(present, ctx.getPositionProvider(), sgShape, fp, node2anchor);
}
}
/**
* @param items
*/
- private static void checkDuplicates(List<? extends StateGraphItem> items) {
+ private void checkDuplicates(List<? extends StateGraphItem> items) {
for (StateGraphItem item : items) {
if (items.indexOf(item)!=items.lastIndexOf(item)) {
Assert.isTrue(
items.indexOf(item)==items.lastIndexOf(item),
- "multiple occurrences of "+RoomNameProvider.getFullPath(item));
+ "multiple occurrences of "+roomNameProvider.getFullPath(item));
}
}
}
- private static void addTransitions(List<Transition> transitions, IPositionProvider positionProvider, ContainerShape sgShape, IFeatureProvider fp,
+ private void addTransitions(List<Transition> transitions, IPositionProvider positionProvider, ContainerShape sgShape, IFeatureProvider fp,
HashMap<String, Anchor> node2anchor) {
for (Transition trans : transitions) {
@@ -677,7 +733,7 @@ public class SupportUtil {
}
}
- private static void addStateGraphNodes(List<? extends StateGraphNode> nodes, IPositionProvider positionProvider, ContainerShape sgShape, IFeatureProvider fp,
+ private void addStateGraphNodes(List<? extends StateGraphNode> nodes, IPositionProvider positionProvider, ContainerShape sgShape, IFeatureProvider fp,
HashMap<String, Anchor> node2anchor) {
List<PosAndSize> positions = positionProvider.getPositions(nodes);
@@ -689,7 +745,7 @@ public class SupportUtil {
}
}
- private static void addStateGraphNode(StateGraphNode tp, ContainerShape sgShape,
+ private void addStateGraphNode(StateGraphNode tp, ContainerShape sgShape,
PosAndSize pos, IFeatureProvider fp, HashMap<String, Anchor> node2anchor) {
AddContext addContext = new AddContext();
addContext.setNewObject(tp);
@@ -707,7 +763,7 @@ public class SupportUtil {
node2anchor.put(getKey(tp), pe.getAnchors().get(0));
}
- private static void updateInitialPoint(Shape shape,
+ private void updateInitialPoint(Shape shape,
IPositionProvider positionProvider, IFeatureProvider fp) {
if (shape==null)
return;
@@ -733,7 +789,7 @@ public class SupportUtil {
fp.layoutIfPossible(lc);
}
- private static void updateStateGraphNodes(List<? extends StateGraphNode> nodes, List<Shape> shapes, IPositionProvider positionProvider, IFeatureProvider fp) {
+ private void updateStateGraphNodes(List<? extends StateGraphNode> nodes, List<Shape> shapes, IPositionProvider positionProvider, IFeatureProvider fp) {
ILinkService linkService = Graphiti.getLinkService();
IGaService gaService = Graphiti.getGaService();
@@ -775,7 +831,7 @@ public class SupportUtil {
}
}
- private static void updateTransitions(Map<Transition, Connection> transitions, IPositionProvider positionProvider, ContainerShape sgShape,
+ private void updateTransitions(Map<Transition, Connection> transitions, IPositionProvider positionProvider, ContainerShape sgShape,
IFeatureProvider fp, HashMap<String, Anchor> node2anchor) {
for(Entry<Transition, Connection> e: transitions.entrySet()){
@@ -820,7 +876,7 @@ public class SupportUtil {
}
}
- private static void getAnchors(State state, PictogramElement stateShape,
+ private void getAnchors(State state, PictogramElement stateShape,
final HashMap<String, Anchor> node2anchor) {
if (stateShape instanceof ContainerShape) {
@@ -841,11 +897,11 @@ public class SupportUtil {
}
}
- private static String getKey(EObject obj) {
+ private String getKey(EObject obj) {
return getKey(obj, false);
}
- private static String getKey(EObject obj, boolean subTp) {
+ private String getKey(EObject obj, boolean subTp) {
if (obj instanceof TrPoint) {
TrPoint tp = (TrPoint) obj;
if (!subTp)
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java
index 69595c46c..96f77b857 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java
@@ -18,7 +18,6 @@ import java.util.List;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.EntryPoint;
import org.eclipse.etrice.core.room.ExitPoint;
@@ -27,8 +26,6 @@ import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.StateGraph;
import org.eclipse.etrice.core.room.TrPoint;
import org.eclipse.etrice.core.room.TransitionPoint;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
-import org.eclipse.etrice.core.validation.ValidationUtil;
import org.eclipse.etrice.ui.behavior.ImageProvider;
import org.eclipse.etrice.ui.behavior.dialogs.TrPointPropertyDialog;
import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor;
@@ -142,11 +139,11 @@ public class TrPointSupport {
@Override
public Object[] doCreate(ICreateContext context) {
ContainerShape targetContainer = context.getTargetContainer();
- ActorClass ac = SupportUtil.getActorClass(getDiagram());
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagram());
StateGraph sg = (StateGraph) targetContainer.getLink().getBusinessObjects().get(0);
- boolean inherited = SupportUtil.isInherited(getDiagram(), sg);
+ boolean inherited = SupportUtil.getInstance().isInherited(getDiagram(), sg);
if (inherited) {
- sg = SupportUtil.insertRefinedState(sg, ac, targetContainer, getFeatureProvider());
+ sg = SupportUtil.getInstance().insertRefinedState(sg, ac, targetContainer, getFeatureProvider());
}
// create transition point
@@ -162,7 +159,7 @@ public class TrPointSupport {
tp = RoomFactory.eINSTANCE.createTransitionPoint();
break;
}
- tp.setName(RoomNameProvider.getUniqueTrPointName(sg));
+ tp.setName(SupportUtil.getInstance().getRoomUtil().getUniqueTrPointName(sg));
sg.getTrPoints().add(tp);
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
@@ -223,7 +220,7 @@ public class TrPointSupport {
ContainerShape parentShape = context.getTargetContainer();
Object bo = getBusinessObjectForPictogramElement(parentShape);
boolean subtp = (bo instanceof State);
- boolean inherited = subtp?SupportUtil.isInherited(getDiagram(), (State)bo):SupportUtil.isInherited(tp, parentShape);
+ boolean inherited = subtp?SupportUtil.getInstance().isInherited(getDiagram(), (State)bo):SupportUtil.getInstance().isInherited(tp, parentShape);
int margin = subtp?MARGIN_SMALL:MARGIN;
int size = subtp?ITEM_SIZE_SMALL:ITEM_SIZE;
@@ -340,8 +337,8 @@ public class TrPointSupport {
elements = Graphiti.getLinkService().getPictogramElements(getDiagram(), s);
}
if (elements.isEmpty()) {
- ActorClass ac = SupportUtil.getActorClass(getDiagram());
- s = RoomHelpers.getTargettingState(s, ac);
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagram());
+ s = SupportUtil.getInstance().getRoomHelpers().getTargettingState(s, ac);
assert(s!=null): "a refined state should point to our parent state";
elements = Graphiti.getLinkService().getPictogramElements(getDiagram(), s);
}
@@ -381,7 +378,7 @@ public class TrPointSupport {
if (bo instanceof TrPoint) {
TrPoint tp = (TrPoint) bo;
- if (SupportUtil.isInherited(getDiagram(), tp))
+ if (SupportUtil.getInstance().isInherited(getDiagram(), tp))
return false;
if (isSubTP(context.getPictogramElement()))
@@ -525,7 +522,7 @@ public class TrPointSupport {
if (pes != null && pes.length == 1 && pes[0] instanceof ContainerShape) {
Object bo = getBusinessObjectForPictogramElement(pes[0]);
if (bo instanceof TrPoint) {
- return !SupportUtil.isInherited(getDiagram(), (TrPoint) bo);
+ return !SupportUtil.getInstance().isInherited(getDiagram(), (TrPoint) bo);
}
}
return false;
@@ -620,7 +617,7 @@ public class TrPointSupport {
}
TrPoint tp = (TrPoint) bo;
- boolean inherited = SupportUtil.isInherited(getDiagram(), tp);
+ boolean inherited = SupportUtil.getInstance().isInherited(getDiagram(), tp);
Color dark = manageColor(inherited? INHERITED_COLOR:DARK_COLOR);
updateTrPointFigure(tp, containerShape, dark, manageColor(BRIGHT_COLOR));
@@ -655,10 +652,10 @@ public class TrPointSupport {
ContainerShape containerShape = (ContainerShape) context.getPictogramElement();
TrPoint tp = (TrPoint) getBusinessObjectForPictogramElement(containerShape);
- if (SupportUtil.isInherited(getDiagram(), tp))
+ if (SupportUtil.getInstance().isInherited(getDiagram(), tp))
return false;
- if (ValidationUtil.isConnectedOutside(tp))
+ if (SupportUtil.getInstance().getValidationUtil().isConnectedOutside(tp))
return false;
return true;
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TransitionSupport.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TransitionSupport.java
index 09e7082a3..e38ca4186 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TransitionSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TransitionSupport.java
@@ -17,7 +17,6 @@ import java.util.ArrayList;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.ActorCommunicationType;
import org.eclipse.etrice.core.room.CPBranchTransition;
@@ -35,8 +34,6 @@ import org.eclipse.etrice.core.room.TrPointTerminal;
import org.eclipse.etrice.core.room.Transition;
import org.eclipse.etrice.core.room.TransitionTerminal;
import org.eclipse.etrice.core.room.TriggeredTransition;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
-import org.eclipse.etrice.core.validation.ValidationUtil;
import org.eclipse.etrice.ui.behavior.ImageProvider;
import org.eclipse.etrice.ui.behavior.dialogs.TransitionPropertyDialog;
import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor;
@@ -129,31 +126,31 @@ public class TransitionSupport {
@Override
public boolean canCreate(ICreateConnectionContext context) {
- return SupportUtil.canConnect(
+ return SupportUtil.getInstance().canConnect(
context.getSourceAnchor(),
context.getTargetAnchor(),
(ContainerShape)context.getSourcePictogramElement().eContainer(), fp);
}
public boolean canStartConnection(ICreateConnectionContext context) {
- TransitionTerminal src = SupportUtil.getTransitionTerminal(context.getSourceAnchor(), fp);
- if (src==null && !SupportUtil.isInitialPoint(context.getSourceAnchor(), fp))
+ TransitionTerminal src = SupportUtil.getInstance().getTransitionTerminal(context.getSourceAnchor(), fp);
+ if (src==null && !SupportUtil.getInstance().isInitialPoint(context.getSourceAnchor(), fp))
return false;
- StateGraph sg = SupportUtil.getStateGraph((ContainerShape) context.getSourcePictogramElement().eContainer(), fp);
+ StateGraph sg = SupportUtil.getInstance().getStateGraph((ContainerShape) context.getSourcePictogramElement().eContainer(), fp);
if (sg==null)
return false;
- return ValidationUtil.isConnectable(src, sg).isOk();
+ return SupportUtil.getInstance().getValidationUtil().isConnectable(src, sg).isOk();
}
@Override
public Connection doCreate(ICreateConnectionContext context) {
- ActorClass ac = SupportUtil.getActorClass(getDiagram());
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagram());
- TransitionTerminal src = SupportUtil.getTransitionTerminal(context.getSourceAnchor(), fp);
- TransitionTerminal dst = SupportUtil.getTransitionTerminal(context.getTargetAnchor(), fp);
- StateGraph sg = SupportUtil.getStateGraph((ContainerShape) context.getSourcePictogramElement().eContainer(), fp);
+ TransitionTerminal src = SupportUtil.getInstance().getTransitionTerminal(context.getSourceAnchor(), fp);
+ TransitionTerminal dst = SupportUtil.getInstance().getTransitionTerminal(context.getTargetAnchor(), fp);
+ StateGraph sg = SupportUtil.getInstance().getStateGraph((ContainerShape) context.getSourcePictogramElement().eContainer(), fp);
if (dst!=null && sg!=null) {
// TODOHRR-B transition dialog
@@ -174,7 +171,7 @@ public class TransitionSupport {
}
else if (src instanceof ChoicepointTerminal) {
boolean dfltBranch = true;
- for (Transition tr : RoomHelpers.getAllTransitions(sg)) {
+ for (Transition tr : SupportUtil.getInstance().getRoomHelpers().getAllTransitions(sg)) {
if (tr instanceof ContinuationTransition) {
TransitionTerminal from = ((ContinuationTransition) tr).getFrom();
if (from instanceof ChoicepointTerminal) {
@@ -242,22 +239,22 @@ public class TransitionSupport {
}
if (trans instanceof InitialTransition) {
- trans.setName(RoomNameProvider.getUniqueInitialTransitionName(sg));
+ trans.setName(SupportUtil.getInstance().getRoomUtil().getUniqueInitialTransitionName(sg));
}
else {
- trans.setName(RoomNameProvider.getUniqueTransitionName(sg));
+ trans.setName(SupportUtil.getInstance().getRoomUtil().getUniqueTransitionName(sg));
}
- ContainerShape targetContainer = SupportUtil.getStateGraphContainer((ContainerShape) context.getSourcePictogramElement().eContainer());
- boolean inherited = SupportUtil.isInherited(getDiagram(), sg);
+ ContainerShape targetContainer = SupportUtil.getInstance().getStateGraphContainer((ContainerShape) context.getSourcePictogramElement().eContainer());
+ boolean inherited = SupportUtil.getInstance().isInherited(getDiagram(), sg);
if (inherited) {
- sg = SupportUtil.insertRefinedState(sg, ac, targetContainer, getFeatureProvider());
+ sg = SupportUtil.getInstance().insertRefinedState(sg, ac, targetContainer, getFeatureProvider());
}
sg.getTransitions().add(trans);
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- TransitionPropertyDialog dlg = new TransitionPropertyDialog(shell, SupportUtil.getActorClass(getDiagram()), trans);
+ TransitionPropertyDialog dlg = new TransitionPropertyDialog(shell, SupportUtil.getInstance().getActorClass(getDiagram()), trans);
if (dlg.open()==Window.OK) {
AddConnectionContext addContext = new AddConnectionContext(context.getSourceAnchor(), context.getTargetAnchor());
addContext.setNewObject(trans);
@@ -294,7 +291,7 @@ public class TransitionSupport {
Object bo = getBusinessObjectForPictogramElement(container);
if (!(bo instanceof StateGraph))
container = container.getContainer();
- boolean inherited = SupportUtil.isInherited(trans, container);
+ boolean inherited = SupportUtil.getInstance().isInherited(trans, container);
IPeCreateService peCreateService = Graphiti.getPeCreateService();
FreeFormConnection connection = peCreateService.createFreeFormConnection(getDiagram());
@@ -316,7 +313,7 @@ public class TransitionSupport {
ConnectionDecorator cd = peCreateService
.createConnectionDecorator(connection, false, 1.0, true);
- Color fillColor = RoomHelpers.hasDetailCode(trans.getAction())?
+ Color fillColor = SupportUtil.getInstance().getRoomHelpers().hasDetailCode(trans.getAction())?
lineColor:manageColor(FILL_COLOR);
createArrow(cd, lineColor, fillColor);
@@ -373,7 +370,7 @@ public class TransitionSupport {
return false;
Transition trans = (Transition) getBusinessObjectForPictogramElement(context.getConnection());
- boolean inherited = SupportUtil.isInherited(getDiagram(), trans);
+ boolean inherited = SupportUtil.getInstance().isInherited(getDiagram(), trans);
if (inherited)
return false;
@@ -384,21 +381,21 @@ public class TransitionSupport {
else
tgt = context.getNewAnchor();
- return SupportUtil.canConnect(src, tgt, trans, (ContainerShape) context.getTargetPictogramElement().eContainer(), fp);
+ return SupportUtil.getInstance().canConnect(src, tgt, trans, (ContainerShape) context.getTargetPictogramElement().eContainer(), fp);
}
@Override
public void postReconnect(IReconnectionContext context) {
super.postReconnect(context);
- TransitionTerminal src = SupportUtil.getTransitionTerminal(context.getConnection().getStart(), fp);
- TransitionTerminal dst = SupportUtil.getTransitionTerminal(context.getConnection().getEnd(), fp);
- StateGraph sg = SupportUtil.getStateGraph((ContainerShape) context.getTargetPictogramElement().eContainer(), fp);
+ TransitionTerminal src = SupportUtil.getInstance().getTransitionTerminal(context.getConnection().getStart(), fp);
+ TransitionTerminal dst = SupportUtil.getInstance().getTransitionTerminal(context.getConnection().getEnd(), fp);
+ StateGraph sg = SupportUtil.getInstance().getStateGraph((ContainerShape) context.getTargetPictogramElement().eContainer(), fp);
// in the following we set source and target of the connection regardless of whether they have changed
// if the type of the transition changed we create a new one and open the property dialog
- ActorClass ac = SupportUtil.getActorClass(getDiagram());
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagram());
Transition orig = (Transition) getBusinessObjectForPictogramElement(context.getConnection());
Transition trans = null;
if (src==null) {
@@ -419,7 +416,7 @@ public class TransitionSupport {
NonInitialTransition t = null;
if (context.getReconnectType().equals(ReconnectionContext.RECONNECT_SOURCE)) {
boolean dfltBranch = true;
- for (Transition tr : RoomHelpers.getAllTransitions(sg)) {
+ for (Transition tr : SupportUtil.getInstance().getRoomHelpers().getAllTransitions(sg)) {
if (tr instanceof ContinuationTransition) {
TransitionTerminal from = ((ContinuationTransition) tr).getFrom();
if (from instanceof ChoicepointTerminal) {
@@ -483,7 +480,7 @@ public class TransitionSupport {
}
doneChanges = true;
- Color fillColor = RoomHelpers.hasDetailCode(trans.getAction())?
+ Color fillColor = SupportUtil.getInstance().getRoomHelpers().hasDetailCode(trans.getAction())?
manageColor(LINE_COLOR):manageColor(FILL_COLOR);
updateLabel(trans, context.getConnection(), fillColor);
}
@@ -525,10 +522,10 @@ public class TransitionSupport {
if (conn.getConnectionDecorators().size()>=2) {
ConnectionDecorator cd = conn.getConnectionDecorators().get(0);
if (cd.getGraphicsAlgorithm() instanceof Polygon) {
- ActorClass ac = SupportUtil.getActorClass(getDiagram());
- boolean inherited = SupportUtil.isInherited(getDiagram(), t);
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagram());
+ boolean inherited = SupportUtil.getInstance().isInherited(getDiagram(), t);
Color lineColor = inherited? manageColor(INHERITED_COLOR):manageColor(LINE_COLOR);
- String code = RoomHelpers.getAllActionCode(t, ac);
+ String code = SupportUtil.getInstance().getRoomHelpers().getAllActionCode(t, ac);
boolean hasActionCode = code!=null && !code.isEmpty();
Color fillColor = hasActionCode? lineColor : manageColor(FILL_COLOR);
if (!equal(cd.getGraphicsAlgorithm().getBackground(), fillColor))
@@ -568,12 +565,12 @@ public class TransitionSupport {
boolean updated = false;
if (bo instanceof Transition) {
- ActorClass ac = SupportUtil.getActorClass(getDiagram());
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagram());
Transition trans = (Transition) bo;
Connection conn = (Connection)context.getPictogramElement();
- boolean inherited = SupportUtil.isInherited(getDiagram(), trans);
+ boolean inherited = SupportUtil.getInstance().isInherited(getDiagram(), trans);
Color lineColor = inherited? manageColor(INHERITED_COLOR):manageColor(LINE_COLOR);
- String code = RoomHelpers.getAllActionCode(trans, ac);
+ String code = SupportUtil.getInstance().getRoomHelpers().getAllActionCode(trans, ac);
boolean hasActionCode = code!=null && !code.isEmpty();
Color fillColor = hasActionCode? lineColor : manageColor(FILL_COLOR);
updateLabel(trans, conn, fillColor);
@@ -633,11 +630,11 @@ public class TransitionSupport {
Connection conn = (Connection) pe;
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- TransitionPropertyDialog dlg = new TransitionPropertyDialog(shell, SupportUtil.getActorClass(getDiagram()), trans);
+ TransitionPropertyDialog dlg = new TransitionPropertyDialog(shell, SupportUtil.getInstance().getActorClass(getDiagram()), trans);
if (dlg.open()==Window.OK){
- boolean inherited = SupportUtil.isInherited(getDiagram(), trans);
+ boolean inherited = SupportUtil.getInstance().isInherited(getDiagram(), trans);
Color lineColor = inherited? manageColor(INHERITED_COLOR):manageColor(LINE_COLOR);
- Color fillColor = RoomHelpers.hasDetailCode(trans.getAction())?
+ Color fillColor = SupportUtil.getInstance().getRoomHelpers().hasDetailCode(trans.getAction())?
lineColor:manageColor(FILL_COLOR);
updateLabel(trans, conn, fillColor);
@@ -691,7 +688,7 @@ public class TransitionSupport {
if (pe instanceof ConnectionDecorator)
pe = (PictogramElement) pe.eContainer();
Transition trans = (Transition) getBusinessObjectForPictogramElement(pe);
- ActorClass ac = SupportUtil.getActorClass(getDiagram());
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagram());
if (ac.getStateMachine()==null)
ac.setStateMachine(RoomFactory.eINSTANCE.createStateGraph());
@@ -727,7 +724,7 @@ public class TransitionSupport {
Object bo = getBusinessObjectForPictogramElement(pe);
if (bo instanceof Transition) {
- boolean inherited = SupportUtil.isInherited(getDiagram(), (Transition) bo);
+ boolean inherited = SupportUtil.getInstance().isInherited(getDiagram(), (Transition) bo);
if (inherited)
return false;
@@ -785,8 +782,8 @@ public class TransitionSupport {
if (bo instanceof Transition) {
Transition trans = (Transition) bo;
- ActorClass ac = SupportUtil.getActorClass(getDiagramTypeProvider().getDiagram());
- boolean editable = RoomHelpers.getActorClass(trans)==ac;
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagramTypeProvider().getDiagram());
+ boolean editable = SupportUtil.getInstance().getRoomHelpers().getActorClass(trans)==ac;
// let's check whether we already refined this transition
if (!editable)
@@ -838,7 +835,7 @@ public class TransitionSupport {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
int MAX_LINE_LENGTH = store.getInt(PreferenceConstants.MAX_LABEL_LINE_LENGTH);
int MAX_LINES = store.getInt(PreferenceConstants.MAX_LABEL_LINES);
- String label = RoomNameProvider.getTransitionLabelName(trans);
+ String label = SupportUtil.getInstance().getRoomNameProvider().getTransitionLabelName(trans);
StringBuilder result = new StringBuilder();
int i = 0;
for (; i+MAX_LINE_LENGTH<label.length(); i+=MAX_LINE_LENGTH) {
@@ -867,8 +864,8 @@ public class TransitionSupport {
Object bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
if (bo instanceof Transition) {
Transition trans = (Transition) bo;
- ActorClass ac = SupportUtil.getActorClass(getDiagramTypeProvider().getDiagram());
- boolean editable = RoomHelpers.getActorClass(trans)==ac;
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagramTypeProvider().getDiagram());
+ boolean editable = SupportUtil.getInstance().getRoomHelpers().getActorClass(trans)==ac;
return new FeatureProvider.PropertyFeature(getDiagramTypeProvider().getFeatureProvider(), editable);
}
@@ -885,9 +882,9 @@ public class TransitionSupport {
EObject bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
if (bo instanceof Transition) {
Transition tr = (Transition) bo;
- String label = RoomNameProvider.getTransitionLabelName(tr);
- ActorClass ac = SupportUtil.getActorClass(getDiagramTypeProvider().getDiagram());
- String code = RoomHelpers.getAllActionCode(tr, ac);
+ String label = SupportUtil.getInstance().getRoomNameProvider().getTransitionLabelName(tr);
+ ActorClass ac = SupportUtil.getInstance().getActorClass(getDiagramTypeProvider().getDiagram());
+ String code = SupportUtil.getInstance().getRoomHelpers().getAllActionCode(tr, ac);
if (code!=null && !code.isEmpty()) {
if (label.length()>0)
label += "\n";
diff --git a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditBehaviorHandler.java b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditBehaviorHandler.java
index fa6eb1a2e..bec220b03 100644
--- a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditBehaviorHandler.java
+++ b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditBehaviorHandler.java
@@ -15,11 +15,12 @@ package org.eclipse.etrice.ui.commands.handlers;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.etrice.core.naming.RoomFragmentProvider;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.StateGraph;
import org.eclipse.etrice.core.room.Transition;
+import org.eclipse.etrice.core.room.util.RoomUtil;
+import org.eclipse.etrice.core.ui.RoomUiModule;
import org.eclipse.etrice.ui.behavior.DiagramAccess;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.xtext.resource.XtextResource;
@@ -27,6 +28,8 @@ import org.eclipse.xtext.ui.editor.XtextEditor;
import org.eclipse.xtext.ui.editor.model.IXtextDocument;
import org.eclipse.xtext.util.concurrent.IUnitOfWork;
+import com.google.inject.Injector;
+
/**
* Handler for outline menu item to open behavior editor.
* The handler will ask to save unsaved editor before opening the diagram.
@@ -57,25 +60,28 @@ public class EditBehaviorHandler extends AbstractEditHandler {
@Override
public void process(XtextResource resource) throws Exception {
if (resource != null) {
+ Injector injector = RoomUiModule.getInjector();
+ RoomUtil util = injector.getInstance(RoomUtil.class);
+
EObject object = resource.getEObject(fragment);
if (object instanceof ActorClass) {
- createTransitionNames(((ActorClass) object).getStateMachine());
+ createTransitionNames(((ActorClass) object).getStateMachine(), util);
}
}
}
- private void createTransitionNames(StateGraph sg) {
+ private void createTransitionNames(StateGraph sg, RoomUtil util) {
if (sg==null)
return;
for (Transition tr : sg.getTransitions()) {
if (tr.getName()==null || tr.getName().isEmpty()) {
- tr.setName(RoomNameProvider.getUniqueTransitionName(sg));
+ tr.setName(util.getUniqueTransitionName(sg));
}
}
for (State s : sg.getStates()) {
- createTransitionNames(s.getSubgraph());
+ createTransitionNames(s.getSubgraph(), util);
}
}
diff --git a/plugins/org.eclipse.etrice.ui.runtime/create_contents.xml b/plugins/org.eclipse.etrice.ui.runtime/create_contents.xml
index 7a4a13b88..82f92e3d9 100644
--- a/plugins/org.eclipse.etrice.ui.runtime/create_contents.xml
+++ b/plugins/org.eclipse.etrice.ui.runtime/create_contents.xml
@@ -15,7 +15,7 @@
<attribute name="source" default="default" />
<sequential>
<delete file="${target}/@{name}.zip" />
- <zip destfile="${target}/@{name}.zip" basedir="@{source}/@{name}" excludes="bin/**,Debug/**,Release/**,*.cspec,jgen_*,target/**,MinGWDebug/**,PosixDebug/**" />
+ <zip destfile="${target}/@{name}.zip" basedir="@{source}/@{name}" excludes="pom.xml,bin/**,Debug/**,Release/**,*.cspec,jgen_*,target/**,MinGWDebug/**,PosixDebug/**" />
</sequential>
</macrodef>
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/dialogs/ActorContainerRefPropertyDialog.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/dialogs/ActorContainerRefPropertyDialog.java
index a1bde2307..e2206451e 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/dialogs/ActorContainerRefPropertyDialog.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/dialogs/ActorContainerRefPropertyDialog.java
@@ -33,12 +33,12 @@ import org.eclipse.etrice.core.room.RoomPackage;
import org.eclipse.etrice.core.room.StructureClass;
import org.eclipse.etrice.core.room.SubSystemClass;
import org.eclipse.etrice.core.room.SubSystemRef;
-import org.eclipse.etrice.core.validation.ValidationUtil;
import org.eclipse.etrice.ui.common.dialogs.AbstractPropertyDialog;
import org.eclipse.etrice.ui.common.dialogs.MultiValidator2;
import org.eclipse.etrice.ui.structure.Activator;
import org.eclipse.etrice.ui.structure.dialogs.PortPropertyDialog.Multiplicity2StringConverter;
import org.eclipse.etrice.ui.structure.dialogs.PortPropertyDialog.String2MultiplicityConverter;
+import org.eclipse.etrice.ui.structure.support.SupportUtil;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Combo;
@@ -194,7 +194,7 @@ public class ActorContainerRefPropertyDialog extends AbstractPropertyDialog {
EObject obj = desc.getEObjectOrProxy();
if (refIsActor && obj instanceof ActorClass) {
if (containerIsActor) {
- if (!ValidationUtil.isReferencing((ActorClass)obj, (ActorClass)sc))
+ if (!SupportUtil.getInstance().getRoomHelpers().isReferencing((ActorClass)obj, (ActorClass)sc))
actors.add(desc);
}
else
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/dialogs/PortPropertyDialog.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/dialogs/PortPropertyDialog.java
index 346aa2fd4..be30c71f8 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/dialogs/PortPropertyDialog.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/dialogs/PortPropertyDialog.java
@@ -24,8 +24,22 @@ import org.eclipse.core.databinding.validation.ValidationStatus;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.validation.ValidationUtil;
+import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.ActorContainerClass;
+import org.eclipse.etrice.core.room.CommunicationType;
+import org.eclipse.etrice.core.room.CompoundProtocolClass;
+import org.eclipse.etrice.core.room.ExternalPort;
+import org.eclipse.etrice.core.room.GeneralProtocolClass;
+import org.eclipse.etrice.core.room.Port;
+import org.eclipse.etrice.core.room.ProtocolClass;
+import org.eclipse.etrice.core.room.RoomFactory;
+import org.eclipse.etrice.core.room.RoomPackage;
+import org.eclipse.etrice.core.room.SubSystemClass;
import org.eclipse.etrice.core.validation.ValidationUtil.Result;
+import org.eclipse.etrice.ui.common.dialogs.AbstractPropertyDialog;
+import org.eclipse.etrice.ui.structure.Activator;
+import org.eclipse.etrice.ui.structure.support.SupportUtil;
+import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
@@ -41,21 +55,6 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.scoping.IScope;
-import org.eclipse.etrice.core.room.ActorClass;
-import org.eclipse.etrice.core.room.ActorContainerClass;
-import org.eclipse.etrice.core.room.CommunicationType;
-import org.eclipse.etrice.core.room.CompoundProtocolClass;
-import org.eclipse.etrice.core.room.ExternalPort;
-import org.eclipse.etrice.core.room.GeneralProtocolClass;
-import org.eclipse.etrice.core.room.Port;
-import org.eclipse.etrice.core.room.ProtocolClass;
-import org.eclipse.etrice.core.room.RoomFactory;
-import org.eclipse.etrice.core.room.RoomPackage;
-import org.eclipse.etrice.core.room.SubSystemClass;
-import org.eclipse.etrice.ui.common.dialogs.AbstractPropertyDialog;
-import org.eclipse.etrice.ui.structure.Activator;
-import org.eclipse.jface.databinding.swt.SWTObservables;
-
public class PortPropertyDialog extends AbstractPropertyDialog {
class NameValidator implements IValidator {
@@ -65,7 +64,7 @@ public class PortPropertyDialog extends AbstractPropertyDialog {
if (value instanceof String) {
String name = (String) value;
- Result result = ValidationUtil.isUniqueName(port, name);
+ Result result = SupportUtil.getInstance().getValidationUtil().isUniqueName(port, name);
if (!result.isOk())
return ValidationStatus.error(result.getMsg());
}
@@ -226,11 +225,11 @@ public class PortPropertyDialog extends AbstractPropertyDialog {
@Override
protected void createContent(IManagedForm mform, Composite body, DataBindingContext bindingContext) {
- Result notReferenced = ValidationUtil.isFreeOfReferences(port);
+ Result notReferenced = SupportUtil.getInstance().getValidationUtil().isFreeOfReferences(port);
boolean multiplicityAnyAllowed = true;
ActorContainerClass parent = (ActorContainerClass) port.eContainer();
if (parent instanceof ActorClass) {
- if (ValidationUtil.isReferencedAsReplicatedInModel((ActorClass) parent))
+ if (SupportUtil.getInstance().getValidationUtil().isReferencedAsReplicatedInModel((ActorClass) parent))
multiplicityAnyAllowed = false;
}
NameValidator nv = new NameValidator();
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/dialogs/SPPPropertyDialog.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/dialogs/SPPPropertyDialog.java
index e80abe269..b6bc3af90 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/dialogs/SPPPropertyDialog.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/dialogs/SPPPropertyDialog.java
@@ -24,10 +24,10 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.RoomPackage;
import org.eclipse.etrice.core.room.SPP;
-import org.eclipse.etrice.core.validation.ValidationUtil;
import org.eclipse.etrice.core.validation.ValidationUtil.Result;
import org.eclipse.etrice.ui.common.dialogs.AbstractPropertyDialog;
import org.eclipse.etrice.ui.structure.Activator;
+import org.eclipse.etrice.ui.structure.support.SupportUtil;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Combo;
@@ -47,7 +47,7 @@ public class SPPPropertyDialog extends AbstractPropertyDialog {
if (value instanceof String) {
String name = (String) value;
- Result result = ValidationUtil.isUniqueName(spp, name);
+ Result result = SupportUtil.getInstance().getValidationUtil().isUniqueName(spp, name);
if (!result.isOk())
return ValidationStatus.error(result.getMsg());
@@ -90,7 +90,7 @@ public class SPPPropertyDialog extends AbstractPropertyDialog {
@Override
protected void createContent(IManagedForm mform, Composite body, DataBindingContext bindingContext) {
- boolean connected = ValidationUtil.isReferencedInModel(spp);
+ boolean connected = SupportUtil.getInstance().getValidationUtil().isReferencedInModel(spp);
NameValidator nv = new NameValidator();
ProtocolValidator pv = new ProtocolValidator();
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 c3429e153..f0fe72af2 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
@@ -22,7 +22,6 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.ActorContainerClass;
import org.eclipse.etrice.core.room.ActorContainerRef;
@@ -34,7 +33,6 @@ import org.eclipse.etrice.core.room.RoomFactory;
import org.eclipse.etrice.core.room.RoomPackage;
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.common.preferences.PreferenceConstants;
import org.eclipse.etrice.ui.common.support.ChangeAwareCreateFeature;
import org.eclipse.etrice.ui.common.support.ChangeAwareCustomFeature;
@@ -430,7 +428,7 @@ public class ActorContainerRefSupport {
newRef = ssr;
}
- newRef.setName(RoomNameProvider.getUniqueActorContainerRefName(sc));
+ newRef.setName(SupportUtil.getInstance().getRoomUtil().getUniqueActorContainerRefName(sc));
IScopeProvider scopeProvider = ((DiagramTypeProvider)getFeatureProvider().getDiagramTypeProvider()).getScopeProvider();
EReference reference = (newRef instanceof ActorRef)?RoomPackage.eINSTANCE.getActorRef_Type():RoomPackage.eINSTANCE.getSubSystemRef_Type();
@@ -800,7 +798,7 @@ public class ActorContainerRefSupport {
// check class name
if (bo instanceof ActorContainerRef) {
- String label = RoomNameProvider.getRefLabelName((ActorContainerRef) bo);
+ String label = SupportUtil.getInstance().getRoomNameProvider().getRefLabelName((ActorContainerRef) bo);
if (!label.equals(graphics.getNameLabel().getValue()))
reason += "Class name is out of date\n";
}
@@ -817,8 +815,8 @@ 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 = RoomHelpers.getInterfaceItems(acc, true);
- List<InterfaceItem> presentItems = SupportUtil.getInterfaceItems(containerShape, fp);
+ List<InterfaceItem> interfaceItems = SupportUtil.getInstance().getRoomHelpers().getInterfaceItems(acc, true);
+ List<InterfaceItem> presentItems = SupportUtil.getInstance().getInterfaceItems(containerShape, fp);
int missing = 0;
for (InterfaceItem interfaceItem : interfaceItems) {
if (!presentItems.contains(interfaceItem))
@@ -855,7 +853,7 @@ public class ActorContainerRefSupport {
Map<EObject, Shape> present = getChildrenShapesForBoClass(containerShape, RoomPackage.Literals.INTERFACE_ITEM);
ActorContainerClass acc = (acr instanceof ActorRef)?((ActorRef)acr).getType():((SubSystemRef)acr).getType();
- List<InterfaceItem> expected = new ArrayList<InterfaceItem>(RoomHelpers.getInterfaceItems(acc, true));
+ List<InterfaceItem> expected = new ArrayList<InterfaceItem>(SupportUtil.getInstance().getRoomHelpers().getInterfaceItems(acc, true));
expected.removeAll(present.keySet());
Map<EObject, Shape> newShapes = addShapesInitial(expected, containerShape);
@@ -1159,7 +1157,7 @@ public class ActorContainerRefSupport {
{
// acr name
Text label = graphics.getNameLabel();
- label.setValue(RoomNameProvider.getRefLabelName(acr));
+ label.setValue(SupportUtil.getInstance().getRoomNameProvider().getRefLabelName(acr));
label.setForeground(lineColor);
label.setBackground(bgColor);
}
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/BindingSupport.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/BindingSupport.java
index 774c7194c..0479184ea 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/BindingSupport.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/BindingSupport.java
@@ -13,7 +13,6 @@
package org.eclipse.etrice.ui.structure.support;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.ActorContainerClass;
import org.eclipse.etrice.core.room.ActorContainerRef;
import org.eclipse.etrice.core.room.Binding;
@@ -23,7 +22,6 @@ import org.eclipse.etrice.core.room.GeneralProtocolClass;
import org.eclipse.etrice.core.room.Port;
import org.eclipse.etrice.core.room.RoomFactory;
import org.eclipse.etrice.core.room.StructureClass;
-import org.eclipse.etrice.core.validation.ValidationUtil;
import org.eclipse.etrice.ui.common.support.ChangeAwareCreateConnectionFeature;
import org.eclipse.etrice.ui.common.support.ChangeAwareCustomFeature;
import org.eclipse.etrice.ui.common.support.DeleteWithoutConfirmFeature;
@@ -99,41 +97,41 @@ public class BindingSupport {
@Override
public boolean canCreate(ICreateConnectionContext context) {
IFeatureProvider featureProvider = getFeatureProvider();
- Port src = SupportUtil.getPort(context.getSourceAnchor(), featureProvider);
- Port tgt = SupportUtil.getPort(context.getTargetAnchor(), featureProvider);
- ActorContainerRef srcRef = SupportUtil.getRef(context.getSourceAnchor(), featureProvider);
+ Port src = SupportUtil.getInstance().getPort(context.getSourceAnchor(), featureProvider);
+ Port tgt = SupportUtil.getInstance().getPort(context.getTargetAnchor(), featureProvider);
+ ActorContainerRef srcRef = SupportUtil.getInstance().getRef(context.getSourceAnchor(), featureProvider);
if (src==null || tgt==null) {
return false;
}
- StructureClass ac = SupportUtil.getParent(context, featureProvider);
+ StructureClass ac = SupportUtil.getInstance().getParent(context, featureProvider);
if (ac==null) {
return false;
}
- ActorContainerRef tgtRef = SupportUtil.getRef(context.getTargetAnchor(), featureProvider);
+ ActorContainerRef tgtRef = SupportUtil.getInstance().getRef(context.getTargetAnchor(), featureProvider);
- return ValidationUtil.isConnectable(src, srcRef, null, tgt, tgtRef, null, ac, null, false).isOk();
+ return SupportUtil.getInstance().getValidationUtil().isConnectable(src, srcRef, null, tgt, tgtRef, null, ac, null, false).isOk();
}
public boolean canStartConnection(ICreateConnectionContext context) {
if (context.getSourceAnchor()==null)
return false;
- Port src = SupportUtil.getPort(context.getSourceAnchor(), getFeatureProvider());
+ Port src = SupportUtil.getInstance().getPort(context.getSourceAnchor(), getFeatureProvider());
boolean canStart = src!=null;
if (canStart) {
- ActorContainerRef ref = SupportUtil.getRef(context.getSourceAnchor(), getFeatureProvider());
+ ActorContainerRef ref = SupportUtil.getInstance().getRef(context.getSourceAnchor(), getFeatureProvider());
if (ref==null) {
// this port is local, i.e. owned by the parent itself
ActorContainerClass acc = (ActorContainerClass) src.eContainer();
- if (!ValidationUtil.isConnectable(src, null, acc).isOk())
+ if (!SupportUtil.getInstance().getValidationUtil().isConnectable(src, null, acc).isOk())
canStart = false;
}
else {
StructureClass acc = (StructureClass) ref.eContainer();
- if (!ValidationUtil.isConnectable(src, ref, acc).isOk())
+ if (!SupportUtil.getInstance().getValidationUtil().isConnectable(src, ref, acc).isOk())
canStart = false;
}
}
@@ -143,9 +141,9 @@ public class BindingSupport {
@Override
public void attachedToSource(ICreateConnectionContext context) {
- Port src = SupportUtil.getPort(context.getSourceAnchor(), getFeatureProvider());
- ActorContainerRef ref = SupportUtil.getRef(context.getSourceAnchor(), getFeatureProvider());
- StructureClass sc = SupportUtil.getParent(context, getFeatureProvider());
+ Port src = SupportUtil.getInstance().getPort(context.getSourceAnchor(), getFeatureProvider());
+ ActorContainerRef ref = SupportUtil.getInstance().getRef(context.getSourceAnchor(), getFeatureProvider());
+ StructureClass sc = SupportUtil.getInstance().getParent(context, getFeatureProvider());
beginHighLightMatches(sc, src, ref);
}
@@ -168,7 +166,7 @@ public class BindingSupport {
for (Shape subShape : scContainer.getChildren()) {
Object bo = getBusinessObjectForPictogramElement(subShape);
if (bo instanceof Port) {
- if (ValidationUtil.isConnectable(src, srcRef, null, (Port) bo, null, null, sc, null, false).isOk()) {
+ if (SupportUtil.getInstance().getValidationUtil().isConnectable(src, srcRef, null, (Port) bo, null, null, sc, null, false).isOk()) {
DecorationProvider.addAllowedPortShape(subShape);
getDiagramBehavior().refreshRenderingDecorators(subShape);
}
@@ -178,7 +176,7 @@ public class BindingSupport {
for (Shape subSubShape : ((ContainerShape)subShape).getChildren()) {
bo = getBusinessObjectForPictogramElement(subSubShape);
if (bo instanceof Port) {
- if (ValidationUtil.isConnectable(src, srcRef, null, (Port) bo, tgtRef, null, sc, null, false).isOk()) {
+ if (SupportUtil.getInstance().getValidationUtil().isConnectable(src, srcRef, null, (Port) bo, tgtRef, null, sc, null, false).isOk()) {
DecorationProvider.addAllowedPortShape(subSubShape);
getDiagramBehavior().refreshRenderingDecorators(subSubShape);
}
@@ -201,17 +199,17 @@ public class BindingSupport {
endHighLightMatches();
IFeatureProvider featureProvider = getFeatureProvider();
- Port src = SupportUtil.getPort(context.getSourceAnchor(), featureProvider);
- Port dst = SupportUtil.getPort(context.getTargetAnchor(), featureProvider);
- StructureClass sc = SupportUtil.getParent(context, featureProvider);
+ Port src = SupportUtil.getInstance().getPort(context.getSourceAnchor(), featureProvider);
+ Port dst = SupportUtil.getInstance().getPort(context.getTargetAnchor(), featureProvider);
+ StructureClass sc = SupportUtil.getInstance().getParent(context, featureProvider);
if (src!=null && dst!=null && sc!=null) {
Binding bind = RoomFactory.eINSTANCE.createBinding();
BindingEndPoint ep1 = RoomFactory.eINSTANCE.createBindingEndPoint();
- ActorContainerRef ar1 = SupportUtil.getRef(context.getSourceAnchor(), featureProvider);
+ ActorContainerRef ar1 = SupportUtil.getInstance().getRef(context.getSourceAnchor(), featureProvider);
ep1.setPort(src);
ep1.setActorRef(ar1);
BindingEndPoint ep2 = RoomFactory.eINSTANCE.createBindingEndPoint();
- ActorContainerRef ar2 = SupportUtil.getRef(context.getTargetAnchor(), featureProvider);
+ ActorContainerRef ar2 = SupportUtil.getInstance().getRef(context.getTargetAnchor(), featureProvider);
ep2.setPort(dst);
ep2.setActorRef(ar2);
bind.setEndpoint1(ep1);
@@ -317,22 +315,22 @@ public class BindingSupport {
atgt = context.getNewAnchor();
IFeatureProvider featureProvider = getFeatureProvider();
- Port src = SupportUtil.getPort(asrc, featureProvider);
- Port tgt = SupportUtil.getPort(atgt, featureProvider);
- ActorContainerRef srcRef = SupportUtil.getRef(asrc, featureProvider);
+ Port src = SupportUtil.getInstance().getPort(asrc, featureProvider);
+ Port tgt = SupportUtil.getInstance().getPort(atgt, featureProvider);
+ ActorContainerRef srcRef = SupportUtil.getInstance().getRef(asrc, featureProvider);
if (src==null || tgt==null) {
return false;
}
- StructureClass ac = SupportUtil.getParent(getDiagram(), featureProvider);
+ StructureClass ac = SupportUtil.getInstance().getParent(getDiagram(), featureProvider);
if (ac==null) {
return false;
}
- ActorContainerRef tgtRef = SupportUtil.getRef(atgt, featureProvider);
+ ActorContainerRef tgtRef = SupportUtil.getInstance().getRef(atgt, featureProvider);
- return ValidationUtil.isConnectable(
+ return SupportUtil.getInstance().getValidationUtil().isConnectable(
src, srcRef, bind.getEndpoint1().getSub(),
tgt, tgtRef, bind.getEndpoint2().getSub(),
ac, bind, true).isOk();
@@ -343,17 +341,17 @@ public class BindingSupport {
super.postReconnect(context);
IFeatureProvider featureProvider = getFeatureProvider();
- Port src = SupportUtil.getPort(context.getConnection().getStart(), featureProvider);
- Port dst = SupportUtil.getPort(context.getConnection().getEnd(), featureProvider);
- StructureClass sc = SupportUtil.getParent(getDiagram(), featureProvider);
+ Port src = SupportUtil.getInstance().getPort(context.getConnection().getStart(), featureProvider);
+ Port dst = SupportUtil.getInstance().getPort(context.getConnection().getEnd(), featureProvider);
+ StructureClass sc = SupportUtil.getInstance().getParent(getDiagram(), featureProvider);
if (src!=null && dst!=null && sc!=null) {
Binding bind = (Binding) getBusinessObjectForPictogramElement(context.getConnection());
BindingEndPoint ep1 = RoomFactory.eINSTANCE.createBindingEndPoint();
- ActorContainerRef ar1 = SupportUtil.getRef(context.getConnection().getStart(), featureProvider);
+ ActorContainerRef ar1 = SupportUtil.getInstance().getRef(context.getConnection().getStart(), featureProvider);
ep1.setPort(src);
ep1.setActorRef(ar1);
BindingEndPoint ep2 = RoomFactory.eINSTANCE.createBindingEndPoint();
- ActorContainerRef ar2 = SupportUtil.getRef(context.getConnection().getEnd(), featureProvider);
+ ActorContainerRef ar2 = SupportUtil.getInstance().getRef(context.getConnection().getEnd(), featureProvider);
ep2.setPort(dst);
ep2.setActorRef(ar2);
@@ -549,7 +547,7 @@ public class BindingSupport {
EObject bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
if (bo instanceof Binding) {
Binding bind = (Binding) bo;
- return RoomNameProvider.getDisplayName(bind);
+ return SupportUtil.getInstance().getRoomNameProvider().getDisplayName(bind);
}
return super.getToolTip(ga);
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 0212b27ae..f4f432303 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
@@ -21,7 +21,6 @@ import org.eclipse.etrice.core.room.InterfaceItem;
import org.eclipse.etrice.core.room.Port;
import org.eclipse.etrice.core.room.SPP;
import org.eclipse.etrice.core.room.SubSystemRef;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.ui.common.support.ChangeAwareCreateFeature;
import org.eclipse.etrice.ui.common.support.ChangeAwareCustomFeature;
import org.eclipse.etrice.ui.common.support.DeleteWithoutConfirmFeature;
@@ -722,7 +721,7 @@ public class InterfaceItemSupport {
if (bo instanceof InterfaceItem) {
InterfaceItem ifitem = (InterfaceItem) bo;
String name = ifitem.getName();
- String protocol = RoomHelpers.getGeneralProtocol(ifitem).getName();
+ String protocol = SupportUtil.getInstance().getRoomHelpers().getGeneralProtocol(ifitem).getName();
if (ifitem instanceof Port) {
Port port = (Port) ifitem;
if (port.getMultiplicity()==-1)
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/LayerConnectionSupport.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/LayerConnectionSupport.java
index dc2c5a841..210aff9de 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/LayerConnectionSupport.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/LayerConnectionSupport.java
@@ -23,7 +23,6 @@ import org.eclipse.etrice.core.room.SAPoint;
import org.eclipse.etrice.core.room.SPP;
import org.eclipse.etrice.core.room.SPPoint;
import org.eclipse.etrice.core.room.StructureClass;
-import org.eclipse.etrice.core.validation.ValidationUtil;
import org.eclipse.etrice.ui.common.support.ChangeAwareCreateConnectionFeature;
import org.eclipse.etrice.ui.common.support.DeleteWithoutConfirmFeature;
import org.eclipse.etrice.ui.structure.ImageProvider;
@@ -90,31 +89,31 @@ public class LayerConnectionSupport {
@Override
public boolean canCreate(ICreateConnectionContext context) {
IFeatureProvider featureProvider = getFeatureProvider();
- SPP src = SupportUtil.getSPP(context.getSourceAnchor(), featureProvider);
- ActorContainerRef srcRef = SupportUtil.getRef(context.getSourceAnchor(), featureProvider);
- SPP tgt = SupportUtil.getSPP(context.getTargetAnchor(), featureProvider);
- ActorContainerRef tgtRef = SupportUtil.getRef(context.getTargetAnchor(), featureProvider);
- StructureClass sc = SupportUtil.getParent(context, featureProvider);
+ SPP src = SupportUtil.getInstance().getSPP(context.getSourceAnchor(), featureProvider);
+ ActorContainerRef srcRef = SupportUtil.getInstance().getRef(context.getSourceAnchor(), featureProvider);
+ SPP tgt = SupportUtil.getInstance().getSPP(context.getTargetAnchor(), featureProvider);
+ ActorContainerRef tgtRef = SupportUtil.getInstance().getRef(context.getTargetAnchor(), featureProvider);
+ StructureClass sc = SupportUtil.getInstance().getParent(context, featureProvider);
- return ValidationUtil.isConnectable(src, srcRef, tgt, tgtRef, sc).isOk();
+ return SupportUtil.getInstance().getValidationUtil().isConnectable(src, srcRef, tgt, tgtRef, sc).isOk();
}
public boolean canStartConnection(ICreateConnectionContext context) {
IFeatureProvider featureProvider = getFeatureProvider();
- SPP src = SupportUtil.getSPP(context.getSourceAnchor(), featureProvider);
- ActorContainerRef ref = SupportUtil.getRef(context.getSourceAnchor(), featureProvider);
- StructureClass sc = SupportUtil.getParent(context, featureProvider);
- return ValidationUtil.isConnectableSrc(src, ref, sc);
+ SPP src = SupportUtil.getInstance().getSPP(context.getSourceAnchor(), featureProvider);
+ ActorContainerRef ref = SupportUtil.getInstance().getRef(context.getSourceAnchor(), featureProvider);
+ StructureClass sc = SupportUtil.getInstance().getParent(context, featureProvider);
+ return SupportUtil.getInstance().getValidationUtil().isConnectableSrc(src, ref, sc);
}
@Override
protected Connection doCreate(ICreateConnectionContext context) {
IFeatureProvider featureProvider = getFeatureProvider();
- SPP src = SupportUtil.getSPP(context.getSourceAnchor(), featureProvider);
- ActorContainerRef srcRef = SupportUtil.getRef(context.getSourceAnchor(), featureProvider);
- SPP dst = SupportUtil.getSPP(context.getTargetAnchor(), featureProvider);
- ActorContainerRef dstRef = SupportUtil.getRef(context.getTargetAnchor(), featureProvider);
- StructureClass sc = SupportUtil.getParent(context, featureProvider);
+ SPP src = SupportUtil.getInstance().getSPP(context.getSourceAnchor(), featureProvider);
+ ActorContainerRef srcRef = SupportUtil.getInstance().getRef(context.getSourceAnchor(), featureProvider);
+ SPP dst = SupportUtil.getInstance().getSPP(context.getTargetAnchor(), featureProvider);
+ ActorContainerRef dstRef = SupportUtil.getInstance().getRef(context.getTargetAnchor(), featureProvider);
+ StructureClass sc = SupportUtil.getInstance().getParent(context, featureProvider);
LayerConnection lc = RoomFactory.eINSTANCE.createLayerConnection();
SAPoint sapt = null;
@@ -310,13 +309,13 @@ public class LayerConnectionSupport {
atgt = context.getNewAnchor();
IFeatureProvider featureProvider = getFeatureProvider();
- SPP src = SupportUtil.getSPP(asrc, featureProvider);
- ActorContainerRef srcRef = SupportUtil.getRef(asrc, featureProvider);
- SPP tgt = SupportUtil.getSPP(atgt, featureProvider);
- ActorContainerRef tgtRef = SupportUtil.getRef(atgt, featureProvider);
- StructureClass sc = SupportUtil.getParent(getDiagram(), featureProvider);
+ SPP src = SupportUtil.getInstance().getSPP(asrc, featureProvider);
+ ActorContainerRef srcRef = SupportUtil.getInstance().getRef(asrc, featureProvider);
+ SPP tgt = SupportUtil.getInstance().getSPP(atgt, featureProvider);
+ ActorContainerRef tgtRef = SupportUtil.getInstance().getRef(atgt, featureProvider);
+ StructureClass sc = SupportUtil.getInstance().getParent(getDiagram(), featureProvider);
- return ValidationUtil.isConnectable(src, srcRef, tgt, tgtRef, sc).isOk();
+ return SupportUtil.getInstance().getValidationUtil().isConnectable(src, srcRef, tgt, tgtRef, sc).isOk();
}
@Override
@@ -324,10 +323,10 @@ public class LayerConnectionSupport {
super.postReconnect(context);
IFeatureProvider featureProvider = getFeatureProvider();
- SPP src = SupportUtil.getSPP(context.getConnection().getStart(), featureProvider);
- ActorContainerRef srcRef = SupportUtil.getRef(context.getConnection().getStart(), featureProvider);
- SPP dst = SupportUtil.getSPP(context.getConnection().getEnd(), featureProvider);
- ActorContainerRef dstRef = SupportUtil.getRef(context.getConnection().getEnd(), featureProvider);
+ SPP src = SupportUtil.getInstance().getSPP(context.getConnection().getStart(), featureProvider);
+ ActorContainerRef srcRef = SupportUtil.getInstance().getRef(context.getConnection().getStart(), featureProvider);
+ SPP dst = SupportUtil.getInstance().getSPP(context.getConnection().getEnd(), featureProvider);
+ ActorContainerRef dstRef = SupportUtil.getInstance().getRef(context.getConnection().getEnd(), featureProvider);
doneChanges = true;
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/PortSupport.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/PortSupport.java
index a31fa7a7e..b2e70605d 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/PortSupport.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/PortSupport.java
@@ -18,7 +18,6 @@ import java.util.Collection;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature.Setting;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.ActorContainerClass;
import org.eclipse.etrice.core.room.Binding;
@@ -31,7 +30,6 @@ import org.eclipse.etrice.core.room.RoomFactory;
import org.eclipse.etrice.core.room.RoomPackage;
import org.eclipse.etrice.core.room.StructureClass;
import org.eclipse.etrice.core.room.SubSystemClass;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.ui.structure.DiagramTypeProvider;
import org.eclipse.etrice.ui.structure.ImageProvider;
import org.eclipse.etrice.ui.structure.dialogs.PortPropertyDialog;
@@ -100,7 +98,7 @@ public class PortSupport extends InterfaceItemSupport {
// create Port
Port port = RoomFactory.eINSTANCE.createPort();
- port.setName(RoomNameProvider.getUniqueInterfaceItemName("p", acc));
+ port.setName(SupportUtil.getInstance().getRoomUtil().getUniqueInterfaceItemName("p", acc));
ExternalPort xp = null;
if (acc instanceof ActorClass) {
@@ -371,7 +369,7 @@ public class PortSupport extends InterfaceItemSupport {
ContainerShape containerShape,
GraphicsAlgorithm invisibleRectangle, Color darkColor, Color brightDolor) {
- boolean relay = RoomHelpers.isRelay(port);
+ boolean relay = SupportUtil.getInstance().getRoomHelpers().isRelay(port);
int size = refport?ITEM_SIZE_SMALL:ITEM_SIZE;
int margin = refport?MARGIN_SMALL:MARGIN;
@@ -529,7 +527,7 @@ public class PortSupport extends InterfaceItemSupport {
String kind = "";
if (port.isConjugated())
kind += "C";
- if (RoomHelpers.isRelay(port))
+ if (SupportUtil.getInstance().getRoomHelpers().isRelay(port))
kind += "R";
if (port.isReplicated())
kind += "M";
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SPPSupport.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SPPSupport.java
index ce0003cab..69c05b2c7 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SPPSupport.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SPPSupport.java
@@ -18,7 +18,6 @@ import java.util.Collection;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature.Setting;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.ActorContainerClass;
import org.eclipse.etrice.core.room.InterfaceItem;
import org.eclipse.etrice.core.room.LayerConnection;
@@ -29,7 +28,6 @@ import org.eclipse.etrice.core.room.SPP;
import org.eclipse.etrice.core.room.SPPoint;
import org.eclipse.etrice.core.room.ServiceImplementation;
import org.eclipse.etrice.core.room.StructureClass;
-import org.eclipse.etrice.core.validation.ValidationUtil;
import org.eclipse.etrice.ui.common.support.NoResizeFeature;
import org.eclipse.etrice.ui.structure.DiagramTypeProvider;
import org.eclipse.etrice.ui.structure.ImageProvider;
@@ -99,7 +97,7 @@ public class SPPSupport extends InterfaceItemSupport {
// create SPP
SPP spp = RoomFactory.eINSTANCE.createSPP();
- spp.setName(RoomNameProvider.getUniqueInterfaceItemName("spp", acc));
+ spp.setName(SupportUtil.getInstance().getRoomUtil().getUniqueInterfaceItemName("spp", acc));
acc.getServiceProvisionPoints().add(spp);
@@ -331,7 +329,7 @@ public class SPPSupport extends InterfaceItemSupport {
ContainerShape containerShape,
GraphicsAlgorithm invisibleRectangle, Color darkColor, Color brightDolor) {
- boolean relay = ValidationUtil.isRelay(spp);
+ boolean relay = SupportUtil.getInstance().getValidationUtil().isRelay(spp);
int size = refspp?ITEM_SIZE_SMALL:ITEM_SIZE;
int margin = refspp?MARGIN_SMALL:MARGIN;
@@ -467,7 +465,7 @@ public class SPPSupport extends InterfaceItemSupport {
protected static String getSPPKind(SPP spp) {
String kind = "";
- if (ValidationUtil.isRelay(spp))
+ if (SupportUtil.getInstance().getValidationUtil().isRelay(spp))
kind += "R";
return kind;
}
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/StructureClassUpdate.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/StructureClassUpdate.java
index 8c48ad493..66bae8809 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/StructureClassUpdate.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/StructureClassUpdate.java
@@ -25,7 +25,6 @@ import org.eclipse.etrice.core.room.InterfaceItem;
import org.eclipse.etrice.core.room.LayerConnection;
import org.eclipse.etrice.core.room.RoomPackage;
import org.eclipse.etrice.core.room.StructureClass;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.ui.structure.support.context.ConnectionUpdateContext;
import org.eclipse.etrice.ui.structure.support.context.InitialAddConnectionContext;
import org.eclipse.etrice.ui.structure.support.context.PositionUpdateContext;
@@ -73,7 +72,7 @@ public class StructureClassUpdate extends ShapeUpdateFeature {
// ACTOR_CONTAINER_REF
{
Map<EObject, Shape> present = getChildrenShapesForBoClass(containerShape, RoomPackage.Literals.ACTOR_CONTAINER_REF);
- List<ActorContainerRef> toAdd = RoomHelpers.getAllActorContainerRefs(sc);
+ List<ActorContainerRef> toAdd = SupportUtil.getInstance().getRoomHelpers().getAllActorContainerRefs(sc);
toAdd.removeAll(present.keySet());
Map<EObject, Shape> newShapes = addShapesInitial(toAdd, containerShape);
@@ -88,7 +87,7 @@ public class StructureClassUpdate extends ShapeUpdateFeature {
// INTERFACE_ITEM
{
Map<EObject, Shape> present = getChildrenShapesForBoClass(containerShape, RoomPackage.Literals.INTERFACE_ITEM);
- List<InterfaceItem> toAdd = RoomHelpers.getInterfaceItems(sc, true);
+ List<InterfaceItem> toAdd = SupportUtil.getInstance().getRoomHelpers().getInterfaceItems(sc, true);
if(sc instanceof ActorClass){
ActorClass base = (ActorClass)sc;
while(base != null){
@@ -108,7 +107,7 @@ public class StructureClassUpdate extends ShapeUpdateFeature {
// LAYER_CONNECTION
{
Map<EObject, Connection> present = getAllConnectionsForBoClass(getDiagram(), RoomPackage.Literals.LAYER_CONNECTION);
- List<LayerConnection> toAdd = RoomHelpers.getConnections(sc, true);
+ List<LayerConnection> toAdd = SupportUtil.getInstance().getRoomHelpers().getConnections(sc, true);
toAdd.removeAll(present.keySet());
Map<EObject, Connection> newConns = addConnectionsInitial(toAdd, connectionProvider);
@@ -118,7 +117,7 @@ public class StructureClassUpdate extends ShapeUpdateFeature {
// BINDING
{
Map<EObject, Connection> present = getAllConnectionsForBoClass(getDiagram(), RoomPackage.Literals.BINDING);
- List<Binding> toAdd = RoomHelpers.getBindings(sc, true);
+ List<Binding> toAdd = SupportUtil.getInstance().getRoomHelpers().getBindings(sc, true);
toAdd.removeAll(present.keySet());
Map<EObject, Connection> newConns = addConnectionsInitial(toAdd, connectionProvider);
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SupportUtil.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SupportUtil.java
index a984497cb..aaa6dda3c 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SupportUtil.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SupportUtil.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.ActorContainerRef;
import org.eclipse.etrice.core.room.Binding;
import org.eclipse.etrice.core.room.BindingEndPoint;
@@ -28,6 +29,10 @@ import org.eclipse.etrice.core.room.SAPoint;
import org.eclipse.etrice.core.room.SPP;
import org.eclipse.etrice.core.room.SPPoint;
import org.eclipse.etrice.core.room.StructureClass;
+import org.eclipse.etrice.core.room.util.RoomHelpers;
+import org.eclipse.etrice.core.room.util.RoomUtil;
+import org.eclipse.etrice.core.ui.RoomUiModule;
+import org.eclipse.etrice.core.validation.ValidationUtil;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.context.ICreateConnectionContext;
import org.eclipse.graphiti.features.context.impl.AddConnectionContext;
@@ -39,6 +44,9 @@ import org.eclipse.graphiti.mm.pictograms.Diagram;
import org.eclipse.graphiti.mm.pictograms.PictogramElement;
import org.eclipse.graphiti.mm.pictograms.Shape;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+
/**
* description
*
@@ -49,18 +57,69 @@ public class SupportUtil {
public static final String SEP = "#";
- public static EObject getOwnObject(EObject obj, ResourceSet rs) {
+ private static SupportUtil instance = null;
+
+
+ /**
+ * @return the instance
+ */
+ public static SupportUtil getInstance() {
+ if (instance==null) {
+ Injector injector = RoomUiModule.getInjector();
+ instance = injector.getInstance(SupportUtil.class);
+ }
+ return instance;
+ }
+
+ @Inject
+ private RoomHelpers roomHelpers;
+ @Inject
+ private ValidationUtil validationUtil;
+ @Inject
+ private RoomNameProvider roomNameProvider;
+ @Inject
+ private RoomUtil roomUtil;
+
+ /**
+ * @return the roomHelpers
+ */
+ public RoomHelpers getRoomHelpers() {
+ return roomHelpers;
+ }
+
+ /**
+ * @return the validationUtil
+ */
+ public ValidationUtil getValidationUtil() {
+ return validationUtil;
+ }
+
+ /**
+ * @return the roomUtil
+ */
+ public RoomUtil getRoomUtil() {
+ return roomUtil;
+ }
+
+ /**
+ * @return the roomNameProvider
+ */
+ public RoomNameProvider getRoomNameProvider() {
+ return roomNameProvider;
+ }
+
+ public EObject getOwnObject(EObject obj, ResourceSet rs) {
URI uri = EcoreUtil.getURI(obj);
EObject own = rs.getEObject(uri, true);
assert(own!=null): "own object must exist";
return own;
}
- public static ContainerShape addItem(EObject obj, int x, int y, ContainerShape container, IFeatureProvider fp) {
+ public ContainerShape addItem(EObject obj, int x, int y, ContainerShape container, IFeatureProvider fp) {
return addItem(obj, x, y, container, null, fp);
}
- public static ContainerShape addItem(EObject obj, int x, int y, ContainerShape container, Map<String,Anchor> ifitem2anchor, IFeatureProvider fp) {
+ public ContainerShape addItem(EObject obj, int x, int y, ContainerShape container, Map<String,Anchor> ifitem2anchor, IFeatureProvider fp) {
AddContext addContext = new AddContext();
addContext.setNewObject(obj);
@@ -82,7 +141,7 @@ public class SupportUtil {
return newShape;
}
- public static void getAnchors(ActorContainerRef acr, PictogramElement refShape,
+ public void getAnchors(ActorContainerRef acr, PictogramElement refShape,
final Map<String, Anchor> ifitem2anchor) {
if (refShape instanceof ContainerShape) {
@@ -106,7 +165,7 @@ public class SupportUtil {
}
}
- public static void addRefItem(ActorContainerRef obj, ContainerShape acShape, int x, int y, IFeatureProvider featureProvider, final Map<String, Anchor> ifitem2anchor) {
+ public void addRefItem(ActorContainerRef obj, ContainerShape acShape, int x, int y, IFeatureProvider featureProvider, final Map<String, Anchor> ifitem2anchor) {
AddContext addContext = new AddContext();
addContext.setNewObject(obj);
addContext.setTargetContainer(acShape);
@@ -115,10 +174,10 @@ public class SupportUtil {
ContainerShape refShape = (ContainerShape) featureProvider.addIfPossible(addContext);
- SupportUtil.getAnchors(obj, refShape, ifitem2anchor);
+ getAnchors(obj, refShape, ifitem2anchor);
}
- public static void addInterfaceItem(InterfaceItem item, ContainerShape acShape, int x, int y, IFeatureProvider featureProvider, final Map<String, Anchor> ifitem2anchor) {
+ public void addInterfaceItem(InterfaceItem item, ContainerShape acShape, int x, int y, IFeatureProvider featureProvider, final Map<String, Anchor> ifitem2anchor) {
AddContext addContext = new AddContext();
addContext.setNewObject(item);
addContext.setTargetContainer(acShape);
@@ -130,7 +189,7 @@ public class SupportUtil {
ifitem2anchor.put(SEP+item.getName(), pe.getAnchors().get(0));
}
- public static void addBinding(Binding bind, IFeatureProvider featureProvider,
+ public void addBinding(Binding bind, IFeatureProvider featureProvider,
final Map<String, Anchor> ifitem2anchor) {
String ep1 = getName(bind.getEndpoint1());
String ep2 = getName(bind.getEndpoint2());
@@ -143,7 +202,7 @@ public class SupportUtil {
featureProvider.addIfPossible(context);
}
- public static void addLayerConnection(LayerConnection lc, IFeatureProvider featureProvider,
+ public void addLayerConnection(LayerConnection lc, IFeatureProvider featureProvider,
final Map<String, Anchor> ifitem2anchor) {
String ep1 = getName(lc.getFrom());
String ep2 = getName(lc.getTo());
@@ -156,7 +215,7 @@ public class SupportUtil {
featureProvider.addIfPossible(context);
}
- public static void addInterfaceItems(List<? extends InterfaceItem> items, int y, ContainerShape acShape, int width,
+ public void addInterfaceItems(List<? extends InterfaceItem> items, int y, ContainerShape acShape, int width,
IFeatureProvider fp,
final Map<String, Anchor> ifitem2anchor) {
@@ -164,12 +223,12 @@ public class SupportUtil {
int delta = width/(n+1);
int pos = delta;
for (InterfaceItem item : items) {
- SupportUtil.addInterfaceItem(item, acShape, pos+StructureClassSupport.MARGIN, y, fp, ifitem2anchor);
+ addInterfaceItem(item, acShape, pos+StructureClassSupport.MARGIN, y, fp, ifitem2anchor);
pos += delta;
}
}
- public static void addRefItems(List<? extends ActorContainerRef> actorRefs,
+ public void addRefItems(List<? extends ActorContainerRef> actorRefs,
ContainerShape acShape, int width,
IFeatureProvider fp, final Map<String, Anchor> ifitem2anchor) {
int ncols = width/ActorContainerRefSupport.DEFAULT_SIZE_X;
@@ -190,18 +249,18 @@ public class SupportUtil {
}
int x = x0+delta*col;
int y = y0+(ActorContainerRefSupport.MARGIN+ActorContainerRefSupport.DEFAULT_SIZE_Y)*row;
- SupportUtil.addRefItem(ar, acShape, x+StructureClassSupport.MARGIN, y+StructureClassSupport.MARGIN, fp, ifitem2anchor);
+ addRefItem(ar, acShape, x+StructureClassSupport.MARGIN, y+StructureClassSupport.MARGIN, fp, ifitem2anchor);
++i;
}
}
- public static String getName(BindingEndPoint ep) {
+ public String getName(BindingEndPoint ep) {
String ar = ep.getActorRef()==null? "":ep.getActorRef().getName();
String p = ep.getPort().getName();
return ar+SEP+p;
}
- public static String getName(SAPoint sapt) {
+ public String getName(SAPoint sapt) {
if (sapt instanceof RelaySAPoint) {
return SEP+((RelaySAPoint)sapt).getRelay().getName();
}
@@ -213,15 +272,15 @@ public class SupportUtil {
return null;
}
- public static String getName(SPPoint sppt) {
+ public String getName(SPPoint sppt) {
return sppt.getRef().getName()+SEP+sppt.getService().getName();
}
- public static List<InterfaceItem> getInterfaceItems(ContainerShape shape, IFeatureProvider fp) {
+ public List<InterfaceItem> getInterfaceItems(ContainerShape shape, IFeatureProvider fp) {
return getInterfaceItems(shape, fp, null);
}
- public static List<InterfaceItem> getInterfaceItems(ContainerShape shape, IFeatureProvider fp, Map<String, Anchor> ifitem2anchor) {
+ public List<InterfaceItem> getInterfaceItems(ContainerShape shape, IFeatureProvider fp, Map<String, Anchor> ifitem2anchor) {
List<InterfaceItem> items = new ArrayList<InterfaceItem>();
for (Shape ch : shape.getChildren()) {
Object bo = fp.getBusinessObjectForPictogramElement(ch);
@@ -234,11 +293,11 @@ public class SupportUtil {
return items;
}
- public static List<ActorContainerRef> getRefs(ContainerShape shape, IFeatureProvider fp) {
+ public List<ActorContainerRef> getRefs(ContainerShape shape, IFeatureProvider fp) {
return getRefs(shape, fp, null);
}
- public static List<ActorContainerRef> getRefs(ContainerShape shape, IFeatureProvider fp, Map<String, Anchor> ifitem2anchor) {
+ public List<ActorContainerRef> getRefs(ContainerShape shape, IFeatureProvider fp, Map<String, Anchor> ifitem2anchor) {
List<ActorContainerRef> refs = new ArrayList<ActorContainerRef>();
for (Shape ch : shape.getChildren()) {
Object bo = fp.getBusinessObjectForPictogramElement(ch);
@@ -251,7 +310,7 @@ public class SupportUtil {
return refs;
}
- public static List<Binding> getBindings(Diagram diag, IFeatureProvider fp) {
+ public List<Binding> getBindings(Diagram diag, IFeatureProvider fp) {
List<Binding> bindings = new ArrayList<Binding>();
for (Connection conn : diag.getConnections()) {
@@ -262,7 +321,7 @@ public class SupportUtil {
return bindings;
}
- public static List<LayerConnection> getConnections(Diagram diag, IFeatureProvider fp) {
+ public List<LayerConnection> getConnections(Diagram diag, IFeatureProvider fp) {
List<LayerConnection> bindings = new ArrayList<LayerConnection>();
for (Connection conn : diag.getConnections()) {
@@ -273,12 +332,12 @@ public class SupportUtil {
return bindings;
}
- public static StructureClass getParent(ICreateConnectionContext context, IFeatureProvider fp) {
+ public StructureClass getParent(ICreateConnectionContext context, IFeatureProvider fp) {
ContainerShape shape = (ContainerShape) context.getSourcePictogramElement().eContainer();
return getParent(shape, fp);
}
- public static StructureClass getParent(ContainerShape shape, IFeatureProvider fp) {
+ public StructureClass getParent(ContainerShape shape, IFeatureProvider fp) {
if(shape == null)
return null;
@@ -294,7 +353,7 @@ public class SupportUtil {
return null;
}
- public static Port getPort(Anchor anchor, IFeatureProvider fp) {
+ public Port getPort(Anchor anchor, IFeatureProvider fp) {
if (anchor != null) {
Object obj = fp.getBusinessObjectForPictogramElement(anchor.getParent());
if (obj instanceof Port) {
@@ -304,7 +363,7 @@ public class SupportUtil {
return null;
}
- public static SPP getSPP(Anchor anchor, IFeatureProvider fp) {
+ public SPP getSPP(Anchor anchor, IFeatureProvider fp) {
if (anchor != null) {
Object obj = fp.getBusinessObjectForPictogramElement(anchor.getParent());
if (obj instanceof SPP) {
@@ -314,7 +373,7 @@ public class SupportUtil {
return null;
}
- public static ActorContainerRef getRef(Anchor anchor, IFeatureProvider fp) {
+ public ActorContainerRef getRef(Anchor anchor, IFeatureProvider fp) {
if (anchor != null) {
ContainerShape shape = (ContainerShape) anchor.getParent().eContainer();
Object bo = fp.getBusinessObjectForPictogramElement(shape);
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/provider/DefaultPositionProvider.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/provider/DefaultPositionProvider.java
index 1b5eb2696..c7c51b5cc 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/provider/DefaultPositionProvider.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/provider/DefaultPositionProvider.java
@@ -29,12 +29,12 @@ import org.eclipse.etrice.core.room.Port;
import org.eclipse.etrice.core.room.RoomClass;
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.support.ActorContainerRefSupport;
import org.eclipse.etrice.ui.structure.support.DiagramUtil;
import org.eclipse.etrice.ui.structure.support.InterfaceItemSupport;
import org.eclipse.etrice.ui.structure.support.StructureClassSupport;
+import org.eclipse.etrice.ui.structure.support.SupportUtil;
import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
import org.eclipse.graphiti.mm.pictograms.ContainerShape;
import org.eclipse.graphiti.mm.pictograms.Diagram;
@@ -106,7 +106,7 @@ public class DefaultPositionProvider implements IPositionProvider {
refs.add((ActorContainerRef) obj);
else if(obj instanceof InterfaceItem){
InterfaceItem item = (InterfaceItem)obj;
- if(item instanceof Port && RoomHelpers.isInternal((Port)item))
+ if(item instanceof Port && SupportUtil.getInstance().getRoomHelpers().isInternal((Port)item))
intPorts.add(item);
else
ifItems.add(item);
@@ -129,7 +129,7 @@ public class DefaultPositionProvider implements IPositionProvider {
int height = StructureClassSupport.DEFAULT_SIZE_Y;
int y = - InterfaceItemSupport.MARGIN + 2*ActorContainerRefSupport.MARGIN;
- layoutInterfaceItems(RoomHelpers.getInterfaceItems(sc, true), width, height, -InterfaceItemSupport.MARGIN);
+ layoutInterfaceItems(SupportUtil.getInstance().getRoomHelpers().getInterfaceItems(sc, true), width, height, -InterfaceItemSupport.MARGIN);
List<InterfaceItem> intPorts = new ArrayList<InterfaceItem>();
if(sc instanceof ActorClass){
@@ -142,7 +142,7 @@ public class DefaultPositionProvider implements IPositionProvider {
layoutInterfaceItems(intPorts, width, height, y);
y += InterfaceItemSupport.ITEM_SIZE + 2*ActorContainerRefSupport.MARGIN;
- layoutActorRefs(RoomHelpers.getAllActorContainerRefs(sc), width, height, y);
+ layoutActorRefs(SupportUtil.getInstance().getRoomHelpers().getAllActorContainerRefs(sc), width, height, y);
}
diff --git a/runtime/org.eclipse.etrice.modellib.java/.classpath b/runtime/org.eclipse.etrice.modellib.java/.classpath
index 318d1f41e..2b29ce094 100644
--- a/runtime/org.eclipse.etrice.modellib.java/.classpath
+++ b/runtime/org.eclipse.etrice.modellib.java/.classpath
@@ -23,11 +23,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
diff --git a/tests/org.eclipse.etrice.abstractexec.behavior.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.etrice.abstractexec.behavior.tests/META-INF/MANIFEST.MF
index f8ccdf873..f6a4be6e7 100644
--- a/tests/org.eclipse.etrice.abstractexec.behavior.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.etrice.abstractexec.behavior.tests/META-INF/MANIFEST.MF
@@ -5,7 +5,8 @@ Bundle-SymbolicName: org.eclipse.etrice.abstractexec.behavior.tests
Bundle-Version: 0.2.0.qualifier
Bundle-Activator: org.eclipse.etrice.abstractexec.behavior.tests.Activator
Bundle-Vendor: Eclipse eTrice (Incubation)
-Require-Bundle: org.eclipse.core.runtime,
+Require-Bundle: org.eclipse.etrice.abstractexec.behavior;bundle-version="0.5.0",
+ org.eclipse.core.runtime,
org.eclipse.emf.ecore;bundle-version="2.7.0",
org.eclipse.etrice.core.room.ui;bundle-version="0.2.0",
com.google.inject;bundle-version="2.0.0",
diff --git a/tests/org.eclipse.etrice.abstractexec.behavior.tests/src/org/eclipse/etrice/abstractexec/behavior/tests/TestSemantics.java b/tests/org.eclipse.etrice.abstractexec.behavior.tests/src/org/eclipse/etrice/abstractexec/behavior/tests/TestSemantics.java
index 0b5c58060..cc2040306 100644
--- a/tests/org.eclipse.etrice.abstractexec.behavior.tests/src/org/eclipse/etrice/abstractexec/behavior/tests/TestSemantics.java
+++ b/tests/org.eclipse.etrice.abstractexec.behavior.tests/src/org/eclipse/etrice/abstractexec/behavior/tests/TestSemantics.java
@@ -19,7 +19,7 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.etrice.abstractexec.behavior.AbstractExecutionValidator;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
+import org.eclipse.etrice.abstractexec.behavior.util.AbstractExecutionUtil;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.StateGraph;
@@ -111,7 +111,7 @@ public class TestSemantics {
Object source = list.get(d.getIndex());
if (source instanceof StateGraphItem) {
StateGraphItem sgi = (StateGraphItem) source;
- checkItem(sgi.getName(), RoomNameProvider.getName(sgi), marker);
+ checkItem(sgi.getName(), AbstractExecutionUtil.getInstance().getRoomNameProvider().getName(sgi), marker);
items.remove(source);
}
}
@@ -119,7 +119,7 @@ public class TestSemantics {
if (container.eContainer() instanceof Transition) {
Transition transition = (Transition) container.eContainer();
checkItem(transition.getName(),
- RoomNameProvider.getName(transition),
+ AbstractExecutionUtil.getInstance().getRoomNameProvider().getName(transition),
marker);
items.remove(container.eContainer());
} else
@@ -127,13 +127,13 @@ public class TestSemantics {
} else if (container instanceof Transition) {
Transition transition = (Transition) container;
checkItem(transition.getName(),
- RoomNameProvider.getName(transition),
+ AbstractExecutionUtil.getInstance().getRoomNameProvider().getName(transition),
marker);
items.remove(container);
} else if (container instanceof State) {
State state = (State) container;
checkItem(state.getName(),
- RoomNameProvider.getName(state),
+ AbstractExecutionUtil.getInstance().getRoomNameProvider().getName(state),
marker);
items.remove(container);
} else
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestCodeInheritance.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestCodeInheritance.java
index 14ab0a1b8..6fa0d8345 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestCodeInheritance.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestCodeInheritance.java
@@ -42,7 +42,8 @@ public class TestCodeInheritance extends TestInstanceModelBuilderBase {
private HashMap<EClass, ArrayList<EObject>> derivedInstances;
private ExpandedActorClass base;
private ExpandedActorClass derived;
-
+ private RoomHelpers roomHelpers = new RoomHelpers();
+
@Before
public void setUp() {
prepare();
@@ -99,26 +100,26 @@ public class TestCodeInheritance extends TestInstanceModelBuilderBase {
State s = getState(derived, "BaseEntryExit");
assertTrue("is ExpandedRefinedState", s instanceof ExpandedRefinedState);
ExpandedRefinedState rs = (ExpandedRefinedState) s;
- assertEquals("entry code", "// derived entry\n", RoomHelpers.getDetailCode(rs.getEntryCode()));
+ assertEquals("entry code", "// derived entry\n", roomHelpers.getDetailCode(rs.getEntryCode()));
assertNull("exit code", rs.getExitCode());
- assertEquals("inherited entry", "// base entry\n", RoomHelpers.getDetailCode(rs.getInheritedEntry()));
- assertEquals("inherited exit", "// base exit\n", RoomHelpers.getDetailCode(rs.getInheritedExit()));
+ assertEquals("inherited entry", "// base entry\n", roomHelpers.getDetailCode(rs.getInheritedEntry()));
+ assertEquals("inherited exit", "// base exit\n", roomHelpers.getDetailCode(rs.getInheritedExit()));
s = getState(derived, "Base");
assertTrue("is ExpandedRefinedState", s instanceof ExpandedRefinedState);
rs = (ExpandedRefinedState) s;
assertNull("entry code", rs.getEntryCode());
- assertEquals("exit code", "// derived exit\n", RoomHelpers.getDetailCode(rs.getExitCode()));
- assertEquals("inherited entry", "", RoomHelpers.getDetailCode(rs.getInheritedEntry()));
- assertEquals("inherited exit", "", RoomHelpers.getDetailCode(rs.getInheritedExit()));
+ assertEquals("exit code", "// derived exit\n", roomHelpers.getDetailCode(rs.getExitCode()));
+ assertEquals("inherited entry", "", roomHelpers.getDetailCode(rs.getInheritedEntry()));
+ assertEquals("inherited exit", "", roomHelpers.getDetailCode(rs.getInheritedExit()));
s = getState(derived, "BaseSub");
assertTrue("is ExpandedRefinedState", s instanceof ExpandedRefinedState);
rs = (ExpandedRefinedState) s;
- assertEquals("entry code", "// derived entry\n", RoomHelpers.getDetailCode(rs.getEntryCode()));
+ assertEquals("entry code", "// derived entry\n", roomHelpers.getDetailCode(rs.getEntryCode()));
assertNull("exit code", rs.getExitCode());
- assertEquals("inherited entry", "", RoomHelpers.getDetailCode(rs.getInheritedEntry()));
- assertEquals("inherited exit", "", RoomHelpers.getDetailCode(rs.getInheritedExit()));
+ assertEquals("inherited entry", "", roomHelpers.getDetailCode(rs.getInheritedEntry()));
+ assertEquals("inherited exit", "", roomHelpers.getDetailCode(rs.getInheritedExit()));
}
}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestInstanceModelBuilderBase.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestInstanceModelBuilderBase.java
index 5bbbb0240..4240717b1 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestInstanceModelBuilderBase.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestInstanceModelBuilderBase.java
@@ -66,12 +66,12 @@ public class TestInstanceModelBuilderBase {
@Override
public void error(String msg, EObject source, EStructuralFeature feature) {
- fail(msg+RoomNameProvider.getLocation(source));
+ fail(msg+roomNameProvider.getLocation(source));
}
@Override
public void error(String msg, EObject source, EStructuralFeature feature, int index) {
- fail(msg+RoomNameProvider.getLocation(source));
+ fail(msg+roomNameProvider.getLocation(source));
}
@Override
@@ -83,7 +83,8 @@ public class TestInstanceModelBuilderBase {
private String basePath;
protected HashMap<EClass, ArrayList<EObject>> instances;
-
+ private RoomNameProvider roomNameProvider = new RoomNameProvider();
+
protected void prepare() {
try {
URL modelsDir = GenmodelTestsActivator.getInstance().getBundle().getEntry("models");
@@ -150,7 +151,7 @@ public class TestInstanceModelBuilderBase {
for (EObject obj : objects) {
if (obj instanceof StateGraphItem) {
StateGraphItem item = (StateGraphItem) obj;
- if (RoomNameProvider.getFullPath(item).equals(path))
+ if (roomNameProvider.getFullPath(item).equals(path))
return item;
}
}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestMultipleConnectedChoicepoint.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestMultipleConnectedChoicepoint.java
index 2695bfaf8..403cdb277 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestMultipleConnectedChoicepoint.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestMultipleConnectedChoicepoint.java
@@ -45,7 +45,8 @@ public class TestMultipleConnectedChoicepoint extends
private Root root;
private ExpandedActorClass xpac;
-
+ private RoomNameProvider roomNameProvider = new RoomNameProvider();
+
@Before
public void setUp() {
prepare();
@@ -107,7 +108,7 @@ public class TestMultipleConnectedChoicepoint extends
public void testGraph() {
ArrayList<EObject> cps = instances.get(RoomPackage.eINSTANCE.getChoicePoint());
ChoicePoint cp = (ChoicePoint) cps.get(0);
- assertEquals("choicepoint name", "cp0", RoomNameProvider.getFullPath(cp));
+ assertEquals("choicepoint name", "cp0", roomNameProvider.getFullPath(cp));
assertEquals("number of incoming transitions", 2, xpac.getIncomingTransitions(cp).size());
assertEquals("number of outgoing transitions", 2, xpac.getOutgoingTransitions(cp).size());
}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStates.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStates.java
index 0930e86b6..af9d06580 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStates.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStates.java
@@ -33,6 +33,7 @@ import org.eclipse.etrice.core.room.Transition;
public class TestStates extends TestInstanceModelBuilderBase {
private Root root;
+ private RoomNameProvider roomNameProvider = new RoomNameProvider();
@Before
public void setUp() {
@@ -90,7 +91,7 @@ public class TestStates extends TestInstanceModelBuilderBase {
ArrayList<EObject> cps = instances.get(RoomPackage.eINSTANCE.getChoicePoint());
ChoicePoint cp = (ChoicePoint) cps.get(0);
- assertEquals("choicepoint name", "CP1", RoomNameProvider.getFullPath(cp));
+ assertEquals("choicepoint name", "CP1", roomNameProvider.getFullPath(cp));
assertEquals("number of incoming transitions", 1, xpac.getIncomingTransitions(cp).size());
assertEquals("number of outgoing transitions", 3, xpac.getOutgoingTransitions(cp).size());
@@ -111,6 +112,6 @@ public class TestStates extends TestInstanceModelBuilderBase {
ExpandedActorClass xpac = root.getXpActorClasses().get(0);
TransitionChain chain = xpac.getChain(t);
assertNotNull("chain", chain);
- assertEquals("chain name", "TRANS_tr5_FROM_tp0_TO_State3_tp1_BY_afct", RoomNameProvider.getFullPath(chain.getTransition()));
+ assertEquals("chain name", "TRANS_tr5_FROM_tp0_TO_State3_tp1_BY_afct", roomNameProvider.getFullPath(chain.getTransition()));
}
}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesAndTriggers.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesAndTriggers.java
index b2ed50684..ef0914522 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesAndTriggers.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesAndTriggers.java
@@ -35,6 +35,7 @@ public class TestStatesAndTriggers extends TestInstanceModelBuilderBase {
private Root root;
private ExpandedActorClass xpac;
+ private RoomNameProvider roomNameProvider = new RoomNameProvider();
@Before
public void setUp() {
@@ -97,7 +98,7 @@ public class TestStatesAndTriggers extends TestInstanceModelBuilderBase {
ArrayList<EObject> cps = instances.get(RoomPackage.eINSTANCE.getChoicePoint());
ChoicePoint cp = (ChoicePoint) cps.get(0);
- assertEquals("choicepoint name", "CP1", RoomNameProvider.getFullPath(cp));
+ assertEquals("choicepoint name", "CP1", roomNameProvider.getFullPath(cp));
assertEquals("number of incoming transitions", 1, xpac.getIncomingTransitions(cp).size());
assertEquals("number of outgoing transitions", 3, xpac.getOutgoingTransitions(cp).size());
@@ -117,7 +118,7 @@ public class TestStatesAndTriggers extends TestInstanceModelBuilderBase {
TransitionChain chain = xpac.getChain(t);
assertNotNull("chain", chain);
- assertEquals("chain name", "TRANS_tr5_FROM_tp0_TO_State3_tp1_BY_afct", RoomNameProvider.getFullPath(chain.getTransition()));
+ assertEquals("chain name", "TRANS_tr5_FROM_tp0_TO_State3_tp1_BY_afct", roomNameProvider.getFullPath(chain.getTransition()));
}
@Test
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesInheritance.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesInheritance.java
index e1d2a004c..d9fe5fca0 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesInheritance.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesInheritance.java
@@ -34,7 +34,8 @@ public class TestStatesInheritance extends TestInstanceModelBuilderBase {
private Root root;
private ExpandedActorClass xpac;
-
+ private RoomNameProvider roomNameProvider = new RoomNameProvider();
+
@Before
public void setUp() {
prepare();
@@ -108,7 +109,7 @@ public class TestStatesInheritance extends TestInstanceModelBuilderBase {
ArrayList<EObject> cps = instances.get(RoomPackage.eINSTANCE.getChoicePoint());
ChoicePoint cp = (ChoicePoint) cps.get(0);
- assertEquals("choicepoint name", "CP1", RoomNameProvider.getFullPath(cp));
+ assertEquals("choicepoint name", "CP1", roomNameProvider.getFullPath(cp));
assertEquals("number of incoming transitions", 1, xpac.getIncomingTransitions(cp).size());
assertEquals("number of outgoing transitions", 4, xpac.getOutgoingTransitions(cp).size());
@@ -128,13 +129,13 @@ public class TestStatesInheritance extends TestInstanceModelBuilderBase {
TransitionChain chain = xpac.getChain(t);
assertNotNull("chain", chain);
- assertEquals("chain name", "TRANS_tr5_FROM_tp0_TO_State3_tp1_BY_afct", RoomNameProvider.getFullPath(chain.getTransition()));
+ assertEquals("chain name", "TRANS_tr5_FROM_tp0_TO_State3_tp1_BY_afct", roomNameProvider.getFullPath(chain.getTransition()));
t = (Transition) getStateGraphItem(cts, "State3_TRANS_tr8_FROM_tp6_TO_State2");
assertNotNull("transition", t);
chain = xpac.getChain(t);
assertNotNull("chain", chain);
- assertEquals("chain name", "TRANS_tr12_FROM_State5_TO_State3_tp6_BY_aport", RoomNameProvider.getFullPath(chain.getTransition()));
+ assertEquals("chain name", "TRANS_tr12_FROM_State5_TO_State3_tp6_BY_aport", roomNameProvider.getFullPath(chain.getTransition()));
}
}
diff --git a/tests/org.eclipse.etrice.generator.java.tests/make.xml b/tests/org.eclipse.etrice.generator.java.tests/make.xml
index 983376fcf..e0c33b0e3 100644
--- a/tests/org.eclipse.etrice.generator.java.tests/make.xml
+++ b/tests/org.eclipse.etrice.generator.java.tests/make.xml
@@ -92,17 +92,17 @@
<pathelement location="../../plugins/org.eclipse.etrice.core.config/bin" />
<pathelement location="../../plugins/org.eclipse.etrice.core.genmodel/bin" />
<fileset dir="${target.platform}/plugins/">
- <include name="org.eclipse.emf.ecore_2.9*.jar" />
- <include name="org.eclipse.emf.common_2.9*.jar" />
- <include name="org.eclipse.emf.ecore.xmi_2.9*.jar" />
- <include name="org.eclipse.xtext_2.4*.jar" />
+ <include name="org.eclipse.emf.ecore_2.10*.jar" />
+ <include name="org.eclipse.emf.common_2.10*.jar" />
+ <include name="org.eclipse.emf.ecore.xmi_2.10*.jar" />
<include name="com.google.inject_*.jar" />
<include name="com.google.guava_1*.jar" />
<include name="org.eclipse.equinox.common_3.6.*.jar" />
- <include name="org.eclipse.xtext.util_2.4*.jar" />
- <include name="org.eclipse.xtext.common.types_2.4*.jar" />
- <include name="org.eclipse.xtend.lib_2.4*.jar" />
- <include name="org.eclipse.xtext.xbase.lib_2.4*.jar" />
+ <include name="org.eclipse.xtext_2.6*.jar" />
+ <include name="org.eclipse.xtext.util_2.6*.jar" />
+ <include name="org.eclipse.xtext.common.types_2.6*.jar" />
+ <include name="org.eclipse.xtend.lib_2.6*.jar" />
+ <include name="org.eclipse.xtext.xbase.lib_2.6*.jar" />
<include name="org.apache.log4j_1.2*.jar" />
<include name="org.antlr.runtime_3.2*.jar" />
<include name="javax.inject_1.0*.jar" />
@@ -271,9 +271,9 @@
<pathelement location="../../plugins/org.eclipse.etrice.etunit.converter/bin" />
<fileset dir="${target.platform}/plugins/">
<include name="org.eclipse.core.runtime_3.9*.jar" />
- <include name="org.eclipse.emf.ecore_2.9*.jar" />
- <include name="org.eclipse.emf.ecore.xmi_2.9*.jar" />
- <include name="org.eclipse.emf.common_2.9*.jar" />
+ <include name="org.eclipse.emf.ecore_2.10*.jar" />
+ <include name="org.eclipse.emf.ecore.xmi_2.10*.jar" />
+ <include name="org.eclipse.emf.common_2.10*.jar" />
</fileset>
</path>
diff --git a/tests/org.eclipse.etrice.generator.tests/src/org/eclipse/etrice/generator/base/TestDetailCodeTranslator.java b/tests/org.eclipse.etrice.generator.tests/src/org/eclipse/etrice/generator/base/TestDetailCodeTranslator.java
index de185a494..5a2f9fd4b 100644
--- a/tests/org.eclipse.etrice.generator.tests/src/org/eclipse/etrice/generator/base/TestDetailCodeTranslator.java
+++ b/tests/org.eclipse.etrice.generator.tests/src/org/eclipse/etrice/generator/base/TestDetailCodeTranslator.java
@@ -54,6 +54,7 @@ import org.junit.Test;
*/
public class TestDetailCodeTranslator {
+ private RoomHelpers roomHelpers = new RoomHelpers();
/**
* @author Henrik Rentz-Reichert
@@ -523,7 +524,7 @@ public class TestDetailCodeTranslator {
DetailCode dc = getLargeFile();
// this adds a trailing \n
- String orig = RoomHelpers.getDetailCode(dc);
+ String orig = roomHelpers.getDetailCode(dc);
// remove trailing \n
orig = orig.substring(0, orig.length()-1);

Back to the top