Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to have multicolored tree label
How to have multicolored tree label [message #327449] Mon, 21 April 2008 01:01 Go to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
Hi in 3.4M6 the tree labels in the Package explorer, and Outline shows
examples where the label is multicolored. E.g. a method is rendered in
the Outline view with black method name, and then the type i gold.

How is this effect created? Greatful if someone can point me to an
example (or how/where to find code that does this).

Regards
- henrik
Re: How to have multicolored tree label [message #327453 is a reply to message #327449] Mon, 21 April 2008 05:40 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
http://wiki.eclipse.org/JFaceSnippets#Snippet049SimpleStyled CellLabelProvider

Tom

Henrik Lindberg schrieb:
> Hi in 3.4M6 the tree labels in the Package explorer, and Outline shows
> examples where the label is multicolored. E.g. a method is rendered in
> the Outline view with black method name, and then the type i gold.
>
> How is this effect created? Greatful if someone can point me to an
> example (or how/where to find code that does this).
>
> Regards
> - henrik


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: How to have multicolored tree label [message #327464 is a reply to message #327453] Mon, 21 April 2008 17:31 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
Thanks Tom,
A couple of follow up questions - the SimpleStyledCellLabelProvider is
marked as deprecated and a different label provider is suggested
StyledCellLabelProvider, and it is quite different.

I have not worked with ViwerCell's before - so I don't get the info
in the JavaDoc for that class -

* For providing the label's styles, create a subclass and overwrite
* {@link StyledCellLabelProvider#update(ViewerCell)} to
* return set all information needed to render a element. Use
* {@link ViewerCell#setStyleRanges(StyleRange[])} to set style ranges
* on the label.

Any pointers to example use of SimpleStyledCellLabelProvider, or to
information about ViewerCell?

Basically, all I want to do is to have a multicolored label in a
TreeViewer (no need for columns, etc). Any Suggestions?

Regards
- henrik


Tom Schindl wrote:
> http://wiki.eclipse.org/JFaceSnippets#Snippet049SimpleStyled CellLabelProvider
>
>
> Tom
>
> Henrik Lindberg schrieb:
>> Hi in 3.4M6 the tree labels in the Package explorer, and Outline shows
>> examples where the label is multicolored. E.g. a method is rendered in
>> the Outline view with black method name, and then the type i gold.
>>
>> How is this effect created? Greatful if someone can point me to an
>> example (or how/where to find code that does this).
>>
>> Regards
>> - henrik
>
>
Re: How to have multicolored tree label [message #327477 is a reply to message #327464] Mon, 21 April 2008 21:33 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

Where do you read something about deprecate in the snippet? Running the
snippet does exactly what you want to it shows a table with a
multi-color label (black and blue).

ViewerCell is the widget independent representation of a Cell in your
viewer. It allows you to set an image, text, ... on the underlying
SWT-Item (TreeItem, TableItem, ...).

Tom

Henrik Lindberg schrieb:
> Thanks Tom,
> A couple of follow up questions - the SimpleStyledCellLabelProvider is
> marked as deprecated and a different label provider is suggested
> StyledCellLabelProvider, and it is quite different.
>
> I have not worked with ViwerCell's before - so I don't get the info
> in the JavaDoc for that class -
>
> * For providing the label's styles, create a subclass and overwrite
> * {@link StyledCellLabelProvider#update(ViewerCell)} to
> * return set all information needed to render a element. Use
> * {@link ViewerCell#setStyleRanges(StyleRange[])} to set style ranges
> * on the label.
>
> Any pointers to example use of SimpleStyledCellLabelProvider, or to
> information about ViewerCell?
>
> Basically, all I want to do is to have a multicolored label in a
> TreeViewer (no need for columns, etc). Any Suggestions?
>
> Regards
> - henrik
>
>
> Tom Schindl wrote:
>> http://wiki.eclipse.org/JFaceSnippets#Snippet049SimpleStyled CellLabelProvider
>>
>>
>> Tom
>>
>> Henrik Lindberg schrieb:
>>> Hi in 3.4M6 the tree labels in the Package explorer, and Outline
>>> shows examples where the label is multicolored. E.g. a method is
>>> rendered in the Outline view with black method name, and then the
>>> type i gold.
>>>
>>> How is this effect created? Greatful if someone can point me to an
>>> example (or how/where to find code that does this).
>>>
>>> Regards
>>> - henrik
>>
>>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: How to have multicolored tree label [message #327500 is a reply to message #327464] Tue, 22 April 2008 14:43 Go to previous messageGo to next message
Boris Bokowski is currently offline Boris BokowskiFriend
Messages: 272
Registered: July 2009
Senior Member
Have a look at the wiki page again. We did update the snippets (they now use
StyledCellLabelProvider instead of SimpleStyledCellLabelProvider), but
because of a "feature" in ViewCVS, you were still seeing the old snippets.

Boris

"Henrik Lindberg" <henrik.lindberg@cloudsmith.com> wrote in message
news:fuij19$d3n$1@build.eclipse.org...
> Thanks Tom,
> A couple of follow up questions - the SimpleStyledCellLabelProvider is
> marked as deprecated and a different label provider is suggested
> StyledCellLabelProvider, and it is quite different.
>
> I have not worked with ViwerCell's before - so I don't get the info
> in the JavaDoc for that class -
>
> * For providing the label's styles, create a subclass and overwrite
> * {@link StyledCellLabelProvider#update(ViewerCell)} to
> * return set all information needed to render a element. Use
> * {@link ViewerCell#setStyleRanges(StyleRange[])} to set style ranges
> * on the label.
>
> Any pointers to example use of SimpleStyledCellLabelProvider, or to
> information about ViewerCell?
>
> Basically, all I want to do is to have a multicolored label in a
> TreeViewer (no need for columns, etc). Any Suggestions?
>
> Regards
> - henrik
>
>
> Tom Schindl wrote:
>> http://wiki.eclipse.org/JFaceSnippets#Snippet049SimpleStyled CellLabelProvider
>> Tom
>>
>> Henrik Lindberg schrieb:
>>> Hi in 3.4M6 the tree labels in the Package explorer, and Outline shows
>>> examples where the label is multicolored. E.g. a method is rendered in
>>> the Outline view with black method name, and then the type i gold.
>>>
>>> How is this effect created? Greatful if someone can point me to an
>>> example (or how/where to find code that does this).
>>>
>>> Regards
>>> - henrik
>>
Re: How to have multicolored tree label [message #327508 is a reply to message #327500] Tue, 22 April 2008 18:25 Go to previous message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
Thanks!
Much better!

(The link is now
http://wiki.eclipse.org/JFaceSnippets#Snippet049StyledCellLa belProvider
since the name changed).

Regards
- henrik

Boris Bokowski wrote:
> Have a look at the wiki page again. We did update the snippets (they now use
> StyledCellLabelProvider instead of SimpleStyledCellLabelProvider), but
> because of a "feature" in ViewCVS, you were still seeing the old snippets.
>
> Boris
>
> "Henrik Lindberg" <henrik.lindberg@cloudsmith.com> wrote in message
> news:fuij19$d3n$1@build.eclipse.org...
>> Thanks Tom,
>> A couple of follow up questions -
Previous Topic:Re: Databinding and EFeatureMap (Re: AdapterFactoryContentProvider and notificat
Next Topic:Copy as RTF
Goto Forum:
  


Current Time: Tue Sep 17 12:15:05 GMT 2024

Powered by FUDForum. Page generated in 0.44976 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top