Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Le Menez2014-07-30 11:14:08 +0000
committerQuentin Le Menez2014-07-30 11:14:08 +0000
commita54d6be620edede8dc4d0f7f174fb4b6c840b6e2 (patch)
treeb545849d4b9ef4de11ec700ab8056eb4c7a033bb /plugins/views
parent3b5be2995a18bf80f38dfbffd4a880b039ba65f3 (diff)
downloadorg.eclipse.papyrus-a54d6be620edede8dc4d0f7f174fb4b6c840b6e2.tar.gz
org.eclipse.papyrus-a54d6be620edede8dc4d0f7f174fb4b6c840b6e2.tar.xz
org.eclipse.papyrus-a54d6be620edede8dc4d0f7f174fb4b6c840b6e2.zip
440545: Switch from IrevealSemanticElement to NavigationTarget
https://bugs.eclipse.org/bugs/show_bug.cgi?id=440545 - changed from IRevealSemanticElement's revealSemanticElement methods to NavigationTarget's revealElement for the table selections - amended the existing classes LinkHelper, SynchronizableGmfDiagramEditor and ModelExplorerView Change-Id: I90ad7103812fd27c3ca729375bf1aa89f6a16c09 Signed-off-by: Quentin Le Menez <quentin.lemenez@cea.fr>
Diffstat (limited to 'plugins/views')
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java25
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java16
2 files changed, 37 insertions, 4 deletions
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java
index b8575e3b482..5d08aa44c3e 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java
@@ -24,6 +24,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForWorkbenchPage;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.widgets.util.IRevealSemanticElement;
+import org.eclipse.papyrus.infra.widgets.util.NavigationTarget;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.ISelectionService;
@@ -76,15 +77,31 @@ public class LinkHelper implements ILinkHelper {
ArrayList<Object> semanticElementList = new ArrayList<Object>();
while(selectionIterator.hasNext()) {
Object currentSelection = selectionIterator.next();
- Object semanticElement = EMFHelper.getEObject(currentSelection);
- if(semanticElement != null) {
- semanticElementList.add(semanticElement);
- }
+ Object semanticElement = EMFHelper.getEObject(currentSelection);
+ if(semanticElement != null) {
+ semanticElementList.add(semanticElement);
+ }
}
((IRevealSemanticElement)diagramEditor).revealSemanticElement(semanticElementList);
}
}
+
+ if(diagramEditor instanceof NavigationTarget) {
+ if(aSelection instanceof IStructuredSelection) {
+ Iterator<?> selectionIterator = aSelection.iterator();
+ ArrayList<Object> semanticElementList = new ArrayList<Object>();
+ while(selectionIterator.hasNext()) {
+ Object currentSelection = selectionIterator.next();
+ Object semanticElement = EMFHelper.getEObject(currentSelection);
+ if(semanticElement != null) {
+ semanticElementList.add(semanticElement);
+ }
+ }
+
+ ((NavigationTarget)diagramEditor).revealElement(semanticElementList);
+ }
+ }
}
} catch (ServiceException ex) {
//We cannot access the service registry. The PapyrusEditor is probably closed.
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
index b7f71045b88..2fc9fd248e0 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
@@ -115,6 +115,8 @@ import org.eclipse.ui.navigator.CommonNavigator;
import org.eclipse.ui.navigator.CommonViewer;
import org.eclipse.ui.navigator.CommonViewerSorter;
import org.eclipse.ui.navigator.IExtensionActivationListener;
+import org.eclipse.ui.navigator.ILinkHelper;
+import org.eclipse.ui.navigator.LinkHelperService;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
@@ -284,6 +286,20 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
}
}
+
+ // Selections from the Model Explorer result in a part from the ModelExplorerPageBookView instance which is not an IEditorPart
+ if(part instanceof ModelExplorerPageBookView && !selection.isEmpty()) {
+ if(selection instanceof IStructuredSelection) {
+ // Extracted from org.eclipse.ui.internal.navigator.actions.LinkEditorAction activateEditorJob
+ // the problem was that multi-element selections were disabled as only selections of 1 could clear the condition size()==1
+ IStructuredSelection sSelection = (IStructuredSelection)selection;
+ LinkHelperService linkService = getLinkHelperService();
+ ILinkHelper[] helpers = linkService.getLinkHelpersFor(sSelection.getFirstElement()); // LinkHelper in org.eclipse.papyrus.views.modelexplorer
+ if(helpers.length > 0) {
+ helpers[0].activateEditor(part.getSite().getPage(), sSelection);
+ }
+ }
+ }
}
}

Back to the top