From 61fc7b77c4c575f8cb378e832192c201b684a060 Mon Sep 17 00:00:00 2001 From: David McKnight Date: Wed, 4 Apr 2007 13:27:26 +0000 Subject: [PATCH] [180872] unqueried folder should initially be stale, internalHasChildren() should check for stale when when there are no children, and getImageDescriptor needs to check if contents have been queried before determining whether to show a folder as open or not --- .../files/ui/view/SystemViewRemoteFileAdapter.java | 12 +++++++----- .../subsystems/files/core/subsystems/RemoteFile.java | 4 +--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java index 01d1e101a4e..7e3808b5953 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java @@ -491,8 +491,11 @@ public class SystemViewRemoteFileAdapter isOpen = atv.getExpandedState(element); if (!isOpen) { - if (!hasChildren((IAdaptable)element)) - isOpen = true; + // if there are children but they are empty then we've queried this but there are no children + // so we have an empty open folder + Object[] contents = file.getContents(RemoteChildrenContentsType.getInstance()); + if (contents != null && contents.length == 0) + isOpen = true; } } if (file.isRoot()) @@ -842,10 +845,9 @@ public class SystemViewRemoteFileAdapter // check that the children are actually there //Object[] contents = file.getContents(RemoteChildrenContentsType.getInstance()); hasChildren = file.hasContents(RemoteChildrenContentsType.getInstance(), filter); - if (!hasChildren && !file.isStale()) + //if (!hasChildren && !file.isStale()) + if (!hasChildren && file.isStale()) // there are no children, but the resource is stale, therefore it still needs to be queried hasChildren = true; - // if (!file.isStale() && contents != null && contents.length == 0 ) - // hasChildren = false; } return hasChildren; diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java index 90e3b763569..89efbc94c0f 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java @@ -35,13 +35,11 @@ import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.ISystemContentsType; import org.eclipse.rse.core.subsystems.IRemoteContainer; import org.eclipse.rse.core.subsystems.RemoteChildrenContentsType; -import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants; import org.eclipse.rse.services.clientserver.StringComparePatternMatcher; import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString; import org.eclipse.rse.subsystems.files.core.model.SystemFileTransferModeRegistry; -import org.eclipse.rse.ui.RSEUIPlugin; /** @@ -87,7 +85,7 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable protected HashMap _contents = new HashMap(); /* container properties */ - protected boolean _isStale = false; + protected boolean _isStale = true; // properties protected HashMap properties = new HashMap();