Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-07-24 13:45:04 +0000
committerCamille Letavernier2014-07-24 13:45:04 +0000
commitaf04d06ee23a281d76f35983b1959cf1d6633f3c (patch)
treef90cf0df690e3acae512527159d0293b24c05f67 /plugins/views
parent660eb9df792ce11992342dfa712e659811d1da11 (diff)
downloadorg.eclipse.papyrus-af04d06ee23a281d76f35983b1959cf1d6633f3c.tar.gz
org.eclipse.papyrus-af04d06ee23a281d76f35983b1959cf1d6633f3c.tar.xz
org.eclipse.papyrus-af04d06ee23a281d76f35983b1959cf1d6633f3c.zip
[ModelExplorer] Allow opening invalid diagrams, as the editor may be
able to repair them on-the-fly
Diffstat (limited to 'plugins/views')
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java21
1 files changed, 3 insertions, 18 deletions
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java
index ccf49a14aa8..4c966806402 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java
@@ -19,7 +19,6 @@ import java.util.List;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
@@ -29,8 +28,6 @@ import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IOpenable;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
import org.eclipse.papyrus.views.modelexplorer.Activator;
import org.eclipse.papyrus.views.modelexplorer.Messages;
@@ -71,7 +68,9 @@ public class DoubleClickListener implements IDoubleClickListener {
Object currentObject = iter.next();
EObject diag = EMFHelper.getEObject(currentObject);
- if(isPage(diag, pageManager) && canOpenByPolicy(diag)) {
+ if(isPage(diag, pageManager)) {
+ //Note that Diagram migration is triggered by the Diagram Editor.
+ //Try to open the diagram, even if it is currently invalid. The editor might be able to repair it
if(pageManager.isOpen(diag)) {
pageToSelect = diag;
} else {
@@ -92,20 +91,6 @@ public class DoubleClickListener implements IDoubleClickListener {
}
}
- /**
- * Determines whether the current policy allows this object to be opened
- * @param selection The object to open
- * @return <code>true</code> if the object can be opened
- */
- private boolean canOpenByPolicy(EObject selection) {
- if (selection instanceof Diagram) {
- Diagram diagram = (Diagram)selection;
- ViewPrototype proto = DiagramUtils.getPrototype(diagram);
- return (proto != ViewPrototype.UNAVAILABLE_VIEW && proto != ViewPrototype.UNAVAILABLE_DIAGRAM);
- }
- return true;
- }
-
protected boolean isPage(EObject element, IPageManager pageManager) {
if(pageManager.allPages().contains(element)) {
return true;

Back to the top