1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-18 13:45:45 +02:00

[173518] refresh remote when updated read-only property not available with current IRemoteFile

This commit is contained in:
David McKnight 2007-05-30 17:44:21 +00:00
parent a0d82da8f6
commit e927256811

View file

@ -26,6 +26,8 @@ import java.util.List;
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;
import org.eclipse.rse.core.model.ISystemRegistry;
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;
@ -472,11 +474,31 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
{
try
{
getRemoteFile().getParentRemoteFileSubSystem().setReadOnly(getRemoteFile(), readOnlySelected, new NullProgressMonitor());
RSECorePlugin.getTheSystemRegistry().fireEvent(
new org.eclipse.rse.core.events.SystemResourceChangeEvent(
getRemoteFile(),ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE,null));
IRemoteFile remoteFile = getRemoteFile();
// get old can write attribute
boolean oldCanWrite = remoteFile.canWrite();
//set readonly
remoteFile.getParentRemoteFileSubSystem().setReadOnly(remoteFile,readOnlySelected, new NullProgressMonitor());
// get the new can write attribute
boolean updatedValue = remoteFile.canWrite();
// if the values haven't changed, then we need to
// refresh
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
// oldCanWrite and updatedValue may not be the same depending on the underlying file service
// If the file service updates the underlying object, then there is no need for a remote refresh
if (oldCanWrite == updatedValue)
{
sr.fireEvent(new SystemResourceChangeEvent(remoteFile,ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE, null));
}
else
{
sr.fireEvent(new SystemResourceChangeEvent(remoteFile,ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE,null));
}
}
catch (RemoteFileIOException exc) {
setMessage(RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_IO_ERROR));