Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2013-10-28 05:06:19 -0400
committerCamille Letavernier2013-10-28 05:06:19 -0400
commit90b3c71cc9e954f4e3a5d1389e49af029b5f567b (patch)
treeb2a7b215426c58b4452ef49e5e6fe55d57cd272b /plugins
parent8be72fef63089c63158c73894a032b2cfb1183a7 (diff)
downloadorg.eclipse.papyrus-90b3c71cc9e954f4e3a5d1389e49af029b5f567b.tar.gz
org.eclipse.papyrus-90b3c71cc9e954f4e3a5d1389e49af029b5f567b.tar.xz
org.eclipse.papyrus-90b3c71cc9e954f4e3a5d1389e49af029b5f567b.zip
417673: [Hyperlinks] Cannot easily navigate to nested diagrams.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=417673
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/navigation/DiagramNavigableElement.java11
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/navigation/DiagramNavigationProvider.java10
2 files changed, 19 insertions, 2 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/navigation/DiagramNavigableElement.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/navigation/DiagramNavigableElement.java
index c3bbaf2cee3..daa8c5734ac 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/navigation/DiagramNavigableElement.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/navigation/DiagramNavigableElement.java
@@ -14,10 +14,12 @@ package org.eclipse.papyrus.infra.gmfdiag.hyperlink.navigation;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.gmfdiag.hyperlink.Activator;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
import org.eclipse.papyrus.infra.services.navigation.service.NavigableElement;
import org.eclipse.papyrus.infra.widgets.util.IRevealSemanticElement;
import org.eclipse.papyrus.infra.widgets.util.NavigationTarget;
@@ -72,7 +74,14 @@ public class DiagramNavigableElement implements NavigableElement {
}
public Image getImage() {
- // TODO Auto-generated method stub
+ if(targetDiagram != null) {
+ try {
+ ILabelProvider labelProvider = ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, targetDiagram).getLabelProvider();
+ return labelProvider.getImage(targetDiagram);
+ } catch (ServiceException ex) {
+ return null;
+ }
+ }
return null;
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/navigation/DiagramNavigationProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/navigation/DiagramNavigationProvider.java
index 0fb614a3b48..569424e6b5b 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/navigation/DiagramNavigationProvider.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/navigation/DiagramNavigationProvider.java
@@ -23,6 +23,7 @@ import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
import org.eclipse.papyrus.infra.services.navigation.service.NavigableElement;
import org.eclipse.papyrus.infra.services.navigation.service.NavigationContributor;
@@ -46,7 +47,8 @@ public class DiagramNavigationProvider implements NavigationContributor {
}
protected List<Diagram> getOwnedDiagrams(Object fromElement) {
- EObject eObject = EMFHelper.getEObject(fromElement);
+ EObject eObject = EMFHelper.getEObject(fromElement); //Should not be null (Otherwise, return=)
+ View currentView = NotationHelper.findView(fromElement); //May be null (e.g. Selection from the ModelExplorer)
if(eObject instanceof View || eObject == null) {
return Collections.emptyList();
}
@@ -58,6 +60,12 @@ public class DiagramNavigationProvider implements NavigationContributor {
for(Object pageObject : pageManager.allPages()) {
if(pageObject instanceof Diagram) {
Diagram diagram = (Diagram)pageObject;
+
+ //Avoid navigation to the current diagram
+ if(currentView != null && currentView.getDiagram() == diagram) {
+ continue;
+ }
+
if(diagram.getElement() == eObject) {
ownedDiagrams.add(diagram);
}

Back to the top