After doing manipulatio开发者_开发知识库n in my tree viewer, when I'm calling this api IResource.refreshLocal(IResource.DEPTH_INFINITE, null); it is not refreshing the UI. Is there any alternative way by which I can refresh my tree?
If you are doing a custom tree viewer that depends on the resource changes, then refreshing the resources will not result in changes in the viewer: the content provider will not be re-executed on resource changes. If you want to refresh a custom viewer, you have to register a resourcechangelistener that will call the refresh or update methods of the viewer.
However, if you are using Common Navigator Framework (CNF) with the built-in resource support, it should refresh itself.
Update: The CNF should be configured as follows (that is extracted from my working solution):
<extension
point="org.eclipse.ui.navigator.viewer">
<viewerContentBinding
viewerId="org.eclipse.viatra2.navigator">
<includes>
<contentExtension
pattern="org.eclipse.ui.navigator.resourceContent" />
<contentExtension
pattern="org.eclipse.ui.navigator.resources.filters.*"/>
</includes>
...
</extension>
For custom models added into Navigator use:
if (viewPart instanceof CommonNavigator) {
CommonViewer viewer = ((CommonNavigator) viewPart).getCommonViewer();
viewer.refresh();
}
精彩评论