|
|
(no subject) [message #715133 is a reply to message #715050] |
Fri, 12 August 2011 13:28 |
David McKnight Messages: 244 Registered: July 2009 |
Senior Member |
|
|
Hi Samuel,
Probably the easiest way to update the RSE tree would be to use a refresh
event:
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
IHost host = fileSS.getHost();
IRemoteFileSubSystem ss = RemoteFileUtility.getFileSubSystem(host);
IRemoteFile parentDirectory;
try {
parentDirectory = ss.getRemoteFileObject(path, monitor);
sr.fireEvent(new SystemResourceChangeEvent(parentDirectory,
ISystemResourceChangeEvents.EVENT_REFRESH, null));
} catch (SystemMessageException e) {
....
}
You could be more granual and use an event like the following, although it
would require a bit more work in that you'd have to determine which files
have changed:
ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED
I hope this helps,
Dave
"Samuel Lampa" <forums-noreply@eclipse.org> wrote in message
news:j22od1$bdo$1@news.eclipse.org...
> Hi,
>
> I programmatically do some stuff by executing remote commands, via SSH,
> which creates new files on the remote host. I realized that the SFTP file
> listing in the Remote systems view does not automatically get updated to
> show the newly created file.
>
> How can I programmatically update this view?
|
|
|
Re: (no subject) [message #715194 is a reply to message #715133] |
Fri, 12 August 2011 16:58 |
Samuel Lampa Messages: 9 Registered: June 2011 |
Junior Member |
|
|
Thanks!
I now tried something along the lines suggested:
IRemoteFile parentDirectory;
try {
parentDirectory = rfss.getRemoteFileObject("/home/samuel", new NullProgressMonitor());
SystemResourceChangeEvent refreshFileSubStystemEvent = new SystemResourceChangeEvent(parentDirectory,
ISystemResourceChangeEvents.EVENT_REFRESH, rfss);
ISystemRegistry registry = SystemStartHere.getSystemRegistry();
registry.fireEvent(refreshFileSubStystemEvent);
} catch (SystemMessageException e) {
e.printStackTrace();
}
Unfortunately I can't seem to get it to work...
It works though, if I use the (deprecated) EVENT_REFRESH_SELECTED_PARENT event type, like so:
// Update the file browser, to show any newly created files
IRemoteFileSubSystem rfss = RemoteFileUtility.getFileSubSystem(HPCUtils.getApplication().getHPCHost());
SystemResourceChangeEvent refreshFileSubStystemEvent = new SystemResourceChangeEvent(this,
ISystemResourceChangeEvents.EVENT_REFRESH_SELECTED_PARENT, rfss);
ISystemRegistry registry = SystemStartHere.getSystemRegistry();
registry.fireEvent(refreshFileSubStystemEvent);
... but using deprecated code is of course not the way to go, I guess ...
|
|
|
Re: (no subject) [message #715209 is a reply to message #715194] |
Fri, 12 August 2011 17:52 |
David McKnight Messages: 244 Registered: July 2009 |
Senior Member |
|
|
Hmm, I'm not sure why the refresh event isn't working. It's possible that
the results are already cached for the parentDirectory. If that's the case,
you could invalidate the cached items by calling
parentDirectory.markStale(true) prior to the event firing. If this is
something that appears directly under a filter reference then you might need
to invalidate the filter reference's cache as well.
Does this work for you if you use the following event instead of the other
refreshes?
ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE
"Samuel Lampa" <forums-noreply@eclipse.org> wrote in message
news:j23lfo$bra$1@news.eclipse.org...
> Thanks!
>
> I now tried something along the lines suggested:
> IRemoteFile parentDirectory;
> try {
> parentDirectory = rfss.getRemoteFileObject("/home/samuel", new
> NullProgressMonitor());
> SystemResourceChangeEvent refreshFileSubStystemEvent = new
> SystemResourceChangeEvent(parentDirectory,
> ISystemResourceChangeEvents.EVENT_REFRESH, rfss);
> ISystemRegistry registry = SystemStartHere.getSystemRegistry();
> registry.fireEvent(refreshFileSubStystemEvent);
> } catch (SystemMessageException e) {
> e.printStackTrace();
> }
>
> Unfortunately I can't seem to get it to work...
>
> It works though, if I use the (deprecated) EVENT_REFRESH_SELECTED_PARENT
> event type, like so:
>
> // Update the file browser, to show any newly created files
> IRemoteFileSubSystem rfss =
> RemoteFileUtility.getFileSubSystem(HPCUtils.getApplication().getHPCHost());
> SystemResourceChangeEvent refreshFileSubStystemEvent = new
> SystemResourceChangeEvent(this,
> ISystemResourceChangeEvents.EVENT_REFRESH_SELECTED_PARENT, rfss);
> ISystemRegistry registry = SystemStartHere.getSystemRegistry();
> registry.fireEvent(refreshFileSubStystemEvent);
>
> .. but using deprecated code is of course not the way to go, I guess ...
|
|
|
Powered by
FUDForum. Page generated in 0.02683 seconds