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

Fixing 162511 - FTP file service does not process filter strings correctly

Fixing 162782 - File filter does not display correct result in RC3
Fixing 162878 - New file and new folder dialogs don't work in FTP in a folder with subfolders
This commit is contained in:
Javier Montalvo Orus 2006-10-31 18:28:13 +00:00
parent 2bcf38bcb4
commit c4a8adca1f

View file

@ -23,6 +23,9 @@
* ftp.ibiblio.org as anonymous fails * ftp.ibiblio.org as anonymous fails
* Javier Montalvo Orus (Symbian) - Fixing 160922 - create folder/file fails for FTP service * Javier Montalvo Orus (Symbian) - Fixing 160922 - create folder/file fails for FTP service
* David Dykstal (IBM) - Fixing 162511 - FTP file service does not process filter strings correctly * David Dykstal (IBM) - Fixing 162511 - FTP file service does not process filter strings correctly
* Javier Montalvo Orus (Symbian) - Fixing 162511 - FTP file service does not process filter strings correctly
* Javier Montalvo Orus (Symbian) - Fixing 162782 - File filter does not display correct result in RC3
* Javier Montalvo Orus (Symbian) - Fixing 162878 - New file and new folder dialogs don't work in FTP in a folder with subfolders
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.services.files.ftp; package org.eclipse.rse.services.files.ftp;
@ -151,16 +154,53 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
*/ */
public IHostFile getFile(IProgressMonitor monitor, String remoteParent, String fileName) public IHostFile getFile(IProgressMonitor monitor, String remoteParent, String fileName)
{ {
IHostFile[] matches = internalFetch(monitor, remoteParent, fileName, FILE_TYPE_FILES_AND_FOLDERS); FTPHostFile file = null;
if (matches != null && matches.length > 0) try{
//try to retrieve the file
FTPClient ftp = getFTPClient();
try
{ {
return matches[0]; ftp.noop();
} }
else catch (Exception e)
{ {
return new FTPHostFile(remoteParent,fileName, false, false, 0, 0, false); disconnect();
reconnect();
ftp = getFTPClient();
} }
if(!ftp.changeWorkingDirectory(remoteParent))
{
return null;
}
String systemName = ftp.getSystemName();
FTPFile[] ftpFiles = ftp.listFiles();
for (int i = 0; i < ftpFiles.length; i++)
{
if(ftpFiles[i].getName().equalsIgnoreCase(fileName))
{
file = new FTPHostFile(remoteParent,ftpFiles[i],systemName);
break;
}
}
// if not found, create new object with non-existing flag
if(file == null)
{
file = new FTPHostFile(remoteParent,fileName, false, false, 0, 0, false);
}
}catch (IOException e){
//file will be null
}
return file;
} }
public boolean isConnected() public boolean isConnected()
@ -447,6 +487,12 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
try try
{ {
FTPClient ftp = getFTPClient(); FTPClient ftp = getFTPClient();
if(!ftp.changeWorkingDirectory(remoteParent))
{
return null;
}
ftp.makeDirectory(folderName); ftp.makeDirectory(folderName);
} }
catch (Exception e) {} catch (Exception e) {}
@ -480,17 +526,12 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
public boolean copy(IProgressMonitor monitor, String srcParent, String srcName, String tgtParent, String tgtName) public boolean copy(IProgressMonitor monitor, String srcParent, String srcName, String tgtParent, String tgtName)
{ {
return move(monitor, srcParent, srcName, tgtParent, tgtName); return false;
} }
public boolean copyBatch(IProgressMonitor monitor, String[] srcParents, String[] srcNames, String tgtParent) throws SystemMessageException public boolean copyBatch(IProgressMonitor monitor, String[] srcParents, String[] srcNames, String tgtParent) throws SystemMessageException
{ {
boolean ok = true; return false;
for (int i = 0; i < srcParents.length; i++)
{
ok = ok && copy(monitor, srcParents[i], srcNames[i], tgtParent, srcNames[i]);
}
return ok;
} }
public void initService(IProgressMonitor monitor) public void initService(IProgressMonitor monitor)