Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-07-29 13:10:55 +0000
committerChristian W. Damus2014-07-29 13:11:13 +0000
commit765422a86034d9f7b040e4a597eed3f1c49a728c (patch)
treec52a411b0a566b650833a016cb31e943014a91db /plugins
parentb3ed5c39e013bd6af2c9e1ffdf397b551a7198e3 (diff)
downloadorg.eclipse.papyrus-765422a86034d9f7b040e4a597eed3f1c49a728c.tar.gz
org.eclipse.papyrus-765422a86034d9f7b040e4a597eed3f1c49a728c.tar.xz
org.eclipse.papyrus-765422a86034d9f7b040e4a597eed3f1c49a728c.zip
437217: [Editors] In-place reloading of model resources in the editors
https://bugs.eclipse.org/bugs/show_bug.cgi?id=437217 Fix problem of injecting selected tree elements from a previous incarnation of the Model Explorer into the Properties view on re-load. Now we just remember the source part for the Properties view's selection and later inject its (restored post re-load) selection.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/MultiDiagramPropertySheetPage.java39
1 files changed, 30 insertions, 9 deletions
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/MultiDiagramPropertySheetPage.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/MultiDiagramPropertySheetPage.java
index 3b9c874445e..8626fcd0bfc 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/MultiDiagramPropertySheetPage.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/MultiDiagramPropertySheetPage.java
@@ -13,12 +13,16 @@
package org.eclipse.papyrus.infra.core.editor;
+import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.papyrus.infra.core.editor.reload.EditorReloadEvent;
import org.eclipse.papyrus.infra.core.editor.reload.IEditorReloadListener;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.part.IShowInSource;
-import org.eclipse.ui.part.IShowInTarget;
import org.eclipse.ui.part.ShowInContext;
+import org.eclipse.ui.views.properties.PropertyShowInContext;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
@@ -30,8 +34,6 @@ class MultiDiagramPropertySheetPage extends TabbedPropertySheetPage implements I
private final CoreMultiDiagramEditor multiDiagramEditor;
- private ShowInContext inputContext;
-
public MultiDiagramPropertySheetPage(CoreMultiDiagramEditor editor) {
super(editor);
@@ -50,18 +52,37 @@ class MultiDiagramPropertySheetPage extends TabbedPropertySheetPage implements I
public void editorAboutToReload(EditorReloadEvent event) {
Object propertySheet = getSite().getService(IViewPart.class);
if(propertySheet instanceof IShowInSource) {
- inputContext = ((IShowInSource)propertySheet).getShowInContext();
+ ShowInContext context = ((IShowInSource)propertySheet).getShowInContext();;
+ if(context instanceof PropertyShowInContext) {
+ IWorkbenchPart inputPart = ((PropertyShowInContext)context).getPart();
+ if(inputPart != null) {
+ event.putContext(inputPart);
+ }
+ }
}
}
@Override
public void editorReloaded(EditorReloadEvent event) {
- if(inputContext != null) {
- Object propertySheet = getSite().getService(IViewPart.class);
- if(propertySheet instanceof IShowInTarget) {
- ((IShowInTarget)propertySheet).show(inputContext);
+ final IWorkbenchPart inputPart = (IWorkbenchPart)event.getContext();
+ if(inputPart != null) {
+ final Object propertySheet = getSite().getService(IViewPart.class);
+ if(propertySheet instanceof IPartListener) {
+ // Kick it with this part
+ ((IPartListener)propertySheet).partActivated(inputPart);
+
+ // And again later to get its new selection (we don't know when its selection may be restored relative to us)
+ getSite().getShell().getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ ISelectionProvider selectionProvider = inputPart.getSite().getSelectionProvider();
+ if(selectionProvider != null) {
+ ((ISelectionListener)propertySheet).selectionChanged(inputPart, selectionProvider.getSelection());
+ }
+ }
+ });
}
}
}
-
}

Back to the top