Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-01-29 09:40:58 +0000
committerCamille Letavernier2014-01-29 09:40:58 +0000
commit0a212d783392f8fc257007e1e4a0adb1e7565f02 (patch)
treee7c600b66dd32972e2d2d10a8cf5e9791ed820ee /plugins/uml
parentdf428e98516823a891a9bc3c4fb47875da83c9c1 (diff)
downloadorg.eclipse.papyrus-0a212d783392f8fc257007e1e4a0adb1e7565f02.tar.gz
org.eclipse.papyrus-0a212d783392f8fc257007e1e4a0adb1e7565f02.tar.xz
org.eclipse.papyrus-0a212d783392f8fc257007e1e4a0adb1e7565f02.zip
426649: Exception setting Stereotype icons
https://bugs.eclipse.org/bugs/show_bug.cgi?id=426649 Workaround, until the following bug is fixed: 402525: [Widgets / Transactions] Papyrus dialogs should be transactional https://bugs.eclipse.org/bugs/show_bug.cgi?id=402525
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeImageEditor.java52
1 files changed, 29 insertions, 23 deletions
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeImageEditor.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeImageEditor.java
index 5f5c0b99ddd..744003a661c 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeImageEditor.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeImageEditor.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* 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
@@ -45,15 +45,15 @@ import org.eclipse.uml2.uml.Image;
/**
* A widget to edit a stereotype image. The image is serialized in order to be
* embedded in the UML xmi model.
- *
+ *
* An expression can be attached to each image, which will be interpreted at runtime
* to determine which image should be displayed.
- *
+ *
* Based on the org.eclipse.papyrus.views.properties.tabbed.profile.imagesection package
* in the org.eclipse.papyrus.views.properties.tabbed.profile plug-in
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public class StereotypeImageEditor extends AbstractPropertyEditor implements SelectionListener {
@@ -138,28 +138,34 @@ public class StereotypeImageEditor extends AbstractPropertyEditor implements Sel
TransactionalEditingDomain domain;
try {
domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(image);
+
+ AbstractTransactionalCommand operation = new AbstractTransactionalCommand(domain, "Set Image content", null) {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ try {
+ ImageUtil.setContent((Image)getElement(), imgFile);
+ ((Image)getElement()).setFormat(PAPYRUS_FORMAT);
+ } catch (Exception ex) {
+ return CommandResult.newErrorCommandResult(ex);
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(operation));
} catch (ServiceException ex) {
Activator.log.error(ex);
- return;
- }
- AbstractTransactionalCommand operation = new AbstractTransactionalCommand(domain, "Set Image content", null) {
+ //FIXME: Workaround for Bug 402525. The icon is not yet attached to the editing domain. Modify it directly.
+ ImageUtil.setContent((Image)getElement(), imgFile);
+ ((Image)getElement()).setFormat(PAPYRUS_FORMAT);
+ //////
- /**
- * {@inheritDoc}
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- try {
- ImageUtil.setContent((Image)getElement(), imgFile);
- ((Image)getElement()).setFormat(PAPYRUS_FORMAT);
- } catch (Exception ex) {
- return CommandResult.newErrorCommandResult(ex);
- }
- return CommandResult.newOKCommandResult();
- }
- };
- domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(operation));
+ //return;
+ }
refresh();
}

Back to the top