Bug 517360 - extension of XMLTableTreeViewer - tree-view shows blank until certain event
Summary: extension of XMLTableTreeViewer - tree-view shows blank until certain event
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2017-05-29 06:22 EDT by Alexander Schwinn CLA
Modified: 2020-07-20 02:42 EDT (History)
2 users (show)

See Also:


Attachments
blank tree-view (7.26 KB, image/png)
2017-05-29 06:22 EDT, Alexander Schwinn CLA
no flags Details
Minimal Plugin-Project to Demonstrate the bug (30.00 KB, application/x-tar)
2017-05-30 06:20 EDT, Alexander Schwinn CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Schwinn CLA 2017-05-29 06:22:05 EDT
Created attachment 268604 [details]
blank tree-view

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 at the beginning is completely blank when a related xml-document is opened with it.

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:

-- re-size the editor-window with the mouse
-- open some other document and than switch back to the tab of the open xml-doc.

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.
Comment 1 Andrey Loskutov CLA 2017-05-29 09:52:19 EDT
Please attach a self contained snippet or project demonstrating the problem. Most likely (I guess) this is layout related. If you have somewhere explicit calls to layout the tree try to play with that code a bit. May be using requestLayout() instead helps.
Comment 2 Alexander Schwinn CLA 2017-05-29 10:56:20 EDT
requestLayout() did not change anything .. however using the class "Control" was a good hint. I tried many of it's methods, and I finally found a method which allows me to fix the problem:

...
public class MyXMLTableTreeViewer extends XMLTableTreeViewer implements IResourceChangeListener{
....

public MyXMLTableTreeViewer(Composite parent, IEditorPart parentEditor)
{
   super(parent);
   ....
   Point size = getControl().getSize();
   ConsoleHandler.printMessage("size.y " + Integer.toString(size.y), true);
   ConsoleHandler.printMessage("size.x " + Integer.toString(size.x), true);
   size.x = 1000;
   getControl().setSize(size);
}
...

The console-output when I run the plugin:
size.y 0
size.x 0
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 the problem seems to be, that the x/y size of the tree-view has bad init-values, which need to adjusted before use.

Is that code-snippet sufficient for you ? If not, I will try to create a small demonstration project. The current one is just to big to boil it down.
Comment 3 Andrey Loskutov CLA 2017-05-29 11:01:53 EDT
(In reply to Alexander Schwinn from comment #2)
> Is that code-snippet sufficient for you ? If not, I will try to create a
> small demonstration project.

This would be really good.
Comment 4 Alexander Schwinn CLA 2017-05-30 06:20:57 EDT
Created attachment 268628 [details]
Minimal Plugin-Project to Demonstrate the bug

Ok, here we go -Plugin-Project added-

- The bug as well shows up if I use the eclipse "XMLTableTreeViewer" instead of extending it.
- I added a file "demoTestfile.myxml" for which the editor has a contentTypeBinding ( configured in plugin.xml ) ... needs to be moved to some empty project in the runtime-workspace once it got created
- Just comment/uncomment 3 lines in MyXMLTableTreeViewer.java to toggle between bug fixed/unfixed
Comment 5 Eclipse Genie CLA 2020-07-14 15:39:38 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 6 Alexander Schwinn CLA 2020-07-20 02:42:16 EDT
reopened, since I still can reproduce