mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 07:05:24 +02:00
[170832] implement setReadOnly() and seLastModified() for ssh
This commit is contained in:
parent
17f6814ff4
commit
eb4639f83b
2 changed files with 45 additions and 5 deletions
|
@ -31,7 +31,7 @@ plugin@org.eclipse.rse.sdk=v20070221,:pserver:anonymous:none@dev.eclipse.org:/cv
|
|||
plugin@org.eclipse.rse.services.dstore=v20070221,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore
|
||||
plugin@org.eclipse.rse.services.files.ftp=v20070221,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.services.files.ftp
|
||||
plugin@org.eclipse.rse.services.local=v20070221,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.services.local
|
||||
plugin@org.eclipse.rse.services.ssh=v20070221,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.services.ssh
|
||||
plugin@org.eclipse.rse.services.ssh=v20070223,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.services.ssh
|
||||
plugin@org.eclipse.rse.services=v20070221,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.services
|
||||
plugin@org.eclipse.rse.shells.ui=v20070223,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.shells.ui
|
||||
plugin@org.eclipse.rse.subsystems.files.core=v20070222,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.subsystems.files.core
|
||||
|
|
|
@ -756,14 +756,54 @@ public class SftpFileService extends AbstractFileService implements IFileService
|
|||
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;
|
||||
boolean ok=false;
|
||||
if (fDirChannelMutex.waitForLock(monitor, fDirChannelTimeout)) {
|
||||
try {
|
||||
String path = parent + '/' + name;
|
||||
getChannel("SftpFileService.setLastModified").setMtime(path, (int)(timestamp/1000)); //$NON-NLS-1$
|
||||
ok=true;
|
||||
Activator.trace("SftpFileService.setLastModified ok"); //$NON-NLS-1$
|
||||
} catch (Exception e) {
|
||||
Activator.trace("SftpFileService.setLastModified failed: "+e.toString()); //$NON-NLS-1$
|
||||
throw makeSystemMessageException(e);
|
||||
} finally {
|
||||
fDirChannelMutex.release();
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
public boolean setReadOnly(IProgressMonitor monitor, String parent,
|
||||
String name, boolean readOnly) throws SystemMessageException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
boolean ok=false;
|
||||
if (fDirChannelMutex.waitForLock(monitor, fDirChannelTimeout)) {
|
||||
try {
|
||||
String path = parent + '/' + name;
|
||||
SftpATTRS attr = getChannel("SftpFileService.setReadOnly").stat(path); //$NON-NLS-1$
|
||||
int permOld = attr.getPermissions();
|
||||
int permNew = permOld;
|
||||
if (readOnly) {
|
||||
permNew &= ~128;
|
||||
} else {
|
||||
permNew |= 128;
|
||||
}
|
||||
if (permNew != permOld) {
|
||||
//getChannel("SftpFileService.setReadOnly").chmod(permNew, path); //$NON-NLS-1$
|
||||
attr.setPERMISSIONS(permNew);
|
||||
getChannel("SftpFileService.setReadOnly").setStat(path, attr); //$NON-NLS-1$
|
||||
ok=true;
|
||||
Activator.trace("SftpFileService.setReadOnly ok"); //$NON-NLS-1$
|
||||
} else {
|
||||
Activator.trace("SftpFileService.setReadOnly nothing-to-do"); //$NON-NLS-1$
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Activator.trace("SftpFileService.rename failed: "+e.toString()); //$NON-NLS-1$
|
||||
throw makeSystemMessageException(e);
|
||||
} finally {
|
||||
fDirChannelMutex.release();
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue