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

[198576] Renaming a folder directly under a Filter doesn't update children

This commit is contained in:
David McKnight 2007-08-01 20:40:59 +00:00
parent 757b183b1f
commit 2922a61fd1
2 changed files with 23 additions and 11 deletions

View file

@ -27,6 +27,7 @@
* David McKnight (IBM) - [197089] Need to set the filter when there is no separator in filter string
* David McKnight (IBM) - [196662] hasChildren() should return false when the file doesn't exist
* David McKnight (IBM) - [197784] Need to check if last separator is at 0
* Kevin Doyle (IBM) - [198576] Renaming a folder directly under a Filter doesn't update children
********************************************************************************/
package org.eclipse.rse.internal.files.ui.view;
@ -53,8 +54,6 @@ import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.Viewer;
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.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterReference;
import org.eclipse.rse.core.filters.SystemFilterReference;
@ -2516,15 +2515,21 @@ public class SystemViewRemoteFileAdapter
moveTempResource(localResource, newLocalPath, ss, newRemotePath);
}
if (file.isDirectory())
{
// update all tree views showing this remote folder...
// Hmm, why do we do this, given SystemView sends a rename event? I think we needed to refresh all child cached references to parent folder name...
SystemResourceChangeEvent event = new SystemResourceChangeEvent(file.getParentRemoteFile(), ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE, null);
sr.fireEvent(event);
//sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED, file, file.getParentRemoteFile(), file.getParentRemoteFileSubSystem(), null, null);
}
file.markStale(true);
// Firing a refresh event before a rename event will cause views to refresh
// but the TreeItems contain the old data, and refresh will display an error
// below the TreeItem saying it's not readable as it's using the old name.
// This is not an issue for the SystemView as it does the refresh in a job, so
// the rename event is actually handled first then the refresh.
// Commented out for bug #198576
// if (file.isDirectory())
// {
// // update all tree views showing this remote folder...
// // Hmm, why do we do this, given SystemView sends a rename event? I think we needed to refresh all child cached references to parent folder name...
// SystemResourceChangeEvent event = new SystemResourceChangeEvent(file.getParentRemoteFile(), ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE, null);
// sr.fireEvent(event);
// //sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED, file, file.getParentRemoteFile(), file.getParentRemoteFileSubSystem(), null, null);
// }
// file.markStale(true);
}
catch (Exception exc)

View file

@ -37,6 +37,7 @@
* David McKnight (IBM) - [196930] Don't add the connection when it's not supposed to be shown
* Tobias Schwarz (Wind River) - [197484] Provide ContextObject for queries on all levels
* David McKnight (IBM) - [196662] Avoid main thread query to check exists when remote refreshing
* Kevin Doyle (IBM) - [198576] Renaming a folder directly under a Filter doesn't update children
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
@ -2481,6 +2482,12 @@ public class SystemView extends SafeTreeViewer
// rename all existing references to the remote object...
renameRemoteObject(remoteResource, event.getOldName(), ss);
// refresh remoteResource if it's a directory
ISystemViewElementAdapter adapter = getViewAdapter(remoteResource);
if (remoteResource instanceof IAdaptable && adapter.hasChildren((IAdaptable) remoteResource)) {
refreshRemoteObject(remoteResource, remoteResource, originatedHere);
}
// now, find all filters that list the contents of the OLD name container.
filterMatches = findAllRemoteItemFilterReferences(event.getOldName(), ss, null);
if (filterMatches != null) {