Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Setting the text color of the tree label provider
Setting the text color of the tree label provider [message #419523] Mon, 26 May 2008 13:09 Go to next message
Mircea Luchian is currently offline Mircea LuchianFriend
Messages: 89
Registered: July 2009
Member
Hello,

I have a custom AdapterFactoryLabelProvider for my EMF tabletree. I
customize the text with no problem, however I want to set it's color. I
cannot use it in public String getColumnText(Object object, int
columnIndex) because the function returns only a String.
How can I change the text color? Do I need to overrite another function
in another class?

Thanks,

Mircea
Re: Setting the text color of the tree label provider [message #419525 is a reply to message #419523] Mon, 26 May 2008 13:30 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Your LabelProvider has to implement ITableColorLabelProvider and then
you can control the color. I don't know if AdapterFactoryLabelProvider
already implements this none mandatory interface.

Tom

Mircea Luchian schrieb:
> Hello,
>
> I have a custom AdapterFactoryLabelProvider for my EMF tabletree. I
> customize the text with no problem, however I want to set it's color. I
> cannot use it in public String getColumnText(Object object, int
> columnIndex) because the function returns only a String.
> How can I change the text color? Do I need to overrite another function
> in another class?
>
> Thanks,
>
> Mircea


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Setting the text color of the tree label provider [message #419526 is a reply to message #419525] Mon, 26 May 2008 14:03 Go to previous messageGo to next message
Mircea Luchian is currently offline Mircea LuchianFriend
Messages: 89
Registered: July 2009
Member
Would you happen to know in which plugin this interface might be? I
didn't find it in the source code of the eclipse plugins.

Mircea

Tom Schindl wrote:
> Your LabelProvider has to implement ITableColorLabelProvider and then
> you can control the color. I don't know if AdapterFactoryLabelProvider
> already implements this none mandatory interface.
>
> Tom
>
> Mircea Luchian schrieb:
>> Hello,
>>
>> I have a custom AdapterFactoryLabelProvider for my EMF tabletree. I
>> customize the text with no problem, however I want to set it's color.
>> I cannot use it in public String getColumnText(Object object, int
>> columnIndex) because the function returns only a String.
>> How can I change the text color? Do I need to overrite another
>> function in another class?
>>
>> Thanks,
>>
>> Mircea
>
>
Re: Setting the text color of the tree label provider [message #419528 is a reply to message #419526] Mon, 26 May 2008 14:29 Go to previous messageGo to next message
Mircea Luchian is currently offline Mircea LuchianFriend
Messages: 89
Registered: July 2009
Member
It's ITableColorProvider.

Mircea Luchian wrote:
> Would you happen to know in which plugin this interface might be? I
> didn't find it in the source code of the eclipse plugins.
>
> Mircea
>
> Tom Schindl wrote:
>> Your LabelProvider has to implement ITableColorLabelProvider and then
>> you can control the color. I don't know if
>> AdapterFactoryLabelProvider already implements this none mandatory
>> interface.
>>
>> Tom
>>
>> Mircea Luchian schrieb:
>>> Hello,
>>>
>>> I have a custom AdapterFactoryLabelProvider for my EMF tabletree. I
>>> customize the text with no problem, however I want to set it's
>>> color. I cannot use it in public String getColumnText(Object object,
>>> int columnIndex) because the function returns only a String.
>>> How can I change the text color? Do I need to overrite another
>>> function in another class?
>>>
>>> Thanks,
>>>
>>> Mircea
>>
>>
>
Re: Setting the text color of the tree label provider [message #419534 is a reply to message #419528] Mon, 26 May 2008 15:02 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Mircea,

Note that AdapterFactoryLabelProvider.ColorProvider will help. Perhaps
you'll want your item providers to support ITableItemColorProvider;
you'll need to declare that in your adapter factory too and you'll
likely want to update the plugin.xml registration to indicate your
factory supports that...


Mircea Luchian wrote:
> It's ITableColorProvider.
>
> Mircea Luchian wrote:
>> Would you happen to know in which plugin this interface might be? I
>> didn't find it in the source code of the eclipse plugins.
>>
>> Mircea
>>
>> Tom Schindl wrote:
>>> Your LabelProvider has to implement ITableColorLabelProvider and
>>> then you can control the color. I don't know if
>>> AdapterFactoryLabelProvider already implements this none mandatory
>>> interface.
>>>
>>> Tom
>>>
>>> Mircea Luchian schrieb:
>>>> Hello,
>>>>
>>>> I have a custom AdapterFactoryLabelProvider for my EMF tabletree. I
>>>> customize the text with no problem, however I want to set it's
>>>> color. I cannot use it in public String getColumnText(Object
>>>> object, int columnIndex) because the function returns only a String.
>>>> How can I change the text color? Do I need to overrite another
>>>> function in another class?
>>>>
>>>> Thanks,
>>>>
>>>> Mircea
>>>
>>>
>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Setting the text color of the tree label provider [message #419538 is a reply to message #419534] Mon, 26 May 2008 15:43 Go to previous messageGo to next message
Mircea Luchian is currently offline Mircea LuchianFriend
Messages: 89
Registered: July 2009
Member
Thanks Ed,

What I did was to implement the ITableColorProvider. It works fine (I
have a CustomAdapterFactoryLabelProvider that extends
AdapterFactoryLabelProvider and implements ITableColorProvider).
What fundamental difference would the method you described have vs
implementing the ITableColorProvider interface?

Mircea

Ed Merks wrote:
> Mircea,
>
> Note that AdapterFactoryLabelProvider.ColorProvider will help.
> Perhaps you'll want your item providers to support
> ITableItemColorProvider; you'll need to declare that in your adapter
> factory too and you'll likely want to update the plugin.xml
> registration to indicate your factory supports that...
>
>
> Mircea Luchian wrote:
>> It's ITableColorProvider.
>>
>> Mircea Luchian wrote:
>>> Would you happen to know in which plugin this interface might be? I
>>> didn't find it in the source code of the eclipse plugins.
>>>
>>> Mircea
>>>
>>> Tom Schindl wrote:
>>>> Your LabelProvider has to implement ITableColorLabelProvider and
>>>> then you can control the color. I don't know if
>>>> AdapterFactoryLabelProvider already implements this none mandatory
>>>> interface.
>>>>
>>>> Tom
>>>>
>>>> Mircea Luchian schrieb:
>>>>> Hello,
>>>>>
>>>>> I have a custom AdapterFactoryLabelProvider for my EMF tabletree.
>>>>> I customize the text with no problem, however I want to set it's
>>>>> color. I cannot use it in public String getColumnText(Object
>>>>> object, int columnIndex) because the function returns only a String.
>>>>> How can I change the text color? Do I need to overrite another
>>>>> function in another class?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Mircea
>>>>
>>>>
>>>
Re: Setting the text color of the tree label provider [message #419540 is a reply to message #419538] Mon, 26 May 2008 15:53 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Mircea,

Comments below.


Mircea Luchian wrote:
> Thanks Ed,
>
> What I did was to implement the ITableColorProvider. It works fine (I
> have a CustomAdapterFactoryLabelProvider that extends
> AdapterFactoryLabelProvider and implements ITableColorProvider).
That's exactly what the existing (in EMF 2.4) class does.
> What fundamental difference would the method you described have vs
> implementing the ITableColorProvider interface?
Like the IItemLabelProvider interfaces, it delegates control of the
colors to the item providers themselves so that each generated item
provider can control the colors directly.
>
> Mircea
>
> Ed Merks wrote:
>> Mircea,
>>
>> Note that AdapterFactoryLabelProvider.ColorProvider will help.
>> Perhaps you'll want your item providers to support
>> ITableItemColorProvider; you'll need to declare that in your adapter
>> factory too and you'll likely want to update the plugin.xml
>> registration to indicate your factory supports that...
>>
>>
>> Mircea Luchian wrote:
>>> It's ITableColorProvider.
>>>
>>> Mircea Luchian wrote:
>>>> Would you happen to know in which plugin this interface might be? I
>>>> didn't find it in the source code of the eclipse plugins.
>>>>
>>>> Mircea
>>>>
>>>> Tom Schindl wrote:
>>>>> Your LabelProvider has to implement ITableColorLabelProvider and
>>>>> then you can control the color. I don't know if
>>>>> AdapterFactoryLabelProvider already implements this none mandatory
>>>>> interface.
>>>>>
>>>>> Tom
>>>>>
>>>>> Mircea Luchian schrieb:
>>>>>> Hello,
>>>>>>
>>>>>> I have a custom AdapterFactoryLabelProvider for my EMF tabletree.
>>>>>> I customize the text with no problem, however I want to set it's
>>>>>> color. I cannot use it in public String getColumnText(Object
>>>>>> object, int columnIndex) because the function returns only a String.
>>>>>> How can I change the text color? Do I need to overrite another
>>>>>> function in another class?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Mircea
>>>>>
>>>>>
>>>>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Disable Drag and Drop for a list (0..*) feature
Next Topic:IactionDelegate.selectionChanged returns null?
Goto Forum:
  


Current Time: Fri Apr 26 20:54:40 GMT 2024

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

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

Back to the top