mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 17:35:35 +02:00
[221211] [api][breaking][files] need batch operations to indicate which operations were successful
https://bugs.eclipse.org/bugs/show_bug.cgi?id=221211
This commit is contained in:
parent
6c82af5a4b
commit
ba07826c2f
7 changed files with 364 additions and 480 deletions
|
@ -58,6 +58,7 @@ import java.io.OutputStream;
|
|||
import java.io.UnsupportedEncodingException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -272,7 +273,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
|
||||
|
||||
|
||||
public boolean upload(InputStream inputStream, String remoteParent, String remoteFile, boolean isBinary,
|
||||
public void upload(InputStream inputStream, String remoteParent, String remoteFile, boolean isBinary,
|
||||
String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
BufferedInputStream bufInputStream = null;
|
||||
|
@ -438,12 +439,10 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
throw new RemoteFileCancelledException();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public boolean upload(File file, String remoteParent, String remoteFile, boolean isBinary,
|
||||
public void upload(File file, String remoteParent, String remoteFile, boolean isBinary,
|
||||
String srcEncoding, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
FileInputStream inputStream = null;
|
||||
|
@ -658,12 +657,10 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
// }
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public boolean download(String remoteParent, String remoteFile, File localFile, boolean isBinary,
|
||||
public void download(String remoteParent, String remoteFile, File localFile, boolean isBinary,
|
||||
String encoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
DataStore ds = getDataStore();
|
||||
|
@ -672,12 +669,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
//int mode = isBinary ? IUniversalDataStoreConstants.BINARY_MODE : IUniversalDataStoreConstants.TEXT_MODE;
|
||||
int mode = IUniversalDataStoreConstants.BINARY_MODE;
|
||||
|
||||
if (!makeSureLocalExists(localFile))
|
||||
{
|
||||
FileNotFoundException e = new FileNotFoundException();
|
||||
throw new RemoteFileIOException(e);
|
||||
}
|
||||
|
||||
makeSureLocalExists(localFile);
|
||||
|
||||
String remotePath = remoteParent + getSeparator(remoteParent) + remoteFile;
|
||||
|
||||
|
@ -779,10 +771,6 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
|
||||
codePageConverter.convertFileFromRemoteEncoding(remotePath, localFile, encoding, localEncoding, this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (resultChild.getType().equals(IUniversalDataStoreConstants.DOWNLOAD_RESULT_FILE_NOT_FOUND_EXCEPTION))
|
||||
{
|
||||
|
@ -825,10 +813,9 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
{
|
||||
//monitor.done();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean makeSureLocalExists(File localFile)
|
||||
private void makeSureLocalExists(File localFile) throws SystemMessageException
|
||||
{
|
||||
if (!localFile.exists())
|
||||
{
|
||||
|
@ -844,19 +831,18 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
return false;
|
||||
SimpleSystemMessage message = new SimpleSystemMessage(Activator.PLUGIN_ID, IStatus.ERROR, e.getLocalizedMessage());
|
||||
throw new SystemMessageException(message);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default implementation - just iterate through each file
|
||||
*/
|
||||
public boolean downloadMultiple(String[] remoteParents, String[] remoteFiles,
|
||||
public void downloadMultiple(String[] remoteParents, String[] remoteFiles,
|
||||
File[] localFiles, boolean[] isBinaries, String[] hostEncodings,
|
||||
IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean result = true;
|
||||
|
||||
|
||||
List downloadListeners = new ArrayList();
|
||||
|
@ -900,7 +886,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
|
||||
|
||||
// kick off all downloads
|
||||
for (int i = 0; i < des.length && result == true; i++)
|
||||
for (int i = 0; i < des.length; i++)
|
||||
{
|
||||
int mode = IUniversalDataStoreConstants.BINARY_MODE;
|
||||
DataElement de = des[i];
|
||||
|
@ -909,11 +895,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
File localFile = localFiles[i];
|
||||
String hostEncoding = hostEncodings[i];
|
||||
|
||||
if (!makeSureLocalExists(localFile))
|
||||
{
|
||||
FileNotFoundException e = new FileNotFoundException();
|
||||
throw new RemoteFileIOException(e);
|
||||
}
|
||||
makeSureLocalExists(localFile);
|
||||
|
||||
long fileLength = DStoreHostFile.getFileLength(de.getSource());
|
||||
if (monitor != null)
|
||||
|
@ -1018,8 +1000,6 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
|
||||
codePageConverter.convertFileFromRemoteEncoding(remoteElement.getName(), localFile, hostEncodings[i], localEncoding, this);
|
||||
}
|
||||
|
||||
result = true;
|
||||
}
|
||||
else if (resultChild.getType().equals(IUniversalDataStoreConstants.DOWNLOAD_RESULT_FILE_NOT_FOUND_EXCEPTION))
|
||||
{
|
||||
|
@ -1034,12 +1014,19 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
}
|
||||
else if (resultChild.getType().equals(IUniversalDataStoreConstants.DOWNLOAD_RESULT_UNSUPPORTED_ENCODING_EXCEPTION))
|
||||
{
|
||||
// TODO inspect this
|
||||
localFile.delete();
|
||||
String msgTxt = ServiceResources.FILEMSG_SECURITY_ERROR;
|
||||
String msgDetails = NLS.bind(ServiceResources.FILEMSG_SECURITY_ERROR_DETAILS, IUniversalDataStoreConstants.DOWNLOAD_RESULT_UNSUPPORTED_ENCODING_EXCEPTION);
|
||||
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
IDStoreMessageIds.FILEMSG_SECURITY_ERROR,
|
||||
IStatus.ERROR, msgTxt, msgDetails);
|
||||
throw new SystemMessageException(msg);
|
||||
//SystemMessage msg = getMessage();
|
||||
//throw new SystemMessageException(msg);
|
||||
//UnsupportedEncodingException e = new UnsupportedEncodingException(resultChild.getName());
|
||||
//UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error reading file " + remotePath, e);
|
||||
//throw new RemoteFileIOException(e);
|
||||
result = false;
|
||||
}
|
||||
|
||||
else if (resultChild.getType().equals(IUniversalDataStoreConstants.DOWNLOAD_RESULT_IO_EXCEPTION))
|
||||
|
@ -1057,7 +1044,14 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
// TODO inspect this
|
||||
localFile.delete();
|
||||
String msgTxt = ServiceResources.FILEMSG_SECURITY_ERROR;
|
||||
String msgDetails = NLS.bind(ServiceResources.FILEMSG_SECURITY_ERROR_DETAILS, IUniversalDataStoreConstants.DOWNLOAD_RESULT_IO_EXCEPTION);
|
||||
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
IDStoreMessageIds.FILEMSG_SECURITY_ERROR,
|
||||
IStatus.ERROR, msgTxt, msgDetails);
|
||||
throw new SystemMessageException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1067,19 +1061,17 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default implementation - just iterate through each file
|
||||
*/
|
||||
public boolean uploadMultiple(File[] localFiles, String[] remoteParents,
|
||||
public void uploadMultiple(File[] localFiles, String[] remoteParents,
|
||||
String[] remoteFiles, boolean[] isBinaries, String[] srcEncodings,
|
||||
String[] hostEncodings, IProgressMonitor monitor)
|
||||
throws SystemMessageException
|
||||
{
|
||||
boolean result = true;
|
||||
for (int i = 0; i < localFiles.length && result == true; i++)
|
||||
for (int i = 0; i < localFiles.length; i++)
|
||||
{
|
||||
File localFile = localFiles[i];
|
||||
String remoteParent = remoteParents[i];
|
||||
|
@ -1088,9 +1080,8 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
boolean isBinary = isBinaries[i];
|
||||
String srcEncoding = srcEncodings[i];
|
||||
String hostEncoding = hostEncodings[i];
|
||||
result = upload(localFile, remoteParent, remoteFile, isBinary, srcEncoding, hostEncoding, monitor);
|
||||
upload(localFile, remoteParent, remoteFile, isBinary, srcEncoding, hostEncoding, monitor);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private DataElement getSubjectFor(String remoteParent, String name)
|
||||
|
@ -1359,7 +1350,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
|
||||
}
|
||||
|
||||
public boolean delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
String remotePath = remoteParent + getSeparator(remoteParent) + fileName;
|
||||
DataElement de = getElementFor(remotePath);
|
||||
|
@ -1382,21 +1373,23 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
// When running a server older than 2.0.1 success is not set for directories, so we must
|
||||
// check if the source message is an empty string
|
||||
if (sourceMsg.equals(IServiceConstants.SUCCESS) || sourceMsg.equals("")) { //$NON-NLS-1$
|
||||
return true;
|
||||
} else {
|
||||
String msgTxt = NLS.bind(ServiceResources.FILEMSG_DELETE_FILE_FAILED, FileSystemMessageUtil.getSourceLocation(status));
|
||||
String msgDetails = ServiceResources.FILEMSG_DELETE_FILE_FAILED_DETAILS;
|
||||
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
IDStoreMessageIds.FILEMSG_DELETE_FILE_FAILED,
|
||||
IStatus.ERROR, msgTxt, msgDetails);
|
||||
|
||||
throw new SystemMessageException(msg);
|
||||
return;
|
||||
}
|
||||
String msgTxt = NLS.bind(ServiceResources.FILEMSG_DELETE_FILE_FAILED, FileSystemMessageUtil.getSourceLocation(status));
|
||||
String msgDetails = ServiceResources.FILEMSG_DELETE_FILE_FAILED_DETAILS;
|
||||
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
IDStoreMessageIds.FILEMSG_DELETE_FILE_FAILED,
|
||||
IStatus.ERROR, msgTxt, msgDetails);
|
||||
|
||||
throw new SystemMessageException(msg);
|
||||
}
|
||||
|
||||
public boolean deleteBatch(String[] remoteParents, String[] fileNames, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void deleteBatch(String[] remoteParents, String[] fileNames, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
if (remoteParents.length == 1) return delete(remoteParents[0], fileNames[0], monitor);
|
||||
if (remoteParents.length == 1) {
|
||||
delete(remoteParents[0], fileNames[0], monitor);
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList dataElements = new ArrayList(remoteParents.length);
|
||||
for (int i = 0; i < remoteParents.length; i++)
|
||||
|
@ -1420,31 +1413,27 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
// When running a server older than 2.0.1 success is not set for directories, so we must
|
||||
// check if the source message is an empty string
|
||||
if (sourceMsg.equals(IServiceConstants.SUCCESS) || sourceMsg.equals("")) { //$NON-NLS-1$
|
||||
return true;
|
||||
} else {
|
||||
String msgTxt = NLS.bind(ServiceResources.FILEMSG_DELETE_FILE_FAILED, FileSystemMessageUtil.getSourceLocation(status));
|
||||
String msgDetails = ServiceResources.FILEMSG_DELETE_FILE_FAILED_DETAILS;
|
||||
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
IDStoreMessageIds.FILEMSG_DELETE_FILE_FAILED,
|
||||
IStatus.ERROR, msgTxt, msgDetails);
|
||||
|
||||
throw new SystemMessageException(msg);
|
||||
return;
|
||||
}
|
||||
String msgTxt = NLS.bind(ServiceResources.FILEMSG_DELETE_FILE_FAILED, FileSystemMessageUtil.getSourceLocation(status));
|
||||
String msgDetails = ServiceResources.FILEMSG_DELETE_FILE_FAILED_DETAILS;
|
||||
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
IDStoreMessageIds.FILEMSG_DELETE_FILE_FAILED,
|
||||
IStatus.ERROR, msgTxt, msgDetails);
|
||||
|
||||
throw new SystemMessageException(msg);
|
||||
}
|
||||
else {
|
||||
// no delete batch descriptor so need to fall back to single command approach
|
||||
boolean result = true;
|
||||
for (int i = 0; i < remoteParents.length && result; i++){
|
||||
for (int i = 0; i < remoteParents.length; i++){
|
||||
String parent = remoteParents[i];
|
||||
String name = fileNames[i];
|
||||
result = delete(parent, name, monitor);
|
||||
delete(parent, name, monitor);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public boolean rename(String remoteParent, String oldName, String newName, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void rename(String remoteParent, String oldName, String newName, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
String oldPath, newPath = null;
|
||||
// if remoteParent is null or empty then we are doing a move
|
||||
|
@ -1498,57 +1487,48 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
//This operation has been cancelled by the user.
|
||||
throw new SystemMessageException(msg);
|
||||
}
|
||||
if (FileSystemMessageUtil.getSourceMessage(status).equals(IServiceConstants.SUCCESS))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
String msgTxt = NLS.bind(ServiceResources.FILEMSG_RENAME_FILE_FAILED, FileSystemMessageUtil.getSourceLocation(status));
|
||||
String msgDetails = ServiceResources.FILEMSG_RENAME_FILE_FAILED_DETAILS;
|
||||
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
IDStoreMessageIds.FILEMSG_RENAME_FILE_FAILED,
|
||||
IStatus.ERROR, msgTxt, msgDetails);
|
||||
|
||||
throw new SystemMessageException(msg);
|
||||
if (FileSystemMessageUtil.getSourceMessage(status).equals(IServiceConstants.SUCCESS)) {
|
||||
return;
|
||||
}
|
||||
String msgTxt = NLS.bind(ServiceResources.FILEMSG_RENAME_FILE_FAILED, FileSystemMessageUtil.getSourceLocation(status));
|
||||
String msgDetails = ServiceResources.FILEMSG_RENAME_FILE_FAILED_DETAILS;
|
||||
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
IDStoreMessageIds.FILEMSG_RENAME_FILE_FAILED,
|
||||
IStatus.ERROR, msgTxt, msgDetails);
|
||||
|
||||
throw new SystemMessageException(msg);
|
||||
}
|
||||
|
||||
public boolean rename(String remoteParent, String oldName, String newName, IHostFile oldFile, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void rename(String remoteParent, String oldName, String newName, IHostFile oldFile, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean retVal = rename(remoteParent, oldName, newName, monitor);
|
||||
rename(remoteParent, oldName, newName, monitor);
|
||||
String newPath = remoteParent + getSeparator(remoteParent) + newName;
|
||||
oldFile.renameTo(newPath);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
protected boolean moveByCopy(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException
|
||||
protected void moveByCopy(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean movedOk = false;
|
||||
|
||||
if (copy(srcParent, srcName, tgtParent, tgtName, monitor))
|
||||
copy(srcParent, srcName, tgtParent, tgtName, monitor);
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
movedOk = delete(srcParent, srcName, monitor);
|
||||
}
|
||||
catch (SystemMessageException exc)
|
||||
{
|
||||
if (null != monitor && monitor.isCanceled())
|
||||
{
|
||||
//This mean the copy operation is ok, but delete operation has been cancelled by user.
|
||||
//The delete() call will take care of recovered from the cancel operation.
|
||||
//So we need to make sure to remove the already copied file/folder.
|
||||
getFile(tgtParent, tgtName, null); //need to call getFile first to put this object into DataElement map first
|
||||
//otherwise it type will default to FilterObject, and could not be deleted properly for virtual object.
|
||||
delete(tgtParent, tgtName, null);
|
||||
}
|
||||
throw exc;
|
||||
}
|
||||
delete(srcParent, srcName, monitor);
|
||||
}
|
||||
catch (SystemMessageException exc)
|
||||
{
|
||||
if (null != monitor && monitor.isCanceled())
|
||||
{
|
||||
//This mean the copy operation is ok, but delete operation has been cancelled by user.
|
||||
//The delete() call will take care of recovered from the cancel operation.
|
||||
//So we need to make sure to remove the already copied file/folder.
|
||||
getFile(tgtParent, tgtName, null); //need to call getFile first to put this object into DataElement map first
|
||||
//otherwise it type will default to FilterObject, and could not be deleted properly for virtual object.
|
||||
delete(tgtParent, tgtName, null);
|
||||
}
|
||||
throw exc;
|
||||
}
|
||||
|
||||
return movedOk;
|
||||
}
|
||||
|
||||
public boolean move(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void move(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
String src = srcParent + getSeparator(srcParent) + srcName;
|
||||
String tgt = tgtParent + getSeparator(tgtParent) + tgtName;
|
||||
|
@ -1556,25 +1536,20 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
boolean isArchive = ArchiveHandlerManager.getInstance().isRegisteredArchive(tgt);
|
||||
if (isVirtual || isArchive)
|
||||
{
|
||||
return moveByCopy(srcParent, srcName, tgtParent, tgtName, monitor);
|
||||
moveByCopy(srcParent, srcName, tgtParent, tgtName, monitor);
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean movedOk = false;
|
||||
try
|
||||
{
|
||||
movedOk = rename("", src, tgt, monitor); //$NON-NLS-1$
|
||||
rename("", src, tgt, monitor); //$NON-NLS-1$
|
||||
}
|
||||
catch (SystemMessageException e)
|
||||
{
|
||||
return moveByCopy(srcParent, srcName, tgtParent, tgtName, monitor);
|
||||
moveByCopy(srcParent, srcName, tgtParent, tgtName, monitor);
|
||||
}
|
||||
// movedOk should never be false otherwise the last DataElement status was null
|
||||
if (!movedOk)
|
||||
{
|
||||
movedOk = moveByCopy(srcParent, srcName, tgtParent, tgtName, monitor);
|
||||
}
|
||||
return movedOk;
|
||||
moveByCopy(srcParent, srcName, tgtParent, tgtName, monitor);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1669,7 +1644,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
}
|
||||
}
|
||||
|
||||
public boolean copy(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void copy(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
DataStore ds = getDataStore();
|
||||
String srcRemotePath = srcParent + getSeparator(srcParent) + srcName;
|
||||
|
@ -1722,7 +1697,6 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
monitor.setCanceled(true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
|
@ -1732,7 +1706,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
}
|
||||
}
|
||||
|
||||
public boolean copyBatch(String[] srcParents, String[] srcNames, String tgtParent, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void copyBatch(String[] srcParents, String[] srcNames, String tgtParent, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
DataStore ds = getDataStore();
|
||||
|
||||
|
@ -1788,18 +1762,14 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
//InterruptedException is used to report user cancellation, so no need to log
|
||||
//This should be reviewed (use OperationCanceledException) with bug #190750
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// no copy batch descriptor so need to fall back to single command approach
|
||||
boolean result = true;
|
||||
for (int i = 0; i < srcParents.length && result; i++){
|
||||
for (int i = 0; i < srcParents.length; i++){
|
||||
String parent = srcParents[i];
|
||||
String name = srcNames[i];
|
||||
result = copy(parent, name, tgtParent, name, monitor);
|
||||
copy(parent, name, tgtParent, name, monitor);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1875,17 +1845,18 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
}
|
||||
|
||||
|
||||
public IHostFile[] listMultiple(String[] remoteParents,
|
||||
String[] fileFilters, int[] fileTypes, IProgressMonitor monitor)
|
||||
public void listMultiple(String[] remoteParents,
|
||||
String[] fileFilters, int[] fileTypes, List hostFiles, IProgressMonitor monitor)
|
||||
throws SystemMessageException
|
||||
{
|
||||
String[] queryStrings = getQueryStrings(fileTypes);
|
||||
|
||||
return fetchMulti(remoteParents, fileFilters, queryStrings, monitor);
|
||||
IHostFile[] result = fetchMulti(remoteParents, fileFilters, queryStrings, monitor);
|
||||
hostFiles.addAll(Arrays.asList(result));
|
||||
}
|
||||
|
||||
public IHostFile[] listMultiple(String[] remoteParents,
|
||||
String[] fileFilters, int fileType, IProgressMonitor monitor)
|
||||
public void listMultiple(String[] remoteParents,
|
||||
String[] fileFilters, int fileType, List hostFiles, IProgressMonitor monitor)
|
||||
throws SystemMessageException
|
||||
{
|
||||
String queryString = getQueryString(fileType);
|
||||
|
@ -1897,7 +1868,8 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
queryStrings[i] = queryString;
|
||||
}
|
||||
|
||||
return fetchMulti(remoteParents, fileFilters, queryStrings, monitor);
|
||||
IHostFile[] result = fetchMulti(remoteParents, fileFilters, queryStrings, monitor);
|
||||
hostFiles.addAll(Arrays.asList(result));
|
||||
}
|
||||
|
||||
protected String[] getPathsFor(String[] remoteParents, String[] remoteFiles)
|
||||
|
@ -2051,7 +2023,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean setLastModified(String parent, String name,
|
||||
public void setLastModified(String parent, String name,
|
||||
long timestamp, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
String remotePath = parent + getSeparator(parent) + name;
|
||||
|
@ -2065,7 +2037,6 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
// first modify the source attribute to temporarily be the date field
|
||||
de.setAttribute(DE.A_SOURCE, timestamp + ""); //$NON-NLS-1$
|
||||
ds.command(setCmd, de, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
|
@ -2074,7 +2045,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
CommonMessages.MSG_ERROR_UNEXPECTED));
|
||||
}
|
||||
|
||||
public boolean setReadOnly(String parent, String name,
|
||||
public void setReadOnly(String parent, String name,
|
||||
boolean readOnly, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
String remotePath = parent + getSeparator(parent) + name;
|
||||
|
@ -2096,7 +2067,6 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
{
|
||||
throw new RemoteFileIOException(e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
|
|
|
@ -99,6 +99,7 @@ import org.apache.commons.net.ftp.FTPClientConfig;
|
|||
import org.apache.commons.net.ftp.FTPFile;
|
||||
import org.apache.commons.net.ftp.FTPReply;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.rse.core.model.IPropertySet;
|
||||
|
@ -109,6 +110,7 @@ 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.PathUtility;
|
||||
import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.services.files.AbstractFileService;
|
||||
|
@ -756,9 +758,8 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.files.IFileService#upload(org.eclipse.core.runtime.IProgressMonitor, java.io.File, java.lang.String, java.lang.String, boolean, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public boolean upload(File localFile, String remoteParent, String remoteFile, boolean isBinary, String srcEncoding, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void upload(File localFile, String remoteParent, String remoteFile, boolean isBinary, String srcEncoding, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean retValue = true;
|
||||
remoteParent = checkEncoding(remoteParent);
|
||||
remoteFile = checkEncoding(remoteFile);
|
||||
|
||||
|
@ -779,7 +780,7 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
{
|
||||
try
|
||||
{
|
||||
retValue = internalUpload(localFile, remoteParent, remoteFile, isBinary, srcEncoding, hostEncoding, progressMonitor);
|
||||
internalUpload(localFile, remoteParent, remoteFile, isBinary, srcEncoding, hostEncoding, progressMonitor);
|
||||
}
|
||||
finally {
|
||||
_commandMutex.release();
|
||||
|
@ -792,17 +793,14 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
} finally {
|
||||
progressMonitor.end();
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.files.IFileService#upload(org.eclipse.core.runtime.IProgressMonitor, java.io.InputStream, java.lang.String, java.lang.String, boolean, java.lang.String)
|
||||
*/
|
||||
public boolean upload(InputStream stream, String remoteParent, String remoteFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void upload(InputStream stream, String remoteParent, String remoteFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean retValue = true;
|
||||
remoteParent = checkEncoding(remoteParent);
|
||||
remoteFile = checkEncoding(remoteFile);
|
||||
|
||||
|
@ -818,31 +816,24 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
while( (readCount = bis.read(buffer)) > 0)
|
||||
{
|
||||
bos.write(buffer, 0, readCount);
|
||||
if (monitor!=null){
|
||||
if (monitor!=null) {
|
||||
if (monitor.isCanceled()) {
|
||||
retValue = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bos.close();
|
||||
|
||||
if(retValue == true){
|
||||
retValue = upload(tempFile, remoteParent, remoteFile, isBinary, null, hostEncoding, monitor);
|
||||
}
|
||||
upload(tempFile, remoteParent, remoteFile, isBinary, null, hostEncoding, monitor);
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RemoteFileIOException(e);
|
||||
}
|
||||
|
||||
return retValue;
|
||||
|
||||
}
|
||||
|
||||
private boolean internalUpload(File localFile, String remoteParent, String remoteFile, boolean isBinary, String srcEncoding, String hostEncoding, MyProgressMonitor progressMonitor) throws IOException, RemoteFileIOException
|
||||
private void internalUpload(File localFile, String remoteParent, String remoteFile, boolean isBinary, String srcEncoding, String hostEncoding, MyProgressMonitor progressMonitor) throws IOException, RemoteFileIOException, SystemMessageException
|
||||
{
|
||||
boolean retValue = true;
|
||||
|
||||
InputStream input = null;
|
||||
OutputStream output = null;
|
||||
|
@ -867,22 +858,17 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
output.write(buffer, 0, readCount);
|
||||
progressMonitor.count(readCount);
|
||||
if (progressMonitor.isCanceled()) {
|
||||
retValue = false;
|
||||
break;
|
||||
throw new RemoteFileCancelledException();
|
||||
}
|
||||
}
|
||||
if (retValue) {
|
||||
output.flush();
|
||||
}
|
||||
output.flush();
|
||||
output.close();
|
||||
output = null;
|
||||
ftpClient.completePendingCommand();
|
||||
} else {
|
||||
throw new RemoteFileIOException(new Exception(ftpClient.getReplyString()));
|
||||
}
|
||||
if(retValue==false) {
|
||||
ftpClient.deleteFile(remoteFile);
|
||||
}
|
||||
ftpClient.deleteFile(remoteFile);
|
||||
|
||||
}finally{
|
||||
try {
|
||||
|
@ -891,8 +877,6 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
if (output!=null) output.close();
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
|
||||
|
@ -900,9 +884,8 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.files.IFileService#download(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.lang.String, java.io.File, boolean, java.lang.String)
|
||||
*/
|
||||
public boolean download(String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void download(String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean retValue = true;
|
||||
|
||||
if (monitor!=null){
|
||||
if (monitor.isCanceled()) {
|
||||
|
@ -919,7 +902,7 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
{
|
||||
try
|
||||
{
|
||||
retValue = internalDownload(remoteParent, remoteFile, localFile, isBinary, hostEncoding, progressMonitor);
|
||||
internalDownload(remoteParent, remoteFile, localFile, isBinary, hostEncoding, progressMonitor);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -934,14 +917,10 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
progressMonitor.end();
|
||||
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
private boolean internalDownload(String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding, MyProgressMonitor progressMonitor) throws SystemMessageException, IOException
|
||||
private void internalDownload(String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding, MyProgressMonitor progressMonitor) throws SystemMessageException, IOException
|
||||
{
|
||||
boolean retValue = true;
|
||||
|
||||
InputStream input = null;
|
||||
OutputStream output = null;
|
||||
|
||||
|
@ -968,17 +947,20 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
output = new FileOutputStream(localFile);
|
||||
byte[] buffer = new byte[4096];
|
||||
int readCount;
|
||||
boolean ok = true;
|
||||
while((readCount = input.read(buffer)) > 0)
|
||||
{
|
||||
output.write(buffer, 0, readCount);
|
||||
progressMonitor.count(readCount);
|
||||
if (progressMonitor.isCanceled()) {
|
||||
retValue = false;
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (retValue) output.flush();
|
||||
if (ok) {
|
||||
output.flush();
|
||||
}
|
||||
input.close();
|
||||
input = null;
|
||||
ftpClient.completePendingCommand();
|
||||
|
@ -996,8 +978,6 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
if (output!=null) output.close();
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1040,8 +1020,7 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.files.IFileService#delete(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public boolean delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException {
|
||||
boolean hasSucceeded = false;
|
||||
public void delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException {
|
||||
remoteParent = checkEncoding(remoteParent);
|
||||
fileName = checkEncoding(fileName);
|
||||
|
||||
|
@ -1053,7 +1032,7 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
if (_commandMutex.waitForLock(monitor, Long.MAX_VALUE)) {
|
||||
try {
|
||||
FTPClient ftpClient = getFTPClient();
|
||||
hasSucceeded = internalDelete(ftpClient, remoteParent, fileName, file.isFile(), progressMonitor);
|
||||
internalDelete(ftpClient, remoteParent, fileName, file.isFile(), progressMonitor);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
@ -1066,11 +1045,9 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
} finally {
|
||||
progressMonitor.end();
|
||||
}
|
||||
// Can only return true since !hasSucceeded always leads to Exception
|
||||
return hasSucceeded;
|
||||
}
|
||||
|
||||
private boolean internalDelete(FTPClient ftpClient, String parentPath, String fileName, boolean isFile, MyProgressMonitor monitor)
|
||||
private void internalDelete(FTPClient ftpClient, String parentPath, String fileName, boolean isFile, MyProgressMonitor monitor)
|
||||
throws RemoteFileException, IOException
|
||||
{
|
||||
if(monitor.isCanceled())
|
||||
|
@ -1079,64 +1056,54 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
}
|
||||
|
||||
clearCache(parentPath);
|
||||
boolean hasSucceeded = FTPReply.isPositiveCompletion(ftpClient.cwd(parentPath));
|
||||
FTPReply.isPositiveCompletion(ftpClient.cwd(parentPath));
|
||||
monitor.worked(1);
|
||||
|
||||
if(hasSucceeded)
|
||||
if(isFile)
|
||||
{
|
||||
if(isFile)
|
||||
{
|
||||
hasSucceeded = ftpClient.deleteFile(fileName);
|
||||
monitor.worked(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
hasSucceeded = ftpClient.removeDirectory(fileName);
|
||||
monitor.worked(1);
|
||||
}
|
||||
ftpClient.deleteFile(fileName);
|
||||
monitor.worked(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ftpClient.removeDirectory(fileName);
|
||||
monitor.worked(1);
|
||||
}
|
||||
|
||||
if(!hasSucceeded){
|
||||
if(isFile)
|
||||
{
|
||||
throw new RemoteFileIOException(new Exception(ftpClient.getReplyString()+" ("+concat(parentPath,fileName)+")")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
if(isFile)
|
||||
{
|
||||
throw new RemoteFileIOException(new Exception(ftpClient.getReplyString()+" ("+concat(parentPath,fileName)+")")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
else //folder recursively
|
||||
{
|
||||
String newParentPath = concat(parentPath,fileName);
|
||||
|
||||
ftpClient.changeWorkingDirectory(newParentPath);
|
||||
FTPFile[] fileNames = ftpClient.listFiles();
|
||||
|
||||
for (int i = 0; i < fileNames.length; i++) {
|
||||
String curName = fileNames[i].getName();
|
||||
if (curName == null || curName.equals(".") || curName.equals("..")) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
continue;
|
||||
}
|
||||
internalDelete(ftpClient, newParentPath, curName, fileNames[i].isFile(), monitor);
|
||||
}
|
||||
else //folder recursively
|
||||
|
||||
//remove empty folder
|
||||
ftpClient.changeWorkingDirectory(parentPath);
|
||||
boolean hasSucceeded = ftpClient.removeDirectory(fileName);
|
||||
if (!hasSucceeded)
|
||||
{
|
||||
String newParentPath = concat(parentPath,fileName);
|
||||
|
||||
ftpClient.changeWorkingDirectory(newParentPath);
|
||||
FTPFile[] fileNames = ftpClient.listFiles();
|
||||
|
||||
for (int i = 0; i < fileNames.length; i++) {
|
||||
String curName = fileNames[i].getName();
|
||||
if (curName == null || curName.equals(".") || curName.equals("..")) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
continue;
|
||||
}
|
||||
hasSucceeded = internalDelete(ftpClient, newParentPath, curName, fileNames[i].isFile(), monitor);
|
||||
}
|
||||
|
||||
//remove empty folder
|
||||
ftpClient.changeWorkingDirectory(parentPath);
|
||||
hasSucceeded = ftpClient.removeDirectory(fileName);
|
||||
if (!hasSucceeded)
|
||||
{
|
||||
throw new RemoteFileIOException(new Exception(ftpClient.getReplyString() + " (" + concat(parentPath, fileName) + ")")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
throw new RemoteFileIOException(new Exception(ftpClient.getReplyString() + " (" + concat(parentPath, fileName) + ")")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
|
||||
// Can only return true since !hasSucceeded always leads to Exception
|
||||
return hasSucceeded;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.files.IFileService#rename(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public boolean rename(String remoteParent, String oldName, String newName, IProgressMonitor monitor) throws SystemMessageException {
|
||||
boolean success = false;
|
||||
public void rename(String remoteParent, String oldName, String newName, IProgressMonitor monitor) throws SystemMessageException {
|
||||
remoteParent = checkEncoding(remoteParent);
|
||||
oldName = checkEncoding(oldName);
|
||||
newName = checkEncoding(newName);
|
||||
|
@ -1152,7 +1119,7 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
throw new RemoteFileIOException(new Exception(ftpClient.getReplyString()));
|
||||
}
|
||||
|
||||
success = ftpClient.rename(oldName, newName);
|
||||
boolean success = ftpClient.rename(oldName, newName);
|
||||
|
||||
if(!success)
|
||||
{
|
||||
|
@ -1165,26 +1132,19 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
_commandMutex.release();
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.files.IFileService#rename(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.lang.String, java.lang.String, org.eclipse.rse.services.files.IHostFile)
|
||||
*/
|
||||
public boolean rename(String remoteParent, String oldName, String newName, IHostFile oldFile, IProgressMonitor monitor) {
|
||||
boolean hasSucceeded = false;
|
||||
|
||||
public void rename(String remoteParent, String oldName, String newName, IHostFile oldFile, IProgressMonitor monitor) {
|
||||
oldFile.renameTo(newName);
|
||||
|
||||
return hasSucceeded;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.files.IFileService#move(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public boolean move(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException{
|
||||
boolean success = false;
|
||||
public void move(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException{
|
||||
srcParent = checkEncoding(srcParent);
|
||||
srcName = checkEncoding(srcName);
|
||||
tgtParent = checkEncoding(tgtParent);
|
||||
|
@ -1200,7 +1160,7 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
|
||||
clearCache(srcParent);
|
||||
clearCache(tgtParent);
|
||||
success = ftpClient.rename(source, target);
|
||||
boolean success = ftpClient.rename(source, target);
|
||||
|
||||
if(!success)
|
||||
{
|
||||
|
@ -1214,7 +1174,6 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
}
|
||||
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -1261,10 +1220,9 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
try {
|
||||
File tempFile = File.createTempFile("ftp", "temp"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
tempFile.deleteOnExit();
|
||||
boolean success = upload(tempFile, remoteParent, fileName, _isBinaryFileType, null, null, monitor);
|
||||
|
||||
if(!success)
|
||||
{
|
||||
try {
|
||||
upload(tempFile, remoteParent, fileName, _isBinaryFileType, null, null, monitor);
|
||||
} catch (SystemMessageException e) {
|
||||
throw new RemoteFileIOException(new Exception(getFTPClient().getReplyString()));
|
||||
}
|
||||
}
|
||||
|
@ -1279,10 +1237,8 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.files.IFileService#copy(java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
public boolean copy(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void copy(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean success = false;
|
||||
|
||||
srcParent = checkEncoding(srcParent);
|
||||
srcName = checkEncoding(srcName);
|
||||
tgtParent = checkEncoding(tgtParent);
|
||||
|
@ -1302,7 +1258,7 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
if(_commandMutex.waitForLock(monitor, Long.MAX_VALUE)) {
|
||||
try {
|
||||
|
||||
success = internalCopy(getFTPClient(), srcParent, srcName, tgtParent, tgtName, remoteHostFile.isDirectory(), progressMonitor);
|
||||
internalCopy(getFTPClient(), srcParent, srcName, tgtParent, tgtName, remoteHostFile.isDirectory(), progressMonitor);
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
|
@ -1312,26 +1268,22 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
_commandMutex.release();
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
private boolean internalCopy(FTPClient ftpClient, String srcParent, String srcName, String tgtParent, String tgtName, boolean isDirectory, MyProgressMonitor monitor) throws SystemMessageException, IOException
|
||||
private void internalCopy(FTPClient ftpClient, String srcParent, String srcName, String tgtParent, String tgtName, boolean isDirectory, MyProgressMonitor monitor) throws SystemMessageException, IOException
|
||||
{
|
||||
if (monitor.isCanceled())
|
||||
{
|
||||
throw new RemoteFileCancelledException();
|
||||
}
|
||||
|
||||
boolean success = false;
|
||||
|
||||
if(isDirectory)
|
||||
{
|
||||
|
||||
//create folder
|
||||
// TODO what happens if the destination folder already exists?
|
||||
// Success=true or false?
|
||||
success = ftpClient.makeDirectory(concat(tgtParent,tgtName));
|
||||
ftpClient.makeDirectory(concat(tgtParent,tgtName));
|
||||
|
||||
//copy contents
|
||||
String newSrcParentPath = concat(srcParent,srcName);
|
||||
|
@ -1346,7 +1298,7 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
continue;
|
||||
}
|
||||
// TODO should we bail out in case a single file fails?
|
||||
success = internalCopy(ftpClient, newSrcParentPath, curName, newTgtParentPath, curName, fileNames[i].isDirectory(), monitor);
|
||||
internalCopy(ftpClient, newSrcParentPath, curName, newTgtParentPath, curName, fileNames[i].isDirectory(), monitor);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1363,33 +1315,21 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
|
||||
//Use binary raw transfer since the file will be uploaded again
|
||||
try {
|
||||
success = internalDownload(srcParent, srcName, tempFile, true, null, monitor);
|
||||
if (success) {
|
||||
success = internalUpload(tempFile, tgtParent, tgtName, true, null, null, monitor);
|
||||
}
|
||||
internalDownload(srcParent, srcName, tempFile, true, null, monitor);
|
||||
internalUpload(tempFile, tgtParent, tgtName, true, null, null, monitor);
|
||||
} finally {
|
||||
tempFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
|
||||
}
|
||||
|
||||
public boolean copyBatch(String[] srcParents, String[] srcNames, String tgtParent, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void copyBatch(String[] srcParents, String[] srcNames, String tgtParent, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean hasSucceeded = false;
|
||||
|
||||
for(int i=0; i<srcNames.length; i++)
|
||||
{
|
||||
hasSucceeded = copy(srcParents[i], srcNames[i], tgtParent, srcNames[i], monitor);
|
||||
if(!hasSucceeded)
|
||||
{
|
||||
break;
|
||||
}
|
||||
copy(srcParents[i], srcNames[i], tgtParent, srcNames[i], monitor);
|
||||
}
|
||||
|
||||
return hasSucceeded;
|
||||
}
|
||||
|
||||
public boolean isCaseSensitive()
|
||||
|
@ -1570,21 +1510,19 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.files.IFileService#setLastModified(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.lang.String, long)
|
||||
*/
|
||||
public boolean setLastModified(String parent, String name,
|
||||
public void setLastModified(String parent, String name,
|
||||
long timestamp, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
// not applicable for FTP
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.rse.services.files.IFileService#setReadOnly(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.lang.String, boolean)
|
||||
*/
|
||||
public boolean setReadOnly(String parent, String name,
|
||||
public void setReadOnly(String parent, String name,
|
||||
boolean readOnly, IProgressMonitor monitor) throws SystemMessageException {
|
||||
|
||||
boolean result = false;
|
||||
FTPHostFile file = getFileInternal(parent,name, monitor);
|
||||
|
||||
int userPermissions = file.getUserPermissions();
|
||||
|
@ -1601,20 +1539,22 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
|||
}
|
||||
int newPermissions = userPermissions * 100 + groupPermissions * 10 + otherPermissions;
|
||||
|
||||
if (newPermissions==oldPermissions) {
|
||||
result = true;
|
||||
if (newPermissions == oldPermissions) {
|
||||
// do nothing
|
||||
} else if(_commandMutex.waitForLock(monitor, Long.MAX_VALUE)) {
|
||||
try {
|
||||
clearCache(parent);
|
||||
result =_ftpClient.sendSiteCommand("CHMOD "+newPermissions+" "+file.getAbsolutePath()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
_ftpClient.sendSiteCommand("CHMOD "+newPermissions+" "+file.getAbsolutePath()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
} catch (IOException e) {
|
||||
result = false;
|
||||
String pluginId = Activator.getDefault().getBundle().getSymbolicName();
|
||||
String messageText = e.getLocalizedMessage();
|
||||
SystemMessage message = new SimpleSystemMessage(pluginId, IStatus.ERROR, messageText, e);
|
||||
throw new SystemMessageException(message);
|
||||
} finally {
|
||||
_commandMutex.release();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -90,6 +90,7 @@ import org.eclipse.rse.services.files.IFileService;
|
|||
import org.eclipse.rse.services.files.IHostFile;
|
||||
import org.eclipse.rse.services.files.IHostFilePermissions;
|
||||
import org.eclipse.rse.services.files.IHostFilePermissionsContainer;
|
||||
import org.eclipse.rse.services.files.RemoteFileCancelledException;
|
||||
import org.eclipse.rse.services.files.RemoteFileException;
|
||||
import org.eclipse.rse.services.files.RemoteFileIOException;
|
||||
import org.eclipse.rse.services.files.RemoteFileSecurityException;
|
||||
|
@ -241,7 +242,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
}
|
||||
}
|
||||
|
||||
public boolean upload(InputStream stream, String remoteParent, String remoteFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void upload(InputStream stream, String remoteParent, String remoteFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean isCancelled = false;
|
||||
|
||||
|
@ -260,16 +261,20 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
ISystemArchiveHandler handler = child.getHandler();
|
||||
if (handler == null)
|
||||
throwCorruptArchiveException(this.getClass() + ".upload()"); //$NON-NLS-1$
|
||||
else
|
||||
return handler.add(stream, child.path, remoteFile, SystemEncodingUtil.ENCODING_UTF_8, hostEncoding, !isBinary, null);
|
||||
else {
|
||||
handler.add(stream, child.path, remoteFile, SystemEncodingUtil.ENCODING_UTF_8, hostEncoding, !isBinary, null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (ArchiveHandlerManager.getInstance().isArchive(destinationFile))
|
||||
{
|
||||
ISystemArchiveHandler handler = ArchiveHandlerManager.getInstance().getRegisteredHandler(destinationFile);
|
||||
if (handler == null)
|
||||
throwCorruptArchiveException(this.getClass() + ".copyToArchive()"); //$NON-NLS-1$
|
||||
else
|
||||
return handler.add(stream, "", remoteFile, SystemEncodingUtil.ENCODING_UTF_8, hostEncoding, !isBinary, null); //$NON-NLS-1$
|
||||
else {
|
||||
handler.add(stream, "", remoteFile, SystemEncodingUtil.ENCODING_UTF_8, hostEncoding, !isBinary, null); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
File destinationParent = destinationFile.getParentFile();
|
||||
|
@ -343,20 +348,19 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
|
||||
if (isCancelled)
|
||||
{
|
||||
// throw new RemoteFileCancelledException();
|
||||
return false;
|
||||
// TODO inspect this
|
||||
throw new RemoteFileCancelledException();
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean download(String remoteParent, String remoteFile, File destinationFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void download(String remoteParent, String remoteFile, File destinationFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
File file = new File(remoteParent, remoteFile);
|
||||
FileInputStream inputStream = null;
|
||||
|
@ -372,11 +376,13 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
boolean targetIsArchive = ArchiveHandlerManager.getInstance().isArchive(destinationFile.getParentFile());
|
||||
if (sourceIsVirtual)
|
||||
{
|
||||
return copyFromArchive(file, destinationFile.getParentFile(), destinationFile.getName(), monitor, hostEncoding, SystemEncodingUtil.ENCODING_UTF_8, !isBinary);
|
||||
copyFromArchive(file, destinationFile.getParentFile(), destinationFile.getName(), monitor, hostEncoding, SystemEncodingUtil.ENCODING_UTF_8, !isBinary);
|
||||
return;
|
||||
}
|
||||
if (targetIsVirtual || targetIsArchive)
|
||||
{
|
||||
return copyToArchive(file, destinationFile.getParentFile(), destinationFile.getName(), monitor, hostEncoding, SystemEncodingUtil.ENCODING_UTF_8, !isBinary);
|
||||
copyToArchive(file, destinationFile.getParentFile(), destinationFile.getName(), monitor, hostEncoding, SystemEncodingUtil.ENCODING_UTF_8, !isBinary);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -450,20 +456,19 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
catch (FileNotFoundException e)
|
||||
{
|
||||
// SystemPlugin.logError("Local copy: " + file.getAbsolutePath(), e);
|
||||
// throw new RemoteFileIOException(e);
|
||||
return false;
|
||||
throw new RemoteFileIOException(e);
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
{
|
||||
// SystemPlugin.logError("Local copy: " + file.getAbsolutePath(), e);
|
||||
// throw new RemoteFileIOException(e);
|
||||
return false;
|
||||
throw new RemoteFileIOException(e);
|
||||
// return false;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// SystemPlugin.logError("Local copy: " + file.getAbsolutePath(), e);
|
||||
// throw new RemoteFileIOException(e);
|
||||
return false;
|
||||
throw new RemoteFileIOException(e);
|
||||
// return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -481,26 +486,25 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
|
||||
if (isCancelled)
|
||||
{
|
||||
// throw new RemoteFileCancelledException();
|
||||
return false;
|
||||
throw new RemoteFileCancelledException();
|
||||
// return false;
|
||||
} else if (file.exists()) {
|
||||
destinationFile.setLastModified(file.lastModified());
|
||||
//TODO check if we want to preserve permissions
|
||||
//if(!file.canWrite()) destinationFile.setReadOnly();
|
||||
if (destinationFile.length() != file.length()) {
|
||||
// throw new RemoteFileCancelledException();
|
||||
System.err.println("local.upload: size mismach on "+destinationFile.getAbsolutePath()); //$NON-NLS-1$
|
||||
return false;
|
||||
throw new RemoteFileCancelledException();
|
||||
// System.err.println("local.upload: size mismach on "+destinationFile.getAbsolutePath()); //$NON-NLS-1$
|
||||
// return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// SystemPlugin.logError("Closing streams: " + file.getAbsolutePath(), e);
|
||||
// throw new RemoteFileIOException(e);
|
||||
throw new RemoteFileIOException(e);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean copyToArchive(File file, File destination, String newName, IProgressMonitor monitor, String sourceEncoding, String targetEncoding, boolean isText) throws SystemMessageException
|
||||
|
@ -563,7 +567,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean upload(File localFile, String remoteParent, String remoteFile, boolean isBinary, String srcEncoding, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void upload(File localFile, String remoteParent, String remoteFile, boolean isBinary, String srcEncoding, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean isCancelled = false;
|
||||
FileInputStream inputStream = null;
|
||||
|
@ -579,11 +583,13 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
boolean targetIsVirtual = ArchiveHandlerManager.isVirtual(target.getAbsolutePath());
|
||||
if (sourceIsVirtual)
|
||||
{
|
||||
return copyFromArchive(localFile, target, remoteFile, monitor, srcEncoding, hostEncoding, !isBinary);
|
||||
copyFromArchive(localFile, target, remoteFile, monitor, srcEncoding, hostEncoding, !isBinary);
|
||||
return;
|
||||
}
|
||||
if (targetIsVirtual)
|
||||
{
|
||||
return copyToArchive(localFile, target, remoteFile, monitor, srcEncoding, hostEncoding, !isBinary);
|
||||
copyToArchive(localFile, target, remoteFile, monitor, srcEncoding, hostEncoding, !isBinary);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -669,8 +675,8 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
|
||||
if (isCancelled)
|
||||
{
|
||||
// throw new RemoteFileCancelledException();
|
||||
return false;
|
||||
throw new RemoteFileCancelledException();
|
||||
// return false;
|
||||
} else if (destinationFile!=null) {
|
||||
destinationFile.setLastModified(localFile.lastModified());
|
||||
//TODO check if we want to preserve permissions
|
||||
|
@ -688,7 +694,6 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
{
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected IHostFile[] internalFetch(String remoteParent, String fileFilter, int type, IProgressMonitor monitor) {
|
||||
|
@ -1043,7 +1048,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
return new LocalVirtualHostFile(child);
|
||||
}
|
||||
|
||||
public boolean delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
if (fileName.endsWith(ArchiveHandlerManager.VIRTUAL_SEPARATOR))
|
||||
{
|
||||
|
@ -1057,35 +1062,33 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
File fileToDelete = new File(remoteParent, fileName);
|
||||
if (ArchiveHandlerManager.isVirtual(fileToDelete.getAbsolutePath()))
|
||||
{
|
||||
return deleteFromArchive(fileToDelete, monitor);
|
||||
deleteFromArchive(fileToDelete, monitor);
|
||||
}
|
||||
else if (ArchiveHandlerManager.getInstance().isArchive(fileToDelete))
|
||||
{
|
||||
return deleteArchive(fileToDelete);
|
||||
deleteArchive(fileToDelete);
|
||||
}
|
||||
if (fileToDelete.isDirectory())
|
||||
{
|
||||
return deleteContents(fileToDelete, monitor);
|
||||
deleteContents(fileToDelete, monitor);
|
||||
}
|
||||
else
|
||||
{
|
||||
return fileToDelete.delete();
|
||||
fileToDelete.delete();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean deleteBatch(String[] remoteParents, String[] fileNames, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void deleteBatch(String[] remoteParents, String[] fileNames, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean ok = true;
|
||||
String deletingMessage = NLS.bind(LocalServiceResources.FILEMSG_DELETING, ""); //$NON-NLS-1$
|
||||
monitor.beginTask(deletingMessage, remoteParents.length);
|
||||
for (int i = 0; i < remoteParents.length; i++)
|
||||
{
|
||||
deletingMessage = NLS.bind(LocalServiceResources.FILEMSG_DELETING, fileNames[i]);
|
||||
monitor.subTask(deletingMessage);
|
||||
ok = ok && delete(remoteParents[i], fileNames[i], monitor);
|
||||
delete(remoteParents[i], fileNames[i], monitor);
|
||||
monitor.worked(1);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
private boolean deleteContents(File folder, IProgressMonitor monitor)
|
||||
|
@ -1153,12 +1156,13 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
return file.delete();
|
||||
}
|
||||
|
||||
public boolean rename(String remoteParent, String oldName, String newName, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void rename(String remoteParent, String oldName, String newName, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
File fileToRename = new File(remoteParent, oldName);
|
||||
if (ArchiveHandlerManager.isVirtual(fileToRename.getAbsolutePath()))
|
||||
{
|
||||
return renameVirtualFile(fileToRename, newName, monitor);
|
||||
renameVirtualFile(fileToRename, newName, monitor);
|
||||
return;
|
||||
}
|
||||
File newFile = new File(remoteParent, newName);
|
||||
boolean result = fileToRename.renameTo(newFile);
|
||||
|
@ -1171,15 +1175,13 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
ILocalMessageIds.FILEMSG_RENAME_FILE_FAILED,
|
||||
IStatus.ERROR, msgTxt, msgDetails));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean rename(String remoteParent, String oldName, String newName, IHostFile oldFile, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void rename(String remoteParent, String oldName, String newName, IHostFile oldFile, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean retVal = rename(remoteParent, oldName, newName, monitor);
|
||||
rename(remoteParent, oldName, newName, monitor);
|
||||
File newFile = new File(remoteParent, newName);
|
||||
oldFile.renameTo(newFile.getAbsolutePath());
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1228,11 +1230,10 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean move(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void move(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
File sourceFolderOrFile = new File(srcParent, srcName);
|
||||
File targetFolder = new File(tgtParent, tgtName);
|
||||
boolean movedOk = false;
|
||||
boolean sourceIsVirtual = ArchiveHandlerManager.isVirtual(sourceFolderOrFile.getAbsolutePath());
|
||||
boolean targetIsVirtual = ArchiveHandlerManager.isVirtual(targetFolder.getAbsolutePath());
|
||||
boolean targetIsArchive = ArchiveHandlerManager.getInstance().isArchive(targetFolder);
|
||||
|
@ -1245,34 +1246,29 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
{
|
||||
File fileToMove = new File(srcParent, srcName);
|
||||
File newFile = new File(tgtParent, tgtName);
|
||||
movedOk = fileToMove.renameTo(newFile);
|
||||
fileToMove.renameTo(newFile);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!movedOk)
|
||||
copy(srcParent, srcName, tgtParent, tgtName, monitor);
|
||||
try
|
||||
{
|
||||
if (copy(srcParent, srcName, tgtParent, tgtName, monitor))
|
||||
{
|
||||
try
|
||||
{
|
||||
movedOk = delete(srcParent, srcName, monitor);
|
||||
}
|
||||
catch (SystemMessageException exc)
|
||||
{
|
||||
if (monitor.isCanceled())
|
||||
{
|
||||
//This mean the copy operation is ok, but delete operation has been cancelled by user.
|
||||
//The delete() call will take care of recovered from the cancel operation.
|
||||
//So we need to make sure to remove the already copied file/folder.
|
||||
delete(tgtParent, tgtName, null);
|
||||
}
|
||||
throw exc;
|
||||
}
|
||||
}
|
||||
delete(srcParent, srcName, monitor);
|
||||
}
|
||||
catch (SystemMessageException exc)
|
||||
{
|
||||
if (monitor.isCanceled())
|
||||
{
|
||||
//This mean the copy operation is ok, but delete operation has been cancelled by user.
|
||||
//The delete() call will take care of recovered from the cancel operation.
|
||||
//So we need to make sure to remove the already copied file/folder.
|
||||
delete(tgtParent, tgtName, null);
|
||||
}
|
||||
throw exc;
|
||||
}
|
||||
return movedOk;
|
||||
}
|
||||
|
||||
public boolean copy(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void copy(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
File srcFile = new File(srcParent, srcName);
|
||||
File tgtFile = new File(tgtParent, tgtName);
|
||||
|
@ -1287,11 +1283,13 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
boolean targetIsArchive = ArchiveHandlerManager.getInstance().isArchive(new File(tgtParent));
|
||||
if (sourceIsVirtual)
|
||||
{
|
||||
return copyFromArchive(srcFile, new File(tgtParent), tgtName, monitor, SystemEncodingUtil.ENCODING_UTF_8, SystemEncodingUtil.ENCODING_UTF_8, false);
|
||||
copyFromArchive(srcFile, new File(tgtParent), tgtName, monitor, SystemEncodingUtil.ENCODING_UTF_8, SystemEncodingUtil.ENCODING_UTF_8, false);
|
||||
return;
|
||||
}
|
||||
if (targetIsVirtual || targetIsArchive)
|
||||
{
|
||||
return copyToArchive(srcFile, new File(tgtParent), tgtName, monitor, SystemEncodingUtil.ENCODING_UTF_8, SystemEncodingUtil.ENCODING_UTF_8, false);
|
||||
copyToArchive(srcFile, new File(tgtParent), tgtName, monitor, SystemEncodingUtil.ENCODING_UTF_8, SystemEncodingUtil.ENCODING_UTF_8, false);
|
||||
return;
|
||||
}
|
||||
|
||||
// handle special characters in source and target strings
|
||||
|
@ -1332,7 +1330,6 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
command = "cp -p " + src + " " + target; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
int rc = -1;
|
||||
try
|
||||
{
|
||||
Process p = null;
|
||||
|
@ -1354,7 +1351,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
}
|
||||
|
||||
//Process p = Runtime.getRuntime().exec(command);
|
||||
rc = p.waitFor();
|
||||
p.waitFor();
|
||||
|
||||
//rc = p.exitValue();
|
||||
}
|
||||
|
@ -1362,7 +1359,6 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
{
|
||||
throw new RemoteFileException(e.getMessage(), e);
|
||||
}
|
||||
return (rc == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1551,40 +1547,47 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
return !isWindows();
|
||||
}
|
||||
|
||||
public boolean copyBatch(String[] srcParents, String[] srcNames, String tgtParent, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void copyBatch(String[] srcParents, String[] srcNames, String tgtParent, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean ok = true;
|
||||
String deletingMessage = NLS.bind(LocalServiceResources.FILEMSG_COPYING, ""); //$NON-NLS-1$
|
||||
monitor.beginTask(deletingMessage, srcParents.length);
|
||||
for (int i = 0; i < srcParents.length; i++)
|
||||
{
|
||||
deletingMessage = NLS.bind(LocalServiceResources.FILEMSG_COPYING, srcNames[i]);
|
||||
monitor.subTask(deletingMessage);
|
||||
ok = ok && copy(srcParents[i], srcNames[i], tgtParent, srcNames[i], monitor);
|
||||
copy(srcParents[i], srcNames[i], tgtParent, srcNames[i], monitor);
|
||||
monitor.worked(1);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
public boolean setLastModified(String parent, String name, long timestamp, IProgressMonitor monitor)
|
||||
public void setLastModified(String parent, String name, long timestamp, IProgressMonitor monitor)
|
||||
{
|
||||
File file = new File(parent, name);
|
||||
return file.setLastModified(timestamp);
|
||||
file.setLastModified(timestamp);
|
||||
}
|
||||
|
||||
public boolean setReadOnly(String parent, String name,
|
||||
public void setReadOnly(String parent, String name,
|
||||
boolean readOnly, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
File file = new File(parent, name);
|
||||
if (!file.exists()) {
|
||||
return false;
|
||||
String pluginId = Activator.PLUGIN_ID;
|
||||
String messageText = "File does not exist";
|
||||
SimpleSystemMessage message = new SimpleSystemMessage(pluginId, IStatus.ERROR, messageText);
|
||||
throw new SystemMessageException(message);
|
||||
}
|
||||
if (readOnly != file.canWrite()) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (readOnly)
|
||||
{
|
||||
return file.setReadOnly();
|
||||
if (!file.setReadOnly()) {
|
||||
String pluginId = Activator.PLUGIN_ID;
|
||||
String messageText = "Cannot set file read only";
|
||||
SimpleSystemMessage message = new SimpleSystemMessage(pluginId, IStatus.ERROR, messageText);
|
||||
throw new SystemMessageException(message);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1604,7 +1607,12 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
return (exitValue == 0);
|
||||
if (exitValue != 0) {
|
||||
String pluginId = Activator.PLUGIN_ID;
|
||||
String messageText = "Cannot set file read-write";
|
||||
SimpleSystemMessage message = new SimpleSystemMessage(pluginId, IStatus.ERROR, messageText);
|
||||
throw new SystemMessageException(message);
|
||||
}
|
||||
}
|
||||
// windows version
|
||||
else
|
||||
|
@ -1622,7 +1630,12 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
return (exitValue == 0);
|
||||
if (exitValue != 0) {
|
||||
String pluginId = Activator.PLUGIN_ID;
|
||||
String messageText = "Cannot set file read-write";
|
||||
SimpleSystemMessage message = new SimpleSystemMessage(pluginId, IStatus.ERROR, messageText);
|
||||
throw new SystemMessageException(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1734,7 +1747,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
String group = newPermissions.getGroupOwner();
|
||||
|
||||
// set the permissions
|
||||
String result = simpleShellCommand("chmod " + permissionsInOctal, file); //$NON-NLS-1$
|
||||
simpleShellCommand("chmod " + permissionsInOctal, file); //$NON-NLS-1$
|
||||
|
||||
// set the user
|
||||
simpleShellCommand("chown " + user, file); //$NON-NLS-1$
|
||||
|
|
|
@ -638,7 +638,7 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
return "/"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public boolean upload(File localFile, String remoteParent, String remoteFile, boolean isBinary, String srcEncoding, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void upload(File localFile, String remoteParent, String remoteFile, boolean isBinary, String srcEncoding, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
String dst = remoteParent;
|
||||
if( remoteFile!=null ) {
|
||||
|
@ -660,7 +660,7 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
channel.put(localFile.getAbsolutePath(), dst, sftpMonitor, mode);
|
||||
Activator.trace("SftpFileService.upload "+remoteFile+ " ok"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
if (monitor.isCanceled()) {
|
||||
return false;
|
||||
throw new RemoteFileCancelledException();
|
||||
} else {
|
||||
SftpATTRS attr = channel.stat(dst);
|
||||
attr.setACMODTIME(attr.getATime(), (int)(localFile.lastModified()/1000));
|
||||
|
@ -685,7 +685,6 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
finally {
|
||||
if (channel!=null) channel.disconnect();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class MyProgressMonitor implements SftpProgressMonitor
|
||||
|
@ -740,7 +739,7 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
}
|
||||
}
|
||||
|
||||
public boolean upload(InputStream stream, String remoteParent, String remoteFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void upload(InputStream stream, String remoteParent, String remoteFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
//TODO hack for now
|
||||
try
|
||||
|
@ -763,10 +762,9 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
throw makeSystemMessageException(e);
|
||||
//return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean download(String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void download(String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
ChannelSftp channel = null;
|
||||
String remotePath = concat(remoteParent, remoteFile);
|
||||
|
@ -788,7 +786,7 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
channel.get(remotePathRecoded, localFile.getAbsolutePath(), sftpMonitor, mode);
|
||||
Activator.trace("SftpFileService.download "+remoteFile+ " ok"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
if (monitor.isCanceled()) {
|
||||
return false;
|
||||
throw new RemoteFileCancelledException();
|
||||
} else {
|
||||
SftpATTRS attr = channel.stat(remotePathRecoded);
|
||||
localFile.setLastModified(1000L * attr.getMTime());
|
||||
|
@ -817,7 +815,6 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
channel.disconnect();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public IHostFile getUserHome() {
|
||||
|
@ -892,9 +889,8 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
return result;
|
||||
}
|
||||
|
||||
public boolean delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean ok=false;
|
||||
String fullPath = concat(remoteParent, fileName);
|
||||
Activator.trace("SftpFileService.delete.waitForLock"); //$NON-NLS-1$
|
||||
if (fDirChannelMutex.waitForLock(monitor, fDirChannelTimeout)) {
|
||||
|
@ -914,25 +910,21 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
}
|
||||
if (attrs==null) {
|
||||
//doesn't exist, nothing to do
|
||||
ok=true;
|
||||
} else if (attrs.isDir()) {
|
||||
try {
|
||||
getChannel("SftpFileService.delete.rmdir").rmdir(fullPathRecoded); //$NON-NLS-1$
|
||||
ok=true;
|
||||
} catch(SftpException e) {
|
||||
if(e.id==ChannelSftp.SSH_FX_FAILURE) {
|
||||
//Bug 153649: Recursive directory delete
|
||||
//throw new RemoteFolderNotEmptyException();
|
||||
String fullPathQuoted = PathUtility.enQuoteUnix(fullPathRecoded);
|
||||
int rv = runCommand("rm -rf "+fullPathQuoted, monitor); //$NON-NLS-1$
|
||||
ok = (rv==0);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
getChannel("SftpFileService.delete.rm").rm(fullPathRecoded); //$NON-NLS-1$
|
||||
ok=true;
|
||||
}
|
||||
Activator.trace("SftpFileService.delete ok"); //$NON-NLS-1$
|
||||
} catch (Exception e) {
|
||||
|
@ -942,18 +934,15 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
fDirChannelMutex.release();
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
public boolean rename(String remoteParent, String oldName, String newName, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void rename(String remoteParent, String oldName, String newName, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean ok=false;
|
||||
String fullPathOld = concat(remoteParent, oldName);
|
||||
String fullPathNew = concat(remoteParent, newName);
|
||||
if (fDirChannelMutex.waitForLock(monitor, fDirChannelTimeout)) {
|
||||
try {
|
||||
getChannel("SftpFileService.rename").rename(recode(fullPathOld), recodeSafe(fullPathNew)); //$NON-NLS-1$
|
||||
ok=true;
|
||||
Activator.trace("SftpFileService.rename ok"); //$NON-NLS-1$
|
||||
} catch (Exception e) {
|
||||
Activator.trace("SftpFileService.rename "+fullPathOld+" -> "+fullPathNew+" failed: "+e.toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
@ -962,12 +951,11 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
fDirChannelMutex.release();
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
public boolean rename(String remoteParent, String oldName, String newName, IHostFile oldFile, IProgressMonitor monitor) throws SystemMessageException {
|
||||
public void rename(String remoteParent, String oldName, String newName, IHostFile oldFile, IProgressMonitor monitor) throws SystemMessageException {
|
||||
// TODO dont know how to update
|
||||
return rename(remoteParent, oldName, newName, monitor);
|
||||
rename(remoteParent, oldName, newName, monitor);
|
||||
}
|
||||
|
||||
private boolean progressWorked(IProgressMonitor monitor, int work) {
|
||||
|
@ -1035,7 +1023,7 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
return result;
|
||||
}
|
||||
|
||||
public boolean move(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void move(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
// move is not supported by sftp directly. Use the ssh shell instead.
|
||||
// TODO check if newer versions of sftp support move directly
|
||||
|
@ -1044,32 +1032,28 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
Activator.trace("SftpFileService.move "+srcName); //$NON-NLS-1$
|
||||
String fullPathOld = PathUtility.enQuoteUnix(recode(concat(srcParent, srcName)));
|
||||
String fullPathNew = PathUtility.enQuoteUnix(recodeSafe(concat(tgtParent, tgtName)));
|
||||
int rv = runCommand("mv "+fullPathOld+' '+fullPathNew, monitor); //$NON-NLS-1$
|
||||
return (rv==0);
|
||||
runCommand("mv "+fullPathOld+' '+fullPathNew, monitor); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public boolean copy(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException {
|
||||
public void copy(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException {
|
||||
// copy is not supported by sftp directly. Use the ssh shell instead.
|
||||
// TODO check if newer versions of sftp support copy directly
|
||||
// TODO Interpret some error messages like "command not found" (use (x)copy instead of cp on windows)
|
||||
Activator.trace("SftpFileService.copy "+srcName); //$NON-NLS-1$
|
||||
String fullPathOld = PathUtility.enQuoteUnix(recode(concat(srcParent, srcName)));
|
||||
String fullPathNew = PathUtility.enQuoteUnix(recodeSafe(concat(tgtParent, tgtName)));
|
||||
int rv = runCommand("cp -Rp "+fullPathOld+' '+fullPathNew, monitor); //$NON-NLS-1$
|
||||
return (rv==0);
|
||||
runCommand("cp -Rp "+fullPathOld+' '+fullPathNew, monitor); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public boolean copyBatch(String[] srcParents, String[] srcNames, String tgtParent, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void copyBatch(String[] srcParents, String[] srcNames, String tgtParent, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
Activator.trace("SftpFileService.copyBatch "+srcNames); //$NON-NLS-1$
|
||||
boolean ok = true;
|
||||
for (int i = 0; i < srcParents.length; i++)
|
||||
{
|
||||
//TODO check what should happen if one file throws an Exception
|
||||
//should the batch job continue?
|
||||
ok = ok && copy(srcParents[i], srcNames[i], tgtParent, srcNames[i], monitor);
|
||||
copy(srcParents[i], srcNames[i], tgtParent, srcNames[i], monitor);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
public void initService(IProgressMonitor monitor) {
|
||||
|
@ -1095,15 +1079,13 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean setLastModified(String parent, String name,
|
||||
public void setLastModified(String parent, String name,
|
||||
long timestamp, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean ok=false;
|
||||
String path = concat(parent, name);
|
||||
if (fDirChannelMutex.waitForLock(monitor, fDirChannelTimeout)) {
|
||||
try {
|
||||
getChannel("SftpFileService.setLastModified").setMtime(recode(path), (int)(timestamp/1000)); //$NON-NLS-1$
|
||||
ok=true;
|
||||
Activator.trace("SftpFileService.setLastModified ok"); //$NON-NLS-1$
|
||||
} catch (Exception e) {
|
||||
Activator.trace("SftpFileService.setLastModified "+path+" failed: "+e.toString()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
@ -1112,12 +1094,10 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
fDirChannelMutex.release();
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setReadOnly(String parent, String name,
|
||||
public void setReadOnly(String parent, String name,
|
||||
boolean readOnly, IProgressMonitor monitor) throws SystemMessageException {
|
||||
boolean ok=false;
|
||||
String path = concat(parent, name);
|
||||
if (fDirChannelMutex.waitForLock(monitor, fDirChannelTimeout)) {
|
||||
try {
|
||||
|
@ -1135,7 +1115,6 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
getChannel("SftpFileService.setReadOnly").setStat(recode(path), attr); //$NON-NLS-1$ ok=true;
|
||||
Activator.trace("SftpFileService.setReadOnly ok"); //$NON-NLS-1$
|
||||
} else {
|
||||
ok=true;
|
||||
Activator.trace("SftpFileService.setReadOnly nothing-to-do"); //$NON-NLS-1$
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -1145,7 +1124,6 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
fDirChannelMutex.release();
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -64,38 +64,34 @@ public abstract class AbstractFileService extends AbstractService implements IFi
|
|||
return internalFetch(remoteParent, fileFilter, fileType, monitor);
|
||||
}
|
||||
|
||||
public IHostFile[] listMultiple(String[] remoteParents,
|
||||
String[] fileFilters, int fileTypes[], IProgressMonitor monitor)
|
||||
public void listMultiple(String[] remoteParents,
|
||||
String[] fileFilters, int fileTypes[], List hostFiles, IProgressMonitor monitor)
|
||||
throws SystemMessageException {
|
||||
|
||||
List files = new ArrayList();
|
||||
for (int i = 0; i < remoteParents.length; i++)
|
||||
{
|
||||
IHostFile[] result = list(remoteParents[i], fileFilters[i], fileTypes[i], monitor);
|
||||
for (int j = 0; j < result.length; j++)
|
||||
{
|
||||
files.add(result[j]);
|
||||
hostFiles.add(result[j]);
|
||||
}
|
||||
}
|
||||
|
||||
return (IHostFile[])files.toArray(new IHostFile[files.size()]);
|
||||
}
|
||||
|
||||
public IHostFile[] listMultiple(String[] remoteParents,
|
||||
String[] fileFilters, int fileType, IProgressMonitor monitor)
|
||||
public void listMultiple(String[] remoteParents,
|
||||
String[] fileFilters, int fileType, List hostFiles, IProgressMonitor monitor)
|
||||
throws SystemMessageException {
|
||||
|
||||
List files = new ArrayList();
|
||||
for (int i = 0; i < remoteParents.length; i++)
|
||||
{
|
||||
IHostFile[] result = list(remoteParents[i], fileFilters[i], fileType, monitor);
|
||||
for (int j = 0; j < result.length; j++)
|
||||
{
|
||||
files.add(result[j]);
|
||||
hostFiles.add(result[j]);
|
||||
}
|
||||
}
|
||||
|
||||
return (IHostFile[])files.toArray(new IHostFile[files.size()]);
|
||||
}
|
||||
|
||||
protected boolean isRightType(int fileType, IHostFile node)
|
||||
|
@ -128,46 +124,42 @@ public abstract class AbstractFileService extends AbstractService implements IFi
|
|||
}
|
||||
|
||||
|
||||
public boolean deleteBatch(String[] remoteParents, String[] fileNames, IProgressMonitor monitor) throws SystemMessageException
|
||||
public void deleteBatch(String[] remoteParents, String[] fileNames, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean ok = true;
|
||||
for (int i = 0; i < remoteParents.length; i++)
|
||||
{
|
||||
ok = ok && delete(remoteParents[i], fileNames[i], monitor);
|
||||
delete(remoteParents[i], fileNames[i], monitor);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default implementation - just iterate through each file
|
||||
*/
|
||||
public boolean downloadMultiple(String[] remoteParents, String[] remoteFiles,
|
||||
public void downloadMultiple(String[] remoteParents, String[] remoteFiles,
|
||||
File[] localFiles, boolean[] isBinaries, String[] hostEncodings,
|
||||
IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
boolean result = true;
|
||||
for (int i = 0; i < remoteParents.length && result == true; i++)
|
||||
for (int i = 0; i < remoteParents.length; i++)
|
||||
{
|
||||
String remoteParent = remoteParents[i];
|
||||
String remoteFile = remoteFiles[i];
|
||||
File localFile = localFiles[i];
|
||||
boolean isBinary = isBinaries[i];
|
||||
String hostEncoding = hostEncodings[i];
|
||||
result = download(remoteParent, remoteFile, localFile, isBinary, hostEncoding, monitor);
|
||||
download(remoteParent, remoteFile, localFile, isBinary, hostEncoding, monitor);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default implementation - just iterate through each file
|
||||
*/
|
||||
public boolean uploadMultiple(File[] localFiles, String[] remoteParents,
|
||||
public void uploadMultiple(File[] localFiles, String[] remoteParents,
|
||||
String[] remoteFiles, boolean[] isBinaries, String[] srcEncodings,
|
||||
String[] hostEncodings, IProgressMonitor monitor)
|
||||
throws SystemMessageException
|
||||
{
|
||||
boolean result = true;
|
||||
for (int i = 0; i < localFiles.length && result == true; i++)
|
||||
for (int i = 0; i < localFiles.length; i++)
|
||||
{
|
||||
File localFile = localFiles[i];
|
||||
String remoteParent = remoteParents[i];
|
||||
|
@ -176,9 +168,8 @@ public abstract class AbstractFileService extends AbstractService implements IFi
|
|||
boolean isBinary = isBinaries[i];
|
||||
String srcEncoding = srcEncodings[i];
|
||||
String hostEncoding = hostEncodings[i];
|
||||
result = upload(localFile, remoteParent, remoteFile, isBinary, srcEncoding, hostEncoding, monitor);
|
||||
upload(localFile, remoteParent, remoteFile, isBinary, srcEncoding, hostEncoding, monitor);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,6 +31,7 @@ package org.eclipse.rse.services.files;
|
|||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
|
@ -69,8 +70,8 @@ public interface IFileService extends IService
|
|||
* return from the query.
|
||||
*
|
||||
* @see IFileService#list(String,String,int,IProgressMonitor)
|
||||
* @see IFileService#listMultiple(String[],String[],int,IProgressMonitor)
|
||||
* @see IFileService#listMultiple(String[],String[],int[],IProgressMonitor)
|
||||
* @see IFileService#listMultiple(String[],String[],int,List,IProgressMonitor)
|
||||
* @see IFileService#listMultiple(String[],String[],int[],List,IProgressMonitor)
|
||||
*
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
|
@ -86,8 +87,8 @@ public interface IFileService extends IService
|
|||
* return from the query.
|
||||
*
|
||||
* @see IFileService#list(String,String,int,IProgressMonitor)
|
||||
* @see IFileService#listMultiple(String[],String[],int,IProgressMonitor)
|
||||
* @see IFileService#listMultiple(String[],String[],int[],IProgressMonitor)
|
||||
* @see IFileService#listMultiple(String[],String[],int,List,IProgressMonitor)
|
||||
* @see IFileService#listMultiple(String[],String[],int[],List,IProgressMonitor)
|
||||
*
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
|
@ -105,8 +106,8 @@ public interface IFileService extends IService
|
|||
* return from the query.
|
||||
*
|
||||
* @see IFileService#list(String,String,int,IProgressMonitor)
|
||||
* @see IFileService#listMultiple(String[],String[],int,IProgressMonitor)
|
||||
* @see IFileService#listMultiple(String[],String[],int[],IProgressMonitor)
|
||||
* @see IFileService#listMultiple(String[],String[],int,List,IProgressMonitor)
|
||||
* @see IFileService#listMultiple(String[],String[],int[],List,IProgressMonitor)
|
||||
*
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
|
@ -151,11 +152,10 @@ public interface IFileService extends IService
|
|||
* @param isBinary - indicates whether the file is text or binary
|
||||
* @param hostEncoding - the tgt encoding of the file (if text)
|
||||
* @param monitor the monitor for this potentially long running operation
|
||||
* @return true if the file was uploaded
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean upload(InputStream stream, String remoteParent, String remoteFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException;
|
||||
public void upload(InputStream stream, String remoteParent, String remoteFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Copy a file to the remote file system. The remote target is denoted by a
|
||||
|
@ -167,12 +167,11 @@ public interface IFileService extends IService
|
|||
* @param srcEncoding - the src encoding of the file (if text)
|
||||
* @param hostEncoding - the tgt encoding of the file (if text)
|
||||
* @param monitor the monitor for this potentially long running operation
|
||||
* @return true if the file was uploaded
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the
|
||||
* {@link RemoteFileException} family.
|
||||
*/
|
||||
public boolean upload(File localFile, String remoteParent, String remoteFile, boolean isBinary, String srcEncoding, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException;
|
||||
public void upload(File localFile, String remoteParent, String remoteFile, boolean isBinary, String srcEncoding, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -189,14 +188,13 @@ public interface IFileService extends IService
|
|||
* @param srcEncodings - the src encodings of the files (if text)
|
||||
* @param hostEncodings - the tgt encodings of the files (if text)
|
||||
* @param monitor the monitor for this potentially long running operation
|
||||
* @return true if the files were uploaded
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the
|
||||
* {@link RemoteFileException} family.
|
||||
*
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean uploadMultiple(File[] localFiles, String[] remoteParents, String[] remoteFiles, boolean[] isBinary, String[] srcEncodings, String[] hostEncodings, IProgressMonitor monitor) throws SystemMessageException;
|
||||
public void uploadMultiple(File[] localFiles, String[] remoteParents, String[] remoteFiles, boolean[] isBinary, String[] srcEncodings, String[] hostEncodings, IProgressMonitor monitor) throws SystemMessageException;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -208,12 +206,11 @@ public interface IFileService extends IService
|
|||
* @param isBinary - indicates whether the file is text on binary
|
||||
* @param hostEncoding - the encoding on the host (if text)
|
||||
* @param monitor the monitor for this potentially long running operation
|
||||
* @return true if the file was copied from the remote system.
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the
|
||||
* {@link RemoteFileException} family.
|
||||
*/
|
||||
public boolean download(String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException;
|
||||
public void download(String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Copy files from the remote file system to the local system.
|
||||
|
@ -230,13 +227,12 @@ public interface IFileService extends IService
|
|||
* @param isBinary - indicates whether the files are text on binary
|
||||
* @param hostEncodings - the encodings on the host (if text)
|
||||
* @param monitor the monitor for this potentially long running operation
|
||||
* @return true if the files were copied from the remote system.
|
||||
* @throws SystemMessageException if an error occurs. Typically this would
|
||||
* be one of those in the {@link RemoteFileException} family.
|
||||
*
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public boolean downloadMultiple(String[] remoteParents, String[] remoteFiles, File[] localFiles, boolean[] isBinary, String[] hostEncodings, IProgressMonitor monitor) throws SystemMessageException;
|
||||
public void downloadMultiple(String[] remoteParents, String[] remoteFiles, File[] localFiles, boolean[] isBinary, String[] hostEncodings, IProgressMonitor monitor) throws SystemMessageException;
|
||||
|
||||
|
||||
|
||||
|
@ -317,15 +313,14 @@ public interface IFileService extends IService
|
|||
* some other type. For each remoteParent, there must be a
|
||||
* corresponding fileType. For the default list of available file
|
||||
* types see <code>IFileServiceContants</code>
|
||||
* @param hostFiles a list to which the found {@link IHostFile} objects will be appended
|
||||
* @param monitor the monitor for this potentially long running operation
|
||||
* @return the collective list of host files that reside in each of the
|
||||
* remoteParents with it's corresponding filter.
|
||||
* @throws SystemMessageException if an error occurs. Typically this would
|
||||
* be one of those in the RemoteFileException family.
|
||||
*
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public IHostFile[] listMultiple(String[] remoteParents, String[] fileFilters, int[] fileTypes, IProgressMonitor monitor) throws SystemMessageException;
|
||||
public void listMultiple(String[] remoteParents, String[] fileFilters, int[] fileTypes, List hostFiles, IProgressMonitor monitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* List the contents of multiple remote folders.
|
||||
|
@ -345,15 +340,14 @@ public interface IFileService extends IService
|
|||
* other type. All results will be of the specified type. For the
|
||||
* default list of available file types see
|
||||
* <code>IFileServiceContants</code>
|
||||
* @param hostFiles a list to which the found {@link IHostFile} objects will be appended
|
||||
* @param monitor the monitor for this potentially long running operation
|
||||
* @return the collective list of host files that reside in each of the
|
||||
* remoteParents with it's corresponding filter.
|
||||
* @throws SystemMessageException if an error occurs. Typically this would
|
||||
* be one of those in the RemoteFileException family.
|
||||
*
|
||||
* @since org.eclipse.rse.services 3.0
|
||||
*/
|
||||
public IHostFile[] listMultiple(String[] remoteParents, String[] fileFilters, int fileType, IProgressMonitor monitor) throws SystemMessageException;
|
||||
public void listMultiple(String[] remoteParents, String[] fileFilters, int fileType, List hostFiles, IProgressMonitor monitor) throws SystemMessageException;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -413,11 +407,10 @@ public interface IFileService extends IService
|
|||
* @param remoteParent the folder containing the file to delete
|
||||
* @param fileName the name of the file or folder to delete
|
||||
* @param monitor the progress monitor
|
||||
* @return true if successful
|
||||
* @throws SystemMessageException if an error occurs. Typically this would
|
||||
* be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException;
|
||||
public void delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Delete a set of files or folders on the host. Should throw an exception
|
||||
|
@ -433,12 +426,10 @@ public interface IFileService extends IService
|
|||
* @param remoteParents the array of folders containing the files to delete
|
||||
* @param fileNames the names of the files or folders to delete
|
||||
* @param monitor the progress monitor
|
||||
* @return <code>true</code> if all delete operations are successful,
|
||||
* <code>false</code> otherwise.
|
||||
* @throws SystemMessageException if an error occurs. Typically this would
|
||||
* be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean deleteBatch(String[] remoteParents, String[] fileNames, IProgressMonitor monitor) throws SystemMessageException;
|
||||
public void deleteBatch(String[] remoteParents, String[] fileNames, IProgressMonitor monitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Rename a file or folder on the host.
|
||||
|
@ -447,11 +438,10 @@ public interface IFileService extends IService
|
|||
* @param oldName the old name of the file or folder to rename
|
||||
* @param newName the new name for the file
|
||||
* @param monitor the progress monitor
|
||||
* @return true if successful
|
||||
* @throws SystemMessageException if an error occurs. Typically this would
|
||||
* be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean rename(String remoteParent, String oldName, String newName, IProgressMonitor monitor) throws SystemMessageException;
|
||||
public void rename(String remoteParent, String oldName, String newName, IProgressMonitor monitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Rename a file or folder on the host.
|
||||
|
@ -461,11 +451,10 @@ public interface IFileService extends IService
|
|||
* @param newName the new name for the file
|
||||
* @param oldFile the file to update with the change
|
||||
* @param monitor the progress monitor
|
||||
* @return true if successful
|
||||
* @throws SystemMessageException if an error occurs. Typically this would
|
||||
* be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean rename(String remoteParent, String oldName, String newName, IHostFile oldFile, IProgressMonitor monitor) throws SystemMessageException;
|
||||
public void rename(String remoteParent, String oldName, String newName, IHostFile oldFile, IProgressMonitor monitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Move the file or folder specified to a different remote path.
|
||||
|
@ -475,11 +464,10 @@ public interface IFileService extends IService
|
|||
* @param tgtParent the destination folder for the move
|
||||
* @param tgtName the name of the moved file or folder
|
||||
* @param monitor the progress monitor
|
||||
* @return true if the file was moved
|
||||
* @throws SystemMessageException if an error occurs. Typically this would
|
||||
* be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean move(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException;
|
||||
public void move(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Copy the file or folder to the specified destination.
|
||||
|
@ -489,11 +477,10 @@ public interface IFileService extends IService
|
|||
* @param tgtParent the destination folder for the copy
|
||||
* @param tgtName the name of the copied file or folder
|
||||
* @param monitor the progress monitor
|
||||
* @return true if the file was copied successfully
|
||||
* @throws SystemMessageException if an error occurs. Typically this would
|
||||
* be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean copy(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException;
|
||||
public void copy(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Copy a set of files or folders to the specified destination.
|
||||
|
@ -506,12 +493,10 @@ public interface IFileService extends IService
|
|||
* @param srcNames the names of the files or folders to copy
|
||||
* @param tgtParent the destination folder for the copy
|
||||
* @param monitor the progress monitor
|
||||
* @return <code>true</code> if all files were copied, <code>false</code>
|
||||
* or exception otherwise.
|
||||
* @throws SystemMessageException if an error occurs. Typically this would
|
||||
* be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean copyBatch(String[] srcParents, String[] srcNames, String tgtParent, IProgressMonitor monitor) throws SystemMessageException;
|
||||
public void copyBatch(String[] srcParents, String[] srcNames, String tgtParent, IProgressMonitor monitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Indicates whether the file system is case sensitive.
|
||||
|
@ -536,11 +521,9 @@ public interface IFileService extends IService
|
|||
* @param timestamp the new timestamp in milliseconds from January 1, 1970,
|
||||
* 00:00:00 UTC.
|
||||
* @param monitor the progress monitor
|
||||
* @return true if the file timestamp was changed successfully
|
||||
*
|
||||
* @see IHostFile#getModifiedDate()
|
||||
*/
|
||||
public boolean setLastModified(String parent, String name, long timestamp, IProgressMonitor monitor) throws SystemMessageException;
|
||||
public void setLastModified(String parent, String name, long timestamp, IProgressMonitor monitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Set the read-only permission of the specified file or folder.
|
||||
|
@ -550,10 +533,8 @@ public interface IFileService extends IService
|
|||
* @param readOnly indicates whether to make the file read-only or
|
||||
* read-write
|
||||
* @param monitor the progress monitor
|
||||
* @return true if the read-only permission was changed successfully, or the
|
||||
* permission already was as desired
|
||||
*/
|
||||
public boolean setReadOnly(String parent, String name, boolean readOnly, IProgressMonitor monitor) throws SystemMessageException;
|
||||
public void setReadOnly(String parent, String name, boolean readOnly, IProgressMonitor monitor) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Gets the remote encoding.
|
||||
|
|
|
@ -407,7 +407,10 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
|
|||
parentPaths[i] = parents[i].getAbsolutePath();
|
||||
}
|
||||
|
||||
IHostFile[] results = getFileService().listMultiple(parentPaths, fileNameFilters, fileTypes, monitor);
|
||||
List hostFiles = new ArrayList(10);
|
||||
getFileService().listMultiple(parentPaths, fileNameFilters, fileTypes, hostFiles, monitor);
|
||||
IHostFile[] results = new IHostFile[hostFiles.size()];
|
||||
hostFiles.toArray(results);
|
||||
RemoteFileContext context = getDefaultContext();
|
||||
|
||||
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, results);
|
||||
|
@ -457,7 +460,10 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
|
|||
parentPaths[i] = parents[i].getAbsolutePath();
|
||||
}
|
||||
|
||||
IHostFile[] results = getFileService().listMultiple(parentPaths, fileNameFilters, fileType, monitor);
|
||||
List hostFiles = new ArrayList(10);
|
||||
getFileService().listMultiple(parentPaths, fileNameFilters, fileType, hostFiles, monitor);
|
||||
IHostFile[] results = new IHostFile[hostFiles.size()];
|
||||
hostFiles.toArray(results);
|
||||
RemoteFileContext context = getDefaultContext();
|
||||
|
||||
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, results);
|
||||
|
@ -789,7 +795,8 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
|
|||
public boolean copy(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
IFileService service = getFileService();
|
||||
return service.copy(sourceFolderOrFile.getParentPath(), sourceFolderOrFile.getName(), targetFolder.getAbsolutePath(), newName, monitor);
|
||||
service.copy(sourceFolderOrFile.getParentPath(), sourceFolderOrFile.getName(), targetFolder.getAbsolutePath(), newName, monitor);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean copyBatch(IRemoteFile[] sourceFolderOrFiles, IRemoteFile targetFolder, IProgressMonitor monitor) throws SystemMessageException
|
||||
|
@ -803,7 +810,8 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
|
|||
sourceParents[i] = sourceFolderOrFiles[i].getParentPath();
|
||||
sourceNames[i] = sourceFolderOrFiles[i].getName();
|
||||
}
|
||||
return service.copyBatch(sourceParents, sourceNames, targetFolder.getAbsolutePath(), monitor);
|
||||
service.copyBatch(sourceParents, sourceNames, targetFolder.getAbsolutePath(), monitor);
|
||||
return true;
|
||||
}
|
||||
|
||||
public IRemoteFile getParentFolder(IRemoteFile folderOrFile, IProgressMonitor monitor)
|
||||
|
@ -846,9 +854,9 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
|
|||
IFileService service = getFileService();
|
||||
String parent = folderOrFile.getParentPath();
|
||||
String name = folderOrFile.getName();
|
||||
boolean result = service.delete(parent, name, monitor);
|
||||
service.delete(parent, name, monitor);
|
||||
folderOrFile.markStale(true);
|
||||
return result;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean deleteBatch(IRemoteFile[] folderOrFiles, IProgressMonitor monitor) throws SystemMessageException
|
||||
|
@ -865,7 +873,8 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
|
|||
removeCachedRemoteFile(folderOrFiles[i]);
|
||||
}
|
||||
IFileService service = getFileService();
|
||||
return service.deleteBatch(parents, names, monitor);
|
||||
service.deleteBatch(parents, names, monitor);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean rename(IRemoteFile folderOrFile, String newName, IProgressMonitor monitor) throws SystemMessageException
|
||||
|
@ -875,9 +884,9 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
|
|||
String srcParent = folderOrFile.getParentPath();
|
||||
String oldName = folderOrFile.getName();
|
||||
String newPath = srcParent + folderOrFile.getSeparator() + newName;
|
||||
boolean result = service.rename(srcParent, oldName, newName, monitor);
|
||||
service.rename(srcParent, oldName, newName, monitor);
|
||||
folderOrFile.getHostFile().renameTo(newPath);
|
||||
return result;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean move(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName, IProgressMonitor monitor) throws SystemMessageException
|
||||
|
@ -887,24 +896,26 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
|
|||
String srcName = sourceFolderOrFile.getName();
|
||||
String tgtParent = targetFolder.getAbsolutePath();
|
||||
removeCachedRemoteFile(sourceFolderOrFile);
|
||||
boolean result = service.move(srcParent, srcName, tgtParent, newName, monitor);
|
||||
service.move(srcParent, srcName, tgtParent, newName, monitor);
|
||||
sourceFolderOrFile.markStale(true);
|
||||
targetFolder.markStale(true);
|
||||
return result;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean setLastModified(IRemoteFile folderOrFile, long newDate, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
String name = folderOrFile.getName();
|
||||
String parent = folderOrFile.getParentPath();
|
||||
return _hostFileService.setLastModified(parent, name, newDate, monitor);
|
||||
_hostFileService.setLastModified(parent, name, newDate, monitor);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean setReadOnly(IRemoteFile folderOrFile, boolean readOnly, IProgressMonitor monitor) throws SystemMessageException
|
||||
{
|
||||
String name = folderOrFile.getName();
|
||||
String parent = folderOrFile.getParentPath();
|
||||
return _hostFileService.setReadOnly(parent, name, readOnly, monitor);
|
||||
_hostFileService.setReadOnly(parent, name, readOnly, monitor);
|
||||
return true;
|
||||
}
|
||||
|
||||
public ILanguageUtilityFactory getLanguageUtilityFactory()
|
||||
|
|
Loading…
Add table
Reference in a new issue