Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShuai Li2015-05-07 10:40:12 -0400
committerGerrit Code Review @ Eclipse.org2015-10-30 10:33:02 -0400
commit7bce7a1129ccdff55e1104bc2ecd63fbd22e2142 (patch)
tree649b0b5477d6d792fd8192cfb14eb193a6c4cad6 /plugins
parent4ef7439e07e4bfcfa03b07d690afaabbe7361689 (diff)
downloadorg.eclipse.papyrus-7bce7a1129ccdff55e1104bc2ecd63fbd22e2142.tar.gz
org.eclipse.papyrus-7bce7a1129ccdff55e1104bc2ecd63fbd22e2142.tar.xz
org.eclipse.papyrus-7bce7a1129ccdff55e1104bc2ecd63fbd22e2142.zip
Bug 465886 - [Navigation, Hyperlink] Double-click default action
- Double-click now creates hyperlinks if there are no default hyperlinks. This is done with hyperlinkContributor extensions. If there are none, then the hyperlinks menu opens. - Add HyperlinkService and its preferences page for hyperlink contributors. (The navigation service is not used for hyperlink contributors because otherwise there is a cyclic dependency issue.) - Hyperlink contributors for nested/nesting package, target/source of element in a directed relationship, owned behavior and inner class of a class - Specific hyperlinks icon for web and document - For nested and nesting contributors, diagrams must be of type class or composite - Add inner composite structure hyperlink contributor - Remove heuristic tab from hyperlink manager (remove extension from uml.diagram.common) - Open normal hyperlink manager instead of advanced one (with the heuristic tab) Patch set 16: - Remove oep.uml.hyperlink plugin (including feature and pom) - Move hyperlink contributors to oep.uml.diagram.X plugins accordingly - Views search is done with ViewerSearchService and DiagramViewerSearcher extends AbstractViewerSearcher implements IExtendedViewerSearcher; IExtendedViewerSearch is a new interface that extends IViewerSearcher - oep.uml.diagram.X depends on oep.infra.hyperlink and oep.infra.services.viewersearch - Remove table hyperlinks since all tables are trees now; will re-integrate in tree table navigation patch Change-Id: I071767591243819205b35f4965383a43ce48cd2a Signed-off-by: Shuai Li <shuai.li@cea.fr>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/META-INF/MANIFEST.MF59
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/NavigationEditPolicy.java134
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF56
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/editpolicy/NavigationEditPolicy.java598
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.viewersearcher/META-INF/MANIFEST.MF36
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.viewersearcher/src/org/eclipse/papyrus/infra/gmfdiag/viewersearcher/DiagramViewerSearcher.java273
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/META-INF/MANIFEST.MF71
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/plugin.xml110
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/schema/hyperlinkContributor.exsd125
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/ObjectHyperLinkHelper.java318
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/preferences/HyperlinkServicePreferencesPage.java218
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/service/HyperlinkContributor.java29
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/service/HyperlinkService.java24
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/service/impl/HyperlinkServiceImpl.java193
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/AbstractHyperLinkManagerShell.java280
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkConstants.java126
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkLabelProvider.java390
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.viewersearch/src/org/eclipse/papyrus/infra/services/viewersearch/IExtendedViewerSearcher.java40
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.viewersearch/src/org/eclipse/papyrus/infra/services/viewersearch/impl/AbstractViewerSearcher.java166
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.viewersearch/src/org/eclipse/papyrus/infra/services/viewersearch/impl/ViewerSearchService.java349
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/hyperlink/OwnedBehaviorHyperlinkContributor.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml10
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF200
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/hyperlink/InnerClassHyperlinkContributor.java104
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/hyperlink/NestedPackageHyperlinkContributor.java124
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/hyperlink/NestingPackageHyperlinkContributor.java121
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml22
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF247
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml15
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/hyperlink/DirectedRelationshipSourceHyperlinkContributor.java146
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/hyperlink/DirectedRelationshipTargetHyperlinkContributor.java145
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/InnerCompositeStructureHyperlinkContributor.java94
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestedPackageHyperlinkContributor.java124
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestingPackageHyperlinkContributor.java121
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml21
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF179
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/hyperlink/OwnedBehaviorHyperlinkContributor.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml9
40 files changed, 3837 insertions, 1654 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/META-INF/MANIFEST.MF
index c3e3a00a6e6..28ef95f5c19 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/META-INF/MANIFEST.MF
@@ -1,29 +1,30 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.papyrus.infra.hyperlink;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.2.0",
- org.eclipse.gmf.runtime.common.core;bundle-version="1.4.1",
- org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
- org.eclipse.emf.transaction;bundle-version="1.4.0",
- org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
- org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.6.0",
- org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.services.navigation;bundle-version="1.2.0"
-Export-Package: org.eclipse.papyrus.infra.gmfdiag.hyperlink,
- org.eclipse.papyrus.infra.gmfdiag.hyperlink.editpolicies,
- org.eclipse.papyrus.infra.gmfdiag.hyperlink.ui
-Bundle-Vendor: Eclipse Modeling Project
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.2.0.qualifier
-Bundle-Name: GMF Diagram Hyperlink
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.hyperlink.Activator
-Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.hyperlink;singleton:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.hyperlink;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.2.0",
+ org.eclipse.gmf.runtime.common.core;bundle-version="1.4.1",
+ org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
+ org.eclipse.emf.transaction;bundle-version="1.4.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
+ org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.6.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.services.navigation;bundle-version="1.2.0"
+Export-Package: org.eclipse.papyrus.infra.gmfdiag.hyperlink,
+ org.eclipse.papyrus.infra.gmfdiag.hyperlink.editpolicies,
+ org.eclipse.papyrus.infra.gmfdiag.hyperlink.ui
+Bundle-Vendor: Eclipse Modeling Project
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: GMF Diagram Hyperlink
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.hyperlink.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.hyperlink;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/NavigationEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/NavigationEditPolicy.java
index 908fdb894dc..ce46788598b 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/NavigationEditPolicy.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/NavigationEditPolicy.java
@@ -25,6 +25,7 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.Request;
@@ -51,6 +52,7 @@ import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
import org.eclipse.papyrus.infra.gmfdiag.hyperlink.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.hyperlink.ui.AdvancedHLManager;
import org.eclipse.papyrus.infra.gmfdiag.navigation.ExistingNavigableElement;
import org.eclipse.papyrus.infra.gmfdiag.navigation.NavigableElement;
import org.eclipse.papyrus.infra.gmfdiag.navigation.NavigationHelper;
@@ -59,7 +61,9 @@ import org.eclipse.papyrus.infra.hyperlink.helper.AbstractHyperLinkHelper;
import org.eclipse.papyrus.infra.hyperlink.helper.HyperLinkHelperFactory;
import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor;
import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
+import org.eclipse.papyrus.infra.hyperlink.service.HyperlinkService;
import org.eclipse.papyrus.infra.hyperlink.ui.EditorNavigationDialog;
+import org.eclipse.papyrus.infra.hyperlink.ui.HyperLinkManagerShell;
import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkHelpersRegistrationUtil;
/**
@@ -109,9 +113,6 @@ public class NavigationEditPolicy extends OpenEditPolicy {
}
final EObject semanticElement = gep.resolveSemanticElement();
- // navigable element by using heuristic
- List<NavigableElement> navElements = null;
-
// defaultHyperlinks
final ArrayList<HyperLinkObject> defaultHyperLinkObject = new ArrayList<HyperLinkObject>();
final ArrayList<HyperLinkObject> hyperLinkObjectList;
@@ -143,81 +144,28 @@ public class NavigationEditPolicy extends OpenEditPolicy {
}
}
-
- // fill navigation by using heuristics
- navElements = NavigationHelper.getInstance().getAllNavigableElements(semanticElement);
- HashMap<NavigableElement, List<CreationCommandDescriptor>> possibleCreations = new HashMap<NavigableElement, List<CreationCommandDescriptor>>();
-
+
// test which kind of navigation by consulting preference
- String navigationKind = Activator.getDefault().getPreferenceStore().getString(INavigationPreferenceConstant.PAPYRUS_NAVIGATION_DOUBLECLICK_KIND);
+ String navigationKind = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore().getString(INavigationPreferenceConstant.PAPYRUS_NAVIGATION_DOUBLECLICK_KIND);
- // no naviagation
+ // no navigation
if (navigationKind.equals(INavigationPreferenceConstant.NO_NAVIGATION)) {
// do nothing
return UnexecutableCommand.INSTANCE;
}
- // navigation by using heuristic
- // add list of diagram navigables by using heuristic
+ // Create default hyperlinks by contributors
if (navigationKind.equals(INavigationPreferenceConstant.EXPLICIT_IMPLICIT_NAVIGATION)) {
- for (NavigableElement navElement : navElements) {
- final EObject element = navElement.getElement();
- if (navElement instanceof ExistingNavigableElement) {
- List<Diagram> associatedDiagrams = DiagramUtils.getAssociatedDiagrams(element, null);
-
- // ignore the current diagram
- associatedDiagrams.remove(gep.getNotationView().getDiagram());
- if (associatedDiagrams != null && !associatedDiagrams.isEmpty()) {
- existingDiagrams.put(navElement, associatedDiagrams);
- }
- }
- }
-
- Iterator<List<Diagram>> iter = existingDiagrams.values().iterator();
- while (iter.hasNext()) {
- List<Diagram> list = iter.next();
- Iterator<Diagram> iterDiagram = list.iterator();
- while (iterDiagram.hasNext()) {
- Diagram diagram = iterDiagram.next();
- HyperLinkEditor hyperLinkEditor = new HyperLinkEditor();
- hyperLinkEditor.setObject(diagram);
- hyperLinkEditor.setTooltipText(diagram.getName() + " (found by heuristic)");
- // look for if a hyperlink already exists
- HyperLinkObject foundHyperlink = null;
- for (int i = 0; i < defaultHyperLinkObject.size() && foundHyperlink == null; i++) {
- if (defaultHyperLinkObject.get(i).getObject().equals(diagram)) {
- foundHyperlink = defaultHyperLinkObject.get(i);
- }
- }
- // the diagram was not into the list of existing default
- // hyperlink
- if (foundHyperlink == null) {
- defaultHyperLinkObject.add(hyperLinkEditor);
- }
+ // If clicked-on object is a diagram shortcut, we do not add hyperlinks by contributors
+ if (!(semanticElement instanceof Diagram) && defaultHyperLinkObject.size() == 0) {
+ HyperlinkService hyperlinkService = ServiceUtilsForEObject.getInstance().getServiceRegistry(semanticElement).getService(HyperlinkService.class);
+ defaultHyperLinkObject.addAll(hyperlinkService.getHyperlinks(semanticElement));
+ for (HyperLinkObject hyperlink : defaultHyperLinkObject) {
+ hyperlink.setIsDefault(true);
}
}
}
-
- // Disable to improve usability and user-friendliness.
- // See Bug 420177: Double click on Hyperlink open diagram AND HyperLink window
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=420177
-
- // if(defaultHyperLinkObject.isEmpty()) {
- // Command command = new Command() {
- //
- // @Override
- // public void execute() {
- // EObject semanticElement = gep.getNotationView().getElement();
- // if(semanticElement instanceof EModelElement) {
- // HyperLinkManagerShell hyperLinkManagerShell = new AdvancedHLManager(createEditorRegistry(), ((IGraphicalEditPart)getHost()).getEditingDomain(), (EModelElement)semanticElement, gep.getNotationView(), hyperlinkHelperFactory);
- // hyperLinkManagerShell.setInput(hyperLinkObjectList);
- // hyperLinkManagerShell.open();
- // }
- // }
- // };
- // return command;
- // }
-
+
if (defaultHyperLinkObject.size() == 1) {
// open the diagram
final HyperLinkObject hyperlinkObject = defaultHyperLinkObject.get(0);
@@ -351,7 +299,59 @@ public class NavigationEditPolicy extends OpenEditPolicy {
return new NavigateHyperlinksCommand();
}
+
+ // No default hyperlinks, so we open the manager shell if the clicked-on object is not a diagram shotcut
+ if (!(semanticElement instanceof Diagram)) {
+ if (defaultHyperLinkObject.size() == 0) {
+ class AddHyperlinkCommand extends Command {
+ private Command addLinkCommand;
+
+ private AddHyperlinkCommand() {
+ super("Add hyperlink");
+ }
+
+ public void execute() {
+ addLinkCommand = new Command("Add Hyperlink") {
+ @Override
+ public void execute() {
+ HyperLinkManagerShell hyperLinkManagerShell = new HyperLinkManagerShell(createEditorRegistry(), ((IGraphicalEditPart) getHost()).getEditingDomain(), (EModelElement) ((IGraphicalEditPart) getHost()).getNotationView().getElement(),
+ ((IGraphicalEditPart) getHost()).getNotationView(), hyperlinkHelperFactory);
+ hyperLinkManagerShell.setInput(hyperLinkObjectList);
+ hyperLinkManagerShell.open(); // TODO cannot click Ok
+ }
+ };
+
+ addLinkCommand.execute();
+ }
+
+ @Override
+ public void undo() {
+ if (addLinkCommand != null && addLinkCommand.canUndo()) {
+ addLinkCommand.undo();
+ }
+ }
+
+ @Override
+ public void redo() {
+ if (addLinkCommand != null && addLinkCommand.canRedo()) {
+ addLinkCommand.redo();
+ }
+ }
+
+ @Override
+ public void dispose() {
+ if (addLinkCommand != null) {
+ addLinkCommand.dispose();
+ addLinkCommand = null;
+ }
+ super.dispose();
+ }
+ };
+
+ return new AddHyperlinkCommand();
+ }
+ }
} catch (Exception e) {
Activator.log.error("Impossible to load hyperlinks", e);
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF
index c8e4cf25064..1b534447835 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/META-INF/MANIFEST.MF
@@ -1,28 +1,28 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="1.2.0",
- org.eclipse.core.expressions;bundle-version="3.4.300",
- org.eclipse.papyrus.views.modelexplorer;bundle-version="1.2.0",
- org.eclipse.ui.navigator;bundle-version="3.5.100",
- org.eclipse.core.runtime;bundle-version="3.7.0",
- org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.services.navigation;bundle-version="1.2.0"
-Export-Package: org.eclipse.papyrus.infra.gmfdiag.navigation,
- org.eclipse.papyrus.infra.gmfdiag.navigation.decorator,
- org.eclipse.papyrus.infra.gmfdiag.navigation.preference
-Bundle-Vendor: %providerName
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.2.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.navigation.Activator
-Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.navigation;singleton:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="1.2.0",
+ org.eclipse.core.expressions;bundle-version="3.4.300",
+ org.eclipse.papyrus.views.modelexplorer;bundle-version="1.2.0",
+ org.eclipse.ui.navigator;bundle-version="3.5.100",
+ org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.services.navigation;bundle-version="1.2.0"
+Export-Package: org.eclipse.papyrus.infra.gmfdiag.navigation,
+ org.eclipse.papyrus.infra.gmfdiag.navigation.decorator,
+ org.eclipse.papyrus.infra.gmfdiag.navigation.preference
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.navigation.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.navigation;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/editpolicy/NavigationEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/editpolicy/NavigationEditPolicy.java
index 5cdba30ed22..06121f1c88d 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/editpolicy/NavigationEditPolicy.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/editpolicy/NavigationEditPolicy.java
@@ -1,299 +1,299 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.navigation.editpolicy;
-
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RootEditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
-import org.eclipse.gef.requests.SelectionRequest;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
-import org.eclipse.papyrus.infra.services.navigation.service.NavigableElement;
-import org.eclipse.papyrus.infra.services.navigation.service.NavigationService;
-import org.eclipse.papyrus.infra.widgets.editors.SelectionMenu;
-import org.eclipse.papyrus.views.modelexplorer.Activator;
-
-/**
- * An edit policy to use the {@link NavigationService} on GMF Diagrams
- *
- * @author Camille Letavernier
- *
- */
-public class NavigationEditPolicy extends GraphicalEditPolicy {
-
- public static final String EDIT_POLICY_ID = "org.eclipse.papyrus.infra.gmfdiag.navigation.NavigationEditPolicy";
-
- private ViewerContext viewerContext;
-
- @Override
- public void activate() {
- super.activate();
- initViewerContext();
-
- if (viewerContext == null) {
- return;
- }
- }
-
- private void initViewerContext() {
- if (getHost() == getRoot()) {
- EditPartViewer viewer = getHost().getViewer();
- viewerContext = new ViewerContext(viewer);
- } else {
- EditPolicy rootNavigationEditPolicy = getRoot().getEditPolicy(EDIT_POLICY_ID);
- if (rootNavigationEditPolicy instanceof NavigationEditPolicy) {
- this.viewerContext = ((NavigationEditPolicy) rootNavigationEditPolicy).viewerContext;
- }
- }
- }
-
- @Override
- public void showTargetFeedback(Request request) {
- super.showTargetFeedback(request);
-
- if (viewerContext == null) {
- return;
- }
-
- // Do not install navigation on the root
- if (getRoot() == getHost()) {
- return;
- }
-
- if (request instanceof SelectionRequest) {
- SelectionRequest selectionRequest = (SelectionRequest) request;
- viewerContext.handleRequest(selectionRequest);
- }
- }
-
- @Override
- public Command getCommand(Request request) {
- if (request instanceof SelectionRequest && viewerContext != null) {
- return viewerContext.navigate((SelectionRequest) request);
- }
- return super.getCommand(request);
- }
-
- private EditPart getRoot() {
- RootEditPart rootEditPart = getHost().getRoot();
- return rootEditPart.getContents();
- }
-
- // A Single ViewerContext for each diagram (Root EditPartViewer)
- private class ViewerContext {
-
- private EditPartViewer editPartViewer;
-
- private EObject currentModel;
-
- private SelectionMenu selectionMenu;
-
- private boolean wasUnderlined;
-
- private WrappingLabel lastWrappingLabel;
-
- public void handleRequest(SelectionRequest request) {
- if (isExitState(request)) {
- exitItem();
- }
-
- if (isEnterState(request)) {
- enterItem(currentModel, request);
- }
- }
-
- public Command navigate(final SelectionRequest request) {
- if (!isAlt(request)) {
- return null;
- }
-
- final NavigableElement element = getElementToNavigate(request);
- if (element == null) {
- return null;
- }
-
- return new Command() {
-
- @Override
- public void execute() {
- try {
- getNavigationService(request).navigate(element);
- } catch (ServiceException ex) {
- Activator.log.error(ex);
- }
- exitItem();
- }
- };
- }
-
- private NavigableElement getElementToNavigate(SelectionRequest request) {
- try {
- List<NavigableElement> navigableElements = getNavigationService(request).getNavigableElements(getEditPart(request));
- if (navigableElements.isEmpty()) {
- return null;
- }
-
- for (NavigableElement element : navigableElements) {
- if (element.isEnabled()) {
- return element;
- }
- }
- } catch (ServiceException ex) {
- // Ignore: the service is not available, do nothing
- }
- return null;
- }
-
- private NavigationService getNavigationService(SelectionRequest request) throws ServiceException {
- return getServicesRegistry().getService(NavigationService.class);
- }
-
- public ViewerContext(EditPartViewer editPartViewer) {
- this.editPartViewer = editPartViewer;
- }
-
- private boolean isExitState(SelectionRequest request) {
- if (currentModel == null) {
- return false;
- }
-
- EObject newModel = getModel(request);
- if (newModel == null) {
- return true;
- }
-
- if (newModel != currentModel) {
- return true;
- }
-
- if (!isAlt(request)) {
- return true;
- }
-
- return false;
- }
-
- private boolean isEnterState(SelectionRequest request) {
- EObject model = getModel(request);
- if (model == currentModel) {
- return false;
- }
-
- if (model == null) {
- return false;
- }
-
- if (!isAlt(request)) {
- return false;
- }
-
- currentModel = model;
-
- return true;
- }
-
- private boolean isAlt(SelectionRequest request) {
- return request.isAltKeyPressed();
- }
-
- private EObject getModel(SelectionRequest request) {
- return EMFHelper.getEObject(getEditPart(request));
-
- }
-
- private EditPart getEditPart(SelectionRequest request) {
- return editPartViewer.findObjectAt(request.getLocation());
- }
-
- private void disposeCurrentMenu() {
- if (selectionMenu != null) {
- selectionMenu.dispose();
- selectionMenu = null;
- }
- }
-
- private void exitItem() {
- if (lastWrappingLabel != null) {
- lastWrappingLabel.setTextUnderline(wasUnderlined);
- }
- wasUnderlined = false;
- lastWrappingLabel = null;
- currentModel = null;
- disposeCurrentMenu();
- }
-
- private void enterItem(EObject model, SelectionRequest request) {
- try {
- EditPart targetEditPart = getEditPart(request);
-
- final NavigationService navigation = getServicesRegistry().getService(NavigationService.class);
- disposeCurrentMenu();
- selectionMenu = navigation.createNavigationList(targetEditPart, editPartViewer.getControl());
- if (selectionMenu == null) {
- return;
- }
-
- wasUnderlined = false;
- if (targetEditPart instanceof IGraphicalEditPart) {
- IGraphicalEditPart graphicalEditPart = (IGraphicalEditPart) targetEditPart;
- IFigure figure = graphicalEditPart.getFigure();
- if (figure instanceof WrappingLabel) {
- lastWrappingLabel = ((WrappingLabel) figure);
- wasUnderlined = lastWrappingLabel.isTextUnderlined();
- lastWrappingLabel.setTextUnderline(!wasUnderlined);
- }
- }
-
- selectionMenu.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- if (event.getSelection().isEmpty()) {
- return;
- }
- Object selectedElement = ((IStructuredSelection) event.getSelection()).getFirstElement();
- if (selectedElement instanceof NavigableElement) {
- NavigableElement navigableElement = (NavigableElement) selectedElement;
- navigate(navigableElement, navigation);
- }
- }
- });
- } catch (ServiceException ex) {
- Activator.log.error(ex);
- }
- }
-
- private void navigate(NavigableElement navigableElement, NavigationService navigationService) {
- navigationService.navigate(navigableElement);
- exitItem();
- }
-
- private ServicesRegistry getServicesRegistry() throws ServiceException {
- return ServiceUtilsForEditPart.getInstance().getServiceRegistry(getHost());
- }
-
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.navigation.editpolicy;
+
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RootEditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.navigation.Activator;
+import org.eclipse.papyrus.infra.services.navigation.service.NavigableElement;
+import org.eclipse.papyrus.infra.services.navigation.service.NavigationService;
+import org.eclipse.papyrus.infra.widgets.editors.SelectionMenu;
+
+/**
+ * An edit policy to use the {@link NavigationService} on GMF Diagrams
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class NavigationEditPolicy extends GraphicalEditPolicy {
+
+ public static final String EDIT_POLICY_ID = "org.eclipse.papyrus.infra.gmfdiag.navigation.NavigationEditPolicy";
+
+ private ViewerContext viewerContext;
+
+ @Override
+ public void activate() {
+ super.activate();
+ initViewerContext();
+
+ if (viewerContext == null) {
+ return;
+ }
+ }
+
+ private void initViewerContext() {
+ if (getHost() == getRoot()) {
+ EditPartViewer viewer = getHost().getViewer();
+ viewerContext = new ViewerContext(viewer);
+ } else {
+ EditPolicy rootNavigationEditPolicy = getRoot().getEditPolicy(EDIT_POLICY_ID);
+ if (rootNavigationEditPolicy instanceof NavigationEditPolicy) {
+ this.viewerContext = ((NavigationEditPolicy) rootNavigationEditPolicy).viewerContext;
+ }
+ }
+ }
+
+ @Override
+ public void showTargetFeedback(Request request) {
+ super.showTargetFeedback(request);
+
+ if (viewerContext == null) {
+ return;
+ }
+
+ // Do not install navigation on the root
+ if (getRoot() == getHost()) {
+ return;
+ }
+
+ if (request instanceof SelectionRequest) {
+ SelectionRequest selectionRequest = (SelectionRequest) request;
+ viewerContext.handleRequest(selectionRequest);
+ }
+ }
+
+ @Override
+ public Command getCommand(Request request) {
+ if (request instanceof SelectionRequest && viewerContext != null) {
+ return viewerContext.navigate((SelectionRequest) request);
+ }
+ return super.getCommand(request);
+ }
+
+ private EditPart getRoot() {
+ RootEditPart rootEditPart = getHost().getRoot();
+ return rootEditPart.getContents();
+ }
+
+ // A Single ViewerContext for each diagram (Root EditPartViewer)
+ private class ViewerContext {
+
+ private EditPartViewer editPartViewer;
+
+ private EObject currentModel;
+
+ private SelectionMenu selectionMenu;
+
+ private boolean wasUnderlined;
+
+ private WrappingLabel lastWrappingLabel;
+
+ public void handleRequest(SelectionRequest request) {
+ if (isExitState(request)) {
+ exitItem();
+ }
+
+ if (isEnterState(request)) {
+ enterItem(currentModel, request);
+ }
+ }
+
+ public Command navigate(final SelectionRequest request) {
+ if (!isAlt(request)) {
+ return null;
+ }
+
+ final NavigableElement element = getElementToNavigate(request);
+ if (element == null) {
+ return null;
+ }
+
+ return new Command() {
+
+ @Override
+ public void execute() {
+ try {
+ getNavigationService(request).navigate(element);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+ exitItem();
+ }
+ };
+ }
+
+ private NavigableElement getElementToNavigate(SelectionRequest request) {
+ try {
+ List<NavigableElement> navigableElements = getNavigationService(request).getNavigableElements(getEditPart(request));
+ if (navigableElements.isEmpty()) {
+ return null;
+ }
+
+ for (NavigableElement element : navigableElements) {
+ if (element.isEnabled()) {
+ return element;
+ }
+ }
+ } catch (ServiceException ex) {
+ // Ignore: the service is not available, do nothing
+ }
+ return null;
+ }
+
+ private NavigationService getNavigationService(SelectionRequest request) throws ServiceException {
+ return getServicesRegistry().getService(NavigationService.class);
+ }
+
+ public ViewerContext(EditPartViewer editPartViewer) {
+ this.editPartViewer = editPartViewer;
+ }
+
+ private boolean isExitState(SelectionRequest request) {
+ if (currentModel == null) {
+ return false;
+ }
+
+ EObject newModel = getModel(request);
+ if (newModel == null) {
+ return true;
+ }
+
+ if (newModel != currentModel) {
+ return true;
+ }
+
+ if (!isAlt(request)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ private boolean isEnterState(SelectionRequest request) {
+ EObject model = getModel(request);
+ if (model == currentModel) {
+ return false;
+ }
+
+ if (model == null) {
+ return false;
+ }
+
+ if (!isAlt(request)) {
+ return false;
+ }
+
+ currentModel = model;
+
+ return true;
+ }
+
+ private boolean isAlt(SelectionRequest request) {
+ return request.isAltKeyPressed();
+ }
+
+ private EObject getModel(SelectionRequest request) {
+ return EMFHelper.getEObject(getEditPart(request));
+
+ }
+
+ private EditPart getEditPart(SelectionRequest request) {
+ return editPartViewer.findObjectAt(request.getLocation());
+ }
+
+ private void disposeCurrentMenu() {
+ if (selectionMenu != null) {
+ selectionMenu.dispose();
+ selectionMenu = null;
+ }
+ }
+
+ private void exitItem() {
+ if (lastWrappingLabel != null) {
+ lastWrappingLabel.setTextUnderline(wasUnderlined);
+ }
+ wasUnderlined = false;
+ lastWrappingLabel = null;
+ currentModel = null;
+ disposeCurrentMenu();
+ }
+
+ private void enterItem(EObject model, SelectionRequest request) {
+ try {
+ EditPart targetEditPart = getEditPart(request);
+
+ final NavigationService navigation = getServicesRegistry().getService(NavigationService.class);
+ disposeCurrentMenu();
+ selectionMenu = navigation.createNavigationList(targetEditPart, editPartViewer.getControl());
+ if (selectionMenu == null) {
+ return;
+ }
+
+ wasUnderlined = false;
+ if (targetEditPart instanceof IGraphicalEditPart) {
+ IGraphicalEditPart graphicalEditPart = (IGraphicalEditPart) targetEditPart;
+ IFigure figure = graphicalEditPart.getFigure();
+ if (figure instanceof WrappingLabel) {
+ lastWrappingLabel = ((WrappingLabel) figure);
+ wasUnderlined = lastWrappingLabel.isTextUnderlined();
+ lastWrappingLabel.setTextUnderline(!wasUnderlined);
+ }
+ }
+
+ selectionMenu.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ if (event.getSelection().isEmpty()) {
+ return;
+ }
+ Object selectedElement = ((IStructuredSelection) event.getSelection()).getFirstElement();
+ if (selectedElement instanceof NavigableElement) {
+ NavigableElement navigableElement = (NavigableElement) selectedElement;
+ navigate(navigableElement, navigation);
+ }
+ }
+ });
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+ private void navigate(NavigableElement navigableElement, NavigationService navigationService) {
+ navigationService.navigate(navigableElement);
+ exitItem();
+ }
+
+ private ServicesRegistry getServicesRegistry() throws ServiceException {
+ return ServiceUtilsForEditPart.getInstance().getServiceRegistry(getHost());
+ }
+
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.viewersearcher/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.viewersearcher/META-INF/MANIFEST.MF
index 8eec3f71096..053b7d2aead 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.viewersearcher/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.viewersearcher/META-INF/MANIFEST.MF
@@ -1,17 +1,19 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.papyrus.infra.services.viewersearch;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
- org.eclipse.emf.ecore;bundle-version="2.9.0",
- org.eclipse.gmf.runtime.diagram.core;bundle-version="1.6.0",
- org.eclipse.papyrus.views.search;bundle-version="1.2.0",
- org.eclipse.search;bundle-version="3.8.100"
-Bundle-Vendor: %vendorName
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.2.0.qualifier
-Bundle-Localization: plugin
-Bundle-Name: %pluginName
-Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.viewersearcher.Activator
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.viewersearcher;singleton:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.services.viewersearch;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
+ org.eclipse.emf.ecore;bundle-version="2.9.0",
+ org.eclipse.gmf.runtime.diagram.core;bundle-version="1.6.0",
+ org.eclipse.papyrus.views.search;bundle-version="1.2.0",
+ org.eclipse.search;bundle-version="3.8.100",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0"
+Bundle-Vendor: %vendorName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.2.0.qualifier
+Bundle-Localization: plugin
+Bundle-Name: %pluginName
+Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.viewersearcher.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.viewersearcher;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.viewersearcher/src/org/eclipse/papyrus/infra/gmfdiag/viewersearcher/DiagramViewerSearcher.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.viewersearcher/src/org/eclipse/papyrus/infra/gmfdiag/viewersearcher/DiagramViewerSearcher.java
index 5852d1611fc..7cbd528b83b 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.viewersearcher/src/org/eclipse/papyrus/infra/gmfdiag/viewersearcher/DiagramViewerSearcher.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.viewersearcher/src/org/eclipse/papyrus/infra/gmfdiag/viewersearcher/DiagramViewerSearcher.java
@@ -1,94 +1,179 @@
-/*****************************************************************************
- * 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
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- * Christian W. Damus (CEA) - bug 426732
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.viewersearcher;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature.Setting;
-import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.services.viewersearch.impl.AbstractViewerSearcher;
-
-/**
- *
- * Contributes to the viewersearchservice by providing the ability to search viewers in GMF diagrams
- *
- */
-public class DiagramViewerSearcher extends AbstractViewerSearcher {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.services.viewersearch.impl.AbstractViewerSearcher#getViewers(java.util.Collection, java.util.Collection)
- *
- * @param modelElements
- * @param modelSets
- * @return
- */
- @Override
- public Map<Object, Map<Object, Object>> getViewers(Collection<Object> modelElements, Collection<ModelSet> modelSets) {
-
- Map<Object, Map<Object, Object>> results = new HashMap<Object, Map<Object, Object>>();
-
- for (ModelSet modelSet : modelSets) {
-
- Map<EObject, Collection<Setting>> references = crossReference(modelElements, modelSet);
-
- for (Object semanticElement : references.keySet()) {
- for (Setting setting : references.get(semanticElement)) {
- if (setting.getEObject() instanceof View) {
- // Diagram diagram = ((View)setting.getEObject()).getDiagram();
- Map<Object, Object> viewMappings;
-
- if (results.containsKey(modelSet)) {
- viewMappings = results.get(modelSet);
- } else {
- viewMappings = new HashMap<Object, Object>();
- }
- viewMappings.put(setting.getEObject(), semanticElement);
-
- results.put(modelSet, viewMappings);
- }
- }
- }
- }
-
- return results;
- }
-
- private Map<EObject, Collection<Setting>> crossReference(Collection<?> modelElements, ModelSet modelSet) {
- Map<EObject, Collection<Setting>> result;
-
- final ECrossReferenceAdapter xrefs = ECrossReferenceAdapter.getCrossReferenceAdapter(modelSet);
- if (xrefs == null) {
- // one-off usage cross referencer
- result = EcoreUtil.UsageCrossReferencer.findAll(modelElements, modelSet);
- } else {
- result = new HashMap<EObject, Collection<Setting>>();
- for (Object next : modelElements) {
- if (next instanceof EObject) {
- EObject eObject = (EObject) next;
- result.put(eObject, xrefs.getInverseReferences(eObject));
- }
- }
- }
-
- return result;
- }
-}
+/*****************************************************************************
+ * 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 426732
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.viewersearcher;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature.Setting;
+import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
+import org.eclipse.papyrus.infra.services.viewersearch.impl.AbstractViewerSearcher;
+
+/**
+ *
+ * Contributes to the viewersearchservice by providing the ability to search viewers in GMF diagrams
+ *
+ */
+public class DiagramViewerSearcher extends AbstractViewerSearcher {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.services.viewersearch.impl.AbstractViewerSearcher#getViewers(java.util.Collection, java.util.Collection)
+ *
+ * @param modelElements
+ * @param modelSets
+ * @return
+ */
+ @Override
+ public Map<Object, Map<Object, Object>> getViewers(Collection<Object> modelElements, Collection<ModelSet> modelSets) {
+
+ Map<Object, Map<Object, Object>> results = new HashMap<Object, Map<Object, Object>>();
+
+ for (ModelSet modelSet : modelSets) {
+
+ Map<EObject, Collection<Setting>> references = crossReference(modelElements, modelSet);
+
+ for (Object semanticElement : references.keySet()) {
+ for (Setting setting : references.get(semanticElement)) {
+ if (setting.getEObject() instanceof View) {
+ // Diagram diagram = ((View)setting.getEObject()).getDiagram();
+ Map<Object, Object> viewMappings;
+
+ if (results.containsKey(modelSet)) {
+ viewMappings = results.get(modelSet);
+ } else {
+ viewMappings = new HashMap<Object, Object>();
+ }
+ viewMappings.put(setting.getEObject(), semanticElement);
+
+ results.put(modelSet, viewMappings);
+ }
+ }
+ }
+ }
+
+ return results;
+ }
+
+ private Map<EObject, Collection<Setting>> crossReference(Collection<?> modelElements, ModelSet modelSet) {
+ Map<EObject, Collection<Setting>> result;
+
+ final ECrossReferenceAdapter xrefs = ECrossReferenceAdapter.getCrossReferenceAdapter(modelSet);
+ if (xrefs == null) {
+ // one-off usage cross referencer
+ result = EcoreUtil.UsageCrossReferencer.findAll(modelElements, modelSet);
+ } else {
+ result = new HashMap<EObject, Collection<Setting>>();
+ for (Object next : modelElements) {
+ if (next instanceof EObject) {
+ EObject eObject = (EObject) next;
+ result.put(eObject, xrefs.getInverseReferences(eObject));
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.services.viewersearch.impl.AbstractViewerSearcher#getViewersInCurrentModel(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject, boolean, boolean)
+ *
+ * @param element
+ * @param container
+ * @param pagesOnly
+ * @param openPagesOnly
+ * @return
+ */
+ @Override
+ public List<Object> getViewersInCurrentModel(EObject element, EObject container, boolean pagesOnly, boolean openPagesOnly) {
+ List<Object> objectsToSelect = new LinkedList<Object>();
+
+ if (element == null && container == null) {
+ return objectsToSelect;
+ }
+
+ IPageManager pageManager;
+ try {
+ if (element == null) {
+ pageManager = ServiceUtilsForEObject.getInstance().getServiceRegistry(container).getService(IPageManager.class);
+ } else {
+ pageManager = ServiceUtilsForEObject.getInstance().getServiceRegistry(element).getService(IPageManager.class);
+ }
+ } catch (Exception ex) {
+ return objectsToSelect;
+ }
+
+ try {
+ for (Object page : pageManager.allPages()) {
+
+ if (page instanceof Diagram) {
+ // TODO openPagesOnly: contributed by future navigation patch
+
+ // Container checks
+ if (container != null) {
+ EObject owner = DiagramUtils.getOwner((Diagram) page);
+ if (!owner.equals(container)) {
+ continue;
+ }
+ }
+
+ if (element == null) {
+ objectsToSelect.add(page);
+ continue;
+ }
+
+ try {
+ TreeIterator<EObject> allViews = ((Diagram) page).eAllContents();
+ while (allViews.hasNext()) {
+ EObject next = allViews.next();
+ if (!(next instanceof View)) {
+ allViews.prune();
+ continue;
+ }
+
+ View nextView = (View) next;
+ if (element.equals(nextView.getElement())) {
+ if (pagesOnly) {
+ objectsToSelect.add(page);
+ } else {
+ objectsToSelect.add(nextView);
+ }
+ break;
+ }
+ }
+ } catch (Exception e) {
+ return objectsToSelect;
+ }
+ }
+ }
+ } catch (Exception e) {
+ return objectsToSelect;
+ }
+
+ return objectsToSelect;
+ }
+}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/META-INF/MANIFEST.MF b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/META-INF/MANIFEST.MF
index 97fc539b2f1..cfa96760480 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/META-INF/MANIFEST.MF
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/META-INF/MANIFEST.MF
@@ -1,35 +1,36 @@
-Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.infra.hyperlink,
- org.eclipse.papyrus.infra.hyperlink.commands,
- org.eclipse.papyrus.infra.hyperlink.helper,
- org.eclipse.papyrus.infra.hyperlink.object,
- org.eclipse.papyrus.infra.hyperlink.ui,
- org.eclipse.papyrus.infra.hyperlink.util
-Require-Bundle: org.eclipse.emf.transaction,
- org.eclipse.gef,
- org.eclipse.gmf.runtime.notation.edit,
- org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0",
- org.eclipse.ui,
- org.eclipse.ui.ide;bundle-version="3.8.0",
- org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
- org.eclipse.ui.navigator;bundle-version="3.5.200",
- org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.2.0",
- org.eclipse.core.filesystem;bundle-version="1.3.200",
- org.eclipse.papyrus.infra.services.openelement;bundle-version="1.2.0",
- org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="1.2.0",
- org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.2.0",
- com.google.guava;bundle-version="11.0.0"
-Bundle-Vendor: %providerName
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.2.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.infra.hyperlink.Activator
-Bundle-Description: %pluginDescription
-Bundle-SymbolicName: org.eclipse.papyrus.infra.hyperlink;singleton:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.infra.hyperlink,
+ org.eclipse.papyrus.infra.hyperlink.commands,
+ org.eclipse.papyrus.infra.hyperlink.helper,
+ org.eclipse.papyrus.infra.hyperlink.object,
+ org.eclipse.papyrus.infra.hyperlink.service,
+ org.eclipse.papyrus.infra.hyperlink.ui,
+ org.eclipse.papyrus.infra.hyperlink.util
+Require-Bundle: org.eclipse.emf.transaction,
+ org.eclipse.gef,
+ org.eclipse.gmf.runtime.notation.edit,
+ org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0",
+ org.eclipse.ui,
+ org.eclipse.ui.ide;bundle-version="3.8.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
+ org.eclipse.ui.navigator;bundle-version="3.5.200",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.2.0",
+ org.eclipse.core.filesystem;bundle-version="1.3.200",
+ org.eclipse.papyrus.infra.services.openelement;bundle-version="1.2.0",
+ org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="1.2.0",
+ org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.2.0",
+ com.google.guava;bundle-version="11.0.0"
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.infra.hyperlink.Activator
+Bundle-Description: %pluginDescription
+Bundle-SymbolicName: org.eclipse.papyrus.infra.hyperlink;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/plugin.xml b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/plugin.xml
index 7b2a28f1e8b..818f9f2270b 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/plugin.xml
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/plugin.xml
@@ -1,46 +1,64 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension-point id="org.eclipse.papyrus.infra.hyperlink.registration" name="%extension-point.name" schema="schema/org.eclipse.papyrus.infra.hyperlink.registration.exsd"/>
- <extension-point id="org.eclipse.papyrus.infra.hyperlink.tab.registration" name="org.eclipse.papyrus.infra.hyperlink.tab.registration" schema="schema/org.eclipse.papyrus.infra.hyperlink.tab.registration.exsd"/>
- <extension-point id="org.eclipse.papyrus.infra.hyperlink.specificHyperLinks" name="org.eclipse.papyrus.infra.hyperlink.specificHyperLinks" schema="schema/specificHyperLinks.exsd"/>
- <extension
- point="org.eclipse.papyrus.infra.hyperlink.registration">
- <hyperlink
- helper="org.eclipse.papyrus.infra.hyperlink.helper.EditorHyperLinkHelper"
- position="50"
- tabId="org.eclipse.papyrus.infra.hyperlink.editor">
- </hyperlink>
- <hyperlink
- helper="org.eclipse.papyrus.infra.hyperlink.helper.ObjectHyperLinkHelper"
- position="75"
- tabId="org.eclipse.papyrus.infra.hyperlink.object">
- </hyperlink>
- <hyperlink
- helper="org.eclipse.papyrus.infra.hyperlink.helper.DocumentHyperLinkHelper"
- position="100"
- tabId="org.eclipse.papyrus.infra.hyperlink.documenteditor">
- </hyperlink>
- <hyperlink
- helper="org.eclipse.papyrus.infra.hyperlink.helper.WebHyperLinkHelper"
- position="150"
- tabId="org.eclipse.papyrus.infra.hyperlink.webeditor">
- </hyperlink>
- </extension>
- <extension
- point="org.eclipse.papyrus.infra.hyperlink.tab.registration">
- <hyperlinktab
- tabId="org.eclipse.papyrus.infra.hyperlink.defaulthyperlinktab"
- position="200"
- tab="org.eclipse.papyrus.infra.hyperlink.ui.DefaultHyperLinkTab">
- </hyperlinktab>
- </extension>
- <extension
- point="org.eclipse.papyrus.infra.services.labelprovider.labelProvider">
- <labelProvider
- priority="40"
- provider="org.eclipse.papyrus.infra.hyperlink.util.HyperLinkFilteredLabelProvider">
- </labelProvider>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="org.eclipse.papyrus.infra.hyperlink.registration" name="%extension-point.name" schema="schema/org.eclipse.papyrus.infra.hyperlink.registration.exsd"/>
+ <extension-point id="org.eclipse.papyrus.infra.hyperlink.tab.registration" name="org.eclipse.papyrus.infra.hyperlink.tab.registration" schema="schema/org.eclipse.papyrus.infra.hyperlink.tab.registration.exsd"/>
+ <extension-point id="org.eclipse.papyrus.infra.hyperlink.specificHyperLinks" name="org.eclipse.papyrus.infra.hyperlink.specificHyperLinks" schema="schema/specificHyperLinks.exsd"/>
+ <extension-point id="org.eclipse.papyrus.infra.hyperlink.hyperlinkContributor" name="hyperlinkContributor" schema="schema/hyperlinkContributor.exsd"/>
+ <extension
+ point="org.eclipse.papyrus.infra.core.service">
+ <service
+ classname="org.eclipse.papyrus.infra.hyperlink.service.impl.HyperlinkServiceImpl"
+ id="org.eclipse.papyrus.infra.hyperlink.service.HyperlinkService"
+ priority="1"
+ startKind="lazy">
+ </service>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory"
+ class="org.eclipse.papyrus.infra.hyperlink.preferences.HyperlinkServicePreferencesPage"
+ id="org.eclipse.papyrus.infra.hyperlink.preferences"
+ name="Hyperlink Service">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.hyperlink.registration">
+ <hyperlink
+ helper="org.eclipse.papyrus.infra.hyperlink.helper.EditorHyperLinkHelper"
+ position="50"
+ tabId="org.eclipse.papyrus.infra.hyperlink.editor">
+ </hyperlink>
+ <hyperlink
+ helper="org.eclipse.papyrus.infra.hyperlink.helper.ObjectHyperLinkHelper"
+ position="75"
+ tabId="org.eclipse.papyrus.infra.hyperlink.object">
+ </hyperlink>
+ <hyperlink
+ helper="org.eclipse.papyrus.infra.hyperlink.helper.DocumentHyperLinkHelper"
+ position="100"
+ tabId="org.eclipse.papyrus.infra.hyperlink.documenteditor">
+ </hyperlink>
+ <hyperlink
+ helper="org.eclipse.papyrus.infra.hyperlink.helper.WebHyperLinkHelper"
+ position="150"
+ tabId="org.eclipse.papyrus.infra.hyperlink.webeditor">
+ </hyperlink>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.hyperlink.tab.registration">
+ <hyperlinktab
+ tabId="org.eclipse.papyrus.infra.hyperlink.defaulthyperlinktab"
+ position="200"
+ tab="org.eclipse.papyrus.infra.hyperlink.ui.DefaultHyperLinkTab">
+ </hyperlinktab>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.services.labelprovider.labelProvider">
+ <labelProvider
+ priority="40"
+ provider="org.eclipse.papyrus.infra.hyperlink.util.HyperLinkFilteredLabelProvider">
+ </labelProvider>
+ </extension>
+</plugin>
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/schema/hyperlinkContributor.exsd b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/schema/hyperlinkContributor.exsd
new file mode 100644
index 00000000000..5b93f0dc93b
--- /dev/null
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/schema/hyperlinkContributor.exsd
@@ -0,0 +1,125 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.infra.hyperlink" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.papyrus.infra.hyperlink" id="org.eclipse.papyrus.infra.hyperlink.hyperlinkContributor" name="hyperlinkContributor"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <choice>
+ <element ref="contributor"/>
+ </choice>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="contributor">
+ <complexType>
+ <attribute name="contributor" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.hyperlink.contributor.HyperlinkContributor"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="label" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/ObjectHyperLinkHelper.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/ObjectHyperLinkHelper.java
index c6cbd4a1d15..deedb905123 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/ObjectHyperLinkHelper.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/helper/ObjectHyperLinkHelper.java
@@ -1,157 +1,161 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.hyperlink.helper;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EModelElement;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.emf.providers.EMFGraphicalContentProvider;
-import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
-import org.eclipse.papyrus.infra.hyperlink.Activator;
-import org.eclipse.papyrus.infra.hyperlink.commands.CreateHyperLinkObjectCommand;
-import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
-import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkSpecificObject;
-import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkConstants;
-import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
-import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
-import org.eclipse.papyrus.infra.widgets.providers.CompositeContentProvider;
-import org.eclipse.papyrus.infra.widgets.providers.ICompositeContentProvider;
-import org.eclipse.papyrus.infra.widgets.providers.IHierarchicContentProvider;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * An Hyperlink Helper for referencing objects (i.e. specific object within an
- * editor, such as a Specific Class in a Class Diagram)
- *
- * @author Camille Letavernier
- *
- */
-public class ObjectHyperLinkHelper extends AbstractHyperLinkHelper {
-
- @Override
- public String getNameofManagedHyperLink() {
- return "Specific object";
- }
-
- @Override
- public void executeNewMousePressed(List<HyperLinkObject> list, EObject aModel) {
- ServicesRegistry servicesRegistry;
- LabelProviderService labelProviderService;
- ModelSet modelSet;
- try {
- servicesRegistry = ServiceUtilsForEObject.getInstance().getServiceRegistry(aModel);
- if (servicesRegistry == null) {
- return;
- }
-
- labelProviderService = servicesRegistry.getService(LabelProviderService.class);
- modelSet = servicesRegistry.getService(ModelSet.class);
- } catch (ServiceException e) {
- Activator.log.error(e);
- return;
- }
-
- // Create and opens a dialog for page models
- TreeSelectorDialog selectionDialog = new TreeSelectorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
- selectionDialog.setBlockOnOpen(true);
-
- IHierarchicContentProvider semanticProvider = getContentProvider();
- ITreeContentProvider graphicalProvider = new EMFGraphicalContentProvider(semanticProvider, modelSet, Activator.PLUGIN_ID + ".specificHyperLinks");
-
- selectionDialog.setContentProvider(graphicalProvider);
- selectionDialog.setLabelProvider(labelProviderService.getLabelProvider());
- selectionDialog.setInput(aModel);
- selectionDialog.open();
- if (selectionDialog.getReturnCode() == Window.OK) {
- Object[] result = selectionDialog.getResult();
- for (Object resultElement : result) {
- if (resultElement instanceof EObject) {
- list.add(new HyperLinkSpecificObject((EObject) resultElement));
- }
- }
- }
- }
-
- public static final String EXTENSION_ID = Activator.PLUGIN_ID + ".specificHyperLinks";
-
- protected IHierarchicContentProvider getContentProvider() {
- ICompositeContentProvider provider = new CompositeContentProvider();
-
- IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
-
- for (IConfigurationElement e : configElements) {
- try {
- Object contentProviderObject = e.createExecutableExtension("contentProvider");
- if (!(contentProviderObject instanceof ITreeContentProvider)) {
- Activator.log.warn("Plugin " + e.getContributor() + " contributed an invalid extension for " + EXTENSION_ID + ". The content provider must be a ITreeContentProvider");
- continue;
- }
-
- ITreeContentProvider contentProvider = (ITreeContentProvider) contentProviderObject;
- provider.appendContentProvider(contentProvider);
- } catch (Exception ex) {
- Activator.log.error("Plugin " + e.getContributor() + " contributed an invalid extension for " + EXTENSION_ID, ex);
- }
- }
-
- return provider;
- }
-
- @Override
- public List<HyperLinkObject> getFilteredObject(List<HyperLinkObject> hyperLinkObjects) {
- List<HyperLinkObject> result = new LinkedList<HyperLinkObject>();
- for (HyperLinkObject object : hyperLinkObjects) {
- if (object instanceof HyperLinkSpecificObject) {
- result.add(object);
- }
- }
- return result;
- }
-
- @Override
- public HyperLinkObject getHyperLinkObject(EAnnotation eAnnotation) {
- if (HyperLinkConstants.PAPYRUS_HYPERLINK_SPECIFIC_ELEMENT.equals(eAnnotation.getSource())) {
- if (!eAnnotation.getReferences().isEmpty()) {
- HyperLinkSpecificObject specificObjectHyperlink = new HyperLinkSpecificObject();
- specificObjectHyperlink.setTargetElement(eAnnotation.getReferences().get(0));
- specificObjectHyperlink.setIsDefault(Boolean.parseBoolean(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_IS_DEFAULT_NAVIGATION)));
- specificObjectHyperlink.setTooltipText(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_TOOLTYPE_TEXT));
- return specificObjectHyperlink;
- }
- }
-
- return null;
- }
-
- @Override
- public RecordingCommand getAddHyperLinkCommand(TransactionalEditingDomain domain, EModelElement object, HyperLinkObject hyperLinkObject) {
- if (hyperLinkObject instanceof HyperLinkSpecificObject) {
- HyperLinkSpecificObject hyperLinkSpecificObject = (HyperLinkSpecificObject) hyperLinkObject;
- return new CreateHyperLinkObjectCommand(domain, object, hyperLinkSpecificObject.getTooltipText(), HyperLinkConstants.PAPYRUS_HYPERLINK_SPECIFIC_ELEMENT, hyperLinkSpecificObject.getTargetElement(), hyperLinkObject.getIsDefault());
- }
- return null;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.hyperlink.helper;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.emf.providers.EMFGraphicalContentProvider;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.hyperlink.Activator;
+import org.eclipse.papyrus.infra.hyperlink.commands.CreateHyperLinkObjectCommand;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkSpecificObject;
+import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkConstants;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
+import org.eclipse.papyrus.infra.widgets.providers.CompositeContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.ICompositeContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.IHierarchicContentProvider;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * An Hyperlink Helper for referencing objects (i.e. specific object within an
+ * editor, such as a Specific Class in a Class Diagram)
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class ObjectHyperLinkHelper extends AbstractHyperLinkHelper {
+
+ @Override
+ public String getNameofManagedHyperLink() {
+ return "Specific object";
+ }
+
+ @Override
+ public void executeNewMousePressed(List<HyperLinkObject> list, EObject aModel) {
+ ServicesRegistry servicesRegistry;
+ LabelProviderService labelProviderService;
+ ModelSet modelSet;
+ try {
+ servicesRegistry = ServiceUtilsForEObject.getInstance().getServiceRegistry(aModel);
+ if (servicesRegistry == null) {
+ return;
+ }
+
+ labelProviderService = servicesRegistry.getService(LabelProviderService.class);
+ modelSet = servicesRegistry.getService(ModelSet.class);
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ return;
+ }
+
+ // Create and opens a dialog for page models
+ TreeSelectorDialog selectionDialog = new TreeSelectorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+ selectionDialog.setBlockOnOpen(true);
+
+ IHierarchicContentProvider semanticProvider = getContentProvider();
+ ITreeContentProvider graphicalProvider = new EMFGraphicalContentProvider(semanticProvider, modelSet, Activator.PLUGIN_ID + ".specificHyperLinks");
+
+ selectionDialog.setContentProvider(graphicalProvider);
+ selectionDialog.setLabelProvider(labelProviderService.getLabelProvider());
+ selectionDialog.setInput(aModel);
+ selectionDialog.open();
+ if (selectionDialog.getReturnCode() == Window.OK) {
+ Object[] result = selectionDialog.getResult();
+ for (Object resultElement : result) {
+ if (resultElement instanceof EObject) {
+ list.add(new HyperLinkSpecificObject((EObject) resultElement));
+ }
+ }
+ }
+ }
+
+ public static final String EXTENSION_ID = Activator.PLUGIN_ID + ".specificHyperLinks";
+
+ protected IHierarchicContentProvider getContentProvider() {
+ ICompositeContentProvider provider = new CompositeContentProvider();
+
+ IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
+
+ for (IConfigurationElement e : configElements) {
+ try {
+ Object contentProviderObject = e.createExecutableExtension("contentProvider");
+ if (!(contentProviderObject instanceof ITreeContentProvider)) {
+ Activator.log.warn("Plugin " + e.getContributor() + " contributed an invalid extension for " + EXTENSION_ID + ". The content provider must be a ITreeContentProvider");
+ continue;
+ }
+
+ ITreeContentProvider contentProvider = (ITreeContentProvider) contentProviderObject;
+ provider.appendContentProvider(contentProvider);
+ } catch (Exception ex) {
+ Activator.log.error("Plugin " + e.getContributor() + " contributed an invalid extension for " + EXTENSION_ID, ex);
+ }
+ }
+
+ return provider;
+ }
+
+ @Override
+ public List<HyperLinkObject> getFilteredObject(List<HyperLinkObject> hyperLinkObjects) {
+ List<HyperLinkObject> result = new LinkedList<HyperLinkObject>();
+ for (HyperLinkObject object : hyperLinkObjects) {
+ if (object instanceof HyperLinkSpecificObject) {
+ result.add(object);
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public HyperLinkObject getHyperLinkObject(EAnnotation eAnnotation) {
+ if (HyperLinkConstants.PAPYRUS_HYPERLINK_SPECIFIC_ELEMENT.equals(eAnnotation.getSource())) {
+ if (!eAnnotation.getReferences().isEmpty()) {
+ HyperLinkSpecificObject specificObjectHyperlink = new HyperLinkSpecificObject();
+ specificObjectHyperlink.setTargetElement(eAnnotation.getReferences().get(0));
+ specificObjectHyperlink.setIsDefault(Boolean.parseBoolean(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_IS_DEFAULT_NAVIGATION)));
+ specificObjectHyperlink.setTooltipText(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_TOOLTYPE_TEXT));
+ return specificObjectHyperlink;
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public RecordingCommand getAddHyperLinkCommand(TransactionalEditingDomain domain, EModelElement object, HyperLinkObject hyperLinkObject) {
+ if (hyperLinkObject instanceof HyperLinkSpecificObject) {
+ HyperLinkSpecificObject hyperLinkSpecificObject = (HyperLinkSpecificObject) hyperLinkObject;
+ return new CreateHyperLinkObjectCommand(domain, object, hyperLinkSpecificObject.getTooltipText(), HyperLinkConstants.PAPYRUS_HYPERLINK_SPECIFIC_ELEMENT, hyperLinkSpecificObject.getTargetElement(), hyperLinkObject.getIsDefault());
+ }
+ return null;
+ }
+}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/preferences/HyperlinkServicePreferencesPage.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/preferences/HyperlinkServicePreferencesPage.java
new file mode 100644
index 00000000000..3756482688b
--- /dev/null
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/preferences/HyperlinkServicePreferencesPage.java
@@ -0,0 +1,218 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.hyperlink.preferences;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.jface.window.ToolTip;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.hyperlink.Activator;
+import org.eclipse.papyrus.infra.hyperlink.service.impl.HyperlinkServiceImpl;
+import org.eclipse.papyrus.infra.hyperlink.service.impl.HyperlinkServiceImpl.ContributorDescriptor;
+import org.eclipse.papyrus.infra.hyperlink.service.impl.HyperlinkServiceImpl.HyperlinkContributorDescriptor;
+import org.eclipse.papyrus.infra.widgets.providers.CollectionContentProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.TableEditor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.osgi.service.prefs.BackingStoreException;
+
+public class HyperlinkServicePreferencesPage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ public static final int ACTIVATION_COLUMN = 0;
+
+ private Map<HyperlinkContributorDescriptor, Button> hyperlinkCheckboxes;
+
+ private HyperlinkServiceImpl hyperlinkService = new HyperlinkServiceImpl();
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public HyperlinkServicePreferencesPage() {
+ super("Hyperlink Services", org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImageDescriptor("/icons/papyrus.png"));
+ }
+
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ setDescription("Papyrus hyperlink services configuration.\nSelect the strategies you wish to activate.");
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+
+ Composite self = new Composite(parent, SWT.NONE);
+ self.setLayout(new GridLayout(1, true));
+ self.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ final TableViewer tableViewer = new TableViewer(self, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ tableViewer.getTable().setLayoutData(gridData);
+
+ ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.NO_RECREATE);
+
+ tableViewer.setContentProvider(CollectionContentProvider.instance);
+
+ try {
+ hyperlinkService.startService();
+ } catch (ServiceException ex) {
+ return self;
+ }
+
+ tableViewer.setLabelProvider(new ColumnLabelProvider() {
+
+ @Override
+ public void update(ViewerCell cell) {
+ if (cell.getColumnIndex() == 1) {
+ super.update(cell);
+ } else {
+ return;
+ }
+ }
+
+ @Override
+ public String getToolTipText(Object element) {
+ if (element instanceof ContributorDescriptor) {
+ return ((ContributorDescriptor) element).getDescription();
+ }
+ return super.getToolTipText(element);
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof ContributorDescriptor) {
+ return null;
+ }
+ return super.getImage(element);
+ }
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof ContributorDescriptor) {
+ return ((ContributorDescriptor) element).getLabel();
+ }
+ return super.getText(element);
+ }
+ });
+
+ TableLayout layout = new TableLayout();
+
+ new TableColumn(tableViewer.getTable(), SWT.LEFT);
+ layout.addColumnData(new ColumnWeightData(10, 25, false));
+
+ new TableColumn(tableViewer.getTable(), SWT.LEFT);
+ layout.addColumnData(new ColumnWeightData(100, 250, true));
+
+ tableViewer.getTable().setLayout(layout);
+ tableViewer.getTable().setHeaderVisible(false);
+
+ List<ContributorDescriptor> contributorDescriptors = new LinkedList<ContributorDescriptor>();
+ contributorDescriptors.addAll(hyperlinkService.getHyperlinkContributors());
+
+ tableViewer.setInput(contributorDescriptors);
+
+ hyperlinkCheckboxes = new HashMap<HyperlinkContributorDescriptor, Button>();
+
+ for (TableItem item : tableViewer.getTable().getItems()) {
+ if (item.getData() instanceof ContributorDescriptor) {
+ TableEditor editor = new TableEditor(tableViewer.getTable());
+
+ final Button button = new Button(tableViewer.getTable(), SWT.CHECK);
+ final TableItem currentItem = item;
+
+ final ContributorDescriptor strategy = (ContributorDescriptor) currentItem.getData();
+
+ if (strategy instanceof HyperlinkContributorDescriptor) {
+ hyperlinkCheckboxes.put((HyperlinkContributorDescriptor) strategy, button);
+ }
+
+ button.setSelection(strategy.isActive());
+
+ editor.setEditor(button, item, ACTIVATION_COLUMN);
+ editor.horizontalAlignment = SWT.CENTER;
+ editor.grabHorizontal = true;
+
+ }
+ }
+
+ return self;
+ }
+
+ @Override
+ protected void performDefaults() {
+ restoreDefaults();
+ super.performDefaults();
+ }
+
+ @Override
+ protected void performApply() {
+ IPreferenceStore preferences = Activator.getDefault().getPreferenceStore();
+
+ for (Map.Entry<HyperlinkContributorDescriptor, Button> entry : hyperlinkCheckboxes.entrySet()) {
+ boolean checked = entry.getValue().getSelection();
+ String isActiveKey = HyperlinkContributorDescriptor.getIsActiveKey(entry.getKey());
+ preferences.setValue(isActiveKey, checked);
+ }
+
+ try {
+ IEclipsePreferences preferenceStore = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
+ preferenceStore.flush();
+ } catch (BackingStoreException ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+ @Override
+ public boolean performOk() {
+ performApply();
+ return super.performOk();
+ }
+
+ /**
+ * Restores the default preferences
+ */
+
+ public void restoreDefaults() {
+ IPreferenceStore preferences = Activator.getDefault().getPreferenceStore();
+
+ for (Map.Entry<HyperlinkContributorDescriptor, Button> entry : hyperlinkCheckboxes.entrySet()) {
+ String isActiveKey = HyperlinkContributorDescriptor.getIsActiveKey(entry.getKey());
+ boolean selected = preferences.getDefaultBoolean(isActiveKey);
+
+ entry.getValue().setSelection(selected);
+ }
+ }
+}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/service/HyperlinkContributor.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/service/HyperlinkContributor.java
new file mode 100644
index 00000000000..6d0c4f1def5
--- /dev/null
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/service/HyperlinkContributor.java
@@ -0,0 +1,29 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.hyperlink.service;
+
+import java.util.List;
+
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
+
+/**
+ * A HyperlinkContributor is used to create hyperlinks for
+ * a specific element
+ *
+ * @author Shuai Li
+ *
+ */
+public interface HyperlinkContributor {
+ public List<HyperLinkObject> getHyperlinks(Object fromElement);
+}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/service/HyperlinkService.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/service/HyperlinkService.java
new file mode 100644
index 00000000000..21f46613089
--- /dev/null
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/service/HyperlinkService.java
@@ -0,0 +1,24 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.hyperlink.service;
+
+import org.eclipse.papyrus.infra.core.services.IService;
+
+/**
+ * @author Shuai Li
+ *
+ */
+public interface HyperlinkService extends IService, HyperlinkContributor {
+
+}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/service/impl/HyperlinkServiceImpl.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/service/impl/HyperlinkServiceImpl.java
new file mode 100644
index 00000000000..fe9944da69b
--- /dev/null
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/service/impl/HyperlinkServiceImpl.java
@@ -0,0 +1,193 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.hyperlink.service.impl;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.hyperlink.Activator;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkSpecificObject;
+import org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor;
+import org.eclipse.papyrus.infra.hyperlink.service.HyperlinkService;
+import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkConstants;
+
+/**
+ * @author Shuai Li
+ *
+ */
+public class HyperlinkServiceImpl implements HyperlinkService {
+ public static final String IS_ACTIVE_KEY = "isActive";
+
+ protected ServicesRegistry registry;
+
+ private List<HyperlinkContributorDescriptor> hyperlinkContributors;
+
+ /**
+ * {@inheritDoc}
+ */
+ public void init(ServicesRegistry servicesRegistry) throws ServiceException {
+ // Nothing
+ this.registry = servicesRegistry;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void startService() throws ServiceException {
+ createHyperlinkContributors();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void disposeService() throws ServiceException {
+ this.registry = null;
+ }
+
+ protected void createHyperlinkContributors() {
+ hyperlinkContributors = new LinkedList<HyperlinkContributorDescriptor>();
+
+ IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(HyperLinkConstants.EXTENSION_ID);
+
+ for (IConfigurationElement e : config) {
+ if (!"contributor".equals(e.getName())) {
+ continue;
+ }
+ try {
+ Object instance = e.createExecutableExtension("contributor");
+ if (instance instanceof HyperlinkContributor) {
+ HyperlinkContributorDescriptor wrapper = new HyperlinkContributorDescriptor((HyperlinkContributor) instance);
+ wrapper.setId(e.getAttribute("id"));
+ wrapper.setLabel(e.getAttribute("label"));
+ wrapper.setDescription(e.getAttribute("description"));
+ wrapper.init();
+ hyperlinkContributors.add(wrapper);
+ }
+ } catch (Exception ex) {
+ Activator.log.warn("Invalid hyperlink contribution from: " + e.getContributor());
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<HyperLinkObject> getHyperlinks(Object fromElement) {
+ List<HyperLinkObject> hyperlinks = new LinkedList<HyperLinkObject>();
+ HashSet<Object> addedHyperlinks = new HashSet<Object>();
+
+ for (HyperlinkContributorDescriptor contributor : hyperlinkContributors) {
+ if (contributor.isActive()) {
+ List<HyperLinkObject> hyperlinkObjects = contributor.getHyperlinks(fromElement);
+
+ for (HyperLinkObject hyperlink : hyperlinkObjects) {
+ Object target = null;
+ if (hyperlink instanceof HyperLinkSpecificObject) {
+ target = ((HyperLinkSpecificObject) hyperlink).getTargetElement();
+ } else {
+ target = hyperlink.getObject();
+ }
+
+ if (!addedHyperlinks.contains(target)) {
+ addedHyperlinks.add(target);
+ hyperlinks.add(hyperlink);
+ }
+ }
+ }
+ }
+
+ return hyperlinks;
+ }
+
+ public static abstract class ContributorDescriptor {
+ private String label;
+
+ private String description;
+
+ private String id;
+
+ private final IPreferenceStore preferences;
+
+ public ContributorDescriptor() {
+ preferences = Activator.getDefault().getPreferenceStore();
+ }
+
+ public void init() {
+ String isActiveKey = getIsActiveKey(this);
+ preferences.setDefault(isActiveKey, true);
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public boolean isActive() { /* NavigationContributorWrapper strategy */
+ String preferenceKey = getIsActiveKey(this);
+ return preferences.getBoolean(preferenceKey);
+ }
+
+ public static String getIsActiveKey(ContributorDescriptor strategy) {
+ return strategy.getId() + "." + IS_ACTIVE_KEY;
+ }
+ }
+
+ public static class HyperlinkContributorDescriptor extends ContributorDescriptor implements HyperlinkContributor {
+ private final HyperlinkContributor contributor;
+
+ public HyperlinkContributorDescriptor(HyperlinkContributor contributor) {
+ super();
+ this.contributor = contributor;
+ }
+
+ public List<HyperLinkObject> getHyperlinks(Object fromElement) {
+ if (isActive()) {
+ return contributor.getHyperlinks(fromElement);
+ } else {
+ return Collections.emptyList();
+ }
+ }
+ }
+
+ public List<HyperlinkContributorDescriptor> getHyperlinkContributors() {
+ return hyperlinkContributors;
+ }
+}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/AbstractHyperLinkManagerShell.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/AbstractHyperLinkManagerShell.java
index 4caa839ac2e..5693a4be01b 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/AbstractHyperLinkManagerShell.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/AbstractHyperLinkManagerShell.java
@@ -1,140 +1,140 @@
-/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.hyperlink.ui;
-
-import java.util.ArrayList;
-
-import org.eclipse.papyrus.infra.hyperlink.messages.Messages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * The Class AbstractHyperLinkManagerShell. This Class has been generated from VisualEditor. Do not
- * modify it manually by adding behavior! you will lose the capacity to open with VE. So this class
- * is abstract and it contains set of getter in order to connect behavior in subclasses
- */
-public abstract class AbstractHyperLinkManagerShell {
-
- /** The hyper link shell. */
- protected Shell hyperLinkShell = null;
-
-
- public Shell getHyperLinkShell() {
- return hyperLinkShell;
- }
-
- /** The c tab folder. */
- private CTabFolder cTabFolder = null;
-
-
- public CTabFolder getcTabFolder() {
- return cTabFolder;
- }
-
-
-
- /** The Ok button. */
- protected Button OkButton = null;
-
- /** The cancel button. */
- protected Button cancelButton = null;
-
-
-
- protected ArrayList<AbstractHyperLinkTab> tabList = new ArrayList<AbstractHyperLinkTab>();
-
- /**
- * This method initializes cTabFolder.
- */
- private void createCTabFolder() {
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 14;
- gridData.verticalAlignment = GridData.FILL;
- cTabFolder = new CTabFolder(hyperLinkShell, SWT.NONE);
- cTabFolder.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
- cTabFolder.setLayoutData(gridData);
-
-
- }
-
-
-
- /**
- * This method initializes HyperlinkComposite.
- */
-
- /**
- * This method initializes hyperLinkShell.
- *
- * @wbp.parser.entryPoint
- */
- protected void createHyperLinkShell() {
- GridData gridData9 = new GridData();
- gridData9.grabExcessHorizontalSpace = true;
- gridData9.verticalAlignment = GridData.FILL;
- gridData9.horizontalSpan = 2;
- gridData9.horizontalAlignment = GridData.FILL;
- GridData gridData8 = new GridData();
- gridData8.horizontalAlignment = GridData.FILL;
- gridData8.grabExcessHorizontalSpace = true;
- gridData8.horizontalSpan = 2;
- gridData8.verticalAlignment = GridData.FILL;
- GridLayout gridLayout2 = new GridLayout();
- gridLayout2.numColumns = 14;
- gridLayout2.makeColumnsEqualWidth = true;
-
- // this line has to be commented in order to open with VISUAL EDITOR
- hyperLinkShell = new Shell(PlatformUI.getWorkbench().getDisplay().getActiveShell(), SWT.DIALOG_TRIM | SWT.RESIZE);
-
- // hyperLinkShell = new Shell();
- hyperLinkShell.setText(Messages.AbstractHyperLinkManagerShell_HyperLink);
- hyperLinkShell.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
- createCTabFolder();
- hyperLinkShell.setLayout(gridLayout2);
- hyperLinkShell.setSize(new Point(687, 308));
- OkButton = new Button(hyperLinkShell, SWT.NONE);
- OkButton.setText(Messages.AbstractHyperLinkManagerShell_OK);
- OkButton.setLayoutData(gridData9);
- cancelButton = new Button(hyperLinkShell, SWT.NONE);
- cancelButton.setText(Messages.AbstractHyperLinkManagerShell_Cancel);
- cancelButton.setLayoutData(gridData8);
-
- getHyperLinkShell().pack();
- }
-
- /**
- * @return the okButton
- */
- public Button getOkButton() {
- return OkButton;
- }
-
- /**
- * @return the cancelButton
- */
- public Button getCancelButton() {
- return cancelButton;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2009-2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.hyperlink.ui;
+
+import java.util.ArrayList;
+
+import org.eclipse.papyrus.infra.hyperlink.messages.Messages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * The Class AbstractHyperLinkManagerShell. This Class has been generated from VisualEditor. Do not
+ * modify it manually by adding behavior! you will lose the capacity to open with VE. So this class
+ * is abstract and it contains set of getter in order to connect behavior in subclasses
+ */
+public abstract class AbstractHyperLinkManagerShell {
+
+ /** The hyper link shell. */
+ protected Shell hyperLinkShell = null;
+
+
+ public Shell getHyperLinkShell() {
+ return hyperLinkShell;
+ }
+
+ /** The c tab folder. */
+ private CTabFolder cTabFolder = null;
+
+
+ public CTabFolder getcTabFolder() {
+ return cTabFolder;
+ }
+
+
+
+ /** The Ok button. */
+ protected Button OkButton = null;
+
+ /** The cancel button. */
+ protected Button cancelButton = null;
+
+
+
+ protected ArrayList<AbstractHyperLinkTab> tabList = new ArrayList<AbstractHyperLinkTab>();
+
+ /**
+ * This method initializes cTabFolder.
+ */
+ private void createCTabFolder() {
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.grabExcessVerticalSpace = true;
+ gridData.horizontalSpan = 14;
+ gridData.verticalAlignment = GridData.FILL;
+ cTabFolder = new CTabFolder(hyperLinkShell, SWT.NONE);
+ cTabFolder.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+ cTabFolder.setLayoutData(gridData);
+
+
+ }
+
+
+
+ /**
+ * This method initializes HyperlinkComposite.
+ */
+
+ /**
+ * This method initializes hyperLinkShell.
+ *
+ * @wbp.parser.entryPoint
+ */
+ protected void createHyperLinkShell() {
+ GridData gridData9 = new GridData();
+ gridData9.grabExcessHorizontalSpace = true;
+ gridData9.verticalAlignment = GridData.FILL;
+ gridData9.horizontalSpan = 2;
+ gridData9.horizontalAlignment = GridData.FILL;
+ GridData gridData8 = new GridData();
+ gridData8.horizontalAlignment = GridData.FILL;
+ gridData8.grabExcessHorizontalSpace = true;
+ gridData8.horizontalSpan = 2;
+ gridData8.verticalAlignment = GridData.FILL;
+ GridLayout gridLayout2 = new GridLayout();
+ gridLayout2.numColumns = 14;
+ gridLayout2.makeColumnsEqualWidth = true;
+
+ // this line has to be commented in order to open with VISUAL EDITOR
+ hyperLinkShell = new Shell(PlatformUI.getWorkbench().getDisplay().getActiveShell(), SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL);
+
+ // hyperLinkShell = new Shell();
+ hyperLinkShell.setText(Messages.AbstractHyperLinkManagerShell_HyperLink);
+ hyperLinkShell.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+ createCTabFolder();
+ hyperLinkShell.setLayout(gridLayout2);
+ hyperLinkShell.setSize(new Point(687, 308));
+ OkButton = new Button(hyperLinkShell, SWT.NONE);
+ OkButton.setText(Messages.AbstractHyperLinkManagerShell_OK);
+ OkButton.setLayoutData(gridData9);
+ cancelButton = new Button(hyperLinkShell, SWT.NONE);
+ cancelButton.setText(Messages.AbstractHyperLinkManagerShell_Cancel);
+ cancelButton.setLayoutData(gridData8);
+
+ getHyperLinkShell().pack();
+ }
+
+ /**
+ * @return the okButton
+ */
+ public Button getOkButton() {
+ return OkButton;
+ }
+
+ /**
+ * @return the cancelButton
+ */
+ public Button getCancelButton() {
+ return cancelButton;
+ }
+
+}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkConstants.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkConstants.java
index 90e701e675d..17dea59555a 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkConstants.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkConstants.java
@@ -1,59 +1,67 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.hyperlink.util;
-
-public final class HyperLinkConstants {
-
- /**
- *
- * Constructor.
- *
- */
- private HyperLinkConstants() {
- // nothing to do
- }
-
- /**
- * this is a key of eAnnnotation that contains hypertext link or referenced document
- **/
- public static final String PAPYRUS_HYPERLINK_PREFIX = "PapyrusHyperLink_"; //$NON-NLS-1$
-
- public static final String PAPYRUS_HYPERLINK_PAGE = PAPYRUS_HYPERLINK_PREFIX + "Page"; //$NON-NLS-1$
-
- public static final String PAPYRUS_HYPERLINK_SPECIFIC_ELEMENT = PAPYRUS_HYPERLINK_PREFIX + "Object"; //$NON-NLS-1$
-
- public static final String HYPERLINK_DOCUMENT = PAPYRUS_HYPERLINK_PREFIX + "Document"; //$NON-NLS-1$
-
- public static final String HYPERLINK_WEB = PAPYRUS_HYPERLINK_PREFIX + "_web"; //$NON-NLS-1$
-
- public static final String HYPERLINK_TOOLTYPE_TEXT = "tooltip_text"; //$NON-NLS-1$
-
- public static final String HYPERLINK_IS_DEFAULT_NAVIGATION = "is_default_navigation"; //$NON-NLS-1$
-
- public static final String HYPERLINK_DOCUMENT_LOCALIZATION = "localization"; //$NON-NLS-1$
-
- public static final String HYPERLINK_WEB_LINK = "link"; //$NON-NLS-1$
-
- public static final String HYPERLINK_PAGE_NAME = "pageName"; //$NON-NLS-1$
-
- /**
- * LEGACY CONSTANTS
- */
-
- public static final String LEGACY_HYPERLINK_DIAGRAM = PAPYRUS_HYPERLINK_PREFIX + "Diagram";
-
- public static final String LEGACY_HYPERLINK_TABLE = PAPYRUS_HYPERLINK_PREFIX + "Table";
-
- public final static String[] validHyperLinkPageSources = new String[] { HyperLinkConstants.PAPYRUS_HYPERLINK_PAGE, HyperLinkConstants.LEGACY_HYPERLINK_DIAGRAM, HyperLinkConstants.LEGACY_HYPERLINK_TABLE };
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.hyperlink.util;
+
+import org.eclipse.papyrus.infra.hyperlink.Activator;
+
+public final class HyperLinkConstants {
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ private HyperLinkConstants() {
+ // nothing to do
+ }
+
+ /**
+ * this is a key of eAnnnotation that contains hypertext link or referenced document
+ **/
+ public static final String PAPYRUS_HYPERLINK_PREFIX = "PapyrusHyperLink_"; //$NON-NLS-1$
+
+ public static final String PAPYRUS_HYPERLINK_PAGE = PAPYRUS_HYPERLINK_PREFIX + "Page"; //$NON-NLS-1$
+
+ public static final String PAPYRUS_HYPERLINK_SPECIFIC_ELEMENT = PAPYRUS_HYPERLINK_PREFIX + "Object"; //$NON-NLS-1$
+
+ public static final String HYPERLINK_DOCUMENT = PAPYRUS_HYPERLINK_PREFIX + "Document"; //$NON-NLS-1$
+
+ public static final String HYPERLINK_WEB = PAPYRUS_HYPERLINK_PREFIX + "_web"; //$NON-NLS-1$
+
+ public static final String HYPERLINK_TOOLTYPE_TEXT = "tooltip_text"; //$NON-NLS-1$
+
+ public static final String HYPERLINK_IS_DEFAULT_NAVIGATION = "is_default_navigation"; //$NON-NLS-1$
+
+ public static final String HYPERLINK_DOCUMENT_LOCALIZATION = "localization"; //$NON-NLS-1$
+
+ public static final String HYPERLINK_WEB_LINK = "link"; //$NON-NLS-1$
+
+ public static final String HYPERLINK_PAGE_NAME = "pageName"; //$NON-NLS-1$
+
+ /**
+ * LEGACY CONSTANTS
+ */
+
+ public static final String LEGACY_HYPERLINK_DIAGRAM = PAPYRUS_HYPERLINK_PREFIX + "Diagram";
+
+ public static final String LEGACY_HYPERLINK_TABLE = PAPYRUS_HYPERLINK_PREFIX + "Table";
+
+ public final static String[] validHyperLinkPageSources = new String[] { HyperLinkConstants.PAPYRUS_HYPERLINK_PAGE, HyperLinkConstants.LEGACY_HYPERLINK_DIAGRAM, HyperLinkConstants.LEGACY_HYPERLINK_TABLE };
+
+ /**
+ * Plugin constants
+ */
+
+ public static final String EXTENSION_ID = Activator.PLUGIN_ID + ".hyperlinkContributor";
+}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkLabelProvider.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkLabelProvider.java
index 00f0292b298..eada2c57b8c 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkLabelProvider.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/util/HyperLinkLabelProvider.java
@@ -1,128 +1,262 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.hyperlink.util;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.LabelProvider;
-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.hyperlink.Activator;
-import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkDocument;
-import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor;
-import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
-import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkSpecificObject;
-import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkWeb;
-import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * The Class DocumentLabelProvider.
- */
-public class HyperLinkLabelProvider extends LabelProvider {
-
- /** The HYPERLIN k_ we b_ ico n_ path. */
- protected final String HYPERLINK_WEB_ICON_PATH = "/icons/hyperlink.gif"; //$NON-NLS-1$
-
- /** The HYPERLIN k_ documen t_ ico n_ path. */
- protected final String HYPERLINK_DOCUMENT_ICON_PATH = "/icons/file.gif"; //$NON-NLS-1$
-
- /** The SEP. */
- private final String SEP = " - "; //$NON-NLS-1$
-
- /**
- * {@inheritedDoc}.
- *
- * @param element
- * the element
- *
- * @return the image
- */
- @Override
- public Image getImage(Object element) {
- if (element instanceof HyperLinkDocument) {
- return org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage(Activator.PLUGIN_ID, HYPERLINK_DOCUMENT_ICON_PATH);
- }
-
- if (element instanceof HyperLinkWeb) {
- return org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage(Activator.PLUGIN_ID, HYPERLINK_WEB_ICON_PATH);
- }
-
- if (element instanceof HyperLinkEditor) {
- EObject editorContext = EMFHelper.getEObject(((HyperLinkEditor) element).getObject());
- if (editorContext != null) {
- try {
- return ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, editorContext).getLabelProvider().getImage(editorContext);
- } catch (ServiceException ex) {
- Activator.log.error(ex);
- }
- }
- }
-
- if (element instanceof HyperLinkSpecificObject) {
- EObject targetElement = ((HyperLinkSpecificObject) element).getTargetElement();
- if (targetElement != null) {
- try {
- return ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, targetElement).getLabelProvider().getImage(targetElement);
- } catch (ServiceException ex) {
- Activator.log.error(ex);
- }
- }
- }
-
- return super.getImage(element);
- }
-
- /**
- * {@inheritedDoc}.
- *
- * @param element
- * the element
- *
- * @return the text
- */
- @Override
- public String getText(Object element) {
- String out = ""; //$NON-NLS-1$
- if (element instanceof HyperLinkDocument) {
- out = ((HyperLinkDocument) element).getHyperlinkDocument();
- } else if (element instanceof HyperLinkWeb) {
- out = ((HyperLinkWeb) element).getHyperLinkWeb();
- } else if (element instanceof HyperLinkEditor) {
- EObject editorContext = EMFHelper.getEObject(((HyperLinkEditor) element).getObject());
- if (editorContext != null) {
- try {
- return ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, editorContext).getLabelProvider().getText(editorContext);
- } catch (ServiceException ex) {
- Activator.log.error(ex);
- }
- }
- } else if (element instanceof HyperLinkSpecificObject) {
- EObject targetElement = ((HyperLinkSpecificObject) element).getTargetElement();
- if (targetElement != null) {
- try {
- return ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, targetElement).getLabelProvider().getText(targetElement);
- } catch (ServiceException ex) {
- Activator.log.error(ex);
- }
- }
- } else {
- return super.getText(element);
- }
-
- out = out + SEP + ((HyperLinkObject) element).getTooltipText();
- return out;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.hyperlink.util;
+
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import java.awt.image.DirectColorModel;
+import java.awt.image.IndexColorModel;
+import java.awt.image.WritableRaster;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.imageio.ImageIO;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.filechooser.FileSystemView;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.LabelProvider;
+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.hyperlink.Activator;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkDocument;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkSpecificObject;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkWeb;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * The Class DocumentLabelProvider.
+ */
+public class HyperLinkLabelProvider extends LabelProvider {
+
+ /** The HYPERLIN k_ we b_ ico n_ path. */
+ protected final String HYPERLINK_WEB_ICON_PATH = "/icons/hyperlink.gif"; //$NON-NLS-1$
+
+ /** The HYPERLIN k_ documen t_ ico n_ path. */
+ protected final String HYPERLINK_DOCUMENT_ICON_PATH = "/icons/file.gif"; //$NON-NLS-1$
+
+ /** The SEP. */
+ private final String SEP = " - "; //$NON-NLS-1$
+
+ /**
+ * {@inheritedDoc}.
+ *
+ * @param element
+ * the element
+ *
+ * @return the image
+ */
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof HyperLinkDocument) {
+ File theDoc = new File(((HyperLinkDocument) element).getHyperlinkDocument());
+ if (theDoc != null) {
+ FileSystemView view = FileSystemView.getFileSystemView();
+ Icon icon = view.getSystemIcon(theDoc);
+ if (icon instanceof ImageIcon) {
+ ImageData imageData = convertAWTImageToSWT(((ImageIcon) icon).getImage());
+ if (imageData != null) {
+ return new Image(Display.getDefault(), imageData);
+ }
+ }
+ }
+
+ return org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage(Activator.PLUGIN_ID, HYPERLINK_DOCUMENT_ICON_PATH);
+ }
+
+ if (element instanceof HyperLinkWeb) {
+ try {
+ InputStream stream = getRawStreamFromURL(new URL("http://www.google.com/s2/favicons?domain=" + ((HyperLinkWeb) element).getHyperLinkWeb()));
+ if (stream != null) {
+ try {
+ BufferedImage image = ImageIO.read(stream);
+ ImageData imageData = convertAWTImageToSWT(image);
+ if (imageData != null) {
+ return new Image(Display.getDefault(), imageData);
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage(Activator.PLUGIN_ID, HYPERLINK_WEB_ICON_PATH);
+ }
+
+ if (element instanceof HyperLinkEditor) {
+ EObject editorContext = EMFHelper.getEObject(((HyperLinkEditor) element).getObject());
+ if (editorContext != null) {
+ try {
+ return ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, editorContext).getLabelProvider().getImage(editorContext);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+ }
+ }
+
+ if (element instanceof HyperLinkSpecificObject) {
+ EObject targetElement = ((HyperLinkSpecificObject) element).getTargetElement();
+ if (targetElement != null) {
+ try {
+ return ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, targetElement).getLabelProvider().getImage(targetElement);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+ }
+ }
+
+ return super.getImage(element);
+ }
+
+ /**
+ * {@inheritedDoc}.
+ *
+ * @param element
+ * the element
+ *
+ * @return the text
+ */
+ @Override
+ public String getText(Object element) {
+ String out = ""; //$NON-NLS-1$
+ if (element instanceof HyperLinkDocument) {
+ out = ((HyperLinkDocument) element).getHyperlinkDocument();
+ } else if (element instanceof HyperLinkWeb) {
+ out = ((HyperLinkWeb) element).getHyperLinkWeb();
+ } else if (element instanceof HyperLinkEditor) {
+ EObject editorContext = EMFHelper.getEObject(((HyperLinkEditor) element).getObject());
+ if (editorContext != null) {
+ try {
+ return ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, editorContext).getLabelProvider().getText(editorContext);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+ }
+ } else if (element instanceof HyperLinkSpecificObject) {
+ EObject targetElement = ((HyperLinkSpecificObject) element).getTargetElement();
+ if (targetElement != null) {
+ try {
+ return ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, targetElement).getLabelProvider().getText(targetElement);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+ }
+ } else {
+ return super.getText(element);
+ }
+
+ out = ((HyperLinkObject) element).getTooltipText() + SEP + out;
+ return out;
+ }
+
+ public static ImageData convertAWTImageToSWT(java.awt.Image image) {
+ if (image == null) {
+ throw new IllegalArgumentException("Null 'image' argument.");
+ }
+ int w = image.getWidth(null);
+ int h = image.getHeight(null);
+ if (w == -1 || h == -1) {
+ return null;
+ }
+ BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
+ Graphics g = bi.getGraphics();
+ g.drawImage(image, 0, 0, null);
+ g.dispose();
+ return convertToSWT(bi);
+ }
+
+ public static ImageData convertToSWT(BufferedImage bufferedImage) {
+ if (bufferedImage.getColorModel() instanceof DirectColorModel) {
+ DirectColorModel colorModel
+ = (DirectColorModel) bufferedImage.getColorModel();
+ PaletteData palette = new PaletteData(colorModel.getRedMask(),
+ colorModel.getGreenMask(), colorModel.getBlueMask());
+ ImageData data = new ImageData(bufferedImage.getWidth(),
+ bufferedImage.getHeight(), colorModel.getPixelSize(),
+ palette);
+ WritableRaster raster = bufferedImage.getRaster();
+ int[] pixelArray = new int[3];
+ for (int y = 0; y < data.height; y++) {
+ for (int x = 0; x < data.width; x++) {
+ raster.getPixel(x, y, pixelArray);
+ int pixel = palette.getPixel(new RGB(pixelArray[0],
+ pixelArray[1], pixelArray[2]));
+ data.setPixel(x, y, pixel);
+ }
+ }
+ return data;
+ } else if (bufferedImage.getColorModel() instanceof IndexColorModel) {
+ IndexColorModel colorModel = (IndexColorModel)
+ bufferedImage.getColorModel();
+ int size = colorModel.getMapSize();
+ byte[] reds = new byte[size];
+ byte[] greens = new byte[size];
+ byte[] blues = new byte[size];
+ colorModel.getReds(reds);
+ colorModel.getGreens(greens);
+ colorModel.getBlues(blues);
+ RGB[] rgbs = new RGB[size];
+ for (int i = 0; i < rgbs.length; i++) {
+ rgbs[i] = new RGB(reds[i] & 0xFF, greens[i] & 0xFF,
+ blues[i] & 0xFF);
+ }
+ PaletteData palette = new PaletteData(rgbs);
+ ImageData data = new ImageData(bufferedImage.getWidth(),
+ bufferedImage.getHeight(), colorModel.getPixelSize(),
+ palette);
+ data.transparentPixel = colorModel.getTransparentPixel();
+ WritableRaster raster = bufferedImage.getRaster();
+ int[] pixelArray = new int[1];
+ for (int y = 0; y < data.height; y++) {
+ for (int x = 0; x < data.width; x++) {
+ raster.getPixel(x, y, pixelArray);
+ data.setPixel(x, y, pixelArray[0]);
+ }
+ }
+ return data;
+ }
+ return null;
+ }
+
+ protected InputStream getRawStreamFromURL(URL url) {
+ try {
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setDoInput(true);
+ connection.connect();
+ InputStream input = connection.getInputStream();
+ return input;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+}
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.viewersearch/src/org/eclipse/papyrus/infra/services/viewersearch/IExtendedViewerSearcher.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewersearch/src/org/eclipse/papyrus/infra/services/viewersearch/IExtendedViewerSearcher.java
new file mode 100644
index 00000000000..78fe22ad0d8
--- /dev/null
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewersearch/src/org/eclipse/papyrus/infra/services/viewersearch/IExtendedViewerSearcher.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.services.viewersearch;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * @author Shuai Li (CEA LIST) <shuai.li@cea.fr>
+ *
+ */
+public interface IExtendedViewerSearcher extends IViewerSearcher {
+ /**
+ * Get viewers of an element in the currently loaded model, according to some parameters.
+ *
+ * @param element
+ * Find views of this element (may be null if container is not null)
+ * @param container
+ * Find view contained by this container (may be null if element is not null)
+ * @param pagesOnly
+ * Return pages containing found views
+ * @param openPagesOnly
+ * Find views in open pages only
+ * @return
+ * A list of objects that are related to found views (e.g. the views themselves)
+ */
+ public List<Object> getViewersInCurrentModel(EObject element, EObject container, boolean pagesOnly, boolean openPagesOnly);
+}
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.viewersearch/src/org/eclipse/papyrus/infra/services/viewersearch/impl/AbstractViewerSearcher.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewersearch/src/org/eclipse/papyrus/infra/services/viewersearch/impl/AbstractViewerSearcher.java
index 496e3a8f193..c12c40a9995 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.viewersearch/src/org/eclipse/papyrus/infra/services/viewersearch/impl/AbstractViewerSearcher.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewersearch/src/org/eclipse/papyrus/infra/services/viewersearch/impl/AbstractViewerSearcher.java
@@ -1,76 +1,90 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.services.viewersearch.impl;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.services.viewersearch.IViewerSearcher;
-
-/**
- * Abstract implementation of a ViewerSearcher.
- */
-public abstract class AbstractViewerSearcher implements IViewerSearcher {
-
- /**
- * Generic implementation of this method that shouldn't be overridden
- *
- * @see org.eclipse.papyrus.infra.services.viewersearch.IViewerSearcher#getViewers(java.util.Collection, org.eclipse.papyrus.infra.core.resource.ModelSet)
- *
- * @param modelElements
- * @param modelSet
- * @return
- */
-
- public Map<Object, Map<Object, Object>> getViewers(Collection<Object> modelElements, ModelSet modelSet) {
- List<ModelSet> listModelSet = new ArrayList<ModelSet>();
- listModelSet.add(modelSet);
-
- return getViewers(modelElements, listModelSet);
-
- }
-
- /**
- * Generic implementation of this method that shouldn't be overridden
- *
- * @see org.eclipse.papyrus.infra.services.viewersearch.IViewerSearcher#getViewers(java.lang.Object, org.eclipse.papyrus.infra.core.resource.ModelSet)
- *
- * @param modelElement
- * @param modelSet
- * @return
- */
-
- public Map<Object, Map<Object, Object>> getViewers(Object modelElement, ModelSet modelSet) {
- List<ModelSet> listModelSet = new ArrayList<ModelSet>();
- listModelSet.add(modelSet);
-
- List<Object> listModelElement = new ArrayList<Object>();
- listModelElement.add(modelElement);
-
- return getViewers(listModelElement, listModelSet);
- }
-
- /**
- * @see org.eclipse.papyrus.infra.services.viewersearch.IViewerSearcher#getViewers(java.util.Collection, java.util.Collection)
- *
- * @param modelElements
- * @param models
- * @return
- */
-
- public abstract Map<Object, Map<Object, Object>> getViewers(Collection<Object> modelElements, Collection<ModelSet> models);
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.services.viewersearch.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.services.viewersearch.IExtendedViewerSearcher;
+import org.eclipse.papyrus.infra.services.viewersearch.IViewerSearcher;
+
+/**
+ * Abstract implementation of a ViewerSearcher.
+ */
+public abstract class AbstractViewerSearcher implements IExtendedViewerSearcher {
+
+ /**
+ * Generic implementation of this method that shouldn't be overridden
+ *
+ * @see org.eclipse.papyrus.infra.services.viewersearch.IViewerSearcher#getViewers(java.util.Collection, org.eclipse.papyrus.infra.core.resource.ModelSet)
+ *
+ * @param modelElements
+ * @param modelSet
+ * @return
+ */
+
+ public Map<Object, Map<Object, Object>> getViewers(Collection<Object> modelElements, ModelSet modelSet) {
+ List<ModelSet> listModelSet = new ArrayList<ModelSet>();
+ listModelSet.add(modelSet);
+
+ return getViewers(modelElements, listModelSet);
+
+ }
+
+ /**
+ * Generic implementation of this method that shouldn't be overridden
+ *
+ * @see org.eclipse.papyrus.infra.services.viewersearch.IViewerSearcher#getViewers(java.lang.Object, org.eclipse.papyrus.infra.core.resource.ModelSet)
+ *
+ * @param modelElement
+ * @param modelSet
+ * @return
+ */
+
+ public Map<Object, Map<Object, Object>> getViewers(Object modelElement, ModelSet modelSet) {
+ List<ModelSet> listModelSet = new ArrayList<ModelSet>();
+ listModelSet.add(modelSet);
+
+ List<Object> listModelElement = new ArrayList<Object>();
+ listModelElement.add(modelElement);
+
+ return getViewers(listModelElement, listModelSet);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.services.viewersearch.IViewerSearcher#getViewers(java.util.Collection, java.util.Collection)
+ *
+ * @param modelElements
+ * @param models
+ * @return
+ */
+
+ public abstract Map<Object, Map<Object, Object>> getViewers(Collection<Object> modelElements, Collection<ModelSet> models);
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.services.viewersearch.IExtendedViewerSearcher#getViewersInCurrentModel(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject, boolean, boolean)
+ *
+ * @param element
+ * @param container
+ * @param pagesOnly
+ * @param openPagesOnly
+ * @return
+ */
+ public abstract List<Object> getViewersInCurrentModel(EObject element, EObject container, boolean pagesOnly, boolean openPagesOnly);
+}
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.viewersearch/src/org/eclipse/papyrus/infra/services/viewersearch/impl/ViewerSearchService.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewersearch/src/org/eclipse/papyrus/infra/services/viewersearch/impl/ViewerSearchService.java
index f31f4068b91..7dd317400f5 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.viewersearch/src/org/eclipse/papyrus/infra/services/viewersearch/impl/ViewerSearchService.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.viewersearch/src/org/eclipse/papyrus/infra/services/viewersearch/impl/ViewerSearchService.java
@@ -1,156 +1,193 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.services.viewersearch.impl;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.services.IService;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.services.viewersearch.Activator;
-import org.eclipse.papyrus.infra.services.viewersearch.IViewerSearcher;
-import org.eclipse.papyrus.infra.services.viewersearch.Messages;
-
-/**
- * The actual implementation of the ViewerSearcherService.
- */
-public class ViewerSearchService extends AbstractViewerSearcher implements IService {
-
- public final static String EXTENSION_ID = Activator.PLUGIN_ID + ".viewerSearcher"; //$NON-NLS-1$
-
- public final static String VIEWER_SEARCHER_ID = "id"; //$NON-NLS-1$
-
- public final static String VIEWER_SEARCHER_CLASS = "class"; //$NON-NLS-1$
-
- /** The viewerSearchers that contribute to the service. */
- private final Map<String, IViewerSearcher> viewerSearchers = new HashMap<String, IViewerSearcher>();
-
- public ViewerSearchService() {
-
- }
-
- /**
- * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry)
- *
- * @param servicesRegistry
- * @throws ServiceException
- */
-
- public void init(ServicesRegistry servicesRegistry) throws ServiceException {
-
- }
-
- /**
- * @see org.eclipse.papyrus.infra.core.services.IService#startService()
- *
- * @throws ServiceException
- */
-
- public void startService() throws ServiceException {
- IConfigurationElement[] configurations = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
-
- readViewerSearchers(configurations);
- }
-
- /**
- * Parses the available viewerSearcher from the extension point.
- *
- * @param configurations
- * The extension point IConfigurationElements
- */
- private void readViewerSearchers(IConfigurationElement[] configurations) {
- viewerSearchers.clear();
-
- for (IConfigurationElement config : configurations) {
- try {
- if ("viewerSearcher".equals(config.getName())) { //$NON-NLS-1$
- String viewerSearcherId = config.getAttribute(VIEWER_SEARCHER_ID);
- if (viewerSearcherId == null) {
- Activator.log.warn(Messages.ViewerSearcherService_2 + config.getContributor() + Messages.ViewerSearcherService_3 + EXTENSION_ID + Messages.ViewerSearcherService_4 + VIEWER_SEARCHER_ID + Messages.ViewerSearcherService_5);
- continue;
- }
-
- IViewerSearcher viewerSearcherClass = (IViewerSearcher) config.createExecutableExtension(VIEWER_SEARCHER_CLASS);
- if (viewerSearcherClass == null) {
- Activator.log.warn(Messages.ViewerSearcherService_6 + config.getContributor() + Messages.ViewerSearcherService_7 + EXTENSION_ID + Messages.ViewerSearcherService_8 + VIEWER_SEARCHER_CLASS + Messages.ViewerSearcherService_9);
- continue;
- }
-
- if (viewerSearchers.containsKey(viewerSearcherId)) {
- Activator.log.warn(Messages.ViewerSearcherService_10 + viewerSearcherId + Messages.ViewerSearcherService_11);
- continue;
- }
-
- /** Associates an empty viewerSearchers to the context */
- viewerSearchers.put(viewerSearcherId, viewerSearcherClass);
- }
- } catch (Exception ex) {
- Activator.log.error("The plugin " + config.getContributor() + " contributed an invalid extension for " + EXTENSION_ID, ex); //$NON-NLS-1$//$NON-NLS-2$
- }
- }
- }
-
- /**
- * @see org.eclipse.papyrus.infra.core.services.IService#disposeService()
- *
- * @throws ServiceException
- */
-
- public void disposeService() throws ServiceException {
- viewerSearchers.clear();
-
- }
-
- /**
- * Collects viewers from the difference viewerSearcher contributors
- *
- * @see org.eclipse.papyrus.infra.services.viewersearch.impl.AbstractViewerSearcher#getViewers(java.util.Collection, java.util.Collection)
- *
- * @param modelElements
- * @param models
- * @return
- */
-
- @Override
- public Map<Object, Map<Object, Object>> getViewers(Collection<Object> modelElements, Collection<ModelSet> models) {
- Map<Object, Map<Object, Object>> results = new HashMap<Object, Map<Object, Object>>();
-
- for (String key : viewerSearchers.keySet()) {
- IViewerSearcher viewerSearcher = viewerSearchers.get(key);
-
- Map<Object, Map<Object, Object>> subResults = viewerSearcher.getViewers(modelElements, models);
- if (subResults != null) {
- for (Object viewer : subResults.keySet()) {
-
- if (results.containsKey(viewer)) {
- Map<Object, Object> viewMappings = subResults.get(viewer);
- Map<Object, Object> resultViewMappings = results.get(viewer);
- resultViewMappings.putAll(viewMappings);
-
- } else {
- results.put(viewer, subResults.get(viewer));
- }
- }
- }
- }
-
- return results;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.services.viewersearch.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.services.IService;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.services.viewersearch.Activator;
+import org.eclipse.papyrus.infra.services.viewersearch.IExtendedViewerSearcher;
+import org.eclipse.papyrus.infra.services.viewersearch.IViewerSearcher;
+import org.eclipse.papyrus.infra.services.viewersearch.Messages;
+
+/**
+ * The actual implementation of the ViewerSearcherService.
+ */
+public class ViewerSearchService extends AbstractViewerSearcher implements IService {
+
+ public final static String EXTENSION_ID = Activator.PLUGIN_ID + ".viewerSearcher"; //$NON-NLS-1$
+
+ public final static String VIEWER_SEARCHER_ID = "id"; //$NON-NLS-1$
+
+ public final static String VIEWER_SEARCHER_CLASS = "class"; //$NON-NLS-1$
+
+ /** The viewerSearchers that contribute to the service. */
+ private final Map<String, IViewerSearcher> viewerSearchers = new HashMap<String, IViewerSearcher>();
+
+ public ViewerSearchService() {
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry)
+ *
+ * @param servicesRegistry
+ * @throws ServiceException
+ */
+
+ public void init(ServicesRegistry servicesRegistry) throws ServiceException {
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.services.IService#startService()
+ *
+ * @throws ServiceException
+ */
+
+ public void startService() throws ServiceException {
+ IConfigurationElement[] configurations = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
+
+ readViewerSearchers(configurations);
+ }
+
+ /**
+ * Parses the available viewerSearcher from the extension point.
+ *
+ * @param configurations
+ * The extension point IConfigurationElements
+ */
+ private void readViewerSearchers(IConfigurationElement[] configurations) {
+ viewerSearchers.clear();
+
+ for (IConfigurationElement config : configurations) {
+ try {
+ if ("viewerSearcher".equals(config.getName())) { //$NON-NLS-1$
+ String viewerSearcherId = config.getAttribute(VIEWER_SEARCHER_ID);
+ if (viewerSearcherId == null) {
+ Activator.log.warn(Messages.ViewerSearcherService_2 + config.getContributor() + Messages.ViewerSearcherService_3 + EXTENSION_ID + Messages.ViewerSearcherService_4 + VIEWER_SEARCHER_ID + Messages.ViewerSearcherService_5);
+ continue;
+ }
+
+ IViewerSearcher viewerSearcherClass = (IViewerSearcher) config.createExecutableExtension(VIEWER_SEARCHER_CLASS);
+ if (viewerSearcherClass == null) {
+ Activator.log.warn(Messages.ViewerSearcherService_6 + config.getContributor() + Messages.ViewerSearcherService_7 + EXTENSION_ID + Messages.ViewerSearcherService_8 + VIEWER_SEARCHER_CLASS + Messages.ViewerSearcherService_9);
+ continue;
+ }
+
+ if (viewerSearchers.containsKey(viewerSearcherId)) {
+ Activator.log.warn(Messages.ViewerSearcherService_10 + viewerSearcherId + Messages.ViewerSearcherService_11);
+ continue;
+ }
+
+ /** Associates an empty viewerSearchers to the context */
+ viewerSearchers.put(viewerSearcherId, viewerSearcherClass);
+ }
+ } catch (Exception ex) {
+ Activator.log.error("The plugin " + config.getContributor() + " contributed an invalid extension for " + EXTENSION_ID, ex); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.services.IService#disposeService()
+ *
+ * @throws ServiceException
+ */
+
+ public void disposeService() throws ServiceException {
+ viewerSearchers.clear();
+
+ }
+
+ /**
+ * Collects viewers from the difference viewerSearcher contributors
+ *
+ * @see org.eclipse.papyrus.infra.services.viewersearch.impl.AbstractViewerSearcher#getViewers(java.util.Collection, java.util.Collection)
+ *
+ * @param modelElements
+ * @param models
+ * @return
+ */
+
+ @Override
+ public Map<Object, Map<Object, Object>> getViewers(Collection<Object> modelElements, Collection<ModelSet> models) {
+ Map<Object, Map<Object, Object>> results = new HashMap<Object, Map<Object, Object>>();
+
+ for (String key : viewerSearchers.keySet()) {
+ IViewerSearcher viewerSearcher = viewerSearchers.get(key);
+
+ Map<Object, Map<Object, Object>> subResults = viewerSearcher.getViewers(modelElements, models);
+ if (subResults != null) {
+ for (Object viewer : subResults.keySet()) {
+
+ if (results.containsKey(viewer)) {
+ Map<Object, Object> viewMappings = subResults.get(viewer);
+ Map<Object, Object> resultViewMappings = results.get(viewer);
+ resultViewMappings.putAll(viewMappings);
+
+ } else {
+ results.put(viewer, subResults.get(viewer));
+ }
+ }
+ }
+ }
+
+ return results;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.services.viewersearch.impl.AbstractViewerSearcher#getViewersInCurrentModel(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject, boolean, boolean)
+ *
+ * @param element
+ * @param container
+ * @param pagesOnly
+ * @param openPagesOnly
+ * @return
+ */
+ @Override
+ public List<Object> getViewersInCurrentModel(EObject element, EObject container, boolean pagesOnly, boolean openPagesOnly) {
+ List<Object> results = new ArrayList<Object>();
+
+ for (String key : viewerSearchers.keySet()) {
+ IViewerSearcher viewerSearcher = viewerSearchers.get(key);
+
+ if (viewerSearcher instanceof IExtendedViewerSearcher) {
+ List<Object> subResults = ((IExtendedViewerSearcher) viewerSearcher).getViewersInCurrentModel(element, container, pagesOnly, openPagesOnly);
+
+ if (subResults != null) {
+ for (Object object : subResults) {
+ if (!results.contains(object)) {
+ results.add(object);
+ }
+ }
+ }
+ }
+
+ }
+
+ return results;
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF
index edec74fb315..7b65bfe616c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF
@@ -87,13 +87,14 @@ Require-Bundle: org.eclipse.core.expressions,
org.eclipse.emf.ecore.edit;visibility:=reexport,
org.eclipse.emf.validation.ocl;visibility:=reexport,
org.eclipse.gef,
- org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,
- 4.0.0)",
+ org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,4.0.0)",
org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0",
org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.2.0",
org.eclipse.e4.ui.css.core,
org.eclipse.papyrus.infra.gmfdiag.canonical;bundle-version="1.2.0",
- org.eclipse.core.databinding
+ org.eclipse.core.databinding,
+ org.eclipse.papyrus.infra.hyperlink;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.services.viewersearch;bundle-version="1.2.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 1.2.0.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/hyperlink/OwnedBehaviorHyperlinkContributor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/hyperlink/OwnedBehaviorHyperlinkContributor.java
new file mode 100644
index 00000000000..e4f5d277ed8
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/hyperlink/OwnedBehaviorHyperlinkContributor.java
@@ -0,0 +1,100 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.activity.hyperlink;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.Activator;
+import org.eclipse.papyrus.infra.core.services.BadStateException;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkSpecificObject;
+import org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor;
+import org.eclipse.papyrus.infra.services.viewersearch.impl.ViewerSearchService;
+import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActivityDiagramEditPart;
+import org.eclipse.uml2.uml.Behavior;
+import org.eclipse.uml2.uml.BehavioredClassifier;
+
+/**
+ * Returns a list of HyperLinkSpecificObjects (view elements) referencing
+ * owned behaviors of a BehaviorClassifier
+ *
+ * @author Shuai Li
+ *
+ */
+public class OwnedBehaviorHyperlinkContributor implements HyperlinkContributor {
+
+ /**
+ * @see org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor#getHyperlinks(java.lang.Object)
+ *
+ * @param fromElement
+ * @return
+ */
+ public List<HyperLinkObject> getHyperlinks(Object fromElement) {
+ ArrayList<HyperLinkObject> hyperlinks = new ArrayList<HyperLinkObject>();
+
+ if (fromElement instanceof BehavioredClassifier) {
+ List<Behavior> behaviors = ((BehavioredClassifier) fromElement).getOwnedBehaviors();
+ List<Object> objectsInViews = new ArrayList<Object>();
+
+ for (Behavior behavior : behaviors) {
+ ViewerSearchService viewerSearchService = null;
+ try {
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (ServiceException e) {
+ if (e instanceof ServiceNotFoundException) {
+ viewerSearchService = new ViewerSearchService();
+ try {
+ viewerSearchService.startService();
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).add(ViewerSearchService.class, 1, viewerSearchService);
+ } catch (ServiceException e1) {
+ Activator.log.error(e1);
+ }
+ } else if (e instanceof BadStateException) {
+ try {
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).startRegistry();
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (Exception e1) {
+ Activator.log.error(e1);
+ }
+ }
+ }
+
+ if (viewerSearchService != null) {
+ List<Object> viewerSearchResults = viewerSearchService.getViewersInCurrentModel(behavior, (BehavioredClassifier) fromElement, false, false);
+ objectsInViews.addAll(viewerSearchResults);
+ }
+ }
+
+ for (Object object : objectsInViews) {
+ if (object instanceof View && ((View) object).getDiagram()!= null) {
+ if (((View) object).getDiagram().getType().equals(ActivityDiagramEditPart.MODEL_ID)) {
+ HyperLinkSpecificObject hyperlink = new HyperLinkSpecificObject((EObject) object);
+ hyperlinks.add(hyperlink);
+ }
+ }
+ }
+ }
+
+ return hyperlinks;
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml
index c224d608779..4330313e621 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml
@@ -3367,4 +3367,14 @@ self.structuralFeature.oclAsType(Property).opposite.type = self.object.type]]>
</diagramReconciler>
</extension>
+<extension
+ point="org.eclipse.papyrus.infra.hyperlink.hyperlinkContributor">
+ <contributor
+ contributor="org.eclipse.papyrus.uml.diagram.activity.hyperlink.OwnedBehaviorHyperlinkContributor"
+ description="Creates hyperlinks referencing an activity represented in a diagram owned by a behaviored classifier"
+ id="org.eclipse.papyrus.uml.diagram.activity.ownedBehaviorHyperlinkContributor"
+ label="Owned activity hyperlinks">
+ </contributor>
+</extension>
+
</plugin>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF
index 0ac27b8c061..f1c9e8334a9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF
@@ -1,102 +1,98 @@
-Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.uml.diagram.clazz,
- org.eclipse.papyrus.uml.diagram.clazz.custom.action,
- org.eclipse.papyrus.uml.diagram.clazz.custom.command,
- org.eclipse.papyrus.uml.diagram.clazz.custom.edit.actions,
- org.eclipse.papyrus.uml.diagram.clazz.custom.edit.commands,
- org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part,
- org.eclipse.papyrus.uml.diagram.clazz.custom.factory,
- org.eclipse.papyrus.uml.diagram.clazz.custom.figure,
- org.eclipse.papyrus.uml.diagram.clazz.custom.helper,
- org.eclipse.papyrus.uml.diagram.clazz.custom.helper.advice,
- org.eclipse.papyrus.uml.diagram.clazz.custom.migration,
- org.eclipse.papyrus.uml.diagram.clazz.custom.parsers,
- org.eclipse.papyrus.uml.diagram.clazz.custom.policies,
- org.eclipse.papyrus.uml.diagram.clazz.custom.providers,
- org.eclipse.papyrus.uml.diagram.clazz.custom.utils,
- org.eclipse.papyrus.uml.diagram.clazz.edit.helpers,
- org.eclipse.papyrus.uml.diagram.clazz.edit.parts,
- org.eclipse.papyrus.uml.diagram.clazz.edit.policies,
- org.eclipse.papyrus.uml.diagram.clazz.expressions,
- org.eclipse.papyrus.uml.diagram.clazz.navigator,
- org.eclipse.papyrus.uml.diagram.clazz.parsers,
- org.eclipse.papyrus.uml.diagram.clazz.part,
- org.eclipse.papyrus.uml.diagram.clazz.providers
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Require-Bundle: org.eclipse.core.expressions,
- org.eclipse.ui.navigator,
- org.eclipse.ui.navigator.resources,
- org.eclipse.gmf.runtime.diagram.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui.render,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
- org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="1.2.0",
- org.eclipse.ocl.ecore,
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.diagram.common;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.2.0",
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.2.0",
- org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.3.0",
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.gmf.runtime.emf.core,
- org.eclipse.gmf.runtime.emf.commands.core,
- org.eclipse.gmf.runtime.emf.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui,
- org.eclipse.gmf.runtime.diagram.ui.providers.ide,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor,
- org.eclipse.uml2.uml,
- org.eclipse.gmf.runtime.draw2d.ui,
- org.eclipse.ui,
- org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.service.types;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0",
- com.google.guava;bundle-version="11.0.0",
- org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.appearance;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
- org.eclipse.ui.ide;bundle-version="3.8.0",
- org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.2.0",
- org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
- org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,
- 4.0.0)",
- org.eclipse.jface,
- org.eclipse.ui.views,
- org.eclipse.emf.ecore,
- org.eclipse.emf.ecore.xmi,
- org.eclipse.emf.edit.ui,
- org.eclipse.emf.ecore;visibility:=reexport,
- org.eclipse.emf.ecore.edit;visibility:=reexport,
- org.eclipse.emf.validation;visibility:=reexport,
- org.eclipse.gef,
- org.apache.batik.dom.svg;bundle-version="[1.6.0,
- 1.7.0)",
- org.apache.batik.util;bundle-version="[1.6.0,
- 1.7.0)",
- org.apache.batik.svggen;bundle-version="[1.6.0,
- 1.7.0)",
- org.apache.batik.dom;bundle-version="[1.6.0,
- 1.7.0)",
- org.w3c.dom.svg,
- org.apache.batik.css;bundle-version="[1.6.0,
- 1.7.0)",
- org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.elementtypesconfigurations;bundle-version="1.2.0",
- org.eclipse.core.databinding.observable
-Bundle-Vendor: %providerName
-Eclipse-LazyStart: true
-Bundle-Version: 1.2.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.clazz.part.UMLDiagramEditorPlugin
-Bundle-ManifestVersion: 2
-Bundle-Description: %pluginDescription
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.clazz; singleton:=true
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.uml.diagram.clazz,
+ org.eclipse.papyrus.uml.diagram.clazz.custom.action,
+ org.eclipse.papyrus.uml.diagram.clazz.custom.command,
+ org.eclipse.papyrus.uml.diagram.clazz.custom.edit.actions,
+ org.eclipse.papyrus.uml.diagram.clazz.custom.edit.commands,
+ org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part,
+ org.eclipse.papyrus.uml.diagram.clazz.custom.factory,
+ org.eclipse.papyrus.uml.diagram.clazz.custom.figure,
+ org.eclipse.papyrus.uml.diagram.clazz.custom.helper,
+ org.eclipse.papyrus.uml.diagram.clazz.custom.helper.advice,
+ org.eclipse.papyrus.uml.diagram.clazz.custom.migration,
+ org.eclipse.papyrus.uml.diagram.clazz.custom.parsers,
+ org.eclipse.papyrus.uml.diagram.clazz.custom.policies,
+ org.eclipse.papyrus.uml.diagram.clazz.custom.providers,
+ org.eclipse.papyrus.uml.diagram.clazz.custom.utils,
+ org.eclipse.papyrus.uml.diagram.clazz.edit.helpers,
+ org.eclipse.papyrus.uml.diagram.clazz.edit.parts,
+ org.eclipse.papyrus.uml.diagram.clazz.edit.policies,
+ org.eclipse.papyrus.uml.diagram.clazz.expressions,
+ org.eclipse.papyrus.uml.diagram.clazz.navigator,
+ org.eclipse.papyrus.uml.diagram.clazz.parsers,
+ org.eclipse.papyrus.uml.diagram.clazz.part,
+ org.eclipse.papyrus.uml.diagram.clazz.providers
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Require-Bundle: org.eclipse.core.expressions,
+ org.eclipse.ui.navigator,
+ org.eclipse.ui.navigator.resources,
+ org.eclipse.gmf.runtime.diagram.ui.properties,
+ org.eclipse.gmf.runtime.diagram.ui.render,
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
+ org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="1.2.0",
+ org.eclipse.ocl.ecore,
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.2.0",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.2.0",
+ org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.3.0",
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.gmf.runtime.emf.core,
+ org.eclipse.gmf.runtime.emf.commands.core,
+ org.eclipse.gmf.runtime.emf.ui.properties,
+ org.eclipse.gmf.runtime.diagram.ui,
+ org.eclipse.gmf.runtime.diagram.ui.providers.ide,
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor,
+ org.eclipse.uml2.uml,
+ org.eclipse.gmf.runtime.draw2d.ui,
+ org.eclipse.ui,
+ org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.service.types;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0",
+ com.google.guava;bundle-version="11.0.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.appearance;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
+ org.eclipse.ui.ide;bundle-version="3.8.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.2.0",
+ org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
+ org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,4.0.0)",
+ org.eclipse.jface,
+ org.eclipse.ui.views,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.emf.ecore.edit;visibility:=reexport,
+ org.eclipse.emf.validation;visibility:=reexport,
+ org.eclipse.gef,
+ org.apache.batik.dom.svg;bundle-version="[1.6.0,1.7.0)",
+ org.apache.batik.util;bundle-version="[1.6.0,1.7.0)",
+ org.apache.batik.svggen;bundle-version="[1.6.0,1.7.0)",
+ org.apache.batik.dom;bundle-version="[1.6.0,1.7.0)",
+ org.w3c.dom.svg,
+ org.apache.batik.css;bundle-version="[1.6.0,1.7.0)",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.elementtypesconfigurations;bundle-version="1.2.0",
+ org.eclipse.core.databinding.observable,
+ org.eclipse.papyrus.infra.hyperlink;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.services.viewersearch;bundle-version="1.2.0"
+Bundle-Vendor: %providerName
+Eclipse-LazyStart: true
+Bundle-Version: 1.2.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.clazz.part.UMLDiagramEditorPlugin
+Bundle-ManifestVersion: 2
+Bundle-Description: %pluginDescription
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.clazz; singleton:=true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/hyperlink/InnerClassHyperlinkContributor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/hyperlink/InnerClassHyperlinkContributor.java
new file mode 100644
index 00000000000..438cb75a71b
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/hyperlink/InnerClassHyperlinkContributor.java
@@ -0,0 +1,104 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.clazz.custom.hyperlink;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.Activator;
+import org.eclipse.papyrus.infra.core.services.BadStateException;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkSpecificObject;
+import org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor;
+import org.eclipse.papyrus.infra.services.viewersearch.impl.ViewerSearchService;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * Returns a list of HyperLinkSpecificObjects (view elements) referencing
+ * inner classes of the class
+ *
+ * @author Shuai Li
+ *
+ */
+public class InnerClassHyperlinkContributor implements HyperlinkContributor {
+
+ /**
+ * @see org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor#getHyperlinks(java.lang.Object)
+ *
+ * @param fromElement
+ * @return
+ */
+ public List<HyperLinkObject> getHyperlinks(Object fromElement) {
+ ArrayList<HyperLinkObject> hyperlinks = new ArrayList<HyperLinkObject>();
+
+ if (fromElement instanceof org.eclipse.uml2.uml.Class) {
+ List<Element> elements = ((org.eclipse.uml2.uml.Class) fromElement).getOwnedElements();
+ List<org.eclipse.uml2.uml.Class> classes = new LinkedList<org.eclipse.uml2.uml.Class>();
+ for (Element element : elements) {
+ if (element.eClass().getName().equals("Class")) {
+ classes.add((org.eclipse.uml2.uml.Class) element);
+ }
+ }
+ List<Object> objectsInViews = new ArrayList<Object>();
+
+ for (org.eclipse.uml2.uml.Class clazz : classes) {
+ ViewerSearchService viewerSearchService = null;
+ try {
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (ServiceException e) {
+ if (e instanceof ServiceNotFoundException) {
+ viewerSearchService = new ViewerSearchService();
+ try {
+ viewerSearchService.startService();
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).add(ViewerSearchService.class, 1, viewerSearchService);
+ } catch (ServiceException e1) {
+ Activator.log.error(e1);
+ }
+ } else if (e instanceof BadStateException) {
+ try {
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).startRegistry();
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (Exception e1) {
+ Activator.log.error(e1);
+ }
+ }
+ }
+
+ if (viewerSearchService != null) {
+ List<Object> viewerSearchResults = viewerSearchService.getViewersInCurrentModel(clazz, (org.eclipse.uml2.uml.Class) fromElement, false, false);
+ objectsInViews.addAll(viewerSearchResults);
+ }
+ }
+
+ for (Object object : objectsInViews) {
+ if (object instanceof View && ((View) object).getDiagram()!= null) {
+ if (((View) object).getDiagram().getType().equals(ModelEditPart.MODEL_ID)) {
+ HyperLinkSpecificObject hyperlink = new HyperLinkSpecificObject((EObject) object);
+ hyperlinks.add(hyperlink);
+ }
+ }
+ }
+ }
+
+ return hyperlinks;
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/hyperlink/NestedPackageHyperlinkContributor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/hyperlink/NestedPackageHyperlinkContributor.java
new file mode 100644
index 00000000000..d877d170142
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/hyperlink/NestedPackageHyperlinkContributor.java
@@ -0,0 +1,124 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.clazz.custom.hyperlink;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.sashwindows.di.PageRef;
+import org.eclipse.papyrus.infra.core.services.BadStateException;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.hyperlink.Activator;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
+import org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor;
+import org.eclipse.papyrus.infra.services.viewersearch.impl.ViewerSearchService;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPart;
+
+/**
+ * Returns a list of HyperLinkEditor objects referencing views directly owned by
+ * the nested packages of the double-clicked package.
+ *
+ * @author Shuai Li
+ *
+ */
+public class NestedPackageHyperlinkContributor implements HyperlinkContributor {
+
+ /**
+ * @see org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor#getHyperlinks(java.lang.Object)
+ *
+ * @param fromElement
+ * @return
+ */
+ 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 {
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (ServiceException e) {
+ if (e instanceof ServiceNotFoundException) {
+ viewerSearchService = new ViewerSearchService();
+ try {
+ viewerSearchService.startService();
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).add(ViewerSearchService.class, 1, viewerSearchService);
+ } catch (ServiceException e1) {
+ Activator.log.error(e1);
+ }
+ } else if (e instanceof BadStateException) {
+ try {
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).startRegistry();
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (Exception e1) {
+ Activator.log.error(e1);
+ }
+ }
+ }
+
+ 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(ModelEditPart.MODEL_ID)) {
+ try {
+ // Page must not be active page
+ IPage activeSashPage = ServiceUtilsForEObject.getInstance().getISashWindowsContainer((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);
+ hyperlinks.add(hyperlink);
+ }
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
+ }
+
+
+ }
+ }
+
+ return hyperlinks;
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/hyperlink/NestingPackageHyperlinkContributor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/hyperlink/NestingPackageHyperlinkContributor.java
new file mode 100644
index 00000000000..bd6648763df
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/hyperlink/NestingPackageHyperlinkContributor.java
@@ -0,0 +1,121 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.clazz.custom.hyperlink;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.sashwindows.di.PageRef;
+import org.eclipse.papyrus.infra.core.services.BadStateException;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.hyperlink.Activator;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
+import org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor;
+import org.eclipse.papyrus.infra.services.viewersearch.impl.ViewerSearchService;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPart;
+
+/**
+ * Returns a list of HyperLinkEditor objects referencing views directly owned by
+ * the nesting package of the double-clicked package.
+ *
+ * @author Shuai Li
+ *
+ */
+public class NestingPackageHyperlinkContributor implements HyperlinkContributor {
+
+ /**
+ * @see org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor#getHyperlinks(java.lang.Object)
+ *
+ * @param fromElement
+ * @return
+ */
+ public List<HyperLinkObject> getHyperlinks(Object fromElement) {
+ ArrayList<HyperLinkObject> hyperlinks = new ArrayList<HyperLinkObject>();
+
+ if (fromElement instanceof org.eclipse.uml2.uml.Package) {
+ org.eclipse.uml2.uml.Package nestingPackage = ((org.eclipse.uml2.uml.Package) fromElement).getNestingPackage();
+ List<Object> pages = new ArrayList<Object>();
+
+ if (nestingPackage != null) {
+ ViewerSearchService viewerSearchService = null;
+ try {
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (ServiceException e) {
+ if (e instanceof ServiceNotFoundException) {
+ viewerSearchService = new ViewerSearchService();
+ try {
+ viewerSearchService.startService();
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).add(ViewerSearchService.class, 1, viewerSearchService);
+ } catch (ServiceException e1) {
+ Activator.log.error(e1);
+ }
+ } else if (e instanceof BadStateException) {
+ try {
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).startRegistry();
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (Exception e1) {
+ Activator.log.error(e1);
+ }
+ }
+ }
+
+ if (viewerSearchService != null) {
+ List<Object> viewerSearchResults = viewerSearchService.getViewersInCurrentModel(null, nestingPackage, true, false);
+ pages.addAll(viewerSearchResults);
+ }
+ }
+
+ for (Object page : pages) {
+ if (page instanceof Diagram
+ && ((Diagram) page).getType().equals(ModelEditPart.MODEL_ID)) {
+ try {
+ // Page must not be active page
+ IPage activeSashPage = ServiceUtilsForEObject.getInstance().getISashWindowsContainer((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);
+ hyperlinks.add(hyperlink);
+ }
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+ }
+
+ return hyperlinks;
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml
index 4ad59a49af9..9a3522329a8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml
@@ -1764,7 +1764,27 @@
<advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
</binding>
</extension>
-
+<extension
+ point="org.eclipse.papyrus.infra.hyperlink.hyperlinkContributor">
+ <contributor
+ contributor="org.eclipse.papyrus.uml.diagram.clazz.custom.hyperlink.InnerClassHyperlinkContributor"
+ description="Creates hyperlinks referencing inner classes of a class"
+ id="org.eclipse.papyrus.uml.diagram.clazz.hyperlink.innerClassHyperlinkContributor"
+ label="Inner class diagram hyperlinks">
+ </contributor>
+ <contributor
+ contributor="org.eclipse.papyrus.uml.diagram.clazz.custom.hyperlink.NestingPackageHyperlinkContributor"
+ description="Creates hyperlinks referencing class diagrams that are directly owned by the nesting package of the selected package"
+ id="org.eclipse.papyrus.uml.diagram.clazz.hyperlink.NestingPackageHyperlinkContributor"
+ label="Nesting package class diagram hyperlinks">
+ </contributor>
+ <contributor
+ contributor="org.eclipse.papyrus.uml.diagram.clazz.custom.hyperlink.NestedPackageHyperlinkContributor"
+ description="Creates hyperlinks referencing class diagrams that are directly owned by nested packages of the selected package"
+ id="org.eclipse.papyrus.uml.diagram.clazz.hyperlink.NestedPackageHyperlinkContributor"
+ label="Nested package class diagram hyperlinks">
+ </contributor>
+</extension>
</plugin>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF
index 06d2f576c60..2c72fc2e624 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF
@@ -1,125 +1,122 @@
-Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.uml.diagram.common,
- org.eclipse.papyrus.uml.diagram.common.actions,
- org.eclipse.papyrus.uml.diagram.common.actions.handlers,
- org.eclipse.papyrus.uml.diagram.common.canonical,
- org.eclipse.papyrus.uml.diagram.common.commands,
- org.eclipse.papyrus.uml.diagram.common.dialogs,
- org.eclipse.papyrus.uml.diagram.common.directedit,
- org.eclipse.papyrus.uml.diagram.common.dragtracker,
- org.eclipse.papyrus.uml.diagram.common.draw2d,
- org.eclipse.papyrus.uml.diagram.common.draw2d.anchors,
- org.eclipse.papyrus.uml.diagram.common.editparts,
- org.eclipse.papyrus.uml.diagram.common.editpolicies,
- org.eclipse.papyrus.uml.diagram.common.figure.edge,
- org.eclipse.papyrus.uml.diagram.common.figure.layout,
- org.eclipse.papyrus.uml.diagram.common.figure.node,
- org.eclipse.papyrus.uml.diagram.common.handlers,
- org.eclipse.papyrus.uml.diagram.common.helper,
- org.eclipse.papyrus.uml.diagram.common.layout,
- org.eclipse.papyrus.uml.diagram.common.listeners,
- org.eclipse.papyrus.uml.diagram.common.locator,
- org.eclipse.papyrus.uml.diagram.common.parser,
- org.eclipse.papyrus.uml.diagram.common.parser.assist,
- org.eclipse.papyrus.uml.diagram.common.parser.custom,
- org.eclipse.papyrus.uml.diagram.common.parser.lookup,
- org.eclipse.papyrus.uml.diagram.common.parser.packageimport,
- org.eclipse.papyrus.uml.diagram.common.parser.stereotype,
- org.eclipse.papyrus.uml.diagram.common.parser.structural,
- org.eclipse.papyrus.uml.diagram.common.part,
- org.eclipse.papyrus.uml.diagram.common.preferences,
- org.eclipse.papyrus.uml.diagram.common.providers,
- org.eclipse.papyrus.uml.diagram.common.providers.assistant,
- org.eclipse.papyrus.uml.diagram.common.resourceupdate,
- org.eclipse.papyrus.uml.diagram.common.service,
- org.eclipse.papyrus.uml.diagram.common.service.palette,
- org.eclipse.papyrus.uml.diagram.common.sheet,
- org.eclipse.papyrus.uml.diagram.common.stereotype,
- org.eclipse.papyrus.uml.diagram.common.stereotype.display.command,
- org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper,
- org.eclipse.papyrus.uml.diagram.common.stereotype.migration,
- org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies,
- org.eclipse.papyrus.uml.diagram.common.strategy.paste,
- org.eclipse.papyrus.uml.diagram.common.ui.dialogs,
- org.eclipse.papyrus.uml.diagram.common.ui.helper,
- org.eclipse.papyrus.uml.diagram.common.util,
- org.eclipse.papyrus.uml.diagram.common.util.functions,
- org.eclipse.papyrus.uml.diagram.common.util.predicates
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
- org.eclipse.gmf.runtime.diagram.ui.resources.editor,
- org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.1.0",
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0",
- org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.diagram.wizards;bundle-version="1.2.0",
- org.eclipse.papyrus.editor;bundle-version="1.2.0",
- org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="1.3.0",
- org.eclipse.ui,
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.2.0",
- org.eclipse.gmf.runtime.diagram.ui.actions,
- org.eclipse.gmf.runtime.draw2d.ui.render;bundle-version="1.4.0",
- org.eclipse.core.expressions,
- org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.diagram.navigation;bundle-version="1.2.0",
- org.eclipse.gmf.runtime.diagram.ui.printing,
- org.eclipse.gmf.runtime.diagram.ui.providers.ide,
- org.eclipse.papyrus.infra.services.decoration;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.services.resourceloading;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.tools;bundle-version="1.2.0",
- com.google.guava;bundle-version="11.0.0",
- org.eclipse.papyrus.uml.profile;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.2.0",
- org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
- org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
- org.eclipse.ui.ide;bundle-version="3.8.0",
- org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.2.0",
- org.eclipse.jface,
- org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.services.localizer;bundle-version="1.2.0",
- org.apache.batik.dom.svg;bundle-version="[1.6.0,
- 1.7.0)",
- org.w3c.dom.svg,
- org.apache.batik.css;bundle-version="[1.6.0,
- 1.7.0)",
- org.apache.batik.util;bundle-version="[1.6.0,
- 1.7.0)",
- org.apache.batik.dom;bundle-version="[1.6.0,
- 1.7.0)",
- org.eclipse.core.databinding;bundle-version="1.4.1",
- org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,
- 4.0.0)",
- org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.core.pluginexplorer;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.diagram.paletteconfiguration;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.tools;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.modelrepair;bundle-version="1.2.0",
- org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.menu;bundle-version="1.2.0",
- org.eclipse.e4.ui.css.core,
- org.eclipse.gmf.runtime.diagram.ui,
- org.eclipse.papyrus.infra.gmfdiag.canonical;bundle-version="1.2.0",
- org.eclipse.gef,
- org.eclipse.papyrus.uml.appearance;bundle-version="1.2.0",
- org.eclipse.emf.common
-Bundle-Vendor: %providerName
-Ant-Version: Apache Ant 1.7.0
-Bundle-Version: 1.2.0.qualifier
-Eclipse-BuddyPolicy: dependent
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.common.Activator
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.common;singleton:=true
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.uml.diagram.common,
+ org.eclipse.papyrus.uml.diagram.common.actions,
+ org.eclipse.papyrus.uml.diagram.common.actions.handlers,
+ org.eclipse.papyrus.uml.diagram.common.canonical,
+ org.eclipse.papyrus.uml.diagram.common.commands,
+ org.eclipse.papyrus.uml.diagram.common.dialogs,
+ org.eclipse.papyrus.uml.diagram.common.directedit,
+ org.eclipse.papyrus.uml.diagram.common.dragtracker,
+ org.eclipse.papyrus.uml.diagram.common.draw2d,
+ org.eclipse.papyrus.uml.diagram.common.draw2d.anchors,
+ org.eclipse.papyrus.uml.diagram.common.editparts,
+ org.eclipse.papyrus.uml.diagram.common.editpolicies,
+ org.eclipse.papyrus.uml.diagram.common.figure.edge,
+ org.eclipse.papyrus.uml.diagram.common.figure.layout,
+ org.eclipse.papyrus.uml.diagram.common.figure.node,
+ org.eclipse.papyrus.uml.diagram.common.handlers,
+ org.eclipse.papyrus.uml.diagram.common.helper,
+ org.eclipse.papyrus.uml.diagram.common.layout,
+ org.eclipse.papyrus.uml.diagram.common.listeners,
+ org.eclipse.papyrus.uml.diagram.common.locator,
+ org.eclipse.papyrus.uml.diagram.common.parser,
+ org.eclipse.papyrus.uml.diagram.common.parser.assist,
+ org.eclipse.papyrus.uml.diagram.common.parser.custom,
+ org.eclipse.papyrus.uml.diagram.common.parser.lookup,
+ org.eclipse.papyrus.uml.diagram.common.parser.packageimport,
+ org.eclipse.papyrus.uml.diagram.common.parser.stereotype,
+ org.eclipse.papyrus.uml.diagram.common.parser.structural,
+ org.eclipse.papyrus.uml.diagram.common.part,
+ org.eclipse.papyrus.uml.diagram.common.preferences,
+ org.eclipse.papyrus.uml.diagram.common.providers,
+ org.eclipse.papyrus.uml.diagram.common.providers.assistant,
+ org.eclipse.papyrus.uml.diagram.common.resourceupdate,
+ org.eclipse.papyrus.uml.diagram.common.service,
+ org.eclipse.papyrus.uml.diagram.common.service.palette,
+ org.eclipse.papyrus.uml.diagram.common.sheet,
+ org.eclipse.papyrus.uml.diagram.common.stereotype,
+ org.eclipse.papyrus.uml.diagram.common.stereotype.display.command,
+ org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper,
+ org.eclipse.papyrus.uml.diagram.common.stereotype.migration,
+ org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies,
+ org.eclipse.papyrus.uml.diagram.common.strategy.paste,
+ org.eclipse.papyrus.uml.diagram.common.ui.dialogs,
+ org.eclipse.papyrus.uml.diagram.common.ui.helper,
+ org.eclipse.papyrus.uml.diagram.common.util,
+ org.eclipse.papyrus.uml.diagram.common.util.functions,
+ org.eclipse.papyrus.uml.diagram.common.util.predicates
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor,
+ org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.1.0",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0",
+ org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.diagram.wizards;bundle-version="1.2.0",
+ org.eclipse.papyrus.editor;bundle-version="1.2.0",
+ org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="1.3.0",
+ org.eclipse.ui,
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.2.0",
+ org.eclipse.gmf.runtime.diagram.ui.actions,
+ org.eclipse.gmf.runtime.draw2d.ui.render;bundle-version="1.4.0",
+ org.eclipse.core.expressions,
+ org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.diagram.navigation;bundle-version="1.2.0",
+ org.eclipse.gmf.runtime.diagram.ui.printing,
+ org.eclipse.gmf.runtime.diagram.ui.providers.ide,
+ org.eclipse.papyrus.infra.services.decoration;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.services.resourceloading;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.tools;bundle-version="1.2.0",
+ com.google.guava;bundle-version="11.0.0",
+ org.eclipse.papyrus.uml.profile;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.2.0",
+ org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
+ org.eclipse.ui.ide;bundle-version="3.8.0",
+ org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.2.0",
+ org.eclipse.jface,
+ org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.services.localizer;bundle-version="1.2.0",
+ org.apache.batik.dom.svg;bundle-version="[1.6.0,1.7.0)",
+ org.w3c.dom.svg,
+ org.apache.batik.css;bundle-version="[1.6.0,1.7.0)",
+ org.apache.batik.util;bundle-version="[1.6.0,1.7.0)",
+ org.apache.batik.dom;bundle-version="[1.6.0,1.7.0)",
+ org.eclipse.core.databinding;bundle-version="1.4.1",
+ org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,4.0.0)",
+ org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.pluginexplorer;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.diagram.paletteconfiguration;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.tools;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.modelrepair;bundle-version="1.2.0",
+ org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.menu;bundle-version="1.2.0",
+ org.eclipse.e4.ui.css.core,
+ org.eclipse.gmf.runtime.diagram.ui,
+ org.eclipse.papyrus.infra.gmfdiag.canonical;bundle-version="1.2.0",
+ org.eclipse.gef,
+ org.eclipse.papyrus.uml.appearance;bundle-version="1.2.0",
+ org.eclipse.emf.common,
+ org.eclipse.papyrus.infra.services.viewersearch;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.hyperlink;bundle-version="1.2.0"
+Bundle-Vendor: %providerName
+Ant-Version: Apache Ant 1.7.0
+Bundle-Version: 1.2.0.qualifier
+Eclipse-BuddyPolicy: dependent
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.common.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.common;singleton:=true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml
index eafd39e9027..0cdc2155a3b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml
@@ -568,4 +568,19 @@
</enablement>
</visualChildrenStrategy>
</extension>
+<extension
+ point="org.eclipse.papyrus.infra.hyperlink.hyperlinkContributor">
+ <contributor
+ contributor="org.eclipse.papyrus.uml.diagram.common.hyperlink.DirectedRelationshipTargetHyperlinkContributor"
+ description="Creates hyperlinks referencing targets of directed relationships for which the clicked element is a source"
+ id="org.eclipse.papyrus.uml.diagram.common.DirectedRelationshipTargetHyperlinkContributor"
+ label="Directed relationship target hyperlinks">
+ </contributor>
+ <contributor
+ contributor="org.eclipse.papyrus.uml.diagram.common.hyperlink.DirectedRelationshipSourceHyperlinkContributor"
+ description="Creates hyperlinks referencing sources of directed relationships for which the clicekd element is a target"
+ id="org.eclipse.papyrus.uml.diagram.common.DirectedRelationshipSourceHyperlinkContributor"
+ label="Directed relationship source hyperlinks">
+ </contributor>
+</extension>
</plugin>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/hyperlink/DirectedRelationshipSourceHyperlinkContributor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/hyperlink/DirectedRelationshipSourceHyperlinkContributor.java
new file mode 100644
index 00000000000..a9fabe40499
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/hyperlink/DirectedRelationshipSourceHyperlinkContributor.java
@@ -0,0 +1,146 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.hyperlink;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.sasheditor.editor.IPage;
+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;
+import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.hyperlink.Activator;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkSpecificObject;
+import org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor;
+import org.eclipse.papyrus.infra.services.viewersearch.impl.ViewerSearchService;
+import org.eclipse.uml2.uml.DirectedRelationship;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * Returns a list of HyperLinkSpecificObjects (view elements) referencing
+ * sources of the directed relationships for which the element is a target
+ *
+ * @author Shuai Li
+ *
+ */
+public class DirectedRelationshipSourceHyperlinkContributor implements HyperlinkContributor {
+
+ /**
+ * @see org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor#getHyperlinks(java.lang.Object)
+ *
+ * @param fromElement
+ * @return
+ */
+ public List<HyperLinkObject> getHyperlinks(Object fromElement) {
+ ArrayList<HyperLinkObject> hyperlinks = new ArrayList<HyperLinkObject>();
+
+ if (fromElement instanceof Element) {
+ List<DirectedRelationship> relationships = ((Element) fromElement).getTargetDirectedRelationships();
+
+ List<Object> objectsInViews = new ArrayList<Object>();
+
+ for (DirectedRelationship relationship : relationships) {
+ for (Element source : relationship.getSources()) {
+ ViewerSearchService viewerSearchService = null;
+ try {
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (ServiceException e) {
+ if (e instanceof ServiceNotFoundException) {
+ viewerSearchService = new ViewerSearchService();
+ try {
+ viewerSearchService.startService();
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).add(ViewerSearchService.class, 1, viewerSearchService);
+ } catch (ServiceException e1) {
+ Activator.log.error(e1);
+ }
+ } else if (e instanceof BadStateException) {
+ try {
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).startRegistry();
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (Exception e1) {
+ Activator.log.error(e1);
+ }
+ }
+ }
+
+ if (viewerSearchService != null) {
+ List<Object> viewerSearchResults = viewerSearchService.getViewersInCurrentModel(source, null, false, false);
+ objectsInViews.addAll(viewerSearchResults);
+ }
+ }
+ }
+
+ // Get active page to later check if a found object is in the active page (we don't want the object then)
+ TreeIterator<EObject> allViewsOfActivatePage = null;
+ View page = null;
+ try {
+ IPage activePage = ServiceUtilsForEObject.getInstance().getISashWindowsContainer((Element) fromElement).getActiveSashWindowsPage();
+
+ if (activePage != null) {
+ Object pageId = activePage.getRawModel();
+
+ if (pageId instanceof PageRef) {
+ Object emfPageId = ((PageRef) pageId).getEmfPageIdentifier();
+
+ if (emfPageId instanceof View) {
+ page = ((View) emfPageId);
+ }
+ }
+ }
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
+
+ for (Object object : objectsInViews) {
+ if (object instanceof View) {
+ // Check if the activate page contains the object
+ // If so, we do not create a hyperlink for the object
+ boolean inActivePage = false;
+ if (page != null) {
+ allViewsOfActivatePage = page.eAllContents();
+ while (allViewsOfActivatePage.hasNext()) {
+ EObject next = allViewsOfActivatePage.next();
+ if (!(next instanceof View)) {
+ allViewsOfActivatePage.prune();
+ continue;
+ }
+
+ View nextView = (View) next;
+ if (object.equals(nextView)) {
+ inActivePage = true;
+ break;
+ }
+ }
+ }
+
+ if (!inActivePage) {
+ HyperLinkSpecificObject hyperlink = new HyperLinkSpecificObject((EObject) object);
+ hyperlinks.add(hyperlink);
+ }
+ }
+ }
+ }
+
+
+ return hyperlinks;
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/hyperlink/DirectedRelationshipTargetHyperlinkContributor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/hyperlink/DirectedRelationshipTargetHyperlinkContributor.java
new file mode 100644
index 00000000000..35dd66e81f7
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/hyperlink/DirectedRelationshipTargetHyperlinkContributor.java
@@ -0,0 +1,145 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.hyperlink;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.sasheditor.editor.IPage;
+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;
+import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.hyperlink.Activator;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkSpecificObject;
+import org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor;
+import org.eclipse.papyrus.infra.services.viewersearch.impl.ViewerSearchService;
+import org.eclipse.uml2.uml.DirectedRelationship;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * Returns a list of HyperLinkSpecificObjects (view elements) referencing
+ * targets of the directed relationships for which the element is a source
+ *
+ * @author Shuai Li
+ *
+ */
+public class DirectedRelationshipTargetHyperlinkContributor implements HyperlinkContributor {
+
+ /**
+ * @see org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor#getHyperlinks(java.lang.Object)
+ *
+ * @param fromElement
+ * @return
+ */
+ public List<HyperLinkObject> getHyperlinks(Object fromElement) {
+ ArrayList<HyperLinkObject> hyperlinks = new ArrayList<HyperLinkObject>();
+
+ if (fromElement instanceof Element) {
+ List<DirectedRelationship> relationships = ((Element) fromElement).getSourceDirectedRelationships();
+
+ List<Object> objectsInViews = new ArrayList<Object>();
+
+ for (DirectedRelationship relationship : relationships) {
+ for (Element target : relationship.getTargets()) {
+ ViewerSearchService viewerSearchService = null;
+ try {
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (ServiceException e) {
+ if (e instanceof ServiceNotFoundException) {
+ viewerSearchService = new ViewerSearchService();
+ try {
+ viewerSearchService.startService();
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).add(ViewerSearchService.class, 1, viewerSearchService);
+ } catch (ServiceException e1) {
+ Activator.log.error(e1);
+ }
+ } else if (e instanceof BadStateException) {
+ try {
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).startRegistry();
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (Exception e1) {
+ Activator.log.error(e1);
+ }
+ }
+ }
+
+ if (viewerSearchService != null) {
+ List<Object> viewerSearchResults = viewerSearchService.getViewersInCurrentModel(target, null, false, false);
+ objectsInViews.addAll(viewerSearchResults);
+ }
+ }
+ }
+
+ // Get active page to later check if a found object is in the active page (we don't want the object then)
+ TreeIterator<EObject> allViewsOfActivatePage = null;
+ View page = null;
+ try {
+ IPage activePage = ServiceUtilsForEObject.getInstance().getISashWindowsContainer((Element) fromElement).getActiveSashWindowsPage();
+
+ if (activePage != null) {
+ Object pageId = activePage.getRawModel();
+
+ if (pageId instanceof PageRef) {
+ Object emfPageId = ((PageRef) pageId).getEmfPageIdentifier();
+
+ if (emfPageId instanceof View) {
+ page = ((View) emfPageId);
+ }
+ }
+ }
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
+
+ for (Object object : objectsInViews) {
+ if (object instanceof View) {
+ // Check if the activate page contains the object
+ // If so, we do not create a hyperlink for the object
+ boolean inActivePage = false;
+ if (page != null) {
+ allViewsOfActivatePage = page.eAllContents();
+ while (allViewsOfActivatePage.hasNext()) {
+ EObject next = allViewsOfActivatePage.next();
+ if (!(next instanceof View)) {
+ allViewsOfActivatePage.prune();
+ continue;
+ }
+
+ View nextView = (View) next;
+ if (object.equals(nextView)) {
+ inActivePage = true;
+ break;
+ }
+ }
+ }
+
+ if (!inActivePage) {
+ HyperLinkSpecificObject hyperlink = new HyperLinkSpecificObject((EObject) object);
+ hyperlinks.add(hyperlink);
+ }
+ }
+ }
+ }
+
+ return hyperlinks;
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF
index 0afa4c8f4ff..085eb942ea6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF
@@ -77,14 +77,15 @@ Require-Bundle: org.eclipse.emf.ecore,
org.eclipse.ocl.ecore;visibility:=reexport,
org.eclipse.emf.validation;visibility:=reexport,
org.eclipse.gef,
- org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,
- 4.0.0)",
+ org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,4.0.0)",
org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0",
org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.2.0",
org.eclipse.papyrus.views.properties;bundle-version="1.2.0",
org.eclipse.papyrus.infra.gmfdiag.canonical;bundle-version="1.2.0",
org.eclipse.core.databinding.observable,
- org.eclipse.papyrus.infra.elementtypesconfigurations;bundle-version="1.2.0"
+ org.eclipse.papyrus.infra.elementtypesconfigurations;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.hyperlink;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.services.viewersearch;bundle-version="1.2.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 1.2.0.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/InnerCompositeStructureHyperlinkContributor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/InnerCompositeStructureHyperlinkContributor.java
new file mode 100644
index 00000000000..4958813b7ac
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/InnerCompositeStructureHyperlinkContributor.java
@@ -0,0 +1,94 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.composite.custom.hyperlink;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.core.Activator;
+import org.eclipse.papyrus.infra.core.services.BadStateException;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
+import org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor;
+import org.eclipse.papyrus.infra.services.viewersearch.impl.ViewerSearchService;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CompositeStructureDiagramEditPart;
+
+/**
+ * Returns a list of HyperLinkEditors referencing
+ * inner composite structure diagrams
+ *
+ * @author Shuai Li
+ *
+ */
+public class InnerCompositeStructureHyperlinkContributor implements HyperlinkContributor {
+
+ /**
+ * @see org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor#getHyperlinks(java.lang.Object)
+ *
+ * @param fromElement
+ * @return
+ */
+ public List<HyperLinkObject> getHyperlinks(Object fromElement) {
+ ArrayList<HyperLinkObject> hyperlinks = new ArrayList<HyperLinkObject>();
+
+ if (fromElement instanceof org.eclipse.uml2.uml.Class) {
+ List<Object> objectsInViews = new ArrayList<Object>();
+
+ ViewerSearchService viewerSearchService = null;
+ try {
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (ServiceException e) {
+ if (e instanceof ServiceNotFoundException) {
+ viewerSearchService = new ViewerSearchService();
+ try {
+ viewerSearchService.startService();
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).add(ViewerSearchService.class, 1, viewerSearchService);
+ } catch (ServiceException e1) {
+ Activator.log.error(e1);
+ }
+ } else if (e instanceof BadStateException) {
+ try {
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).startRegistry();
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (Exception e1) {
+ Activator.log.error(e1);
+ }
+ }
+ }
+
+ if (viewerSearchService != null) {
+ List<Object> viewerSearchResults = viewerSearchService.getViewersInCurrentModel((org.eclipse.uml2.uml.Class) fromElement, (org.eclipse.uml2.uml.Class) fromElement, true, false);
+ objectsInViews.addAll(viewerSearchResults);
+ }
+
+ for (Object object : objectsInViews) {
+ if (object instanceof Diagram) {
+ if (((Diagram) object).getType().equals(CompositeStructureDiagramEditPart.MODEL_ID)) {
+ HyperLinkEditor hyperlink = new HyperLinkEditor();
+ hyperlink.setObject(object);
+ hyperlinks.add(hyperlink);
+ }
+ }
+ }
+ }
+
+ return hyperlinks;
+ }
+
+}
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
new file mode 100644
index 00000000000..0750025442a
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestedPackageHyperlinkContributor.java
@@ -0,0 +1,124 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.composite.custom.hyperlink;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.sashwindows.di.PageRef;
+import org.eclipse.papyrus.infra.core.services.BadStateException;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.hyperlink.Activator;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
+import org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor;
+import org.eclipse.papyrus.infra.services.viewersearch.impl.ViewerSearchService;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CompositeStructureDiagramEditPart;
+
+/**
+ * Returns a list of HyperLinkEditor objects referencing views directly owned by
+ * the nested packages of the double-clicked package.
+ *
+ * @author Shuai Li
+ *
+ */
+public class NestedPackageHyperlinkContributor implements HyperlinkContributor {
+
+ /**
+ * @see org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor#getHyperlinks(java.lang.Object)
+ *
+ * @param fromElement
+ * @return
+ */
+ 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 {
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (ServiceException e) {
+ if (e instanceof ServiceNotFoundException) {
+ viewerSearchService = new ViewerSearchService();
+ try {
+ viewerSearchService.startService();
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).add(ViewerSearchService.class, 1, viewerSearchService);
+ } catch (ServiceException e1) {
+ Activator.log.error(e1);
+ }
+ } else if (e instanceof BadStateException) {
+ try {
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).startRegistry();
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (Exception e1) {
+ Activator.log.error(e1);
+ }
+ }
+ }
+
+ 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();
+ 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);
+ hyperlinks.add(hyperlink);
+ }
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
+ }
+
+
+ }
+ }
+
+ return hyperlinks;
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestingPackageHyperlinkContributor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestingPackageHyperlinkContributor.java
new file mode 100644
index 00000000000..272c0630c6d
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/hyperlink/NestingPackageHyperlinkContributor.java
@@ -0,0 +1,121 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.composite.custom.hyperlink;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.sashwindows.di.PageRef;
+import org.eclipse.papyrus.infra.core.services.BadStateException;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.hyperlink.Activator;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
+import org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor;
+import org.eclipse.papyrus.infra.services.viewersearch.impl.ViewerSearchService;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CompositeStructureDiagramEditPart;
+
+/**
+ * Returns a list of HyperLinkEditor objects referencing views directly owned by
+ * the nesting package of the double-clicked package.
+ *
+ * @author Shuai Li
+ *
+ */
+public class NestingPackageHyperlinkContributor implements HyperlinkContributor {
+
+ /**
+ * @see org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor#getHyperlinks(java.lang.Object)
+ *
+ * @param fromElement
+ * @return
+ */
+ public List<HyperLinkObject> getHyperlinks(Object fromElement) {
+ ArrayList<HyperLinkObject> hyperlinks = new ArrayList<HyperLinkObject>();
+
+ if (fromElement instanceof org.eclipse.uml2.uml.Package) {
+ org.eclipse.uml2.uml.Package nestingPackage = ((org.eclipse.uml2.uml.Package) fromElement).getNestingPackage();
+ List<Object> pages = new ArrayList<Object>();
+
+ if (nestingPackage != null) {
+ ViewerSearchService viewerSearchService = null;
+ try {
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (ServiceException e) {
+ if (e instanceof ServiceNotFoundException) {
+ viewerSearchService = new ViewerSearchService();
+ try {
+ viewerSearchService.startService();
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).add(ViewerSearchService.class, 1, viewerSearchService);
+ } catch (ServiceException e1) {
+ Activator.log.error(e1);
+ }
+ } else if (e instanceof BadStateException) {
+ try {
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).startRegistry();
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (Exception e1) {
+ Activator.log.error(e1);
+ }
+ }
+ }
+
+ if (viewerSearchService != null) {
+ List<Object> viewerSearchResults = viewerSearchService.getViewersInCurrentModel(null, nestingPackage, 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();
+ 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);
+ hyperlinks.add(hyperlink);
+ }
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+ }
+
+ return hyperlinks;
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml
index 80313dbb4ab..65b59e1b2e0 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml
@@ -1531,6 +1531,27 @@
target="1.1.0">
</diagramReconciler>
</extension>
+<extension
+ point="org.eclipse.papyrus.infra.hyperlink.hyperlinkContributor">
+ <contributor
+ contributor="org.eclipse.papyrus.uml.diagram.composite.custom.hyperlink.InnerCompositeStructureHyperlinkContributor"
+ description="Creates hyperlinks referencing inner composite structure diagrams"
+ id="org.eclipse.papyrus.uml.diagram.composite.hyperlink.InnerCompositeStructureHyperlinkContributor"
+ label="Inner composite structure diagram hyperlinks">
+ </contributor>
+ <contributor
+ contributor="org.eclipse.papyrus.uml.diagram.comosite.custom.hyperlink.NestingPackageHyperlinkContributor"
+ description="Creates hyperlinks referencing composite structure diagrams that are directly owned by the nesting package of the selected package"
+ id="org.eclipse.papyrus.uml.diagram.composite.hyperlink.NestingPackageHyperlinkContributor"
+ label="Nesting package composite structure diagram hyperlinks">
+ </contributor>
+ <contributor
+ contributor="org.eclipse.papyrus.uml.diagram.comosite.custom.hyperlink.NestedPackageHyperlinkContributor"
+ description="Creates hyperlinks referencing composite structure diagrams that are directly owned by nested packages of the selected package"
+ id="org.eclipse.papyrus.uml.diagram.composite.hyperlink.NestedPackageHyperlinkContributor"
+ label="Nested package composite structure diagram hyperlinks">
+ </contributor>
+</extension>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF
index 04c64769269..9991b8eed46 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF
@@ -1,89 +1,90 @@
-Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.uml.diagram.statemachine,
- org.eclipse.papyrus.uml.diagram.statemachine.custom.commands,
- org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part,
- org.eclipse.papyrus.uml.diagram.statemachine.custom.expressions,
- org.eclipse.papyrus.uml.diagram.statemachine.custom.factory,
- org.eclipse.papyrus.uml.diagram.statemachine.custom.figures,
- org.eclipse.papyrus.uml.diagram.statemachine.custom.helpers,
- org.eclipse.papyrus.uml.diagram.statemachine.custom.listeners,
- org.eclipse.papyrus.uml.diagram.statemachine.custom.parsers,
- org.eclipse.papyrus.uml.diagram.statemachine.custom.policies,
- org.eclipse.papyrus.uml.diagram.statemachine.custom.providers,
- org.eclipse.papyrus.uml.diagram.statemachine.edit.helpers,
- org.eclipse.papyrus.uml.diagram.statemachine.edit.parts,
- org.eclipse.papyrus.uml.diagram.statemachine.edit.policies,
- org.eclipse.papyrus.uml.diagram.statemachine.parsers,
- org.eclipse.papyrus.uml.diagram.statemachine.part,
- org.eclipse.papyrus.uml.diagram.statemachine.preferences,
- org.eclipse.papyrus.uml.diagram.statemachine.providers,
- org.eclipse.papyrus.uml.diagram.statemachine.sheet
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Require-Bundle: org.eclipse.core.expressions,
- org.eclipse.core.resources,
- org.eclipse.core.runtime,
- org.eclipse.emf.ecore,
- org.eclipse.emf.ecore.edit;visibility:=reexport,
- org.eclipse.emf.ecore.xmi,
- org.eclipse.emf.ecore;visibility:=reexport,
- org.eclipse.emf.edit.ui,
- org.eclipse.emf.validation,
- org.eclipse.emf.validation.ocl;visibility:=reexport,
- org.eclipse.gef,
- org.eclipse.gmf.runtime.diagram.ui,
- org.eclipse.gmf.runtime.diagram.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui.providers,
- org.eclipse.gmf.runtime.diagram.ui.providers.ide,
- org.eclipse.gmf.runtime.diagram.ui.render,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
- org.eclipse.gmf.runtime.draw2d.ui,
- org.eclipse.gmf.runtime.draw2d.ui,
- org.eclipse.gmf.runtime.emf.commands.core,
- org.eclipse.gmf.runtime.emf.core,
- org.eclipse.gmf.runtime.emf.ui.properties,
- org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,
- 4.0.0)",
- org.eclipse.jface,
- org.eclipse.ocl.ecore,
- org.eclipse.papyrus.editor;bundle-version="1.2.0",
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.appearance;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.diagram.common;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.diagram.navigation;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.service.types;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.tools;bundle-version="1.2.0",
- org.eclipse.ui.ide;bundle-version="3.8.0",
- org.eclipse.ui.views,
- org.eclipse.uml2.uml,
- org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
- org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
- org.eclipse.core.databinding.observable,
- org.eclipse.papyrus.infra.gmfdiag.canonical;bundle-version="1.2.0",
- com.google.guava;bundle-version="11.0.0"
-Bundle-Vendor: %providerName
-Ant-Version: Apache Ant 1.7.0
-Eclipse-LazyStart: true
-Bundle-Version: 1.2.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditorPlugin
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.statemachine; singleton:=true
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.uml.diagram.statemachine,
+ org.eclipse.papyrus.uml.diagram.statemachine.custom.commands,
+ org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part,
+ org.eclipse.papyrus.uml.diagram.statemachine.custom.expressions,
+ org.eclipse.papyrus.uml.diagram.statemachine.custom.factory,
+ org.eclipse.papyrus.uml.diagram.statemachine.custom.figures,
+ org.eclipse.papyrus.uml.diagram.statemachine.custom.helpers,
+ org.eclipse.papyrus.uml.diagram.statemachine.custom.listeners,
+ org.eclipse.papyrus.uml.diagram.statemachine.custom.parsers,
+ org.eclipse.papyrus.uml.diagram.statemachine.custom.policies,
+ org.eclipse.papyrus.uml.diagram.statemachine.custom.providers,
+ org.eclipse.papyrus.uml.diagram.statemachine.edit.helpers,
+ org.eclipse.papyrus.uml.diagram.statemachine.edit.parts,
+ org.eclipse.papyrus.uml.diagram.statemachine.edit.policies,
+ org.eclipse.papyrus.uml.diagram.statemachine.parsers,
+ org.eclipse.papyrus.uml.diagram.statemachine.part,
+ org.eclipse.papyrus.uml.diagram.statemachine.preferences,
+ org.eclipse.papyrus.uml.diagram.statemachine.providers,
+ org.eclipse.papyrus.uml.diagram.statemachine.sheet
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Require-Bundle: org.eclipse.core.expressions,
+ org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.ecore.edit;visibility:=reexport,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.emf.validation,
+ org.eclipse.emf.validation.ocl;visibility:=reexport,
+ org.eclipse.gef,
+ org.eclipse.gmf.runtime.diagram.ui,
+ org.eclipse.gmf.runtime.diagram.ui.properties,
+ org.eclipse.gmf.runtime.diagram.ui.providers,
+ org.eclipse.gmf.runtime.diagram.ui.providers.ide,
+ org.eclipse.gmf.runtime.diagram.ui.render,
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor,
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
+ org.eclipse.gmf.runtime.draw2d.ui,
+ org.eclipse.gmf.runtime.draw2d.ui,
+ org.eclipse.gmf.runtime.emf.commands.core,
+ org.eclipse.gmf.runtime.emf.core,
+ org.eclipse.gmf.runtime.emf.ui.properties,
+ org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,4.0.0)",
+ org.eclipse.jface,
+ org.eclipse.ocl.ecore,
+ org.eclipse.papyrus.editor;bundle-version="1.2.0",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.appearance;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.diagram.navigation;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.service.types;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.tools;bundle-version="1.2.0",
+ org.eclipse.ui.ide;bundle-version="3.8.0",
+ org.eclipse.ui.views,
+ org.eclipse.uml2.uml,
+ org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
+ org.eclipse.core.databinding.observable,
+ org.eclipse.papyrus.infra.gmfdiag.canonical;bundle-version="1.2.0",
+ com.google.guava;bundle-version="11.0.0",
+ org.eclipse.papyrus.infra.hyperlink;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.services.viewersearch;bundle-version="1.2.0"
+Bundle-Vendor: %providerName
+Ant-Version: Apache Ant 1.7.0
+Eclipse-LazyStart: true
+Bundle-Version: 1.2.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditorPlugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.statemachine; singleton:=true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/hyperlink/OwnedBehaviorHyperlinkContributor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/hyperlink/OwnedBehaviorHyperlinkContributor.java
new file mode 100644
index 00000000000..0c57ab7a0cc
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/hyperlink/OwnedBehaviorHyperlinkContributor.java
@@ -0,0 +1,100 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.statemachine.custom.hyperlink;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.Activator;
+import org.eclipse.papyrus.infra.core.services.BadStateException;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkSpecificObject;
+import org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor;
+import org.eclipse.papyrus.infra.services.viewersearch.impl.ViewerSearchService;
+import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.PackageEditPart;
+import org.eclipse.uml2.uml.Behavior;
+import org.eclipse.uml2.uml.BehavioredClassifier;
+
+/**
+ * Returns a list of HyperLinkSpecificObjects (view elements) referencing
+ * owned behaviors of a BehaviorClassifier
+ *
+ * @author Shuai Li
+ *
+ */
+public class OwnedBehaviorHyperlinkContributor implements HyperlinkContributor {
+
+ /**
+ * @see org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor#getHyperlinks(java.lang.Object)
+ *
+ * @param fromElement
+ * @return
+ */
+ public List<HyperLinkObject> getHyperlinks(Object fromElement) {
+ ArrayList<HyperLinkObject> hyperlinks = new ArrayList<HyperLinkObject>();
+
+ if (fromElement instanceof BehavioredClassifier) {
+ List<Behavior> behaviors = ((BehavioredClassifier) fromElement).getOwnedBehaviors();
+ List<Object> objectsInViews = new ArrayList<Object>();
+
+ for (Behavior behavior : behaviors) {
+ ViewerSearchService viewerSearchService = null;
+ try {
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (ServiceException e) {
+ if (e instanceof ServiceNotFoundException) {
+ viewerSearchService = new ViewerSearchService();
+ try {
+ viewerSearchService.startService();
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).add(ViewerSearchService.class, 1, viewerSearchService);
+ } catch (ServiceException e1) {
+ Activator.log.error(e1);
+ }
+ } else if (e instanceof BadStateException) {
+ try {
+ ServiceUtilsForEObject.getInstance().getServiceRegistry((EObject) fromElement).startRegistry();
+ viewerSearchService = ServiceUtilsForEObject.getInstance().getService(ViewerSearchService.class, (EObject) fromElement);
+ } catch (Exception e1) {
+ Activator.log.error(e1);
+ }
+ }
+ }
+
+ if (viewerSearchService != null) {
+ List<Object> viewerSearchResults = viewerSearchService.getViewersInCurrentModel(behavior, (BehavioredClassifier) fromElement, false, false);
+ objectsInViews.addAll(viewerSearchResults);
+ }
+ }
+
+ for (Object object : objectsInViews) {
+ if (object instanceof View && ((View) object).getDiagram()!= null) {
+ if (((View) object).getDiagram().getType().equals(PackageEditPart.MODEL_ID)) { // PackageEditPart of org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.parts
+ HyperLinkSpecificObject hyperlink = new HyperLinkSpecificObject((EObject) object);
+ hyperlinks.add(hyperlink);
+ }
+ }
+ }
+ }
+
+ return hyperlinks;
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
index 8a60d3dfe6c..ad635373371 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
@@ -878,4 +878,13 @@
target="1.2.0">
</diagramReconciler>
</extension>
+<extension
+ point="org.eclipse.papyrus.infra.hyperlink.hyperlinkContributor">
+ <contributor
+ contributor="org.eclipse.papyrus.uml.diagram.statemachine.custom.hyperlink.OwnedBehaviorHyperlinkContributor"
+ description="Creates hyperlinks referencing a state machine represented in a diagram owned by a behaviored classifier"
+ id="org.eclipse.papyrus.uml.diagram.statemachine.ownedBehaviorHyperlinkContributor"
+ label="Owned state machine hyperlinks">
+ </contributor>
+</extension>
</plugin>

Back to the top