Skip to main content



      Home
Home » Newcomers » Newcomers » Auto-Refresh
Auto-Refresh [message #110624] Fri, 21 October 2005 06:22 Go to next message
Eclipse UserFriend
Originally posted by: dheepuks.yahoo.co.in

Hi,

I have copied a file from one location to another location. I have to
display the file in a tree node. the file is being copied well and get
struck in node.
But to view the file in the node i will have to refresh the tree node
manually by pressing F5 key.then only its getting displayed.

i have used
1.
MyNavigator nav = MyData.getInstance().getMyView(true);
nav.getViewer().refresh(); // refreshes the view part

2.
try
{
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject myProj = root.getProject(Const.MY_PROJECT);
myFolder = myApp.getFolder(Const.MY_FOLDER);

IFolder folder = myFolder;
folder.refreshLocal(IResource.FORCE, null);
}
catch(Exception ex)
{
ex.printStackTrace();
}
}

i have tried with given 1, 2 steps but its not getting refreshed
automatically.
i have used
java.nio.channels.FileChannel
to copy the files.

FileChannel dstChannel = new FileOutputStream(path1).getChannel();
dstChannel.transferFrom(source, 0, source.size());


please let me know


Thanks in advance.
Re: Auto-Refresh [message #111120 is a reply to message #110624] Mon, 24 October 2005 12:14 Go to previous message
Eclipse UserFriend
Originally posted by: john.eclipsefaq.org

Is this your own view or the Navigator that is not refreshing?
Generally, a viewer never needs to be manually refreshed from outside.
The viewer will listen for changes to the underlying model (the
workspace in this case), and update itself accordingly. So, simply
changing the underlying model will cause the viewer to update itself.
If you are modifying a file in the workspace diretly using java.nio, you
will need to refresh the IResource, as you are doing in snippet #2.
--

Dheepu Kumar wrote:
> Hi,
>
> I have copied a file from one location to another location. I have to
> display the file in a tree node. the file is being copied well and get
> struck in node.
> But to view the file in the node i will have to refresh the tree node
> manually by pressing F5 key.then only its getting displayed.
>
> i have used 1. MyNavigator nav = MyData.getInstance().getMyView(true);
> nav.getViewer().refresh(); // refreshes the view part
>
> 2.
> try
> {
> IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
> IProject myProj = root.getProject(Const.MY_PROJECT);
> myFolder = myApp.getFolder(Const.MY_FOLDER);
> IFolder folder = myFolder;
> folder.refreshLocal(IResource.FORCE, null); }
> catch(Exception ex)
> {
> ex.printStackTrace();
> }
> }
>
> i have tried with given 1, 2 steps but its not getting refreshed
> automatically.
> i have used java.nio.channels.FileChannel to copy the files.
>
> FileChannel dstChannel = new FileOutputStream(path1).getChannel();
> dstChannel.transferFrom(source, 0, source.size());
>
> please let me know
> Thanks in advance.
>
Previous Topic:Create new run configuration for second project
Next Topic:Auto-saving of files when I want to run the project
Goto Forum:
  


Current Time: Thu Jul 17 19:11:17 EDT 2025

Powered by FUDForum. Page generated in 0.12012 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top