Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Can decorators modify tooltips
Can decorators modify tooltips [message #328937] Fri, 06 June 2008 22:34 Go to next message
John Reysa is currently offline John ReysaFriend
Messages: 21
Registered: July 2009
Junior Member
I have a label provider for a TreeViewer that implements
ILightWeightLabelProvider. I wanted to alter or possibly overwrite the
tooltip based on the status of the decorator. Is this possible?

I tried converting my label provider to extend ColumnLabelProvider but it
doesn't seem to work when I pass it in to the DecoratingLabelProvider.
Even if it did, it doesn't appear there is an api for the decorator to
update the tooltip.

The thinking was that I wanted to give users some extra information/help
based on the status of an object. Is there a better way to achieve this?
Re: Can decorators modify tooltips [message #328945 is a reply to message #328937] Sat, 07 June 2008 15:43 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Does this one help[1]. I didn't had time to port in 3.4 but it should
work. If it does could you please comment on the bug and tells what
problems you faced. I'd like to resolve this issue in 3.5 and add a
implementation to JFace.

Tom

[1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=182216

John Reysa schrieb:
> I have a label provider for a TreeViewer that implements
> ILightWeightLabelProvider. I wanted to alter or possibly overwrite the
> tooltip based on the status of the decorator. Is this possible?
>
> I tried converting my label provider to extend ColumnLabelProvider but
> it doesn't seem to work when I pass it in to the
> DecoratingLabelProvider. Even if it did, it doesn't appear there is an
> api for the decorator to update the tooltip.
>
> The thinking was that I wanted to give users some extra information/help
> based on the status of an object. Is there a better way to achieve this?
>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Can decorators modify tooltips [message #329071 is a reply to message #328945] Thu, 12 June 2008 04:25 Go to previous messageGo to next message
John Reysa is currently offline John ReysaFriend
Messages: 21
Registered: July 2009
Junior Member
Tom, I'll do that. On a quick glance through the code, I don't see how
the tool tip can be affected by the decoration status, but I will try to
get something working and comment that bug.
Re: Can decorators modify tooltips [message #329074 is a reply to message #329071] Thu, 12 June 2008 07:04 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
The information for the tooltip is always requested before it is shown
to the user so there's no special asyn-decoration needed if only the
text shown should change.

Tom

John Reysa schrieb:
> Tom, I'll do that. On a quick glance through the code, I don't see how
> the tool tip can be affected by the decoration status, but I will try to
> get something working and comment that bug.
>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Can decorators modify tooltips [message #329113 is a reply to message #329074] Thu, 12 June 2008 22:42 Go to previous messageGo to next message
John Reysa is currently offline John ReysaFriend
Messages: 21
Registered: July 2009
Junior Member
I've done the following:
1) Added your DecoratingCellLabelProvider to a workspace plugin and put it
in a org.eclipse.jface.viewers package
2) Changed the references to DecorationContext.RESOURCE_MANAGER_KEY to
"DecorationContext.RESOURCE_MANAGER_KEY" since my 3.3 version of
DecorationContext did not have that String defined
3) Created an ILabelProvider that extends ColumnLabelProvider
- Created overrides for getToolTipText and getToolTipImage
4) enabled tooltips with the ColumnViewerToolTipSupport.enableFor(viewer)

Results:
- decorators work as they did before
- tooltips now show up

Problem:
- I may be missing something stupid, but I don't see how the
ColumnLabelProvider can see what decorations were added. My decoration is
expensive, so I don't want to re-do it here. I was thinking there would
be an addition to the ILabelDecorator or ILightweightLabelDecorator that
allowed me to decorate or overwrite the tooltip.
Re: Can decorators modify tooltips [message #329117 is a reply to message #329113] Fri, 13 June 2008 07:47 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi John,

I'm not so familiar with decorators. You are asking how to cache the
result for the getToolTipText/getToolTipImage instead of calculating it
every time?

Tom

John Reysa schrieb:
> I've done the following:
> 1) Added your DecoratingCellLabelProvider to a workspace plugin and put
> it in a org.eclipse.jface.viewers package
> 2) Changed the references to DecorationContext.RESOURCE_MANAGER_KEY to
> "DecorationContext.RESOURCE_MANAGER_KEY" since my 3.3 version of
> DecorationContext did not have that String defined
> 3) Created an ILabelProvider that extends ColumnLabelProvider
> - Created overrides for getToolTipText and getToolTipImage
> 4) enabled tooltips with the ColumnViewerToolTipSupport.enableFor(viewer)
>
> Results:
> - decorators work as they did before
> - tooltips now show up
>
> Problem: - I may be missing something stupid, but I don't see how the
> ColumnLabelProvider can see what decorations were added. My decoration
> is expensive, so I don't want to re-do it here. I was thinking there
> would be an addition to the ILabelDecorator or
> ILightweightLabelDecorator that allowed me to decorate or overwrite the
> tooltip.
>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Can decorators modify tooltips [message #329128 is a reply to message #329117] Fri, 13 June 2008 13:24 Go to previous messageGo to next message
John Reysa is currently offline John ReysaFriend
Messages: 21
Registered: July 2009
Junior Member
I like what you've done on getting tools tips, base image and base labels
for an object and that all seems to fit well in the label provider. The
decorator is nice because it is run in the background and in my case
checks on the status of all the objects (a series of database queries and
file accesses) and decorates the text and labels appropriately. While I
have that status information in the decorator code, I would like to be
able to modify the tooltip to tell the user how to address the specific
status issue. I think this would be better than
a) persisting the status in the decorator code or my object
b) Getting access to the decorator text, deciphering it, and modifying the
tooltip through the label provider.
Now that I understand bug 182216 (which did fix the first of my two
problems), should I open a new bug to request adding a new method to the
decorator interfaces?
Re: Can decorators modify tooltips [message #329130 is a reply to message #329128] Fri, 13 June 2008 13:56 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Yes please file a bug and cc me on it.

Tom

John Reysa schrieb:
> I like what you've done on getting tools tips, base image and base
> labels for an object and that all seems to fit well in the label
> provider. The decorator is nice because it is run in the background and
> in my case checks on the status of all the objects (a series of database
> queries and file accesses) and decorates the text and labels
> appropriately. While I have that status information in the decorator
> code, I would like to be able to modify the tooltip to tell the user how
> to address the specific status issue. I think this would be better than
> a) persisting the status in the decorator code or my object
> b) Getting access to the decorator text, deciphering it, and modifying
> the tooltip through the label provider.
> Now that I understand bug 182216 (which did fix the first of my two
> problems), should I open a new bug to request adding a new method to the
> decorator interfaces?
>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Previous Topic:3.4rc4, manual build failed
Next Topic:eclipse prog launch failure, binaries,toolchain
Goto Forum:
  


Current Time: Thu Nov 07 05:21:58 GMT 2024

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

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

Back to the top