diff options
author | Christian W. Damus | 2014-03-24 14:58:15 +0000 |
---|---|---|
committer | Christian W. Damus | 2014-03-24 22:22:11 +0000 |
commit | 0238414c873c187c7936988711eab3c294460426 (patch) | |
tree | 484a9f419fb63048c96b4d37762b40e44d7b1a0d /plugins/uml/modelexplorer | |
parent | 88a320ee08fe0d1f4546dbb247dbbeb2eab61e22 (diff) | |
download | org.eclipse.papyrus-0238414c873c187c7936988711eab3c294460426.tar.gz org.eclipse.papyrus-0238414c873c187c7936988711eab3c294460426.tar.xz org.eclipse.papyrus-0238414c873c187c7936988711eab3c294460426.zip |
413703: [Model Explorer] Cannot create a LiteralInteger in a Property
https://bugs.eclipse.org/bugs/show_bug.cgi?id=413703
Fix exceptions that prevent correct presentation of the "New Child" context menu on EReferences in the Advanced mode of the Model Explorer.
Diffstat (limited to 'plugins/uml/modelexplorer')
-rw-r--r-- | plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/util/ModelExplorerUtils.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/util/ModelExplorerUtils.java b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/util/ModelExplorerUtils.java index 4bdaec2a680..127c62f68df 100644 --- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/util/ModelExplorerUtils.java +++ b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/util/ModelExplorerUtils.java @@ -1,5 +1,5 @@ /*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,10 +8,11 @@ *
* Contributors:
* Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 413703
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.modelexplorer.util;
-import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -57,14 +58,15 @@ public class ModelExplorerUtils { container = EMFHelper.getEObject(selection);
- if(container == null) {
- reference = (EReference)((IAdaptable)selection).getAdapter(EReference.class);
-
+ if(container instanceof EReference) {
+ reference = (EReference)container;
+ container = null;
+
// The following part introduce a dependency to EMF Facet.
// Although the selection can be adapted to EReference, the link parent is required but
// no API allows to get this element except LinkItem or ITreeElement.
- if((reference != null) && (selection instanceof EReferenceTreeElement )) {
- container = ((EReferenceTreeElement)selection).getParent();
+ if(selection instanceof EReferenceTreeElement) {
+ container = ((EReferenceTreeElement)selection).getParent().getEObject();
}
}
|