Common Navigator Framework, view refresh issue. [message #186923] |
Fri, 05 January 2007 04:16 |
Eclipse User |
|
|
|
Originally posted by: swapnaja.gmail.com
Hello,
We are using CNF for providing a hierarchical view similar to Navigator
View.
We have written content providers (these cache data) and model objects at
different levels in the hierarchy.
At certain levels we have to provide actions like add/delete which will
add/remove resources from the view.
The way this is done for add action, is given below.
Action class creates workspace modify operation and creates certain
folders in the filesystem.
The operation is executed in the action itself as
PlatformUI.getWorkbench().getProgressService().run(true, false,
addSubDialogOperation);
This results in firing resource change event.
Content providers are listening to resource changes hence will receive the
event.
On receipt of this event, cache gets updated appropriately to handle this
addition.
After updating the cache successfully, view needs to be refreshed. This is
done by calling,
new UIJob("Update Subdialog changes.")
{
public IStatus
runInUIThread(IProgressMonitor monitor)
{
if (viewer != null &&
!viewer.getControl().isDisposed())
viewer.refresh(projectDelta.getResource());
return Status.OK_STATUS;
}
}.schedule();
For some reason we get these events only at the root level. Hence we
extract project from it.
projectDelta.getResource() actually corresponds to the corresponding
project resource (i.e. IProject).
After this, view gets refreshed. The results are very strange and
absolutely unpredictable.
For.e.g say the intial view is, (I was unable to paste images into the
post hence doing it with text.)
speech1
|--Speech Dialogs
|--dialog1
|--dialog2
|--dialog3
|--main
To the selected node dialog4is added, now the new view should be,
speech1
|--Speech Dialogs
|--dialog1
|--dialog2
|--dialog3
|--dialog4
|--main
But what we got this time was,
speech1
|--Speech Dialogs
|--dialog1
|--dialog2
|--dialog3
|--dialog4
|--dialog4
As can be seen here, dialog4 appears twice and main does not appear at
all. We have checked that the content providers return correct children.
The behavior is very unpredictable and we do not get the same results
every time. At times we get tree item Speech Dialogs as one of sits own
children.
The error disappears if the view is closed and opened again.
Does anybody have any idea as to could be possibly wrong here?
This is very critical for the functionality that we are working on. Any
urgent help would be highly appreciated.
Please let me know in case if any other information is needed.
Thanks.
Swapnaja.
|
|
|
Powered by
FUDForum. Page generated in 0.09787 seconds