本文整理汇总了Java中org.eclipse.core.filesystem.EFS.SET_LAST_MODIFIED属性的典型用法代码示例。如果您正苦于以下问题:Java EFS.SET_LAST_MODIFIED属性的具体用法?Java EFS.SET_LAST_MODIFIED怎么用?Java EFS.SET_LAST_MODIFIED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.core.filesystem.EFS
的用法示例。
在下文中一共展示了EFS.SET_LAST_MODIFIED属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: putInfo
void putInfo(IPath path, IFileInfo info, int options) throws CoreException {
CommonNode node = find(path);
if (node == null) {
throw newCoreException("The store does not exist: " + path, null); //$NON-NLS-1$
} else {
if ((options & EFS.SET_ATTRIBUTES) != 0) {
copyAttribute(info, node.info, EFS.ATTRIBUTE_ARCHIVE);
copyAttribute(info, node.info, EFS.ATTRIBUTE_EXECUTABLE);
copyAttribute(info, node.info, EFS.ATTRIBUTE_HIDDEN);
copyAttribute(info, node.info, EFS.ATTRIBUTE_LINK_TARGET);
copyAttribute(info, node.info, EFS.ATTRIBUTE_READ_ONLY);
}
if ((options & EFS.SET_LAST_MODIFIED) != 0) {
node.info.setLastModified(info.getLastModified());
}
}
}
示例2: putInfo
public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) throws CoreException {
boolean success = true;
if ((options & EFS.SET_ATTRIBUTES) != 0) {
// if (LocalFileNativesManager.isUsingNatives())
// success &= LocalFileNativesManager.putFileInfo(filePath, info, options);
}
// native does not currently set last modified
if ((options & EFS.SET_LAST_MODIFIED) != 0)
success &= file.setLastModified(info.getLastModified());
if (!success && !file.exists())
Policy.error(EFS.ERROR_NOT_EXISTS, NLS.bind(Messages.fileNotFound, filePath));
}
示例3: transferAttributes
private void transferAttributes(IFileInfo sourceInfo, IFileStore destination)
throws CoreException {
int options = EFS.SET_ATTRIBUTES | EFS.SET_LAST_MODIFIED;
destination.putInfo(sourceInfo, options, null);
}
示例4: putInfo
public final synchronized void putInfo(IPath path, IFileInfo info, int options, IProgressMonitor monitor)
throws CoreException
{
monitor = Policy.monitorFor(monitor);
monitor.beginTask(
MessageFormat.format(Messages.BaseConnectionFileManager_putting_changes, path.toPortableString()), 5);
try
{
ProgressMonitorInterrupter.setCurrentThreadInterruptDelegate(interruptDelegate);
testOrConnect(monitor);
if ((options & EFS.SET_LAST_MODIFIED) != 0)
{
setModificationTime(basePath.append(path), info.getLastModified(), Policy.subMonitorFor(monitor, 1));
setLastOperationTime();
}
if ((options & EFS.SET_ATTRIBUTES) != 0 && (options & IExtendedFileInfo.SET_PERMISSIONS) == 0)
{
ExtendedFileInfo fileInfo = fetchAndCacheFileInfo(path, Policy.subMonitorFor(monitor, 1));
if (fileInfo.exists())
{
long permissions = fileInfo.getPermissions();
if (!info.getAttribute(EFS.ATTRIBUTE_READ_ONLY))
{
permissions |= IExtendedFileInfo.PERMISSION_OWNER_WRITE;
}
else
{
permissions &= ~IExtendedFileInfo.PERMISSION_OWNER_WRITE;
}
if (info.getAttribute(EFS.ATTRIBUTE_EXECUTABLE))
{
permissions |= IExtendedFileInfo.PERMISSION_OWNER_EXECUTE;
}
else
{
permissions &= ~IExtendedFileInfo.PERMISSION_OWNER_EXECUTE;
}
changeFilePermissions(basePath.append(path), permissions, Policy.subMonitorFor(monitor, 1));
}
setLastOperationTime();
}
if (info instanceof IExtendedFileInfo)
{
IExtendedFileInfo extInfo = (IExtendedFileInfo) info;
if ((options & IExtendedFileInfo.SET_PERMISSIONS) != 0)
{
changeFilePermissions(basePath.append(path), extInfo.getPermissions(),
Policy.subMonitorFor(monitor, 1));
}
if ((options & IExtendedFileInfo.SET_GROUP) != 0)
{
changeFileGroup(basePath.append(path), extInfo.getGroup(), Policy.subMonitorFor(monitor, 1));
}
setLastOperationTime();
}
}
catch (FileNotFoundException e)
{
setLastOperationTime();
throw new CoreException(new Status(IStatus.ERROR, CoreIOPlugin.PLUGIN_ID,
Messages.BaseConnectionFileManager_no_such_file, initFileNotFoundException(path, e.getCause())));
}
finally
{
ProgressMonitorInterrupter.setCurrentThreadInterruptDelegate(null);
clearCache(path);
monitor.done();
}
}