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

[197976] Changing a file to read-only when it is open doesn't update local copy

This commit is contained in:
Kevin Doyle 2007-10-19 18:12:27 +00:00
parent 547f047169
commit fed40af8b4
3 changed files with 30 additions and 3 deletions

View file

@ -19,6 +19,7 @@
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
* David McKnight (IBM) - [187130] New Folder/File, Move and Rename should be available for read-only folders
* Kevin Doyle (IBM) - [197976] Changing a file to read-only when it is open doesn't update local copy
********************************************************************************/
package org.eclipse.rse.files.ui.resources;
@ -439,9 +440,15 @@ public class SystemEditableRemoteFile implements ISystemEditableRemoteObject, IP
{
setEditorAsReadOnly();
}
else if (editor instanceof ISystemTextEditor)
else
{
((ISystemTextEditor) editor).setReadOnly(false);
if (editor instanceof ISystemTextEditor) {
((ISystemTextEditor) editor).setReadOnly(false);
}
IFile file = getLocalResource();
setReadOnly(file, false);
SystemIFileProperties properties = new SystemIFileProperties(file);
properties.setReadOnly(true);
}
}
@ -1600,7 +1607,8 @@ public class SystemEditableRemoteFile implements ISystemEditableRemoteObject, IP
((ISystemTextEditor) editor).setReadOnly(true);
}
IFile file = getLocalResource();
setReadOnly(file, true);
SystemIFileProperties properties = new SystemIFileProperties(file);
properties.setReadOnly(true);
}

View file

@ -19,6 +19,7 @@
* Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
* David McKnight (IBM) - [205297] Editor upload should not be on main thread
* David McKnight (IBM) - [195285] mount path mapper changes
* Kevin Doyle (IBM) - [197976] Synch up Read-Only attribute when performing save based on local copy
********************************************************************************/
package org.eclipse.rse.files.ui.resources;
@ -26,6 +27,7 @@ import java.util.ArrayList;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
import org.eclipse.rse.core.events.SystemResourceChangeEvent;
@ -176,6 +178,13 @@ public class SystemUniversalTempFileListener extends SystemTempFileListener
// get modification stamp and dirty state
long storedModifiedStamp = properties.getRemoteFileTimeStamp();
// If remote file is read-only make it writable as the local
// copy has changed to be writable
if (remoteFile.exists() && !remoteFile.canWrite() && !tempFile.isReadOnly()) {
remoteFile.getParentRemoteFileSubSystem().setReadOnly(
remoteFile, false, new NullProgressMonitor());
}
// get associated editable
SystemEditableRemoteFile editable = getEditedFile(remoteFile);
if (editable != null && storedModifiedStamp == 0)

View file

@ -17,6 +17,7 @@
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David Dykstal (IBM) - [160776] format file size according to client system conventions and locale
* David McKnight (IBM) - [173518] [refresh] Read only changes are not shown in RSE until the parent folder is refreshed
* Kevin Doyle (IBM) - [197976] Changing a file to read-only when it is open doesn't update local copy
********************************************************************************/
package org.eclipse.rse.internal.files.ui.propertypages;
@ -30,6 +31,7 @@ import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
import org.eclipse.rse.core.events.SystemResourceChangeEvent;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
import org.eclipse.rse.internal.files.ui.FileResources;
import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
@ -42,6 +44,7 @@ import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage;
import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
@ -491,6 +494,13 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
// get the new can write attribute
boolean updatedValue = remoteFile.canWrite();
// check if the file is open in an editor
SystemEditableRemoteFile editable = new SystemEditableRemoteFile(remoteFile);
if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.NOT_OPEN) {
// Need to keep local copy and remote copies up to date
editable.setReadOnly(readOnlySelected);
}
// if the values haven't changed, then we need to
// refresh
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();