summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-02-16 05:28:07 (EST)
committer Stephan Born2012-04-24 10:12:54 (EDT)
commit7b32040b6bbd626a6a36890bcc7fa43c0bd23a50 (patch)
tree6b1f5b96fcaadeedaa996aa331c327ff6709386f
parent1d395103b66f84686d020f1783ae33ba36e84c40 (diff)
downloadorg.eclipse.stardust.ide-7b32040b6bbd626a6a36890bcc7fa43c0bd23a50.zip
org.eclipse.stardust.ide-7b32040b6bbd626a6a36890bcc7fa43c0bd23a50.tar.gz
org.eclipse.stardust.ide-7b32040b6bbd626a6a36890bcc7fa43c0bd23a50.tar.bz2
Jira-ID: CRNT-23668
Rename from outline for a model causes NPE git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ide@53815 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--model/org.eclipse.stardust.model.xpdl/src/org/eclipse/stardust/model/xpdl/carnot/util/VariableContextHelper.java22
-rw-r--r--modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/editors/parts/diagram/commands/SetValueCmd.java15
2 files changed, 36 insertions, 1 deletions
diff --git a/model/org.eclipse.stardust.model.xpdl/src/org/eclipse/stardust/model/xpdl/carnot/util/VariableContextHelper.java b/model/org.eclipse.stardust.model.xpdl/src/org/eclipse/stardust/model/xpdl/carnot/util/VariableContextHelper.java
index e4b4cae..ab45818 100644
--- a/model/org.eclipse.stardust.model.xpdl/src/org/eclipse/stardust/model/xpdl/carnot/util/VariableContextHelper.java
+++ b/model/org.eclipse.stardust.model.xpdl/src/org/eclipse/stardust/model/xpdl/carnot/util/VariableContextHelper.java
@@ -63,7 +63,7 @@ public class VariableContextHelper
ModelType modelType = ModelUtils.findContainingModel(element);
if (modelType != null)
{
- VariableContext context = contextMap.get(modelType);
+ VariableContext context = contextMap.get(modelType.getId());
// If this is a referenced model a corresponding context does not exist -->
// create on the fly
if (context == null)
@@ -75,4 +75,24 @@ public class VariableContextHelper
return null;
}
+ public synchronized void updateContextID(ModelType modelType, String newID)
+ {
+ if (contextMap.get(modelType.getId()) != null)
+ {
+ VariableContext context = contextMap.remove(modelType.getId());
+ contextMap.put(newID, context);
+ }
+ }
+
+ public synchronized void storeVariables(ModelType workflowModel, boolean save)
+ {
+ createContext(workflowModel);
+ getContext(workflowModel).initializeVariables(workflowModel);
+ getContext(workflowModel).refreshVariables(workflowModel);
+ if (save)
+ {
+ getContext(workflowModel).saveVariables();
+ }
+ }
+
}
diff --git a/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/editors/parts/diagram/commands/SetValueCmd.java b/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/editors/parts/diagram/commands/SetValueCmd.java
index e11074c..992862d 100644
--- a/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/editors/parts/diagram/commands/SetValueCmd.java
+++ b/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/editors/parts/diagram/commands/SetValueCmd.java
@@ -14,6 +14,8 @@ import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.stardust.model.xpdl.carnot.ModelType;
+import org.eclipse.stardust.model.xpdl.carnot.util.VariableContextHelper;
public class SetValueCmd extends ContainedElementCommand
{
@@ -78,7 +80,14 @@ public class SetValueCmd extends ContainedElementCommand
{
wasSet = parent.eIsSet(feature);
undoValue = parent.eGet(feature);
+ if (parent instanceof ModelType)
+ {
+ ModelType modelType = (ModelType) parent;
+ VariableContextHelper.getInstance().updateContextID(modelType,
+ getValue().toString());
+ }
parent.eSet(feature, getValue());
+
}
}
}
@@ -97,6 +106,12 @@ public class SetValueCmd extends ContainedElementCommand
{
if (wasSet)
{
+ if (parent instanceof ModelType)
+ {
+ ModelType modelType = (ModelType) parent;
+ VariableContextHelper.getInstance().updateContextID(modelType,
+ undoValue.toString());
+ }
parent.eSet(feature, undoValue);
}
else