[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: label providers

One more not TreeViewer supports having the same instance in a Tree under the different paths. A Tree like this completely correct in terms of TreeViewer because the paths to the element is different.

---------8<---------
- Soccer
  - Tom Schindl
  - Ed Merks
- Rugby
  - Ed Merks
- Tennis
  - Tom Schindl
---------8<---------

Tom

Tom Schindl schrieb:
Well I'd use a ITreePathLabelProvider (or TreeColumnViewerLabelProvider if you are on 3.3) instead of giving you the element it will give you the TreePath :-)

Tom

Ed Merks schrieb:
Anders,

The JFace viewers rely on objects in the tree being unique. I.e., the object should appear at most once in the tree. So EMF uses wrappers when dealing with things like non-containment references that are likely to violate these assumptions. Such wrappers will know the parent to implement getParent correctly. So in ItemProviderAdapter there are methods like isWrappingNeeded and createWrapper for creating them as needed. It sounds like you could hook into this to create a wrapper that decorates the result in some specialized way depending on the parent...


Anders H wrote:
Hi,

I've got the following structure in my view:

Component
 - Service1
    - Attribute1
    - Service2
 - Service2
 - Entity1
 - Entity2

As you can see, the object Service1 appears in different places in the tree.
I only see it once. I guess you mean Service2. :-P
How do I customize the label provider to take this into account. Specifically, I want the label to state "implements Service2" when Service2 appears as a child of Service1.

- Anders






--
B e s t S o l u t i o n . at
--------------------------------------------------------------------
Tom Schindl                                          JFace-Committer
--------------------------------------------------------------------