1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

[342095] Properties in Properties view remain "Pending..." in some cases

-account for non-structured selection and dialog scenario
This commit is contained in:
David McKnight 2011-06-28 14:48:27 +00:00
parent 9cf86ee217
commit 35c5e71ccf

View file

@ -5961,7 +5961,7 @@ public class SystemView extends SafeTreeViewer
*/ */
private void updatePropertySheet(boolean force) { private void updatePropertySheet(boolean force) {
ISelection selection = getSelection(); ISelection selection = getSelection();
if (selection == null) return; if (selection == null || !(selection instanceof IStructuredSelection)) return;
// only fire this event if the view actually has focus // only fire this event if the view actually has focus
if (force || getControl().isFocusControl()) if (force || getControl().isFocusControl())
@ -5969,16 +5969,21 @@ public class SystemView extends SafeTreeViewer
Object object = ((IStructuredSelection)selection).getFirstElement(); Object object = ((IStructuredSelection)selection).getFirstElement();
if (object != null){ if (object != null){
IWorkbenchPart ourPart = getWorkbenchPart(); IWorkbenchPart ourPart = getWorkbenchPart();
IWorkbenchPart activePart = getWorkbenchWindow().getActivePage().getActivePart(); IWorkbenchPart activePart = null;
IWorkbenchWindow win = getWorkbenchWindow(); // from dialog it's possible to not have an active part
if (win != null){
IWorkbenchPage page = win.getActivePage();
if (page != null){
activePart = page.getActivePart();
}
}
if (activePart != null){
if (activePart != ourPart){ if (activePart != ourPart){
ourPart.setFocus(); // without part focus, there are no post selection change listeners ourPart.setFocus(); // without part focus, there are no post selection change listeners
} }
IStructuredSelection fakeSelection = null;
// create events in order to update the property sheet // create events in order to update the property sheet
if (selection instanceof IStructuredSelection){ IStructuredSelection fakeSelection = new StructuredSelection(new Object());
fakeSelection = new StructuredSelection(new Object());
}
if (fakeSelection != null){ if (fakeSelection != null){
SelectionChangedEvent dummyEvent = new SelectionChangedEvent(this, fakeSelection); SelectionChangedEvent dummyEvent = new SelectionChangedEvent(this, fakeSelection);
@ -5996,6 +6001,7 @@ public class SystemView extends SafeTreeViewer
activePart.setFocus(); activePart.setFocus();
} }
} }
}
} }
} }