diff --git a/dlight.remote.impl/src/org/netbeans/modules/remote/impl/fs/RemoteFileObjectBase.java b/dlight.remote.impl/src/org/netbeans/modules/remote/impl/fs/RemoteFileObjectBase.java --- a/dlight.remote.impl/src/org/netbeans/modules/remote/impl/fs/RemoteFileObjectBase.java +++ b/dlight.remote.impl/src/org/netbeans/modules/remote/impl/fs/RemoteFileObjectBase.java @@ -57,11 +57,14 @@ import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment; import org.netbeans.modules.dlight.libs.common.InvalidFileObjectSupport; import org.netbeans.modules.nativeexecution.api.util.ConnectionManager; +import org.netbeans.modules.nativeexecution.api.util.ProcessUtils; +import org.netbeans.modules.nativeexecution.api.util.ProcessUtils.ExitStatus; import org.netbeans.modules.remote.support.RemoteLogger; import org.openide.filesystems.FileAttributeEvent; import org.openide.filesystems.FileChangeListener; import org.openide.filesystems.FileLock; import org.openide.filesystems.FileObject; +import org.openide.filesystems.FileRenameEvent; import org.openide.util.Exceptions; /** @@ -332,9 +335,27 @@ @Override public void rename(FileLock lock, String name, String ext) throws IOException { - throw new ReadOnlyException(); + String newNameExt = (ext == null) ? name : name + '.' + ext; + if (newNameExt.equals(getNameExt())) { + return; + } + ExitStatus ret = ProcessUtils.executeInDir(getParent().getPath(), getExecutionEnvironment(), "mv", getNameExt(), newNameExt); + if (!ret.isOK()) { + throw new IOException(ret.error); + } + try { + getParent().refreshImpl(false); + } catch (ConnectException ex) { + throw ex; + } catch (InterruptedException ex) { + // nothing + } catch (CancellationException ex) { + // nothing + } catch (ExecutionException ex) { + throw new IOException("Can not rename " + getPath() + " to " + newNameExt, ex); //NOI18N + } } - + @Override public Object getAttribute(String attrName) { return getFileSystem().getAttribute(this, attrName);