Detecting TreeViewer content change [message #315705] |
Mon, 21 May 2007 14:38  |
Eclipse User |
|
|
|
Originally posted by: balu_amburayath.stercomm.com
I have implemented two custom views (both are objects of TreeViewer). One
view displays one set of resources(folders) of a project while the other
displays the remaining set of resources (folders) of the same project.
A custom action (context menu) on one view displays a menu to create files
and folders to that project. Once a resource is added, I reload the entire
tree to reflect the changes.
Question:
How do I detect the tree contents of the first View has changed so that I
can refresh the contents in the second view?
I have implemented selection listener as below. But I am not sure how to
determine if the contents of the first has changed or not.
Any help is appreciated (could not find this type of discussion in the
groups)
Thanks in advance.
listener = new ISelectionListener() {
public void selectionChanged(IWorkbenchPart part, ISelection sel)
{
if (!(sel instanceof IStructuredSelection))
return;
IStructuredSelection ss = (IStructuredSelection) sel;
Object o = ss.getFirstElement();
if (o instanceof MyFirstView)
//Do something
}
};
|
|
|
|
|
|
|
|
|
|
Re: Detecting TreeViewer content change [message #315839 is a reply to message #315809] |
Wed, 23 May 2007 16:31  |
Eclipse User |
|
|
|
Originally posted by: balu_amburayath.stercomm.com
Thanks.
With these pieces of info in hand, I implemented a model class that
listens to ResourceChanges and accordingly notifies the listeners of my
model appropriately.
During Run time, when a project is created through a view (package
explorer), I am able to get notification inside the Model class, but when
my listeners access my model data, iterate through the list of projects
and accesses MEMBERS of the newly created project, I get
exception "org.eclipse.core.internal.resources.ResourceException: The
resource tree is locked for modifications."
I am doing project.isAccessible() check before iteration, but the error
continues.
I need to get the list of members in order to display on the TreeView.
Is there any way to get around this other than actually doing a File IO
operation that hits the file system directly?
Regards.
|
|
|
Powered by
FUDForum. Page generated in 0.07088 seconds