1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-20 06:35:50 +02:00

[192724] Fixed logic to filter folders if FILE_TYPE_FOLDERS

This commit is contained in:
Martin Oberhuber 2007-07-23 14:36:28 +00:00
parent d729792624
commit a864b9bfc3
2 changed files with 15 additions and 21 deletions

View file

@ -45,6 +45,7 @@
* Javier Montalvo Orus (Symbian) - [187862] Incorrect Error Message when creating new file in read-only directory * Javier Montalvo Orus (Symbian) - [187862] Incorrect Error Message when creating new file in read-only directory
* Javier Montalvo Orus (Symbian) - [194204] Renaming Files/Folders moves them sometimes * Javier Montalvo Orus (Symbian) - [194204] Renaming Files/Folders moves them sometimes
* Javier Montalvo Orus (Symbian) - [192724] New Filter with Show Files Only still shows folders * Javier Montalvo Orus (Symbian) - [192724] New Filter with Show Files Only still shows folders
* Martin Oberhuber (Wind River) - [192724] Fixed logic to filter folders if FILE_TYPE_FOLDERS
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.services.files.ftp; package org.eclipse.rse.internal.services.files.ftp;
@ -497,27 +498,18 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
for(int i=0; i<_ftpFiles.length; i++) for(int i=0; i<_ftpFiles.length; i++)
{ {
FTPHostFile f = new FTPHostFile(parentPath, _ftpFiles[i]); FTPHostFile f = new FTPHostFile(parentPath, _ftpFiles[i]);
if (isRightType(fileType,f)) {
if((filematcher.matches(f.getName()) || f.isDirectory()) && !(f.getName().equals(".") || f.getName().equals(".."))) //$NON-NLS-1$ //$NON-NLS-2$ String name = f.getName();
{ if (name.equals(".") || name.equals("..")) { //$NON-NLS-1$ //$NON-NLS-2$
switch(fileType) //Never return the default directory names
{ continue;
case FILE_TYPE_FOLDERS: } else if (f.isDirectory() && fileType!=FILE_TYPE_FOLDERS) {
if(f.isDirectory()) //get ALL directory names (unless looking for folders only)
{
results.add(f); results.add(f);
} } else if (filematcher.matches(name)) {
break; //filter all others by name.
case FILE_TYPE_FILES:
if(f.isFile())
{
results.add(f); results.add(f);
} }
break;
case FILE_TYPE_FILES_AND_FOLDERS:
results.add(f);
break;
}
} }
} }
} }

View file

@ -10,6 +10,7 @@
* Dave Dykstal (IBM) - fixing bug 162510: correctly process filter strings * Dave Dykstal (IBM) - fixing bug 162510: correctly process filter strings
* Kushal Munir (IBM) - for API bug * Kushal Munir (IBM) - for API bug
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [192724] Fixed logic to filter folders if FILE_TYPE_FOLDERS
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.services.ssh.files; package org.eclipse.rse.internal.services.ssh.files;
@ -307,7 +308,8 @@ public class SftpFileService extends AbstractFileService implements IFileService
//don't show the trivial names //don't show the trivial names
continue; continue;
} }
if (filematcher.matches(fileName) || lsEntry.getAttrs().isDir()) { if (filematcher.matches(fileName) || (lsEntry.getAttrs().isDir() && fileType!=FILE_TYPE_FOLDERS)) {
//get ALL directory names (unless looking for folders only)
SftpHostFile node = makeHostFile(parentPath, fileName, lsEntry.getAttrs()); SftpHostFile node = makeHostFile(parentPath, fileName, lsEntry.getAttrs());
if (isRightType(fileType, node)) { if (isRightType(fileType, node)) {
results.add(node); results.add(node);