Alex
Alex

Reputation: 1641

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 ?

Upvotes: 1

Views: 195

Answers (2)

Alex
Alex

Reputation: 1641

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.

Upvotes: 2

greg-449
greg-449

Reputation: 111217

Both XMLMultiPageEditorPart and XMLTableTreeViewer are in internal packages. This means that they are not part of the Eclipse APIs and can be changed by the Eclipse developers without warning (see Eclipse API Rules of Engagement).

It may well be the case that something was changed between Eclipse Mars and Neon. You cannot rely on internal classes working the same between releases. It is not an Eclipse bug because you are not using official APIs.

Upvotes: 1

Related Questions