1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 23:05:47 +02:00

[207178] listFolders queries folders, not both

This commit is contained in:
David McKnight 2007-11-01 18:24:23 +00:00
parent 0dfacdf39d
commit 23fd70411a

View file

@ -442,6 +442,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
return null; return null;
} }
// TODO - change this to use listMulti to be more efficient
for (int idx=0; idx<filterStrings.length; idx++) for (int idx=0; idx<filterStrings.length; idx++)
{ {
if (monitor != null) if (monitor != null)
@ -580,18 +581,11 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
} }
} }
/**
* Actually resolve an absolute filter string. This is called by the private String fixFilterString(IRemoteFileSubSystemConfiguration rfssf, String filterString)
* run(IProgressMonitor monitor) method, which in turn is called by resolveFilterString.
* @see org.eclipse.rse.core.subsystems.SubSystem#internalResolveFilterString(String,IProgressMonitor)
*/
protected Object[] internalResolveFilterString(String filterString, IProgressMonitor monitor) throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException
{ {
boolean debugMode = false;
IRemoteFileSubSystemConfiguration rfssf = getParentRemoteFileSubSystemConfiguration();
boolean windows = !rfssf.isUnixStyle(); boolean windows = !rfssf.isUnixStyle();
if (debugMode)
SystemBasePlugin.logInfo("INTERNALRESOLVEFILTERSTRING: INPUT FILTERSTRING: " + filterString); //$NON-NLS-1$
if (filterString.startsWith("/") && windows) // request to list root files? //$NON-NLS-1$ if (filterString.startsWith("/") && windows) // request to list root files? //$NON-NLS-1$
{ // convert to request to list drives on Windows { // convert to request to list drives on Windows
int len = filterString.length(); int len = filterString.length();
@ -599,13 +593,24 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
filterString = "*"; // hmm, should never happen //$NON-NLS-1$ filterString = "*"; // hmm, should never happen //$NON-NLS-1$
else else
filterString = filterString.substring(1); filterString = filterString.substring(1);
if (debugMode)
SystemBasePlugin.logInfo("...FINAL FILTERSTRING: " + filterString); //$NON-NLS-1$
} }
return filterString;
}
/**
* Actually resolve an absolute filter string. This is called by the
* run(IProgressMonitor monitor) method, which in turn is called by resolveFilterString.
* @see org.eclipse.rse.core.subsystems.SubSystem#internalResolveFilterString(String,IProgressMonitor)
*/
protected Object[] internalResolveFilterString(String filterString, IProgressMonitor monitor) throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException
{
IRemoteFileSubSystemConfiguration rfssf = getParentRemoteFileSubSystemConfiguration();
filterString = fixFilterString(rfssf, filterString);
RemoteFileFilterString fs = new RemoteFileFilterString(rfssf, filterString); RemoteFileFilterString fs = new RemoteFileFilterString(rfssf, filterString);
currFilterString = fs; currFilterString = fs;
if (debugMode)
SystemBasePlugin.logInfo("...LISTROOTS = " + fs.listRoots()); //$NON-NLS-1$
if (fs.listRoots()) if (fs.listRoots())
return listRoots(new RemoteFileContext(this, null, fs), monitor); return listRoots(new RemoteFileContext(this, null, fs), monitor);
else else
@ -613,24 +618,16 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
boolean showDirs = fs.getShowSubDirs(); boolean showDirs = fs.getShowSubDirs();
boolean showFiles = fs.getShowFiles(); boolean showFiles = fs.getShowFiles();
String path = fs.getPath(); String path = fs.getPath();
boolean windows = !rfssf.isUnixStyle();
if (windows && (path != null) && !path.endsWith(rfssf.getSeparator())) if (windows && (path != null) && !path.endsWith(rfssf.getSeparator()))
path = path + rfssf.getSeparatorChar(); path = path + rfssf.getSeparatorChar();
String filter = fs.getFileOrTypes();
if (debugMode)
SystemBasePlugin.logInfo("...path='" + path + "', filter='" + filter + "', showDirs=" + showDirs + ", showFiles=" + showFiles); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
String filter = fs.getFileOrTypes();
IRemoteFile parent = null; IRemoteFile parent = null;
try try
{ {
parent = getRemoteFileObject(path, monitor); parent = getRemoteFileObject(path, monitor);
/* DKM - now filters should get invalidated via SystemRegistry event firing so this should not be needed
*
// DKM: this may be a filter refresh - to be safe I'm marking it stale
if (parent != null)
parent.markStale(true);
*/
} }
catch (SystemMessageException e) catch (SystemMessageException e)
{ {
@ -654,9 +651,9 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
boolean hasFileAndFolderContents = !parent.isStale() && parent.hasContents(RemoteChildrenContentsType.getInstance(), filter); boolean hasFileAndFolderContents = !parent.isStale() && parent.hasContents(RemoteChildrenContentsType.getInstance(), filter);
if (showDirs && showFiles) if (showDirs && showFiles)
{ {
if (hasFileAndFolderContents) if (hasFileAndFolderContents)
{ {
// has everything
} }
else if (hasFileContents) else if (hasFileContents)
{ {
@ -1465,7 +1462,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
*/ */
public IRemoteFile[] listFolders(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException public IRemoteFile[] listFolders(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException
{ {
return list(parent, IFileServiceConstants.FILE_TYPE_FILES_AND_FOLDERS, monitor); return list(parent, IFileServiceConstants.FILE_TYPE_FOLDERS, monitor);
} }
/** /**