Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Text formatting with label provider
Text formatting with label provider [message #481618] Fri, 21 August 2009 21:41 Go to next message
Christoph Höger is currently offline Christoph HögerFriend
Messages: 40
Registered: July 2009
Member
Hi,

As you can see from the jdts display of Libraries, there is some way to
change the text style of text in the navigator (e.g. the JREs name is
dark gray).
Since that text is simply returned as a string by a LabelProvider I was
wondering how. Is there some kind of magic formatting for that kind of
stuff or does one have to register a special "FormattingDecorator" for this?

regards

Christoph
Re: Text formatting with label provider [message #481741 is a reply to message #481618] Mon, 24 August 2009 07:47 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Christoph Höger wrote:
> Hi,
>
> As you can see from the jdts display of Libraries, there is some way
> to change the text style of text in the navigator (e.g. the JREs name
> is dark gray).
> Since that text is simply returned as a string by a LabelProvider I
> was wondering how. Is there some kind of magic formatting for that
> kind of stuff or does one have to register a special
> "FormattingDecorator" for this?
What exactly do you want to do?

Dani
>
> regards
>
> Christoph
Re: Text formatting with label provider [message #481952 is a reply to message #481741] Mon, 24 August 2009 20:03 Go to previous messageGo to next message
Christoph Höger is currently offline Christoph HögerFriend
Messages: 40
Registered: July 2009
Member
> What exactly do you want to do?

I have custom Navigator elements (in that case entries for referenced
libraries) for my Modelica projects. I want those elements to be
rendered with custom colors.
You can see a similar feature in JDT: The system library is called "JRE
System Library" (in black) followed by the JRE version in dark gray.
Single library entries have a name and their path in light gray.
That is what I would like to archive for my elements.
Re: Text formatting with label provider [message #481958 is a reply to message #481952] Mon, 24 August 2009 20:45 Go to previous messageGo to next message
Jacob Fancher is currently offline Jacob FancherFriend
Messages: 1
Registered: July 2009
Junior Member
I think what you are looking for are the styled label providers added in
3.4. Take a look at these snippets:

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.s nippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippet s/viewers/Snippet049StyledCellLabelProvider.java?view=markup
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.s nippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippet s/viewers/Snippet050DelegatingStyledCellLabelProvider.java?v iew=markup

I believe if you use a lightweight decorator to add a prefix or suffix
to an element, it will style it in a different color as well. Though the
color it chooses for the decoration is a platform-wide preference.

Christoph Höger wrote:
>> What exactly do you want to do?
>
> I have custom Navigator elements (in that case entries for referenced
> libraries) for my Modelica projects. I want those elements to be
> rendered with custom colors.
> You can see a similar feature in JDT: The system library is called "JRE
> System Library" (in black) followed by the JRE version in dark gray.
> Single library entries have a name and their path in light gray.
> That is what I would like to archive for my elements.
Re: Text formatting with label provider [message #482174 is a reply to message #481952] Tue, 25 August 2009 15:01 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Christoph Höger wrote:
>> What exactly do you want to do?
>
> I have custom Navigator elements (in that case entries for referenced
> libraries) for my Modelica projects. I want those elements to be
> rendered with custom colors.
> You can see a similar feature in JDT: The system library is called
> "JRE System Library" (in black) followed by the JRE version in dark
> gray. Single library entries have a name and their path in light gray.
> That is what I would like to archive for my elements.
Let your label provider implement
org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider. IStyledLabelProvider.

Dani
Re: Text formatting with label provider [message #482773 is a reply to message #482174] Thu, 27 August 2009 21:43 Go to previous message
Christoph Höger is currently offline Christoph HögerFriend
Messages: 40
Registered: July 2009
Member
Thanks alot Daniel and Jacob!

That was what I was searching for.
Previous Topic:debug JSTL variables
Next Topic:Using P2 to deploy plugins with fragments
Goto Forum:
  


Current Time: Thu Apr 25 05:28:05 GMT 2024

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

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

Back to the top