Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [gef-dev] TreeViewer root element

Title: RE: [gef-dev] TreeViewer root element

I had the same problem. I resolve it creating a TreeEditPart class for my root and then overriding the setWidget method :

public class MyRootTreeEditPart extends TreeEditPart  {

   /* (non-Javadoc)
    * @see org.eclipse.gef.TreeEditPart#setWidget(org.eclipse.swt.widgets.Widget)
    */
   public void setWidget(Widget widget) {
      if (widget instanceof Tree) {
         TreeItem item = new TreeItem((Tree) widget, SWT.MULTI); // create the treeitem for the root
         widget = item;
      }
      super.setWidget(widget);
   }
}

Image and text are not set here, you have to override getImage() and getText().

Regards,
Fabien Mairesse


-----Message d'origine-----
De : gef-dev-admin@xxxxxxxxxxx [mailto:gef-dev-admin@xxxxxxxxxxx]De la
part de Vadim Gurov
Envoye : mercredi 26 mai 2004 08:20
A : gef-dev@xxxxxxxxxxx
Objet : [gef-dev] TreeViewer root element


Hello gef-dev,

  Why TreeViewer doesn't show root element of my model?
  Example:
   model has structure
      my model root element
       |
       +- my model child element 1
       +- my model child element 2


  After call to TreeViewer.setContent(my model root element) actually
  on screen I see only child elements.
      
--
Best regards,
 Vadim                          mailto:vgurov@xxxxxxxxxxxxx



_______________________________________________
gef-dev mailing list
gef-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/gef-dev
- - - - - - - DISCLAIMER - - - - - - - -
Unless indicated otherwise, the information contained in this message is privileged and confidential, and is intended only for the use of the addressee(s) named above and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message and/or attachments is strictly prohibited. The company accepts no liability for any damage caused by any virus transmitted by this email. Furthermore, the company does not warrant a proper and complete transmission of this information, nor does it accept liability for any delays. If you have received this message in error, please contact the sender and delete the message. Thank you.


Back to the top