An EMF application previously made in eclipse 3.2ProgramIn section 3.3, some labels in treeviewer are incorrectly formatted. For example, if "condition true" is displayed, "1" may be displayed in section 3.3 ". After debugging, it is found that when these treeviewer obtain tags for each node, if the corresponding xxxitemprovider implements the itableitemlableprovider (that is, the xxxitemprovider is also used by tableviewer in the application), getcolumntext () is called () instead of gettext () to get the text content.
I found this post in the newsgroup about the same thing (the newsgroup is the first response after a problem occurs). The reason is that the implementation of treeviewer has changed in eclipse 3.3, not EMF, the new implementation treats the original treeviewer as a special tableviewer with only one column, so that EMF regards treeviewer as tableviewer, and of course it will go to getcolumntext. The solution is not complicated, and the post in the newsgroup also mentioned it. I will post it for your reference.
/** * @ Added * solve a problem raised in jface 3.3 tree viewer * @ See Http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg25409.html * */ Class Workaroundadapterfactorylabelprovider Extends Adapterfactorylabelprovider { /** * @ Param Adapterfactory */ Public Workaroundadapterfactorylabelprovider (adapterfactory ){ Super (Adapterfactory);} @ override Public Image getcolumnimage (Object object, Int Columnindex ){ Return Super . Getimage (object) ;}@ override Public String getcolumntext (Object object, Int Columnindex ){ Return Super . Gettext (object );}}
With the above class, replace adapterfactorylabelprovider in setlabelprovider () with it. EMF Versions later will solve this problem.