1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 15:15:25 +02:00

[149150] new setLastModified() service call and use in file transfer operations

This commit is contained in:
David McKnight 2007-01-09 19:58:49 +00:00
parent 119d7c5588
commit ced81d390f
10 changed files with 170 additions and 114 deletions

View file

@ -1030,6 +1030,10 @@ public class UniversalFileTransferUtility
String srcFileLocation = srcFileOrFolder.getLocation().toOSString(); String srcFileLocation = srcFileOrFolder.getLocation().toOSString();
targetFS.upload(srcFileLocation, srcCharSet, newPath, targetFS.getRemoteEncoding(),monitor); targetFS.upload(srcFileLocation, srcCharSet, newPath, targetFS.getRemoteEncoding(),monitor);
newFilePathList.add(newPath); newFilePathList.add(newPath);
// should check preference first
SystemIFileProperties properties = new SystemIFileProperties(srcFileOrFolder);
((FileServiceSubSystem)targetFS).getFileService().setLastModified(monitor, newPathBuf.toString(), name, properties.getRemoteFileTimeStamp());
} }
catch (RemoteFileIOException e) catch (RemoteFileIOException e)
@ -1220,9 +1224,14 @@ public class UniversalFileTransferUtility
} }
targetFS.upload(srcFileLocation, srcCharSet, newPath, targetFS.getRemoteEncoding(), monitor); targetFS.upload(srcFileLocation, srcCharSet, newPath, targetFS.getRemoteEncoding(), monitor);
IRemoteFile copiedFile = targetFS.getRemoteFileObject(targetFolder, name); IRemoteFile copiedFile = targetFS.getRemoteFileObject(targetFolder, name);
// should check preference first
SystemIFileProperties properties = new SystemIFileProperties(srcFileOrFolder);
targetFS.setLastModified(monitor, copiedFile, properties.getRemoteFileTimeStamp());
return copiedFile; return copiedFile;
} }
@ -1416,7 +1425,7 @@ public class UniversalFileTransferUtility
if (source instanceof IFile) if (source instanceof IFile)
{ {
SystemIFileProperties properties = new SystemIFileProperties(source); SystemIFileProperties properties = new SystemIFileProperties(source);
target.getParentRemoteFileSubSystem().setLastModified(target, properties.getRemoteFileTimeStamp()); target.getParentRemoteFileSubSystem().setLastModified(monitor, target, properties.getRemoteFileTimeStamp());
} }
else if (source instanceof IContainer) else if (source instanceof IContainer)
{ {

View file

@ -62,6 +62,21 @@ public interface IUniversalDataStoreConstants extends IServiceConstants
public static final String C_COPY = "C_COPY"; //$NON-NLS-1$ public static final String C_COPY = "C_COPY"; //$NON-NLS-1$
public static final String C_COPY_BATCH = "C_COPY_BATCH"; //$NON-NLS-1$ public static final String C_COPY_BATCH = "C_COPY_BATCH"; //$NON-NLS-1$
public static final String C_SEARCH = "C_SEARCH"; //$NON-NLS-1$
public static final String C_CANCEL = "C_CANCEL"; //$NON-NLS-1$
public static final String C_SET_READONLY = "C_SET_READONLY";//$NON-NLS-1$
public static final String C_SET_LASTMODIFIED = "C_SET_LASTMODIFIED";//$NON-NLS-1$
public static final String C_QUERY_BASIC_PROPERTY = "C_QUERY_BASIC_PROPERTY";//$NON-NLS-1$
public static final String C_QUERY_CAN_WRITE_PROPERTY = "C_QUERY_CAN_WRITE_PROPERTY";//$NON-NLS-1$
public static final String C_QUERY_ADVANCE_PROPERTY = "C_QUERY_ADVANCE_PROPERTY";//$NON-NLS-1$
public static final String C_QUERY_FILE_CLASSIFICATION = "C_QUERY_FILE_CLASSIFICATION";//$NON-NLS-1$
public static final String C_QUERY_FILE_CLASSIFICATIONS = "C_QUERY_FILE_CLASSIFICATIONS"; //$NON-NLS-1$
public static final String C_QUERY_EXISTS = "C_QUERY_EXISTS";//$NON-NLS-1$
public static final String C_GET_OSTYPE = "C_GET_OSTYPE";//$NON-NLS-1$
public static final String C_QUERY_CLASSNAME = "C_QUERY_CLASSNAME"; //$NON-NLS-1$
public static final String C_CREATE_TEMP = "C_CREATE_TEMP"; //$NON-NLS-1$
// Download file command // Download file command
public static final String C_DOWNLOAD_FILE = "C_DOWNLOAD_FILE"; //$NON-NLS-1$ public static final String C_DOWNLOAD_FILE = "C_DOWNLOAD_FILE"; //$NON-NLS-1$

View file

@ -109,8 +109,6 @@ public class UniversalFileSystemMiner extends Miner implements
String name = getCommandName(theElement); String name = getCommandName(theElement);
DataElement status = getCommandStatus(theElement); DataElement status = getCommandStatus(theElement);
DataElement subject = getCommandArgument(theElement, 0); DataElement subject = getCommandArgument(theElement, 0);
@ -120,7 +118,7 @@ public class UniversalFileSystemMiner extends Miner implements
boolean caseSensitive = !_isWindows; boolean caseSensitive = !_isWindows;
// TODO: test on WINDOWS! // TODO: test on WINDOWS!
if ("C_QUERY_VIEW_ALL".equals(name)) { //$NON-NLS-1$ if (C_QUERY_VIEW_ALL.equals(name)) {
DataElement attributes = getCommandArgument(theElement, 1); DataElement attributes = getCommandArgument(theElement, 1);
if (attributes != null && attributes.getType().equals("attributes")) //$NON-NLS-1$ if (attributes != null && attributes.getType().equals("attributes")) //$NON-NLS-1$
{ {
@ -132,7 +130,7 @@ public class UniversalFileSystemMiner extends Miner implements
return handleQueryAll(subject, null, status, queryType, return handleQueryAll(subject, null, status, queryType,
caseSensitive); caseSensitive);
} }
} else if ("C_QUERY_VIEW_FILES".equals(name)) { //$NON-NLS-1$ } else if (C_QUERY_VIEW_FILES.equals(name)) {
DataElement attributes = getCommandArgument(theElement, 1); DataElement attributes = getCommandArgument(theElement, 1);
if (attributes != null && attributes.getType().equals("attributes")) //$NON-NLS-1$ if (attributes != null && attributes.getType().equals("attributes")) //$NON-NLS-1$
{ {
@ -144,7 +142,7 @@ public class UniversalFileSystemMiner extends Miner implements
return handleQueryFiles(subject, null, status, queryType, return handleQueryFiles(subject, null, status, queryType,
caseSensitive); caseSensitive);
} }
} else if ("C_QUERY_VIEW_FOLDERS".equals(name)) { //$NON-NLS-1$ } else if (C_QUERY_VIEW_FOLDERS.equals(name)) {
DataElement attributes = getCommandArgument(theElement, 1); DataElement attributes = getCommandArgument(theElement, 1);
if (attributes != null && attributes.getType().equals("attributes")) //$NON-NLS-1$ if (attributes != null && attributes.getType().equals("attributes")) //$NON-NLS-1$
{ {
@ -156,48 +154,48 @@ public class UniversalFileSystemMiner extends Miner implements
return handleQueryFolders(subject, null, status, queryType, return handleQueryFolders(subject, null, status, queryType,
caseSensitive); caseSensitive);
} }
} else if ("C_QUERY_ROOTS".equals(name)) { //$NON-NLS-1$ } else if (C_QUERY_ROOTS.equals(name)) {
return handleQueryRoots(subject, status); return handleQueryRoots(subject, status);
} else if ("C_SEARCH".equals(name)) { //$NON-NLS-1$ } else if (C_SEARCH.equals(name)) {
return handleSearch(theElement, status, queryType, return handleSearch(theElement, status, queryType,
caseSensitive); caseSensitive);
} else if ("C_CANCEL".equals(name)) { //$NON-NLS-1$ } else if (C_CANCEL.equals(name)) {
subject.getName(); subject.getName();
return handleCancel(subject, status); return handleCancel(subject, status);
} else if ("C_RENAME".equals(name)) { //$NON-NLS-1$ } else if (C_RENAME.equals(name)) {
return handleRename(subject, status); return handleRename(subject, status);
} else if ("C_DELETE".equals(name)) { //$NON-NLS-1$ } else if (C_DELETE.equals(name)) {
return handleDelete(subject, status, true); return handleDelete(subject, status, true);
} else if ("C_DELETE_BATCH".equals(name)) { //$NON-NLS-1$ } else if (C_DELETE_BATCH.equals(name)) {
return handleDeleteBatch(theElement, status); return handleDeleteBatch(theElement, status);
} else if ("C_COPY".equals(name)) { //$NON-NLS-1$ } else if (C_COPY.equals(name)) {
return handleCopy(subject, getCommandArgument(theElement, 1), return handleCopy(subject, getCommandArgument(theElement, 1),
getCommandArgument(theElement, 2), status); getCommandArgument(theElement, 2), status);
} else if ("C_COPY_BATCH".equals(name)) { //$NON-NLS-1$ } else if (C_COPY_BATCH.equals(name)) {
return handleCopyBatch(subject, theElement, status); return handleCopyBatch(subject, theElement, status);
} else if ("C_CREATE_FILE".equals(name)) { //$NON-NLS-1$ } else if (C_CREATE_FILE.equals(name)) {
return handleCreateFile(subject, status, queryType); return handleCreateFile(subject, status, queryType);
} else if ("C_CREATE_FOLDER".equals(name)) { //$NON-NLS-1$ } else if (C_CREATE_FOLDER.equals(name)) {
return handleCreateFolder(subject, status, queryType); return handleCreateFolder(subject, status, queryType);
} else if ("C_SET_READONLY".equals(name)) { //$NON-NLS-1$ } else if (C_SET_READONLY.equals(name)) {
return handleSetReadOnly(subject, status); return handleSetReadOnly(subject, status);
} else if ("C_SET_LASTMODIFIED".equals(name)) { //$NON-NLS-1$ } else if (C_SET_LASTMODIFIED.equals(name)) {
return handleSetLastModified(subject, status); return handleSetLastModified(subject, status);
} else if ("C_QUERY_BASIC_PROPERTY".equals(name)) { //$NON-NLS-1$ } else if (C_QUERY_BASIC_PROPERTY.equals(name)) {
return handleQueryBasicProperty(subject, status); return handleQueryBasicProperty(subject, status);
} else if ("C_QUERY_CAN_WRITE_PROPERTY".equals(name)) { //$NON-NLS-1$ } else if (C_QUERY_CAN_WRITE_PROPERTY.equals(name)) {
return handleQuerycanWriteProperty(subject, status); return handleQuerycanWriteProperty(subject, status);
} else if ("C_QUERY_ADVANCE_PROPERTY".equals(name)) { //$NON-NLS-1$ } else if (C_QUERY_ADVANCE_PROPERTY.equals(name)) {
return handleQueryAdvanceProperty(subject, status); return handleQueryAdvanceProperty(subject, status);
} else if ("C_QUERY_FILE_CLASSIFICATIONS".equals(name)) { //$NON-NLS-1$ } else if (C_QUERY_FILE_CLASSIFICATIONS.equals(name)) {
return handleQueryFileClassification(subject, status); return handleQueryFileClassification(subject, status);
} else if ("C_QUERY_FILE_CLASSIFICATION".equals(name)) { //$NON-NLS-1$ } else if (C_QUERY_FILE_CLASSIFICATION.equals(name)) {
return handleQueryFileClassification(subject, status); return handleQueryFileClassification(subject, status);
} else if ("C_QUERY_EXISTS".equals(name)) { //$NON-NLS-1$ } else if (C_QUERY_EXISTS.equals(name)) {
return handleQueryExists(subject, status, queryType); return handleQueryExists(subject, status, queryType);
} else if ("C_QUERY_GET_REMOTE_OBJECT".equals(name)) { //$NON-NLS-1$ } else if (C_QUERY_GET_REMOTE_OBJECT.equals(name)) {
return handleQueryGetRemoteObject(subject, status, queryType); return handleQueryGetRemoteObject(subject, status, queryType);
} else if ("C_GET_OSTYPE".equals(name)) { //$NON-NLS-1$ } else if (C_GET_OSTYPE.equals(name)) {
return handleGetOSType(subject, status); return handleGetOSType(subject, status);
} else if (C_DOWNLOAD_FILE.equals(name)) { } else if (C_DOWNLOAD_FILE.equals(name)) {
return handleDownload(theElement, status); return handleDownload(theElement, status);
@ -205,7 +203,7 @@ public class UniversalFileSystemMiner extends Miner implements
return handleQueryEncoding(subject, status); return handleQueryEncoding(subject, status);
} else if (C_QUERY_UNUSED_PORT.equals(name)) { } else if (C_QUERY_UNUSED_PORT.equals(name)) {
return handleQueryUnusedPort(subject, status); return handleQueryUnusedPort(subject, status);
} else if ("C_QUERY_CLASSNAME".equals(name)) { //$NON-NLS-1$ } else if (C_QUERY_CLASSNAME.equals(name)) {
return handleQueryClassName(subject, status); return handleQueryClassName(subject, status);
} else if (C_QUERY_QUALIFIED_CLASSNAME.equals(name)) { } else if (C_QUERY_QUALIFIED_CLASSNAME.equals(name)) {
return handleQueryQualifiedClassName(subject, status); return handleQueryQualifiedClassName(subject, status);
@ -1286,8 +1284,8 @@ private DataElement createDataElementFromLSString(DataElement subject,
* Method to set LastModified to a file or folder. * Method to set LastModified to a file or folder.
*/ */
public DataElement handleSetLastModified(DataElement subject, public DataElement handleSetLastModified(DataElement subject,
DataElement status) { DataElement status)
{
File filename = new File(subject.getAttribute(DE.A_VALUE)); File filename = new File(subject.getAttribute(DE.A_VALUE));
if (!filename.exists()) if (!filename.exists())
status.setAttribute(DE.A_SOURCE, FAILED_WITH_DOES_NOT_EXIST); status.setAttribute(DE.A_SOURCE, FAILED_WITH_DOES_NOT_EXIST);
@ -2525,32 +2523,23 @@ private DataElement createDataElementFromLSString(DataElement subject,
_dataStore.refresh(schemaRoot); _dataStore.refresh(schemaRoot);
// Define command descriptors // Define command descriptors
createCommandDescriptor(UniversalFilter, "Filter", "C_QUERY_VIEW_ALL"); //$NON-NLS-1$ //$NON-NLS-2$ createCommandDescriptor(UniversalFilter, "Filter", C_QUERY_VIEW_ALL); //$NON-NLS-1$
createCommandDescriptor(UniversalFilter, "Filter", "C_QUERY_VIEW_FILES"); //$NON-NLS-1$ //$NON-NLS-2$ createCommandDescriptor(UniversalFilter, "Filter", C_QUERY_VIEW_FILES); //$NON-NLS-1$
createCommandDescriptor(UniversalFilter, "Filter", //$NON-NLS-1$ createCommandDescriptor(UniversalFilter, "Filter", C_QUERY_VIEW_FOLDERS); //$NON-NLS-1$
"C_QUERY_VIEW_FOLDERS"); //$NON-NLS-1$ createCommandDescriptor(UniversalFilter, "Filter", C_QUERY_ROOTS); //$NON-NLS-1$
createCommandDescriptor(UniversalFilter, "Filter", "C_QUERY_ROOTS"); //$NON-NLS-1$ //$NON-NLS-2$
createCommandDescriptor(UniversalFilter, "GetOSType", "C_GET_OSTYPE"); //$NON-NLS-1$ //$NON-NLS-2$ createCommandDescriptor(UniversalFilter, "GetOSType", C_GET_OSTYPE); //$NON-NLS-1$
createCommandDescriptor(UniversalFilter, "Exists", "C_QUERY_EXISTS"); //$NON-NLS-1$ //$NON-NLS-2$ createCommandDescriptor(UniversalFilter, "Exists", C_QUERY_EXISTS); //$NON-NLS-1$
createCommandDescriptor(UniversalFilter, "GetRemoteObject", //$NON-NLS-1$ createCommandDescriptor(UniversalFilter, "GetRemoteObject", C_QUERY_GET_REMOTE_OBJECT); //$NON-NLS-1$
"C_QUERY_GET_REMOTE_OBJECT"); //$NON-NLS-1$ createCommandDescriptor(UniversalFilter, "CreateNewFile", C_CREATE_FILE); //$NON-NLS-1$
createCommandDescriptor(UniversalFilter, "CreateNewFile", //$NON-NLS-1$ createCommandDescriptor(UniversalFilter, "CreateNewFolder", C_CREATE_FOLDER); //$NON-NLS-1$
"C_CREATE_FILE"); //$NON-NLS-1$ createCommandDescriptor(UniversalFilter, "SetLastModified", C_SET_LASTMODIFIED); //$NON-NLS-1$
createCommandDescriptor(UniversalFilter, "CreateNewFolder", //$NON-NLS-1$ createCommandDescriptor(deUniversalFolderObject, "Filter", C_QUERY_VIEW_ALL); //$NON-NLS-1$
"C_CREATE_FOLDER"); //$NON-NLS-1$ createCommandDescriptor(deUniversalFolderObject, "Filter", C_QUERY_VIEW_FILES); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "Filter", //$NON-NLS-1$ createCommandDescriptor(deUniversalFolderObject, "Filter", C_QUERY_VIEW_FOLDERS); //$NON-NLS-1$
"C_QUERY_VIEW_ALL"); //$NON-NLS-1$ createCommandDescriptor(deUniversalArchiveFileObject, "Filter", C_QUERY_VIEW_ALL); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "Filter", //$NON-NLS-1$ createCommandDescriptor(deUniversalArchiveFileObject, "Filter", C_QUERY_VIEW_FILES); //$NON-NLS-1$
"C_QUERY_VIEW_FILES"); //$NON-NLS-1$ createCommandDescriptor(deUniversalArchiveFileObject, "Filter", C_QUERY_VIEW_FOLDERS); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "Filter", //$NON-NLS-1$
"C_QUERY_VIEW_FOLDERS"); //$NON-NLS-1$
createCommandDescriptor(deUniversalArchiveFileObject, "Filter", //$NON-NLS-1$
"C_QUERY_VIEW_ALL"); //$NON-NLS-1$
createCommandDescriptor(deUniversalArchiveFileObject, "Filter", //$NON-NLS-1$
"C_QUERY_VIEW_FILES"); //$NON-NLS-1$
createCommandDescriptor(deUniversalArchiveFileObject, "Filter", //$NON-NLS-1$
"C_QUERY_VIEW_FOLDERS"); //$NON-NLS-1$
_dataStore.createReference(deUniversalFileObject, _dataStore.createReference(deUniversalFileObject,
deUniversalArchiveFileObject, "abstracts", "abstracted by"); //$NON-NLS-1$ //$NON-NLS-2$ deUniversalArchiveFileObject, "abstracts", "abstracted by"); //$NON-NLS-1$ //$NON-NLS-2$
@ -2562,66 +2551,45 @@ private DataElement createDataElementFromLSString(DataElement subject,
deUniversalVirtualFolderObject, "abstracts", "abstracted by"); //$NON-NLS-1$ //$NON-NLS-2$ deUniversalVirtualFolderObject, "abstracts", "abstracted by"); //$NON-NLS-1$ //$NON-NLS-2$
// create the search descriptor and make it cacnellable // create the search descriptor and make it cacnellable
DataElement searchDescriptor = createCommandDescriptor( DataElement searchDescriptor = createCommandDescriptor(deUniversalFolderObject, "Search", C_SEARCH); //$NON-NLS-1$
deUniversalFolderObject, "Search", "C_SEARCH"); //$NON-NLS-1$ //$NON-NLS-2$
DataElement cancellable = _dataStore.find(schemaRoot, DE.A_NAME, DataElement cancellable = _dataStore.find(schemaRoot, DE.A_NAME,
DataStoreResources.model_Cancellable, 1); DataStoreResources.model_Cancellable, 1);
_dataStore.createReference(cancellable, searchDescriptor, "abstracts", //$NON-NLS-1$ _dataStore.createReference(cancellable, searchDescriptor, "abstracts", //$NON-NLS-1$
"abstracted by"); //$NON-NLS-1$ "abstracted by"); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "GetAdvanceProperty", //$NON-NLS-1$ createCommandDescriptor(deUniversalFolderObject, "GetAdvanceProperty", C_QUERY_ADVANCE_PROPERTY); //$NON-NLS-1$
"C_QUERY_ADVANCE_PROPERTY"); //$NON-NLS-1$ createCommandDescriptor(tempnode, "Filter", C_CREATE_TEMP); //$NON-NLS-1$
createCommandDescriptor(tempnode, "Filter", "C_CREATE_TEMP"); //$NON-NLS-1$ //$NON-NLS-2$ createCommandDescriptor(deUniversalFileObject, "Delete", C_DELETE); //$NON-NLS-1$
createCommandDescriptor(deUniversalFileObject, "Delete", "C_DELETE"); //$NON-NLS-1$ //$NON-NLS-2$ createCommandDescriptor(deUniversalFileObject, "DeleteBatch", C_DELETE_BATCH); //$NON-NLS-1$
createCommandDescriptor(deUniversalFileObject, "DeleteBatch", "C_DELETE_BATCH"); //$NON-NLS-1$ //$NON-NLS-2$ createCommandDescriptor(deUniversalFileObject, "CreateNewFile", C_CREATE_FILE); //$NON-NLS-1$
createCommandDescriptor(deUniversalFileObject, "CreateNewFile", //$NON-NLS-1$ createCommandDescriptor(deUniversalFileObject, "CreateNewFolder", C_CREATE_FOLDER); //$NON-NLS-1$
"C_CREATE_FILE"); //$NON-NLS-1$ createCommandDescriptor(deUniversalFileObject, "Rename", C_RENAME); //$NON-NLS-1$
createCommandDescriptor(deUniversalFileObject, "CreateNewFolder", //$NON-NLS-1$ createCommandDescriptor(deUniversalFileObject, "SetReadOnly", C_SET_READONLY); //$NON-NLS-1$
"C_CREATE_FOLDER"); //$NON-NLS-1$ createCommandDescriptor(deUniversalFileObject, "SetLastModified", C_SET_LASTMODIFIED); //$NON-NLS-1$
createCommandDescriptor(deUniversalFileObject, "Rename", "C_RENAME"); //$NON-NLS-1$ //$NON-NLS-2$ createCommandDescriptor(deUniversalFileObject, "GetAdvanceProperty", C_QUERY_ADVANCE_PROPERTY); //$NON-NLS-1$
createCommandDescriptor(deUniversalFileObject, "SetReadOnly", //$NON-NLS-1$ createCommandDescriptor(deUniversalFileObject, "GetBasicProperty", C_QUERY_BASIC_PROPERTY); //$NON-NLS-1$
"C_SET_READONLY"); //$NON-NLS-1$
createCommandDescriptor(deUniversalFileObject, "SetLastModified", //$NON-NLS-1$
"C_SET_LASTMODIFIED"); //$NON-NLS-1$
createCommandDescriptor(deUniversalFileObject, "GetAdvanceProperty", //$NON-NLS-1$
"C_QUERY_ADVANCE_PROPERTY"); //$NON-NLS-1$
// dePropertyQuery = createCommandDescriptor(deUniversalFileObject, "GetBasicProperty", "C_QUERY_BASIC_PROPERTY");
createCommandDescriptor(deUniversalFileObject, "GetBasicProperty", "C_QUERY_BASIC_PROPERTY"); //$NON-NLS-1$ //$NON-NLS-2$
createCommandDescriptor(deUniversalFileObject, "GetcanWriteProperty", //$NON-NLS-1$ createCommandDescriptor(deUniversalFileObject, "GetcanWriteProperty", C_QUERY_CAN_WRITE_PROPERTY); //$NON-NLS-1$
"C_QUERY_CAN_WRITE_PROPERTY"); //$NON-NLS-1$ createCommandDescriptor(deUniversalFileObject, "Exists", C_QUERY_EXISTS); //$NON-NLS-1$
createCommandDescriptor(deUniversalFileObject, "Exists", "C_QUERY_EXISTS"); //$NON-NLS-1$ //$NON-NLS-2$
createCommandDescriptor(deUniversalFolderObject, "Delete", "C_DELETE"); //$NON-NLS-1$ //$NON-NLS-2$ createCommandDescriptor(deUniversalFolderObject, "Delete", C_DELETE); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "DeleteBatch", "C_DELETE_BATCH"); //$NON-NLS-1$ //$NON-NLS-2$ createCommandDescriptor(deUniversalFolderObject, "DeleteBatch", C_DELETE_BATCH); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "Rename", "C_RENAME"); //$NON-NLS-1$ //$NON-NLS-2$ createCommandDescriptor(deUniversalFolderObject, "Rename", C_RENAME); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "Copy", "C_COPY"); //$NON-NLS-1$ //$NON-NLS-2$ createCommandDescriptor(deUniversalFolderObject, "Copy", C_COPY); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "CopyBatch", "C_COPY_BATCH"); //$NON-NLS-1$ //$NON-NLS-2$ createCommandDescriptor(deUniversalFolderObject, "CopyBatch", C_COPY_BATCH); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "CreateNewFolder", //$NON-NLS-1$ createCommandDescriptor(deUniversalFolderObject, "CreateNewFolder", C_CREATE_FOLDER); //$NON-NLS-1$
"C_CREATE_FOLDER"); //$NON-NLS-1$ createCommandDescriptor(deUniversalFolderObject, "SetReadOnly", C_SET_READONLY); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "SetReadOnly", //$NON-NLS-1$ createCommandDescriptor(deUniversalFolderObject, "SetLastModified", C_SET_LASTMODIFIED); //$NON-NLS-1$
"C_SET_READONLY"); //$NON-NLS-1$ createCommandDescriptor(deUniversalFolderObject, "GetBasicProperty", C_QUERY_BASIC_PROPERTY); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "SetLastModified", //$NON-NLS-1$ createCommandDescriptor(deUniversalFolderObject, "GetcanWriteProperty", C_QUERY_CAN_WRITE_PROPERTY); //$NON-NLS-1$
"C_SET_LASTMODIFIED"); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "GetBasicProperty", //$NON-NLS-1$
"C_QUERY_BASIC_PROPERTY"); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "GetcanWriteProperty", //$NON-NLS-1$
"C_QUERY_CAN_WRITE_PROPERTY"); //$NON-NLS-1$
// deFileClassificationQuery = createCommandDescriptor(deUniversalFileObject, "GetFileClassifications", "C_QUERY_FILE_CLASSIFICATIONS"); createCommandDescriptor(deUniversalFileObject, "GetFileClassifications", C_QUERY_FILE_CLASSIFICATIONS); //$NON-NLS-1$
createCommandDescriptor(deUniversalFileObject, "GetFileClassifications", "C_QUERY_FILE_CLASSIFICATIONS"); //$NON-NLS-1$ //$NON-NLS-2$ createCommandDescriptor(deUniversalFolderObject, "GetFolderClassifications", C_QUERY_FILE_CLASSIFICATION); //$NON-NLS-1$
// deFolderClassificationQuery = createCommandDescriptor(deUniversalFolderObject, "GetFolderClassifications", "C_QUERY_FILE_CLASSIFICATION"); createCommandDescriptor(deUniversalFolderObject, "Exists", C_QUERY_EXISTS); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "GetFolderClassifications", "C_QUERY_FILE_CLASSIFICATION"); //$NON-NLS-1$ //$NON-NLS-2$ createCommandDescriptor(deUniversalFolderObject, "CreateNewFile", C_CREATE_FILE); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "Exists", //$NON-NLS-1$ createCommandDescriptor(deUniversalFolderObject, "CreateNewFolder", C_CREATE_FOLDER); //$NON-NLS-1$
"C_QUERY_EXISTS"); //$NON-NLS-1$ createCommandDescriptor(deUniversalFolderObject, "GetOSType", C_GET_OSTYPE); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "CreateNewFile", //$NON-NLS-1$ createCommandDescriptor(deUniversalFileObject, "GetOSType", C_GET_OSTYPE); //$NON-NLS-1$
"C_CREATE_FILE"); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "CreateNewFolder", //$NON-NLS-1$
"C_CREATE_FOLDER"); //$NON-NLS-1$
createCommandDescriptor(deUniversalFolderObject, "GetOSType", //$NON-NLS-1$
"C_GET_OSTYPE"); //$NON-NLS-1$
createCommandDescriptor(deUniversalFileObject, "GetOSType", //$NON-NLS-1$
"C_GET_OSTYPE"); //$NON-NLS-1$
// create a download command descriptor and make it cancellable // create a download command descriptor and make it cancellable
DataElement downloadDescriptor = createCommandDescriptor( DataElement downloadDescriptor = createCommandDescriptor(
@ -2643,8 +2611,7 @@ private DataElement createDataElementFromLSString(DataElement subject,
createCommandDescriptor(tempnode, "UnusedPort", C_QUERY_UNUSED_PORT); //$NON-NLS-1$ createCommandDescriptor(tempnode, "UnusedPort", C_QUERY_UNUSED_PORT); //$NON-NLS-1$
// command descriptor to retrieve package name for a class file // command descriptor to retrieve package name for a class file
createCommandDescriptor(deUniversalFileObject, "GetQualifiedClassName", //$NON-NLS-1$ createCommandDescriptor(deUniversalFileObject, "GetQualifiedClassName", C_QUERY_CLASSNAME); //$NON-NLS-1$
"C_QUERY_CLASSNAME"); //$NON-NLS-1$
// command descriptor to retrieve qualified class name for class file // command descriptor to retrieve qualified class name for class file
createCommandDescriptor(deUniversalFileObject, "GetFullClassName", //$NON-NLS-1$ createCommandDescriptor(deUniversalFileObject, "GetFullClassName", //$NON-NLS-1$

View file

@ -1227,6 +1227,28 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
return true; return true;
} }
public boolean setLastModified(IProgressMonitor monitor, String parent,
String name, long timestamp) throws SystemMessageException
{
String remotePath = parent + getSeparator(parent) + name;
DataElement de = getElementFor(remotePath);
DataStore ds = de.getDataStore();
DataElement setCmd = getCommandDescriptor(de, C_SET_LASTMODIFIED);
if (setCmd != null)
{
// 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;
}
return false;
}
} }

View file

@ -980,4 +980,13 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
} }
public boolean setLastModified(IProgressMonitor monitor, String parent,
String name, long timestamp) throws SystemMessageException
{
// TODO - implement this to set the timestamp
return false;
}
} }

View file

@ -1310,5 +1310,11 @@ public class LocalFileService extends AbstractFileService implements IFileServic
return ok; return ok;
} }
public boolean setLastModified(IProgressMonitor monitor, String parent, String name, long timestamp)
{
File file = new File(parent, name);
return file.setLastModified(timestamp);
}
} }

View file

@ -752,4 +752,11 @@ public class SftpFileService extends AbstractFileService implements IFileService
return true; return true;
} }
public boolean setLastModified(IProgressMonitor monitor, String parent,
String name, long timestamp) throws SystemMessageException
{
// TODO implement this to set the timestamp on the specified file
return false;
}
} }

View file

@ -264,4 +264,14 @@ public interface IFileService extends IService
* @return true if the file system has case sensitive file names * @return true if the file system has case sensitive file names
*/ */
public boolean isCaseSensitive(); public boolean isCaseSensitive();
/**
* Sets the last modified stamp of the file or folder with the specified timestamp
* @param monitor the progress monitor
* @param parent the parent path of the file to set
* @param name the name of the file to set
* @param timestamp the new timestamp
* @return true if the file timestamp was changed successfully
*/
public boolean setLastModified(IProgressMonitor monitor, String parent, String name, long timestamp) throws SystemMessageException;
} }

View file

@ -762,11 +762,21 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
} }
public boolean setLastModified(IRemoteFile folderOrFile, long newDate) throws RemoteFileSecurityException, RemoteFileIOException public boolean setLastModified(IProgressMonitor monitor, IRemoteFile folderOrFile, long newDate) throws RemoteFileSecurityException, RemoteFileIOException
{ {
// TODO Auto-generated method stub String name = folderOrFile.getName();
String parent = folderOrFile.getParentPath();
try
{
return _hostFileService.setLastModified(monitor, parent, name, newDate);
}
catch (SystemMessageException e)
{
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
dlg.open();
return false; return false;
} }
}
public boolean setReadOnly(IRemoteFile folderOrFile) throws RemoteFileSecurityException, RemoteFileIOException public boolean setReadOnly(IRemoteFile folderOrFile) throws RemoteFileSecurityException, RemoteFileIOException
{ {

View file

@ -346,11 +346,12 @@ public interface IRemoteFileSubSystem extends ISubSystem{
* Set the last modified date for the given file or folder. Like a Unix "touch" operation. * Set the last modified date for the given file or folder. Like a Unix "touch" operation.
* Folder or file must exist on disk for this to succeed. * Folder or file must exist on disk for this to succeed.
* *
* @param monitor the progress monitor
* @param folderOrFile represents the object to be renamed. * @param folderOrFile represents the object to be renamed.
* @param newDate new date, in milliseconds from epoch, to assign. * @param newDate new date, in milliseconds from epoch, to assign.
* @return false if the given folder/file didn't exist on disk (operation fails), else true. Throws an exception if anything fails. * @return false if the given folder/file didn't exist on disk (operation fails), else true. Throws an exception if anything fails.
*/ */
public boolean setLastModified(IRemoteFile folderOrFile, long newDate) throws RemoteFileSecurityException, RemoteFileIOException; public boolean setLastModified(IProgressMonitor monitor, IRemoteFile folderOrFile, long newDate) throws RemoteFileSecurityException, RemoteFileIOException;
/** /**
* Set a file to readonly. * Set a file to readonly.