1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-09 01:55:24 +02:00

Apply patch for bug 162510: correctly process filter strings

This commit is contained in:
Martin Oberhuber 2006-10-28 21:55:16 +00:00
parent 968b81c454
commit f81c3e4d81

View file

@ -1,12 +1,13 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006 Wind River Systems, Inc. * Copyright (c) 2006 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - initial API and implementation * Martin Oberhuber (Wind River) - initial API and implementation
* Dave Dykstal (IBM) - fixing bug 162510: correctly process filter strings
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.services.ssh.files; package org.eclipse.rse.services.ssh.files;
@ -38,6 +39,8 @@ import com.jcraft.jsch.SftpException;
import com.jcraft.jsch.SftpProgressMonitor; import com.jcraft.jsch.SftpProgressMonitor;
import org.eclipse.rse.services.Mutex; import org.eclipse.rse.services.Mutex;
import org.eclipse.rse.services.clientserver.FileTypeMatcher;
import org.eclipse.rse.services.clientserver.IMatcher;
import org.eclipse.rse.services.clientserver.NamePatternMatcher; import org.eclipse.rse.services.clientserver.NamePatternMatcher;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.services.files.AbstractFileService; import org.eclipse.rse.services.files.AbstractFileService;
@ -210,7 +213,13 @@ public class SftpFileService extends AbstractFileService implements IFileService
if (fileFilter == null) { if (fileFilter == null) {
fileFilter = "*"; //$NON-NLS-1$ fileFilter = "*"; //$NON-NLS-1$
} }
NamePatternMatcher filematcher = new NamePatternMatcher(fileFilter, true, true); IMatcher filematcher = null;
if (fileFilter.endsWith(",")) { //$NON-NLS-1$
String[] types = fileFilter.split(","); //$NON-NLS-1$
filematcher = new FileTypeMatcher(types, true);
} else {
filematcher = new NamePatternMatcher(fileFilter, true, true);
}
List results = new ArrayList(); List results = new ArrayList();
if (fDirChannelMutex.waitForLock(monitor, fDirChannelTimeout)) { if (fDirChannelMutex.waitForLock(monitor, fDirChannelTimeout)) {
try { try {
@ -224,7 +233,7 @@ 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)) { if (filematcher.matches(fileName) || lsEntry.getAttrs().isDir()) {
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);