Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael ADAM2016-09-22 10:24:13 -0400
committerGerrit Code Review @ Eclipse.org2016-09-30 03:25:32 -0400
commit62ff5b7ce50daf940e0183e675819c8936fc3c91 (patch)
tree45151f14ae40e2bda53e35a3ac783ba0515f34e9 /plugins
parent52b6db0337e4d0a91de8001283ae5622921dd2c0 (diff)
downloadorg.eclipse.papyrus-62ff5b7ce50daf940e0183e675819c8936fc3c91.tar.gz
org.eclipse.papyrus-62ff5b7ce50daf940e0183e675819c8936fc3c91.tar.xz
org.eclipse.papyrus-62ff5b7ce50daf940e0183e675819c8936fc3c91.zip
Bug 502003 - [Model Explorer] Expand/Collapse buttons should be work at
selected element https://bugs.eclipse.org/bugs/show_bug.cgi?id=502003 Change-Id: Ife74540571623e4eacadaca18ba72e6daab63dc6 Signed-off-by: Mickael ADAM <mickael.adam@ALL4TEC.net>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/SemanticUMLContentProvider.java24
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java69
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/icons/etool16/collapseall.pngbin0 -> 1265 bytes
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/icons/etool16/expandall.pngbin0 -> 229 bytes
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml38
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Activator.java7
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CollapseAllHandler.java82
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/ExpandAllHandler.java81
8 files changed, 282 insertions, 19 deletions
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/SemanticUMLContentProvider.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/SemanticUMLContentProvider.java
index fa0bb6e144a..50ae94a1663 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/SemanticUMLContentProvider.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/SemanticUMLContentProvider.java
@@ -31,11 +31,13 @@ import org.eclipse.emf.transaction.ResourceSetListener;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.resource.NotFoundException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.emf.adapters.ResourceSetRootsAdapter;
+import org.eclipse.papyrus.infra.tools.util.PlatformHelper;
import org.eclipse.papyrus.infra.ui.emf.providers.strategy.SemanticEMFContentProvider;
import org.eclipse.papyrus.infra.widgets.Activator;
import org.eclipse.papyrus.uml.tools.model.UmlModel;
@@ -408,4 +410,26 @@ public class SemanticUMLContentProvider extends SemanticEMFContentProvider {
private RootsAdapter rootsAdapter = new RootsAdapter();
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.ui.emf.providers.strategy.SemanticEMFContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(final Object element) {
+
+ // In case of use of EReference visualisation by face through EReferenceTreeElement, we verify if the object is realy a child of its parent
+ // This is done to avoid infinite loop.
+ Object parent = getParent(element);
+ if (parent instanceof EReferenceTreeElement) {
+ EObject eParent = PlatformHelper.getAdapter(parent, EObject.class);
+ // The element must be contained into the parent
+ if (!eParent.eContents().contains(PlatformHelper.getAdapter(element, EObject.class))) {
+ return false;
+ }
+ }
+
+ return super.hasChildren(element);
+ }
+
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java
index 5a4bd0257df..2e5e8b22288 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java
@@ -24,10 +24,12 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResource;
+import org.eclipse.papyrus.infra.tools.util.PlatformHelper;
import org.eclipse.papyrus.infra.ui.emf.providers.EMFEnumeratorContentProvider;
import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers;
import org.eclipse.papyrus.infra.widgets.providers.EmptyContentProvider;
@@ -92,6 +94,28 @@ public class UMLContentProvider extends EncapsulatedContentProvider {
}
/**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(final Object element) {
+
+ // In case of use of EReference visualisation by face through EReferenceTreeElement, we verify if the object is realy a child of its parent
+ // This is done to avoid infinite loop.
+ Object parent = getParent(element);
+ if (parent instanceof EReferenceTreeElement) {
+ EObject eParent = PlatformHelper.getAdapter(parent, EObject.class);
+ // The element must be contained into the parent
+ if (!eParent.eContents().contains(PlatformHelper.getAdapter(element, EObject.class))) {
+ return false;
+ }
+ }
+
+ return super.hasChildren(element);
+ }
+
+ /**
* Constructor.
*
* @param source
@@ -186,8 +210,7 @@ public class UMLContentProvider extends EncapsulatedContentProvider {
if (feature.getEType() instanceof EClass) {
return getStereotypedReferenceContentProvider(source, feature, (EClass) feature.getEType());
}
- }
- else {
+ } else {
// handle attributes of a stereotype nested in datatypes (see bug 427419 - Problems with DataTypes whose properties are typed by Stereotypes)
EObject sourceCont = source.eContainer();
if ((sourceCont != null) && (UMLUtil.getBaseElement(sourceCont) != null) && feature.getEType() instanceof EClass) {
@@ -217,11 +240,14 @@ public class UMLContentProvider extends EncapsulatedContentProvider {
/**
* Uses the content provider for reference properties typed by a stereotype
*
- * @param source The source element. Used to find base model (resource)
- * @param feature A feature referencing the element
- * @param type a stereotype (we want to filter for
+ * @param source
+ * The source element. Used to find base model (resource)
+ * @param feature
+ * A feature referencing the element
+ * @param type
+ * a stereotype (we want to filter for
* @return
- * The Content Provider for properties typed by a stereotype
+ * The Content Provider for properties typed by a stereotype
*/
protected IHierarchicContentProvider getStereotypedReferenceContentProvider(EObject source, EStructuralFeature feature, Stereotype type) {
ResourceSet root = UMLUtil.getBaseElement(source).eResource().getResourceSet();
@@ -231,30 +257,37 @@ public class UMLContentProvider extends EncapsulatedContentProvider {
return contentProvider;
}
-
+
/**
* Uses the content provider for reference properties typed by a stereotype (provided in form of the EClass of its definition)
*
- * @param source The source element. Used to find base model (resource)
- * @param feature A feature of the source element
- * @param type The EClass of the feature (stereotype definition)
+ * @param source
+ * The source element. Used to find base model (resource)
+ * @param feature
+ * A feature of the source element
+ * @param type
+ * The EClass of the feature (stereotype definition)
* @return
- * The Content Provider for properties typed by a stereotype
+ * The Content Provider for properties typed by a stereotype
*/
protected IHierarchicContentProvider getStereotypedReferenceContentProvider(EObject source, EStructuralFeature feature, EClass type) {
return getStereotypedReferenceContentProvider(source, source, feature, type);
}
-
+
/**
* Uses the content provider for reference properties typed by a stereotype (provided in form of the EClass of its definition)
*
- * @param source The source element. Used to find base model (resource)
- * @param subSource The subelement within the source. This can occur, if an attribute of the stereotype is not primitive, but
- * a datatype with sub-feature
- * @param feature A feature (within subSource, if subsource != source)
- * @param type The EClass of the feature (stereotype definition)
+ * @param source
+ * The source element. Used to find base model (resource)
+ * @param subSource
+ * The subelement within the source. This can occur, if an attribute of the stereotype is not primitive, but
+ * a datatype with sub-feature
+ * @param feature
+ * A feature (within subSource, if subsource != source)
+ * @param type
+ * The EClass of the feature (stereotype definition)
* @return
- * The Content Provider for properties typed by a stereotype
+ * The Content Provider for properties typed by a stereotype
*/
protected IHierarchicContentProvider getStereotypedReferenceContentProvider(EObject source, EObject subSource, EStructuralFeature feature, EClass type) {
ResourceSet root = UMLUtil.getBaseElement(source).eResource().getResourceSet();
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/icons/etool16/collapseall.png b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/icons/etool16/collapseall.png
new file mode 100644
index 00000000000..75c898936a2
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/icons/etool16/collapseall.png
Binary files differ
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/icons/etool16/expandall.png b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/icons/etool16/expandall.png
new file mode 100644
index 00000000000..354ac37cf23
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/icons/etool16/expandall.png
Binary files differ
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml
index f21882a6c8f..81b373de3a2 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml
@@ -18,6 +18,12 @@
</extension>
<extension point="org.eclipse.ui.navigator.viewer">
<viewer popupMenuId="org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup" viewerId="org.eclipse.papyrus.views.modelexplorer.modelexplorer">
+ <options>
+ <property
+ name="org.eclipse.ui.navigator.hideCollapseAllAction"
+ value="true">
+ </property>
+ </options>
</viewer>
<viewerContentBinding viewerId="org.eclipse.papyrus.views.modelexplorer.modelexplorer">
<includes>
@@ -135,6 +141,18 @@
<!-- Sort elements command -->
<command commandId="org.eclipse.papyrus.views.modelexplorer.sortelement" icon="icons/etool16/sort.gif" label="sort" style="toggle">
</command>
+ <command
+ commandId="org.eclipse.papyrus.views.modelexplorer.expandall"
+ icon="icons/etool16/expandall.png"
+ label="Expand all at selected element"
+ style="push">
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.views.modelexplorer.collapseall"
+ icon="icons/etool16/collapseall.png"
+ label="Collapse all at selected element"
+ style="push">
+ </command>
</menuContribution>
<menuContribution allPopups="false" locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup">
<separator
@@ -261,7 +279,21 @@
<!-- Command declaration : Delete element command -->
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.views.modelexplorer.handler.DeleteCommandHandler" description="Delete" id="org.eclipse.papyrus.uml.service.creation.DeleteCommand" name="Delete">
- </command>
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.views.modelexplorer.handler.ExpandAllHandler"
+ description="Expand All at selected Element"
+ id="org.eclipse.papyrus.views.modelexplorer.expandall"
+ name="Expand All at Selected Element (Ctrl+ Shift+ Numpad_Multiply)">
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.views.modelexplorer.handler.CollapseAllHandler"
+ description="Collapse All at selected Element"
+ id="org.eclipse.papyrus.views.modelexplorer.collapseall"
+ name="Collapse All at Selected Element (Ctrl+ Shift+ Numpad_Divide)">
+ </command>
</extension>
@@ -472,6 +504,10 @@
</with>
</and>
</activeWhen>
+ </handler>
+ <handler
+ class="org.eclipse.papyrus.views.modelexplorer.handler.ExpandAllHandler"
+ commandId="org.eclipse.ui.navigate.expandAll">
</handler>
</extension>
<extension point="org.eclipse.core.expressions.propertyTesters">
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Activator.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Activator.java
index bd3850b16e9..57e6819abb6 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Activator.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Activator.java
@@ -26,6 +26,9 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationManager;
import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.papyrus.infra.ui.emf.utils.ProviderHelper;
+import org.eclipse.papyrus.views.modelexplorer.handler.CollapseAllHandler;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -59,6 +62,10 @@ public class Activator extends AbstractUIPlugin {
if (System.getProperty(workaround) == null) { // Only change the value if it is not explicitly set already (Don't override user-defined value)
System.setProperty(workaround, Boolean.toString(true));
}
+
+ //Replace collapseHandler in handler service
+ IHandlerService handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class);
+ handlerService.activateHandler(org.eclipse.ui.handlers.CollapseAllHandler.COMMAND_ID, new CollapseAllHandler());
}
/**
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CollapseAllHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CollapseAllHandler.java
new file mode 100644
index 00000000000..6905ee1c2cf
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CollapseAllHandler.java
@@ -0,0 +1,82 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST, ALL4TEC 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:
+ * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.views.modelexplorer.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
+import org.eclipse.papyrus.views.modelexplorer.ModelExplorerView;
+import org.eclipse.papyrus.views.modelexplorer.core.ui.pagebookview.MultiViewPageBookView;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.navigator.CommonViewer;
+
+/**
+ * Handler to collapse all children at selected element.
+ */
+public class CollapseAllHandler extends AbstractHandler {
+
+ /**
+ * Constructor.
+ */
+ public CollapseAllHandler() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) {
+
+ ModelExplorerView openedModelExplorerView = getOpenedModelExplorerView();
+
+ if (openedModelExplorerView != null) {
+ CommonViewer commonViewer = openedModelExplorerView.getCommonViewer();
+ ISelection selection = commonViewer.getSelection();
+ // If there are selected element
+ if (selection instanceof StructuredSelection && !selection.isEmpty()) {
+ // expand each selected element
+ for (Object object : ((StructuredSelection) selection).toArray()) {
+ commonViewer.collapseToLevel(object, AbstractTreeViewer.ALL_LEVELS);
+ }
+
+ } else {
+ // or collapse all
+ commonViewer.collapseAll();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get the view 'ModelExplorer' if it's already opened.
+ */
+ public static ModelExplorerView getOpenedModelExplorerView() {
+ final IViewReference[] iViewModelExplorers = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .getViewReferences();
+
+ for (final IViewReference iViewModelExplorer : iViewModelExplorers) {
+ final IViewPart iViewPart = iViewModelExplorer.getView(false);
+ if (iViewPart instanceof ModelExplorerPageBookView && ((MultiViewPageBookView) iViewPart).getActiveView() instanceof ModelExplorerView) {
+ return (ModelExplorerView) ((ModelExplorerPageBookView) iViewPart).getActiveView();
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/ExpandAllHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/ExpandAllHandler.java
new file mode 100644
index 00000000000..749188e3627
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/ExpandAllHandler.java
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST, ALL4TEC 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:
+ * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.views.modelexplorer.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
+import org.eclipse.papyrus.views.modelexplorer.ModelExplorerView;
+import org.eclipse.papyrus.views.modelexplorer.core.ui.pagebookview.MultiViewPageBookView;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.navigator.CommonViewer;
+
+/**
+ * Handler to expand all children at selected element.
+ */
+public class ExpandAllHandler extends AbstractHandler {
+
+ /**
+ * Constructor.
+ */
+ public ExpandAllHandler() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) {
+
+ ModelExplorerView openedModelExplorerView = getOpenedModelExplorerView();
+
+ if (openedModelExplorerView != null) {
+ CommonViewer commonViewer = openedModelExplorerView.getCommonViewer();
+ ISelection selection = commonViewer.getSelection();
+ // If there are selected element
+ if (selection instanceof StructuredSelection && !selection.isEmpty()) {
+ // For each element
+ for (Object object : ((StructuredSelection) selection).toArray()) {
+ commonViewer.expandToLevel(object, AbstractTreeViewer.ALL_LEVELS);
+ }
+ } else {
+ // or expand all
+ commonViewer.expandAll();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get the view 'References' if it's already opened.
+ */
+ public static ModelExplorerView getOpenedModelExplorerView() {
+ final IViewReference[] iViewModelExplorers = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .getViewReferences();
+
+ for (final IViewReference iModelExplorer : iViewModelExplorers) {
+ final IViewPart iViewPart = iModelExplorer.getView(false);
+ if (iViewPart instanceof ModelExplorerPageBookView && ((MultiViewPageBookView) iViewPart).getActiveView() instanceof ModelExplorerView) {
+ return (ModelExplorerView) ((ModelExplorerPageBookView) iViewPart).getActiveView();
+ }
+ }
+ return null;
+ }
+
+}

Back to the top