Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2014-03-10 18:45:09 +0000
committerptessier2014-03-10 18:45:09 +0000
commit092c199d76f56d68517af972b41917b8e9501d6a (patch)
treefc4ff21a14ab57f6894a6346c852bb84b26d2e36 /plugins/uml
parent908ac148c84a3efdf11147865c12d4773d8a0795 (diff)
downloadorg.eclipse.papyrus-092c199d76f56d68517af972b41917b8e9501d6a.tar.gz
org.eclipse.papyrus-092c199d76f56d68517af972b41917b8e9501d6a.tar.xz
org.eclipse.papyrus-092c199d76f56d68517af972b41917b8e9501d6a.zip
Bug 386118 - [EMF Facet] Papyrus should progressively support EMF Facet
0.2 update to EMFHerlper
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/AbstractEMFCommandHandler.java22
1 files changed, 6 insertions, 16 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/AbstractEMFCommandHandler.java b/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/AbstractEMFCommandHandler.java
index 53d9ba6e5ca..f414d96790b 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/AbstractEMFCommandHandler.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/AbstractEMFCommandHandler.java
@@ -31,6 +31,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.emf.utils.BusinessModelResolver;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
import org.eclipse.papyrus.uml.commands.Activator;
@@ -104,14 +105,7 @@ public abstract class AbstractEMFCommandHandler extends AbstractHandler {
// Treat non-null selected object (try to adapt and return EObject)
if(selection != null) {
- if(selection instanceof IAdaptable) {
- selection = ((IAdaptable)selection).getAdapter(EObject.class);
- }
-
- Object businessObject = BusinessModelResolver.getInstance().getBusinessModel(selection);
- if(businessObject instanceof EObject) {
- eObject = (EObject)businessObject;
- }
+ eObject=EMFHelper.getEObject(selection);
}
return eObject;
}
@@ -148,24 +142,20 @@ public abstract class AbstractEMFCommandHandler extends AbstractHandler {
IStructuredSelection structuredSelection = (IStructuredSelection)selection;
for(Object current : structuredSelection.toArray()) {
// Adapt current selection to EObject
- if(current instanceof IAdaptable) {
- EObject eobject = (EObject)((IAdaptable)current).getAdapter(EObject.class);
- if(eobject != null) {
- selectedEObjects.add(eobject);
- }
+ EObject eobject=EMFHelper.getEObject(selection);
+ if(eobject != null) {
+ selectedEObjects.add(eobject);
}
}
} else { // Not a IStructuredSelection
if(selection != null) {
// Adapt current selection to EObject
- if(selection instanceof IAdaptable) {
- EObject eobject = (EObject)((IAdaptable)selection).getAdapter(EObject.class);
+ EObject eobject=EMFHelper.getEObject(selection);
if(eobject != null) {
selectedEObjects.add(eobject);
}
}
- }
}
return selectedEObjects;

Back to the top