From e37806d9279ecc244e5e99598816ba8923184af4 Mon Sep 17 00:00:00 2001 From: David McKnight Date: Wed, 8 Jun 2011 16:36:04 +0000 Subject: [PATCH] [342095] Properties in Properties view remain "Pending..." in some cases --- .../rse/internal/ui/view/SystemView.java | 46 +++++++++++++------ 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java index 0030358acc6..ae778ed2824 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java @@ -79,6 +79,7 @@ * David McKnight (IBM) - [333196] New member filter dialogue keep popping up when creating a shared member filter. * David McKnight (IBM) - [341281] amendment to fix for bug 308983 * David McKnight (IBM) - [342208] potential NPE in SystemView$ExpandRemoteObjects.execute() + * David McKnight (IBM) - [342095] Properties in Properties view remain "Pending..." in some cases ********************************************************************************/ package org.eclipse.rse.internal.ui.view; @@ -221,6 +222,7 @@ import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeItem; import org.eclipse.swt.widgets.Widget; import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; @@ -5963,22 +5965,38 @@ public class SystemView extends SafeTreeViewer // only fire this event if the view actually has focus if (force || getControl().isFocusControl()) - { - IStructuredSelection fakeSelection = null; - // create events in order to update the property sheet - if (selection instanceof IStructuredSelection){ - fakeSelection = new StructuredSelection(new Object()); + { + Object object = ((IStructuredSelection)selection).getFirstElement(); + if (object != null){ + IWorkbenchPart ourPart = getWorkbenchPart(); + IWorkbenchPart activePart = getWorkbenchWindow().getActivePage().getActivePart(); + if (activePart != ourPart){ + ourPart.setFocus(); // without part focus, there are no post selection change listeners + } + + IStructuredSelection fakeSelection = null; + // create events in order to update the property sheet + if (selection instanceof IStructuredSelection){ + fakeSelection = new StructuredSelection(new Object()); + } + + if (fakeSelection != null){ + SelectionChangedEvent dummyEvent = new SelectionChangedEvent(this, fakeSelection); + // first change the selection, then change it back (otherwise the property sheet ignores the event) + fireSelectionChanged(dummyEvent); + firePostSelectionChanged(dummyEvent); + } + SelectionChangedEvent event = new SelectionChangedEvent(this, selection); + + // fire the event + fireSelectionChanged(event); + firePostSelectionChanged(event); + + if (ourPart != activePart){ + activePart.setFocus(); + } } - - if (fakeSelection != null){ - SelectionChangedEvent dummyEvent = new SelectionChangedEvent(this, fakeSelection); - // first change the selection, then change it back (otherwise the property sheet ignores the event) - fireSelectionChanged(dummyEvent); - } - SelectionChangedEvent event = new SelectionChangedEvent(this, selection); - // fire the event - fireSelectionChanged(event); } }