Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ActionUtil.java')
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ActionUtil.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ActionUtil.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ActionUtil.java
index a93321213d0..1d3e003df7d 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ActionUtil.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ActionUtil.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 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
@@ -20,12 +20,13 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
/**
* Utility class for Actions
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public class ActionUtil {
@@ -36,7 +37,7 @@ public class ActionUtil {
* themselves. This method adapts a collections of such objects to their
* underlying EObjects, so that EMF can handle them.
* Objects that cannot be adapted remain as-is in the collection.
- *
+ *
* @param selection
* The collection to adapt
* @return
@@ -62,7 +63,7 @@ public class ActionUtil {
* themselves. This method adapts a ISelection of such objects to their
* underlying EObjects, so that EMF can handle them.
* Objects that cannot be adapted remain as-is in the selection.
- *
+ *
* @param sourceSelection
* The selection to adapt
* @return
@@ -76,12 +77,11 @@ public class ActionUtil {
Iterator<?> it = currentSelection.iterator();
while(it.hasNext()) {
Object object = it.next();
- if(object instanceof IAdaptable) {
- EObject eObject = (EObject)((IAdaptable)object).getAdapter(EObject.class);
- if(eObject != null)
- newSelection.add(eObject);
- else
- newSelection.add(object);
+ EObject eObject = EMFHelper.getEObject(object);
+ if(eObject != null) {
+ newSelection.add(eObject);
+ } else {
+ newSelection.add(object);
}
}

Back to the top