From 1ea4c1a2ebc5862ef6720987362383e182823d34 Mon Sep 17 00:00:00 2001 From: David McKnight Date: Wed, 29 Aug 2012 18:42:55 +0000 Subject: [PATCH] [388364] RDz property view flickers when a user disconnects from zOS system --- .../rse/internal/ui/view/SystemView.java | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 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 eb9db8a47f3..25eb5e33577 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 @@ -84,6 +84,7 @@ * David Dykstal (IBM) - [257110] Prompting filter called twice on double click rather than just once * David McKnight (IBM) - [380613] Problem in SystemView with disposed TreeItem when Link With Editor toolbar icon is used * David McKnight (IBM) - [385774] select folder dialog doesn't update enablement properly after new folder created + * David McKnight (IBM) - [388364] RDz property view flickers when a user disconnects from zOS system ********************************************************************************/ package org.eclipse.rse.internal.ui.view; @@ -240,6 +241,7 @@ import org.eclipse.ui.progress.PendingUpdateAdapter; import org.eclipse.ui.progress.UIJob; import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds; import org.eclipse.ui.views.framelist.GoIntoAction; +import org.eclipse.ui.views.properties.IPropertyDescriptor; /** * This subclass of the standard JFace tree viewer is used to show a tree @@ -413,6 +415,8 @@ public class SystemView extends SafeTreeViewer protected List _setList; protected boolean _allowAdapterToHandleDoubleClick = true; + + private Object[] _lastPropertyValues = null; // to reduce duplicate property sheet updates /** * Constructor @@ -5983,6 +5987,39 @@ public class SystemView extends SafeTreeViewer { Object object = ((IStructuredSelection)selection).getFirstElement(); if (object != null){ + ISystemViewElementAdapter adapter = getViewAdapter(object); + if (adapter != null){ + // figure out what properties this object has + adapter.setPropertySourceInput(object); + IPropertyDescriptor[] descriptors = adapter.getPropertyDescriptors(); + Object[] propertyValues = new Object[descriptors.length]; + for (int i = 0; i < descriptors.length; i++){ + IPropertyDescriptor descriptor = descriptors[i]; + propertyValues[i] = adapter.getPropertyValue(descriptor.getId()); + } + + if (_lastPropertyValues != null){ + if (_lastPropertyValues.length == propertyValues.length){ + boolean theSame = true; + // check to see if anything has changed + for (int i = 0; i < _lastPropertyValues.length && theSame; i++){ + Object lastPropertyValue = _lastPropertyValues[i]; + Object propertyValue = propertyValues[i]; + if (lastPropertyValue != null && !lastPropertyValue.equals(propertyValue)){ + theSame = false; + } + } + if (theSame){ + // no need to refresh anything + return; + } + } + } + _lastPropertyValues = propertyValues; + + } + + IWorkbenchPart ourPart = getWorkbenchPart(); IWorkbenchPart activePart = null; IWorkbenchWindow win = getWorkbenchWindow(); // from dialog it's possible to not have an active part @@ -5995,8 +6032,8 @@ public class SystemView extends SafeTreeViewer if (activePart != null){ if (activePart != ourPart){ ourPart.setFocus(); // without part focus, there are no post selection change listeners - } - + } + // create events in order to update the property sheet IStructuredSelection fakeSelection = new StructuredSelection(new Object());