Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-11-06 16:12:01 +0000
committerChristian W. Damus2014-11-06 16:14:34 +0000
commit8ba69c0f833ec6506fa4766387af786fdc65355e (patch)
tree4fc47ee2360d7d0e2ddb939d3e38d48883816d54 /plugins/views
parentea544a65c85ed350090e77c416d44bf0d8ecf826 (diff)
downloadorg.eclipse.papyrus-8ba69c0f833ec6506fa4766387af786fdc65355e.tar.gz
org.eclipse.papyrus-8ba69c0f833ec6506fa4766387af786fdc65355e.tar.xz
org.eclipse.papyrus-8ba69c0f833ec6506fa4766387af786fdc65355e.zip
450235: [Resource Reloading] The IPageManager is lost when automatically reloading a sub-model
https://bugs.eclipse.org/bugs/show_bug.cgi?id=450235 Ensure that the DoubleClickListener in the Model Explorer view gets whatever is the current service registry of the editor.
Diffstat (limited to 'plugins/views')
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java11
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java30
2 files changed, 33 insertions, 8 deletions
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 0499fc1e3fb..f85e70f4b56 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
@@ -1,6 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010, 2014 CEA LIST and others.
- *
+ * Copyright (c) 2010, 2014 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -14,6 +13,7 @@
* Christian W. Damus (CEA) - bug 434635
* Christian W. Damus (CEA) - bug 437217
* Christian W. Damus (CEA) - bug 441857
+ * Christian W. Damus - bug 450235
*
*****************************************************************************/
package org.eclipse.papyrus.views.modelexplorer;
@@ -123,6 +123,7 @@ import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
@@ -461,7 +462,11 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
getCommonViewer().setSorter(null);
((CustomCommonViewer) getCommonViewer()).getDropAdapter().setFeedbackEnabled(true);
- getCommonViewer().addDoubleClickListener(new DoubleClickListener(serviceRegistry));
+ getCommonViewer().addDoubleClickListener(new DoubleClickListener(new Supplier<ServicesRegistry>() {
+ public ServicesRegistry get() {
+ return serviceRegistry;
+ }
+ }));
Tree tree = getCommonViewer().getTree();
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java
index 94fffe5d831..e08f794eb21 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java
@@ -1,6 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
+ * Copyright (c) 2010, 2014 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,6 +8,7 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ * Christian W. Damus - bug 450235
*
*****************************************************************************/
package org.eclipse.papyrus.views.modelexplorer.listener;
@@ -31,16 +31,36 @@ import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.views.modelexplorer.Activator;
import org.eclipse.papyrus.views.modelexplorer.Messages;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+
/**
* this class is a listener in charge to manage double on element of the model explorer
*
*/
public class DoubleClickListener implements IDoubleClickListener {
- private final ServicesRegistry servicesRegistry;
+ private final Supplier<ServicesRegistry> servicesRegistry;
+ /**
+ * Initializes me with a fixed service registry.
+ *
+ * @param servicesRegistry a service registry
+ *
+ * @deprecated The editor that the Model Explorer views can change dynamically, replacing its service registry. Use the {@link #DoubleClickListener(Supplier)} constructor instead to account for the variability of the registry.
+ */
+ @Deprecated
public DoubleClickListener(ServicesRegistry servicesRegistry) {
- this.servicesRegistry = servicesRegistry;
+ this(Suppliers.ofInstance(servicesRegistry));
+ }
+
+ /**
+ * Initializes me with a variable service registry.
+ *
+ * @param servicesRegistrySupplier a supplier of a dynamically variable service registry
+ */
+ public DoubleClickListener(Supplier<ServicesRegistry> servicesRegistrySupplier) {
+ this.servicesRegistry = servicesRegistrySupplier;
}
/**
@@ -53,7 +73,7 @@ public class DoubleClickListener implements IDoubleClickListener {
final IPageManager pageManager;
// get the page Manager
try {
- pageManager = ServiceUtils.getInstance().getIPageManager(servicesRegistry);
+ pageManager = ServiceUtils.getInstance().getIPageManager(servicesRegistry.get());
} catch (Exception e) {
Activator.log.error(Messages.DoubleClickListener_Error_NoLoadManagerToOpen, e);
return;

Back to the top