diff options
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestedPackageHyperlinkContributor.java')
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestedPackageHyperlinkContributor.java | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestedPackageHyperlinkContributor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestedPackageHyperlinkContributor.java index 0750025442a..261d2ce2586 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestedPackageHyperlinkContributor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestedPackageHyperlinkContributor.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015 CEA LIST and others. + * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, 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,6 +8,7 @@ * * Contributors: * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation + * Christian W. Damus - bug 485220 * *****************************************************************************/ @@ -20,6 +21,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.core.sasheditor.editor.IPage; +import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; import org.eclipse.papyrus.infra.core.services.BadStateException; import org.eclipse.papyrus.infra.core.services.ServiceException; @@ -47,13 +49,14 @@ public class NestedPackageHyperlinkContributor implements HyperlinkContributor { * @param fromElement * @return */ + @Override public List<HyperLinkObject> getHyperlinks(Object fromElement) { ArrayList<HyperLinkObject> hyperlinks = new ArrayList<HyperLinkObject>(); - + if (fromElement instanceof org.eclipse.uml2.uml.Package) { List<org.eclipse.uml2.uml.Package> nestedPackages = ((org.eclipse.uml2.uml.Package) fromElement).getNestedPackages(); List<Object> pages = new ArrayList<Object>(); - + for (org.eclipse.uml2.uml.Package nestedPackage : nestedPackages) { ViewerSearchService viewerSearchService = null; try { @@ -76,34 +79,34 @@ public class NestedPackageHyperlinkContributor implements HyperlinkContributor { } } } - + if (viewerSearchService != null) { List<Object> viewerSearchResults = viewerSearchService.getViewersInCurrentModel(null, nestedPackage, true, false); pages.addAll(viewerSearchResults); } } - + for (Object page : pages) { - + if (page instanceof Diagram && ((Diagram) page).getType().equals(CompositeStructureDiagramEditPart.MODEL_ID)) { try { // Page must not be active page - IPage activeSashPage = ServiceUtilsForEObject.getInstance().getISashWindowsContainer((org.eclipse.uml2.uml.Package) fromElement).getActiveSashWindowsPage(); + IPage activeSashPage = ServiceUtilsForEObject.getInstance().getService(ISashWindowsContainer.class, (org.eclipse.uml2.uml.Package) fromElement).getActiveSashWindowsPage(); Object activePage = null; - + if (activeSashPage != null) { Object pageId = activeSashPage.getRawModel(); - + if (pageId instanceof PageRef) { Object emfPageId = ((PageRef) pageId).getEmfPageIdentifier(); - + if (emfPageId instanceof View) { activePage = emfPageId; } } } - + if (activePage == null || !activePage.equals(page)) { HyperLinkEditor hyperlink = new HyperLinkEditor(); hyperlink.setObject(page); @@ -113,11 +116,11 @@ public class NestedPackageHyperlinkContributor implements HyperlinkContributor { Activator.log.error(e); } } - - + + } } - + return hyperlinks; } |