Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Charles David2017-05-30 10:02:53 -0400
committerPierre-Charles David2017-05-30 11:14:20 -0400
commit173588d5b612549222ceeaf84ade14c9dbec329b (patch)
treebc1b17998be5c909fa8699a15debcdabf42d4fce
parent17f118e8abf017cc0e34ec7b13b1ecb22b6be5f1 (diff)
downloadorg.eclipse.sirius-173588d5b612549222ceeaf84ade14c9dbec329b.tar.gz
org.eclipse.sirius-173588d5b612549222ceeaf84ade14c9dbec329b.tar.xz
org.eclipse.sirius-173588d5b612549222ceeaf84ade14c9dbec329b.zip
[517206] Do not share content provider in different views
The content provider (and most importantly, the underlying AdapterFactoryContentProvider) used by all instances of SiriusCommonContentProvider was a single, shared instance. This caused UI refresh issues when different views tried to use such providers, as the underlying AFCP only remembers the last view it was attached to when forwarding ViewerRefresh requests to the UI layer. Bug: 517206 Change-Id: I422b9fed91e33d83c853c86943d66e0c02cbfc3b Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.html4
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile1
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/ViewHelper.java4
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/ViewHelperImpl.java25
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonContentProvider.java4
5 files changed, 14 insertions, 24 deletions
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
index 4925131229..d1fd5ac44b 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
@@ -369,6 +369,10 @@
<code>void</code> to
<code>Session</code> to allow callers to have access to the newly created session directly.
</li>
+ <li><span class="label label-info">Modified</span> The method
+ <code>org.eclipse.sirius.ui.tools.api.views.ViewHelper.getContentProvider()</code> has been renamed into
+ <code>createContentProvider()</code> and now returns a new instance on each invocation.
+ </li>
<li><span class="label label-danger">Removed</span> The old
<em>Model Request Interpreter</em> view is not available anymore. It is superseded by the
<em>Interpreter</em> view, which comes from the Acceleo project but does not actually depend on Acceleo or AQL and can be installed separately (using the feature
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
index a66546845e..f8a9cc790d 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
@@ -90,6 +90,7 @@ h4. Changes in @org.eclipse.sirius.ui@
* <span class="label label-info">Modified</span> The method @org.eclipse.sirius.ui.tools.api.assist.TextContentProposalProvider.getContentContext(String, int)@ has been made protected instead of private to allow to use it for sub types.
* <span class="label label-info">Modified</span> The method @org.eclipse.sirius.ui.tools.api.assist.TextContentProposalProvider.removeDuplicatedProposals(List<ContentProposal>)@ has been made protected instead of private to allow to use it in sub types.
* <span class="label label-info">Modified</span> The method @org.eclipse.sirius.ui.tools.api.project.ModelingProjectManager.createLocalRepresentationsFile(IProject, IProgressMonitor)@ has its return type changed from @void@ to @Session@ to allow callers to have access to the newly created session directly.
+* <span class="label label-info">Modified</span> The method @org.eclipse.sirius.ui.tools.api.views.ViewHelper.getContentProvider()@ has been renamed into @createContentProvider()@ and now returns a new instance on each invocation.
* <span class="label label-danger">Removed</span> The old _Model Request Interpreter_ view is not available anymore. It is superseded by the _Interpreter_ view, which comes from the Acceleo project but does not actually depend on Acceleo or AQL and can be installed separately (using the feature @org.eclipse.acceleo.ui.interpreter@, which is available directly from the Sirius update-sites). The corresponding interface @org.eclipse.sirius.ui.tools.api.views.interpreterview.InterpreterView@ has been removed. Technically, the implementation code for the old _Model Request Interpreter_ view is still present if needed during the transition, but not exposed or used anywhere. It will be removed in a future version.
h4. Changes in @org.eclipse.sirius.diagram@
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/ViewHelper.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/ViewHelper.java
index a507423ab3..9d0a0c4f19 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/ViewHelper.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/ViewHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 THALES GLOBAL SERVICES.
+ * Copyright (c) 2008, 2017 THALES GLOBAL SERVICES 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
@@ -39,5 +39,5 @@ public interface ViewHelper {
*
* @return the content provider
*/
- ITreeContentProvider getContentProvider();
+ ITreeContentProvider createContentProvider();
}
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/ViewHelperImpl.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/ViewHelperImpl.java
index 82acfb378b..1d601dba3b 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/ViewHelperImpl.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/ViewHelperImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010, 2011 THALES GLOBAL SERVICES.
+ * Copyright (c) 2008, 2010, 2017 THALES GLOBAL SERVICES 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
@@ -38,9 +38,7 @@ import com.google.common.collect.Lists;
*/
public final class ViewHelperImpl implements ViewHelper {
- private ITreeContentProvider contentProvider;
-
- private Collection<ISessionViewExtension> extensions = Lists.newArrayList();
+ private static Collection<ISessionViewExtension> extensions = Lists.newArrayList();
/**
* Avoid instantiation.
@@ -61,20 +59,17 @@ public final class ViewHelperImpl implements ViewHelper {
@Override
public AdapterFactory createAdapterFactory() {
final List<AdapterFactory> factories = new ArrayList<AdapterFactory>();
- final ComposedAdapterFactory generic = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
factories.add(DialectUIManager.INSTANCE.createAdapterFactory());
factories.add(FeatureExtensionsUIManager.INSTANCE.createAdapterFactory());
- factories.add(generic);
+ factories.add(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE));
factories.add(new ReflectiveItemProviderAdapterFactory());
return new ComposedAdapterFactory(factories);
}
@Override
- public ITreeContentProvider getContentProvider() {
- if (contentProvider == null) {
+ public ITreeContentProvider createContentProvider() {
SessionWrapperContentProvider sessionWrapperContentProvider = new SessionWrapperContentProvider(new AdapterFactoryContentProvider(createAdapterFactory()));
-
- contentProvider = new GroupingContentProvider(sessionWrapperContentProvider);
+ ITreeContentProvider contentProvider = new GroupingContentProvider(sessionWrapperContentProvider);
Collection<ITreeContentProvider> liveProviders = Collections2.transform(extensions, new Function<ISessionViewExtension, ITreeContentProvider>() {
@Override
public ITreeContentProvider apply(ISessionViewExtension from) {
@@ -82,15 +77,7 @@ public final class ViewHelperImpl implements ViewHelper {
}
});
sessionWrapperContentProvider.setExtensions(liveProviders);
- }
- return contentProvider;
- }
-
- /**
- * Reset to null the contentProvider.
- */
- public void resetContentProvider() {
- contentProvider = null;
+ return contentProvider;
}
/**
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonContentProvider.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonContentProvider.java
index 8d08e07399..a23c99e0fe 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonContentProvider.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonContentProvider.java
@@ -51,7 +51,6 @@ import org.eclipse.sirius.business.api.session.SessionManagerListener;
import org.eclipse.sirius.common.ui.tools.api.navigator.GroupingContentProvider;
import org.eclipse.sirius.ext.base.Option;
import org.eclipse.sirius.ui.tools.api.views.ViewHelper;
-import org.eclipse.sirius.ui.tools.internal.views.ViewHelperImpl;
import org.eclipse.sirius.ui.tools.internal.views.common.FileSessionFinder;
import org.eclipse.sirius.ui.tools.internal.views.common.SessionWrapperContentProvider;
import org.eclipse.sirius.ui.tools.internal.views.common.item.AnalysisResourceItemImpl;
@@ -114,7 +113,7 @@ public class SiriusCommonContentProvider implements ICommonContentProvider {
* Constructor.
*/
public SiriusCommonContentProvider() {
- defaultContentProvider = ViewHelper.INSTANCE.getContentProvider();
+ defaultContentProvider = ViewHelper.INSTANCE.createContentProvider();
initSessionManager();
initDoubleClickListener();
@@ -522,7 +521,6 @@ public class SiriusCommonContentProvider implements ICommonContentProvider {
linkWithEditorSelectionListener.dispose();
linkWithEditorSelectionListener = null;
}
- ((ViewHelperImpl) ViewHelper.INSTANCE).resetContentProvider();
}
/**

Back to the top