javaxmleclipsetreevieweclipse-neon

extension of eclipse XMLMultiPageEditorPart - trigger refresh of tree-view manually


I am working on an eclipse-plugin which makes use of a custom XMLMultiPageEditor by extending XMLMultiPageEditorPart and XMLTableTreeView by extending XMLTableTreeViewer the second one as well implements a IResourceChangeListener.

I provide this plugin in eclipse-mars and eclipse-neon, however the wired behavior only shows up in eclipse-neon.

The editor works fine so far, the only problem is, that the tree-view is completely blank when a related xml-document is opened with it:

blank tree view

I can even modify the document in the source-view and save it .. the tree-view stays blank.

The only events which bring the tree-view to life are:

After that, the tree-view works like it should. If I now change the xml in the source-view, the tree-view is updated immediately.

Any ideas how I could trigger a refresh of the tree-view manually ?

Is this maybe a bug in eclipse-neon ?


Solution

  • Ok, the problem seems to be, that the x/y size of the TreeViewer in eclipse-neon is initialized with (0,0). Here a hack to fix that:

    ...
    public class MyXMLTableTreeViewer extends XMLTableTreeViewer implements IResourceChangeListener{
    ....
    
    public MyXMLTableTreeViewer(Composite parent, IEditorPart parentEditor)
    {
       super(parent);
       ....
       Point size = getControl().getSize();
       size.x = 1000;
       getControl().setSize(size);
    }
    

    It seems to be sufficient to only set x to some value ... 10 already gives an image, but the "node" section than looks a bit pressed, so I picket 1000.

    Even if it is just internal API, it looks like a bug for me. So if you are further interested, take a look to the eclipse bugreport.