Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2012-11-23 10:52:23 +0000
committercletavernie2012-11-23 10:52:23 +0000
commit6424abf6e7e922c90a56eec84fd3f9b2de9dfae5 (patch)
tree8d3239a03710422cba8493b4dbe9ee2bb9aeda71 /plugins/uml/properties
parentc7ed19562dfcf443385c0213765c98ffc841409f (diff)
downloadorg.eclipse.papyrus-6424abf6e7e922c90a56eec84fd3f9b2de9dfae5.tar.gz
org.eclipse.papyrus-6424abf6e7e922c90a56eec84fd3f9b2de9dfae5.tar.xz
org.eclipse.papyrus-6424abf6e7e922c90a56eec84fd3f9b2de9dfae5.zip
391945: [Refactoring] Part 2: Refactoring on Kepler (0.10)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=391945
Diffstat (limited to 'plugins/uml/properties')
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java3
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java34
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java13
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java8
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypeCompositeWithView.java23
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypePropertyCompositeWithView.java33
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java31
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java34
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java73
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedProfileSection.java9
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypeKindAppearanceSection.java15
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypePropertiesPlaceSection.java18
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeImageEditor.java27
14 files changed, 201 insertions, 123 deletions
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF
index b4e8e1e9427..0816cfb5ce8 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF
@@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.extensionpoints.editors;bundle-version="0.10.0",
org.eclipse.gef;bundle-version="3.7.1",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.uml.properties.tabbedproperties.comments,
org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection
Bundle-Vendor: %providerName
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java
index ba1fc31c8db..c7248c68e8e 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java
@@ -103,6 +103,7 @@ public class HTMLCommentEditorDialogConfiguration extends DefaultDirectEditorCon
/**
* @{inheritDoc
*/
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
// create OK and Cancel buttons by default
// remove the OK button as default button, so Carriage Return key pressed does not close the dialog
@@ -123,7 +124,7 @@ public class HTMLCommentEditorDialogConfiguration extends DefaultDirectEditorCon
/**
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*
- *@param parent
+ * @param parent
* the parent composite to contain the dialog area
* @return the dialog area control
*/
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java
index 3ddfaae6cb3..cfa166b103c 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java
@@ -63,7 +63,9 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.diagram.common.commands.CommonDeferredCreateConnectionViewCommand;
import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter;
import org.eclipse.papyrus.uml.diagram.common.parser.HTMLCleaner;
@@ -185,7 +187,7 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
// creates the rich text editor content
richText = CommentRichTextFormToolkit.createFocusAwareRichTextEditor(getWidgetFactory(), mainComposite, "", comment, //$NON-NLS-1$
- SWT.NONE, EditorUtils.getMultiDiagramEditor().getEditorSite());
+ SWT.NONE, EditorUtils.getMultiDiagramEditor().getEditorSite());
data = new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1);
data.heightHint = 240;
richText.setLayoutData(data);
@@ -350,7 +352,7 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
// this is the real element, not a ghost one. display it in the list
if(!isProxy) {
- if(comment.getAnnotatedElements().contains((Element)inputElement)) {
+ if(comment.getAnnotatedElements().contains(inputElement)) {
annotatedElements.add(comment);
}
}
@@ -394,6 +396,7 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
/**
* {@inheritDoc}
*/
+ @Override
public String getText(Object element) {
if(element instanceof Comment) {
String body = ((Comment)element).getBody();
@@ -476,7 +479,14 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
final Element element = getElement();
// add a comment to this element
- TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(element);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+
// open transaction to save the comment body
// retrieve editing domain
if(domain != null) {
@@ -542,7 +552,13 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
}
// add a comment to this element
- TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(element);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
// open transaction to save the comment body
// retrieve editing domain
if(domain != null) {
@@ -680,7 +696,15 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
IAdaptable sourceAdapter = (IAdaptable)((List)request.getNewObject()).get(0);
IAdaptable targetAdapter = new SemanticAdapter(null, selectionEditPart.getModel());
- CreateCommentLinkTransactionnalCommand linkVisualIDCommand = new CreateCommentLinkTransactionnalCommand(EditorUtils.getTransactionalEditingDomain(), selectionEditPart.getViewer(), sourceAdapter, targetAdapter);
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(element);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+
+ CreateCommentLinkTransactionnalCommand linkVisualIDCommand = new CreateCommentLinkTransactionnalCommand(domain, selectionEditPart.getViewer(), sourceAdapter, targetAdapter);
CompositeCommand compoundCommand = new CompositeCommand("Display Comment with link");
compoundCommand.compose(new CommandProxy(createCommand));
compoundCommand.compose(linkVisualIDCommand);
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java
index 21ec160cd60..2f2cc57e139 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java
@@ -13,7 +13,8 @@ package org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysec
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.properties.tabbedproperties.comments.Activator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
@@ -40,6 +41,7 @@ public class FocusAwareCommentRichText extends CommentRichText {
/**
* Adds listeners to manage the activation and focus events.
*/
+ @Override
protected void addListeners() {
editorControl = getControlSite(editor);
@@ -80,7 +82,14 @@ public class FocusAwareCommentRichText extends CommentRichText {
return;
}
- TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(getComment());
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+
// open transaction to save the comment body
// retrieve editing domain
if(domain != null) {
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java
index 0da4c022584..69012b17005 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java
@@ -22,6 +22,7 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.profile.Activator;
import org.eclipse.papyrus.uml.profile.ImageManager;
@@ -310,7 +311,12 @@ public class AppearanceForAppliedStereotypeComposite extends org.eclipse.papyrus
}
public TransactionalEditingDomain getDomain() {
- return EditorUtils.getTransactionalEditingDomain();
+ try {
+ return ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(element);
+ } catch (Exception ex){
+ Activator.log.error(ex);
+ return null;
+ }
}
/**
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypeCompositeWithView.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypeCompositeWithView.java
index 4b191db4943..f94c0271d15 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypeCompositeWithView.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypeCompositeWithView.java
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.uml.properties.profile.ui.compositeforview;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.resource.JFaceColors;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -117,6 +118,7 @@ public class AppliedStereotypeCompositeWithView extends org.eclipse.papyrus.uml.
* @return the selected
* @deprecated
*/
+ @Deprecated
@Override
public Element getSelected() {
return getElement();
@@ -144,8 +146,8 @@ public class AppliedStereotypeCompositeWithView extends org.eclipse.papyrus.uml.
return;
}
try {
-
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(elt);
+ domain.runExclusive(new Runnable() {
public void run() {
@@ -154,15 +156,15 @@ public class AppliedStereotypeCompositeWithView extends org.eclipse.papyrus.uml.
public void run() {
String presentationKind = AppliedStereotypeHelper.getAppliedStereotypePresentationKind(diagramElement);
- RecordingCommand command = AppliedStereotypeHelper.getAddAppliedStereotypeCommand(getDomain(), diagramElement, st.getQualifiedName(), presentationKind);
- getDomain().getCommandStack().execute(command);
+ RecordingCommand command = AppliedStereotypeHelper.getAddAppliedStereotypeCommand(domain, diagramElement, st.getQualifiedName(), presentationKind);
+ domain.getCommandStack().execute(command);
}
});
}
});
} catch (Exception e) {
- e.printStackTrace ();
+ e.printStackTrace();
}
}
@@ -180,8 +182,11 @@ public class AppliedStereotypeCompositeWithView extends org.eclipse.papyrus.uml.
if(diagramElement == null) {
return;
}
+
+ final TransactionalEditingDomain domain = getEditingDomain(elt);
+
try {
- getDomain().runExclusive(new Runnable() {
+ domain.runExclusive(new Runnable() {
public void run() {
@@ -189,15 +194,15 @@ public class AppliedStereotypeCompositeWithView extends org.eclipse.papyrus.uml.
public void run() {
String presentationKind = AppliedStereotypeHelper.getAppliedStereotypePresentationKind(diagramElement);
- RecordingCommand command = AppliedStereotypeHelper.getRemoveAppliedStereotypeCommand(getDomain(), diagramElement, st.getQualifiedName(), presentationKind);
+ RecordingCommand command = AppliedStereotypeHelper.getRemoveAppliedStereotypeCommand(domain, diagramElement, st.getQualifiedName(), presentationKind);
- getDomain().getCommandStack().execute(command);
+ domain.getCommandStack().execute(command);
}
});
}
});
} catch (Exception e) {
- e.printStackTrace ();
+ e.printStackTrace();
}
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypePropertyCompositeWithView.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypePropertyCompositeWithView.java
index d103b330db5..9ad99de8679 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypePropertyCompositeWithView.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypePropertyCompositeWithView.java
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.uml.properties.profile.ui.compositeforview;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.resource.JFaceColors;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.swt.SWT;
@@ -61,32 +62,33 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
protected void touchModel() {
// CommandSupport.exec ("update stereotype", /* command)
- if (currentView == null) {
+ if(currentView == null) {
return;
}
-
+
try {
- getDomain().runExclusive(new Runnable() {
-
+ final TransactionalEditingDomain domain = getEditingDomain(currentView);
+ domain.runExclusive(new Runnable() {
+
public void run() {
- Display.getCurrent().asyncExec( new Runnable() {
+ Display.getCurrent().asyncExec(new Runnable() {
public void run() {
String localization = AppliedStereotypeHelper.getAppliedStereotypesPropertiesLocalization(currentView);
- RecordingCommand command = AppliedStereotypeHelper.getSetAppliedStereotypePropertiesLocalizationCommand(getDomain(), currentView, localization);
+ RecordingCommand command = AppliedStereotypeHelper.getSetAppliedStereotypePropertiesLocalizationCommand(domain, currentView, localization);
+
+ domain.getCommandStack().execute(command);
- getDomain().getCommandStack().execute(command);
-
}
});
-
+
}
});
} catch (Exception e) {
- e.printStackTrace ();
+ e.printStackTrace();
}
}
@@ -97,7 +99,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
public void addButtonPressed() {
super.addButtonPressed();
touchModel();
- stereotypeComposite.refreshTreeViewer ();
+ stereotypeComposite.refreshTreeViewer();
}
/**
@@ -107,7 +109,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
public void removeButtonPressed() {
super.removeButtonPressed();
touchModel();
- stereotypeComposite.refreshTreeViewer ();
+ stereotypeComposite.refreshTreeViewer();
}
/**
@@ -117,7 +119,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
public void upButtonPressed() {
super.upButtonPressed();
touchModel();
- stereotypeComposite.refreshTreeViewer ();
+ stereotypeComposite.refreshTreeViewer();
}
/**
@@ -127,7 +129,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
public void downButtonPressed() {
super.downButtonPressed();
touchModel();
- stereotypeComposite.refreshTreeViewer ();
+ stereotypeComposite.refreshTreeViewer();
}
/**
@@ -136,7 +138,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
@Override
protected void createPropTree() {
super.createPropTree();
- getTree().addListener(SWT.MouseDoubleClick, new StereotypePropertiesDoubleClickListener (treeViewer, stereotypeComposite, this));
+ getTree().addListener(SWT.MouseDoubleClick, new StereotypePropertiesDoubleClickListener(treeViewer, stereotypeComposite, this));
}
/**
@@ -152,6 +154,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
/**
*
*/
+ @Override
public void disposeListeners() {
super.disposeListeners();
stereotypeComposite.disposeListeners();
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java
index 143a89865ad..b1036c6691c 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java
@@ -36,7 +36,8 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.profile.Activator;
import org.eclipse.papyrus.uml.profile.ImageManager;
import org.eclipse.papyrus.uml.profile.ui.dialogs.ProfileTreeSelectionDialog;
@@ -91,8 +92,6 @@ public class AppliedProfileCompositeOnModel extends Composite {
*/
private CLabel appliedLabel;
- private TransactionalEditingDomain domain;
-
/**
* the factory to create elements
*/
@@ -154,14 +153,16 @@ public class AppliedProfileCompositeOnModel extends Composite {
*/
protected void applyProfile(final Package thepackage, final Profile profile, final boolean withSubProfiles) {
try {
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(thepackage);
+ domain.runExclusive(new Runnable() {
public void run() {
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- getDomain().getCommandStack().execute(new RecordingCommand(domain) {
+
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
protected void doExecute() {
@@ -425,8 +426,13 @@ public class AppliedProfileCompositeOnModel extends Composite {
}
}
- public TransactionalEditingDomain getDomain() {
- return EditorUtils.getTransactionalEditingDomain();
+ public TransactionalEditingDomain getEditingDomain(Element context) {
+ try {
+ return ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(context);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
+ }
}
/**
@@ -549,10 +555,6 @@ public class AppliedProfileCompositeOnModel extends Composite {
}
}
- public void setDomain(TransactionalEditingDomain domain) {
- this.domain = domain;
- }
-
/**
* Sets the selection.
*
@@ -573,14 +575,15 @@ public class AppliedProfileCompositeOnModel extends Composite {
*/
protected void unApplyProfile(final Package thepackage, final Profile profile) {
try {
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(thepackage);
+ domain.runExclusive(new Runnable() {
public void run() {
-
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- getDomain().getCommandStack().execute(new RecordingCommand(domain) {
+
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
protected void doExecute() {
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java
index 989dd6ba598..6408aa9c467 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java
@@ -26,7 +26,8 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.profile.Activator;
import org.eclipse.papyrus.uml.profile.preference.ProfilePreferenceConstants;
import org.eclipse.papyrus.uml.profile.tree.ProfileElementContentProvider;
@@ -59,8 +60,13 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
*
* @return the domain
*/
- public TransactionalEditingDomain getDomain() {
- return EditorUtils.getTransactionalEditingDomain();
+ public TransactionalEditingDomain getEditingDomain(Element context) {
+ try {
+ return ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(context);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
+ }
}
/** The panel that display applied stereotypes. */
@@ -272,8 +278,8 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
*
* @param propertyView
*/
- public void refreshTreeViewer () {
- treeViewer.refresh ();
+ public void refreshTreeViewer() {
+ treeViewer.refresh();
}
/**
@@ -428,15 +434,15 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
*/
public void applyStereotype(final Element elt, final Stereotype st) {
try {
-
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(elt);
+ domain.runExclusive(new Runnable() {
public void run() {
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- getDomain().getCommandStack().execute(new RecordingCommand(getDomain()) {
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
protected void doExecute() {
@@ -466,15 +472,15 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
protected void unapplyStereotype(final Element elt, final Stereotype st) {
// bugfix: a selected element is not necessary a diagram element (ex: selection in the outline)
try {
-
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(elt);
+ domain.runExclusive(new Runnable() {
public void run() {
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- getDomain().getCommandStack().execute(new RecordingCommand(getDomain()) {
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
protected void doExecute() {
@@ -504,15 +510,15 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
*/
public void reorderStereotypeApplications(final Element element, final EList stereotypes) {
try {
-
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(element);
+ domain.runExclusive(new Runnable() {
public void run() {
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- getDomain().getCommandStack().execute(new RecordingCommand(getDomain()) {
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
protected void doExecute() {
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java
index 37ca929d9b6..22737da2527 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java
@@ -18,8 +18,10 @@ package org.eclipse.papyrus.uml.properties.profile.ui.compositesformodel;
import java.util.ArrayList;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.profile.Message;
import org.eclipse.papyrus.uml.profile.tree.ProfileElementContentProvider;
import org.eclipse.papyrus.uml.profile.tree.ProfileElementLabelProvider;
@@ -27,6 +29,7 @@ import org.eclipse.papyrus.uml.profile.tree.objects.AppliedStereotypePropertyTre
import org.eclipse.papyrus.uml.profile.tree.objects.AppliedStereotypeTreeObject;
import org.eclipse.papyrus.uml.profile.tree.objects.StereotypedElementTreeObject;
import org.eclipse.papyrus.uml.profile.tree.objects.ValueTreeObject;
+import org.eclipse.papyrus.uml.properties.Activator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Tree;
@@ -41,9 +44,13 @@ import org.eclipse.uml2.uml.Stereotype;
*/
public class PropertyComposite extends DecoratedTreeComposite {
- public TransactionalEditingDomain getDomain() {
- // used by heir AppliedStereotypePropertyCompositeWithView
- return EditorUtils.getTransactionalEditingDomain();
+ public TransactionalEditingDomain getEditingDomain(EModelElement context) {
+ try {
+ return ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(context);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
+ }
}
/**
@@ -56,7 +63,7 @@ public class PropertyComposite extends DecoratedTreeComposite {
super(parent, SWT.NONE, "Property values", false);
}
-
+
/*
* (non-Javadoc)
*
@@ -131,12 +138,12 @@ public class PropertyComposite extends DecoratedTreeComposite {
}
- public void itemDClicked () {
+ public void itemDClicked() {
AppliedStereotypePropertyTreeObject pTO = (AppliedStereotypePropertyTreeObject)treeViewer.getInput();
// re-initialize value tree objects (model is already updated, value in tree object is not)
pTO.reInitChilds();
}
-
+
/**
* Action triggered when the add button is pressed.
*/
@@ -160,10 +167,10 @@ public class PropertyComposite extends DecoratedTreeComposite {
// if lower multiplicity is equal to upper multiplicity : cannot add
if(lower == upper && pTO.getValue() != null) {
- if (pTO.getValue() instanceof EList) {
+ if(pTO.getValue() instanceof EList) {
@SuppressWarnings("unchecked")
- EList<Object> currentValues = (EList<Object>) pTO.getValue ();
- if (currentValues.size() >= upper) {
+ EList<Object> currentValues = (EList<Object>)pTO.getValue();
+ if(currentValues.size() >= upper) {
Message.warning("Multiplicity of this property is " + property.getLower() + ".." + property.getUpper() + "\n" + "Impossible to add a new value.");
return;
}
@@ -176,29 +183,28 @@ public class PropertyComposite extends DecoratedTreeComposite {
// Retrieve current value
ArrayList<Object> currentPropertyValues = new ArrayList<Object>();
Object currentValue = pTO.getValue();
- if (currentValue != null) {
-
+ if(currentValue != null) {
+
if(upper == 1) {
currentPropertyValues.add(currentValue);
} else { // if (upper != 1) {
-
+
@SuppressWarnings("unchecked")
- EList<Object> currentValues = (EList<Object>) currentValue;
+ EList<Object> currentValues = (EList<Object>)currentValue;
for(int i = 0; i < currentValues.size(); i++) {
currentPropertyValues.add(currentValues.get(i));
}
}
}
- if (property.isMultivalued() || (currentPropertyValues.size() < upper)) {
- ValueTreeObject.createInstance(pTO, null).editMe ();
- }
- else {
+ if(property.isMultivalued() || (currentPropertyValues.size() < upper)) {
+ ValueTreeObject.createInstance(pTO, null).editMe();
+ } else {
Message.warning("Upper multiplicity of " + property.getName() + " is " + property.getUpper());
}
// Update value tree objects
- pTO.reInitChilds ();
+ pTO.reInitChilds();
}
/**
@@ -213,9 +219,8 @@ public class PropertyComposite extends DecoratedTreeComposite {
TreeItem[] items = getTree().getSelection();
for(int i = 0; i < nbrOfSelection; i++) {
- ValueTreeObject vTO = (ValueTreeObject) items[i].getData();
- AppliedStereotypePropertyTreeObject pTO =
- (AppliedStereotypePropertyTreeObject) treeViewer.getInput();
+ ValueTreeObject vTO = (ValueTreeObject)items[i].getData();
+ AppliedStereotypePropertyTreeObject pTO = (AppliedStereotypePropertyTreeObject)treeViewer.getInput();
Property property = pTO.getProperty();
int lower = property.getLower();
@@ -230,25 +235,25 @@ public class PropertyComposite extends DecoratedTreeComposite {
Object currentVal = pTO.getValue();
ArrayList<Object> tempValues = new ArrayList<Object>();
- if (upper != 1) {
+ if(upper != 1) {
@SuppressWarnings("unchecked")
- EList<Object> currentValues = (EList<Object>) currentVal;
- tempValues.addAll (currentValues);
-
- if (tempValues.size() > lower) {
+ EList<Object> currentValues = (EList<Object>)currentVal;
+ tempValues.addAll(currentValues);
+
+ if(tempValues.size() > lower) {
tempValues.remove(vTO.getValue());
}
}
-
+
if(property.isMultivalued()) {
// setPropertiesValue(selectedElt, stereotype, property, tempValues);
- pTO.updateValue (tempValues);
+ pTO.updateValue(tempValues);
} else {
- pTO.updateValue (null);
+ pTO.updateValue(null);
}
// Update value tree objects
- pTO.reInitChilds ();
+ pTO.reInitChilds();
}
}
@@ -315,8 +320,8 @@ public class PropertyComposite extends DecoratedTreeComposite {
*/
public void setInput(AppliedStereotypePropertyTreeObject element) {
treeViewer.setInput(element);
- if (element != null) {
- element.reInitChilds ();
+ if(element != null) {
+ element.reInitChilds();
}
refresh();
}
@@ -339,4 +344,4 @@ public class PropertyComposite extends DecoratedTreeComposite {
public void editItem(TreeItem item) {
// do nothing
}
-} \ No newline at end of file
+}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedProfileSection.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedProfileSection.java
index 7cfb418a0e6..1e7c488c883 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedProfileSection.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedProfileSection.java
@@ -21,7 +21,6 @@ import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.uml.properties.profile.ui.compositeforview.AppliedProfileCompositeWithView;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbenchPart;
@@ -62,6 +61,7 @@ public class AppliedProfileSection extends AbstractPropertySection {
*
* {@inheritDoc}
*/
+ @Override
public void refresh() {
appliedProfileComposite.refresh();
}
@@ -70,6 +70,7 @@ public class AppliedProfileSection extends AbstractPropertySection {
*
* {@inheritDoc}
*/
+ @Override
public void setInput(IWorkbenchPart part, ISelection selection) {
super.setInput(part, selection);
if(selection instanceof IStructuredSelection) {
@@ -86,8 +87,6 @@ public class AppliedProfileSection extends AbstractPropertySection {
appliedProfileComposite.setSelection(selection);
}
}
-
- appliedProfileComposite.setDomain(EditorUtils.getTransactionalEditingDomain());
}
}
@@ -113,9 +112,11 @@ public class AppliedProfileSection extends AbstractPropertySection {
/**
*
*/
+ @Override
public void dispose() {
super.dispose();
- if(appliedProfileComposite != null)
+ if(appliedProfileComposite != null) {
appliedProfileComposite.disposeListeners();
+ }
}
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypeKindAppearanceSection.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypeKindAppearanceSection.java
index c73fee5ce42..3464717550c 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypeKindAppearanceSection.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypeKindAppearanceSection.java
@@ -14,6 +14,7 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.profile.ui.section;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
@@ -21,8 +22,6 @@ import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
import org.eclipse.papyrus.uml.tools.utils.ElementUtil;
@@ -266,14 +265,13 @@ public class AppliedStereotypeKindAppearanceSection extends AbstractPropertySect
if(part instanceof ContentOutline) {
IContributedContentsView contributedView = ((IContributedContentsView)((ContentOutline)part).getAdapter(IContributedContentsView.class));
if(contributedView != null) {
- part = (IWorkbenchPart)contributedView.getContributingPart();
+ part = contributedView.getContributingPart();
}
}
- if(part instanceof IMultiDiagramEditor) {
- IMultiDiagramEditor editor = (IMultiDiagramEditor)part;
- domain = EditorUtils.getTransactionalEditingDomain();
- } else
- domain = null;
+
+ if(part instanceof IAdaptable) {
+ domain = (TransactionalEditingDomain)((IAdaptable)part).getAdapter(TransactionalEditingDomain.class);
+ }
}
}
@@ -418,6 +416,7 @@ public class AppliedStereotypeKindAppearanceSection extends AbstractPropertySect
/**
* {@inheritDoc}
*/
+ @Override
public void dispose() {
if(comboStereotypeAppearance != null && !comboStereotypeAppearance.isDisposed()) {
comboStereotypeAppearance.removeSelectionListener(comboStereotypeAppearanceListener);
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypePropertiesPlaceSection.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypePropertiesPlaceSection.java
index d4c6bf43a3f..5e89a1702bc 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypePropertiesPlaceSection.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypePropertiesPlaceSection.java
@@ -1,5 +1,6 @@
package org.eclipse.papyrus.uml.properties.profile.ui.section;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;
@@ -10,8 +11,6 @@ import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
import org.eclipse.swt.SWT;
@@ -132,12 +131,14 @@ public class AppliedStereotypePropertiesPlaceSection extends AbstractPropertySec
*
* {@inheritDoc}
*/
+ @Override
public void dispose() {
super.dispose();
diagramElement.eAdapters().remove(this);
- if(comboStereotypePropertiesPlace != null && !comboStereotypePropertiesPlace.isDisposed())
+ if(comboStereotypePropertiesPlace != null && !comboStereotypePropertiesPlace.isDisposed()) {
comboStereotypePropertiesPlace.removeSelectionListener(comboStereotypePropertiesPlaceListener);
+ }
}
/**
@@ -175,14 +176,13 @@ public class AppliedStereotypePropertiesPlaceSection extends AbstractPropertySec
if(part instanceof ContentOutline) {
IContributedContentsView contributedView = ((IContributedContentsView)((ContentOutline)part).getAdapter(IContributedContentsView.class));
if(contributedView != null) {
- part = (IWorkbenchPart)contributedView.getContributingPart();
+ part = contributedView.getContributingPart();
}
}
- if(part instanceof IMultiDiagramEditor) {
- IMultiDiagramEditor editor = (IMultiDiagramEditor)part;
- domain = EditorUtils.getTransactionalEditingDomain();
- } else
- domain = null;
+
+ if(part instanceof IAdaptable) {
+ domain = (TransactionalEditingDomain)((IAdaptable)part).getAdapter(TransactionalEditingDomain.class);
+ }
}
}
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 b6e15f1c61c..5f5c0b99ddd 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
@@ -20,7 +20,8 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
import org.eclipse.papyrus.uml.properties.Activator;
import org.eclipse.papyrus.uml.properties.modelelement.UMLModelElement;
@@ -132,8 +133,16 @@ public class StereotypeImageEditor extends AbstractPropertyEditor implements Sel
if(getElement() instanceof Image) {
final File imgFile = new File(iconSelected);
+ Image image = (Image)getElement();
+
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(image);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
- TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
AbstractTransactionalCommand operation = new AbstractTransactionalCommand(domain, "Set Image content", null) {
/**
@@ -159,9 +168,15 @@ public class StereotypeImageEditor extends AbstractPropertyEditor implements Sel
protected void removeAction() {
// Erase image content
if(getElement() instanceof Image) {
-
- TransactionalEditingDomain dom = EditorUtils.getTransactionalEditingDomain();
- AbstractTransactionalCommand operation = new AbstractTransactionalCommand(dom, "Remove Image content", null) {
+ Image image = (Image)getElement();
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(image);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+ AbstractTransactionalCommand operation = new AbstractTransactionalCommand(domain, "Remove Image content", null) {
/**
* {@inheritDoc}
@@ -177,7 +192,7 @@ public class StereotypeImageEditor extends AbstractPropertyEditor implements Sel
}
};
- dom.getCommandStack().execute(new GMFtoEMFCommandWrapper(operation));
+ domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(operation));
refresh();
}

Back to the top