Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2014-03-13 14:40:00 +0000
committerAnsgar Radermacher2014-03-13 14:41:41 +0000
commitee83380462941881a5d2b4fcc1c82155e2c1c446 (patch)
tree44801150aaeb51fd297ce91fb4e6c20bcd00728d /plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext
parent1a08f4c9af22318f711e5b9e8121f1d9bdd978b8 (diff)
downloadorg.eclipse.papyrus-ee83380462941881a5d2b4fcc1c82155e2c1c446.tar.gz
org.eclipse.papyrus-ee83380462941881a5d2b4fcc1c82155e2c1c446.tar.xz
org.eclipse.papyrus-ee83380462941881a5d2b4fcc1c82155e2c1c446.zip
Bug 427025 - [OCL For Papyrus] Cannot create OCL constraints in Luna: handle editing of newly created opaque expressions
Diffstat (limited to 'plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext')
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/XtextLanguageEditor.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/XtextLanguageEditor.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/XtextLanguageEditor.java
index b6e8e0bb746..2251a534bf3 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/XtextLanguageEditor.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/XtextLanguageEditor.java
@@ -1,6 +1,8 @@
package org.eclipse.papyrus.uml.properties.xtext;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
@@ -11,6 +13,7 @@ import org.eclipse.papyrus.extensionpoints.editors.Activator;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.emf.dialog.NestedEditingDialogContext;
import org.eclipse.papyrus.uml.properties.modelelement.UMLModelElement;
import org.eclipse.papyrus.uml.properties.widgets.BodyEditor;
import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
@@ -74,8 +77,16 @@ public class XtextLanguageEditor implements BodyEditor, IContextElementProvider
new EObjectAdapter(getEObject()),
textControl.getText(), 0);
- TransactionUtil.getEditingDomain(getEObject()).getCommandStack().execute(
- new GMFtoEMFCommandWrapper(command));
+ TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(getEObject());
+ if (domain == null) {
+ // can be null for opaque expression that have been created but have not been added to parent
+ // try to get resource set from nested dialog context
+ ResourceSet rs = NestedEditingDialogContext.getInstance().getResourceSet();
+ domain = TransactionUtil.getEditingDomain(rs);
+ }
+ if (domain != null) {
+ domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(command));
+ }
}
}
@@ -229,7 +240,9 @@ public class XtextLanguageEditor implements BodyEditor, IContextElementProvider
}
public void setInput(String value) {
- textControl.setText(value);
+ if (value != null) {
+ textControl.setText(value);
+ }
}
public void dispose() {

Back to the top