A problem that the new treeviewer in eclipse 3.3 brings to the EMF Application

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.