In using org.eclipse.ui.navigator.navigatorContent extension point I provide content provider, function of which is for certain folders return folder's child during the calling of getChildren() method
public Object[] getChildren(Object parentElement) {
if(parentElement instanceof IFolder){
try {
List<IResource> children = analyzeFolder((IFolder)parentElement);
return children.size() == 0 ? ((IContainer)parentElement).members() : children.toArray(new IResource[children.size()]);
} catch (CoreException e) {
return EMPTY_ARRAY;
}
}
else{
try {
return ((IContainer)parentElement).members();
} catch (CoreException e) {
return EMPTY_ARRAY;
}
}
}
I also use org.eclipse.ui.navigator.ProjectExplorer as Common Navigator instead of defining my own because I don't need any special functionality to define my own CN implementation. And I think the problem is that CN extender provides its own ContentProvider - NavigatorContentServiceContentProvider that adds folders that I am "hiding" in my own ContentProvider. Because of this, I have to utilize ViewerFilter that hides these folders.
Essentially this is what happens:
Model
ProjA
-- folder.myExtension (folder is created)
-- file.myExtension (file is created under folder)
Viewer
ProjA
-- file (content proovider returns file.myExtension instead of folder.myExtension)
What I found is that if I remove ViewerFilter, then the tree gets refreshed, however then I get folders that I was trying to hide that NavigatorContentServiceContentProvider "injects".
Is there a better way to achieve this folder hiding that I am doing, a virtual folder is you will? Can somehow de-register NavigatorContentServiceContentProvider? Or should define my own CN implementation as ProjectExplorer does so that I can myself control all the content?