Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2014-08-06 12:56:38 +0000
committerHenrik Rentz-Reichert2014-08-06 12:56:38 +0000
commitcc931d088f87d69a2deeb145d541f83aae8bab50 (patch)
tree332ee8870baa362e5ca4340ceb89a9ac97be65cb /plugins/org.eclipse.etrice.ui.commands
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
Diffstat (limited to 'plugins/org.eclipse.etrice.ui.commands')
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditBehaviorHandler.java16
1 files changed, 11 insertions, 5 deletions
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);
}
}

Back to the top