Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-03-25 10:52:44 +0000
committerCamille Letavernier2014-03-25 10:52:44 +0000
commitcbf0292270ab55f1d748d380522a325cc08d402c (patch)
tree80405dcb6746493688443728ceb21bdfa5b88a53 /plugins
parentddf5179c9e0e8b12ac95a9c1d42c25673d0cfc49 (diff)
downloadorg.eclipse.papyrus-cbf0292270ab55f1d748d380522a325cc08d402c.tar.gz
org.eclipse.papyrus-cbf0292270ab55f1d748d380522a325cc08d402c.tar.xz
org.eclipse.papyrus-cbf0292270ab55f1d748d380522a325cc08d402c.zip
431039: [Usability] I should not be able to create a sub model fragment
in contexts where it makes no sense https://bugs.eclipse.org/bugs/show_bug.cgi?id=431039
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/IsControlledFragmentTester.java18
1 files changed, 6 insertions, 12 deletions
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/IsControlledFragmentTester.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/IsControlledFragmentTester.java
index d10a6d49bca..af604071e75 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/IsControlledFragmentTester.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/IsControlledFragmentTester.java
@@ -4,23 +4,23 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Arthur Daussy <a href="mailto:arthur.daussy@atos.net"> - initial API and implementation
******************************************************************************/
package org.eclipse.papyrus.infra.services.controlmode;
-import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.services.controlmode.util.ControlHelper;
/**
* Tester used to test control elements property
- *
+ *
* @author adaussy
- *
+ *
*/
public class IsControlledFragmentTester extends org.eclipse.core.expressions.PropertyTester {
@@ -73,18 +73,12 @@ public class IsControlledFragmentTester extends org.eclipse.core.expressions.Pro
/**
* Retrieve a EObject from an object
- *
+ *
* @param selectedElement
* @return
*/
public static EObject getSemanticObject(Object selectedElement) {
- EObject semanticObject = null;
- if(selectedElement instanceof IAdaptable) {
- semanticObject = (EObject)((IAdaptable)selectedElement).getAdapter(EObject.class);
- }
- if(selectedElement instanceof EObject) {
- semanticObject = (EObject)selectedElement;
- }
+ EObject semanticObject = EMFHelper.getEObject(selectedElement);
if(selectedElement == null || selectedElement instanceof EReference || semanticObject instanceof EReference) {
return null;
}

Back to the top