Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Two sets of tooltips
Two sets of tooltips [message #324933] Mon, 04 February 2008 11:57 Go to next message
Eclipse UserFriend
This is a multipart message in MIME format.
--=_alternative 005D3141802573E5_=
Content-Type: text/plain; charset="US-ASCII"

I have added a fancy tool tip provider which just provides a multiline
wrapped Text object to display the tooltip. The problem I am encountering
is that the first one or two times I hover the mouse I get the normal
tooltip and mine appearing. After that I just get mine. How do I stop the
normal ones appearing. Using Windows Vista if that makes any difference.
Borrowed the code straight out of the snipet.

private static class FancyToolTipSupport extends
ColumnViewerToolTipSupport {

protected FancyToolTipSupport(final ColumnViewer viewer, final int style,
final boolean manualActivation) {
super(viewer, style, manualActivation);
}

protected Composite createToolTipContentArea(final Event event, final
Composite parent) {
final Composite composite = new Composite(parent, SWT.NONE);
final Text text = new Text(composite, SWT.MULTI | SWT.WRAP);
text.setText(getText(event));
text.setSize(800, 60);
return composite;
}

public boolean isHideOnMouseDown() {
return false;
}

public static final void enableFor(final ColumnViewer viewer) {
new FancyToolTipSupport(viewer, ToolTip.NO_RECREATE, false);
}
}

FancyToolTipSupport.enableFor(tableViewer);

descriptionColumn.setLabelProvider(new ColumnLabelProvider() {

public String getToolTipText(final Object element) {
if (element instanceof Counter) {
final Counter counter = (Counter) element;
return counter.getQuoteItemName() + " : " +
counter.getWarningDescription(); //$NON-NLS-1$
}
return Messages.na;
}

public Point getToolTipShift(final Object object) {
return new Point(5, 5);
}

public int getToolTipDisplayDelayTime(final Object object) {
return 200;
}

public int getToolTipTimeDisplayed(final Object object) {
return 5000;
}

plus the getText etc that was there before.
--=_alternative 005D3141802573E5_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">I have added a fancy tool tip provider
which just provides a multiline wrapped Text object to display the tooltip.
The problem I am encountering is that the first one or two times I hover
the mouse I get the normal tooltip and mine appearing. After that I just
get mine. How do I stop the normal ones appearing. Using Windows Vista
if that makes any difference. Borrowed the code straight out of the snipet.</font>
<br>
<br><font size=2 color=#820040 face="Courier New"><b>private</b></font><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>static</b></font><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>class</b></font><font size=2 face="Courier New">
FancyToolTipSupport </font><font size=2 color=#820040 face="Courier New"><b>extends</b></font><font size=2 face="Courier New">
ColumnViewerToolTipSupport {</font>
<br>
<br><font size=2 color=#820040 face="Courier New"><b>protected</b></font><font size=2 face="Courier New">
FancyToolTipSupport(</font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
ColumnViewer viewer, </font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>int</b></font><font size=2 face="Courier New">
style, </font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>boolean</b></font><font size=2 face="Courier New">
manualActivation) {</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>super</b></font><font size=2 face="Courier New">(viewer,
style, manualActivation);</font>
<br><font size=2 face="Courier New">}</font>
<br>
<br><font size=2 color=#820040 face="Courier New"><b>protected</b></font><font size=2 face="Courier New">
Composite createToolTipContentArea(</font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
Event event, </font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
Composite parent) {</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
Composite composite = </font><font size=2 color=#820040 face="Courier New"><b>new</b></font><font size=2 face="Courier New">
Composite(parent, SWT.</font><font size=2 color=#0021bf face="Courier New"><i>NONE</i></font><font size=2 face="Courier New">);</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
Text text = </font><font size=2 color=#820040 face="Courier New"><b>new</b></font><font size=2 face="Courier New">
Text(composite, SWT.</font><font size=2 color=#0021bf face="Courier New"><i>MULTI</i></font><font size=2 face="Courier New">
| SWT.</font><font size=2 color=#0021bf face="Courier New"><i>WRAP</i></font><font size=2 face="Courier New">);</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; text.setText(getText(event));</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; text.setSize(800,
60);</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>return</b></font><font size=2 face="Courier New">
composite;</font>
<br><font size=2 face="Courier New">}</font>
<br>
<br><font size=2 color=#820040 face="Courier New"><b>public</b></font><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>boolean</b></font><font size=2 face="Courier New">
isHideOnMouseDown() {</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>return</b></font><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>false</b></font><font size=2 face="Courier New">;</font>
<br><font size=2 face="Courier New">}</font>
<br>
<br><font size=2 color=#820040 face="Courier New"><b>public</b></font><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>static</b></font><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>void</b></font><font size=2 face="Courier New">
enableFor(</font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
ColumnViewer viewer) {</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>new</b></font><font size=2 face="Courier New">
FancyToolTipSupport(viewer, ToolTip.</font><font size=2 color=#0021bf face="Courier New"><i>NO_RECREATE</i></font><font size=2 face="Courier New">,
</font><font size=2 color=#820040 face="Courier New"><b>false</b></font><font size=2 face="Courier New">);</font>
<br><font size=2 face="Courier New">}</font>
<br><font size=2 face="Courier New">}</font>
<br>
<br><font size=2 face="Courier New">FancyToolTipSupport.<i>enableFor</i>(</font><font size=2 color=#0021bf face="Courier New">tableViewer</font><font size=2 face="Courier New">);</font>
<br>
<br><font size=2 face="Courier New">descriptionColumn.setLabelProvider(</font><font size=2 color=#820040 face="Courier New"><b>new</b></font><font size=2 face="Courier New">
ColumnLabelProvider() {</font>
<br>
<br><font size=2 color=#820040 face="Courier New"><b>public</b></font><font size=2 face="Courier New">
String getToolTipText(</font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
Object element) {</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>if</b></font><font size=2 face="Courier New">
(element </font><font size=2 color=#820040 face="Courier New"><b>instanceof</b></font><font size=2 face="Courier New">
Counter) {</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
Counter counter = (Counter) element;</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>return</b></font><font size=2 face="Courier New">
counter.getQuoteItemName() + </font><font size=2 color=#4200ff face="Courier New">&quot;
: &quot;</font><font size=2 face="Courier New"> + counter.getWarningDescription();
</font><font size=2 color=#3f8080 face="Courier New">//$NON-NLS-1$</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; }</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>return</b></font><font size=2 face="Courier New">
Messages.</font><font size=2 color=#0021bf face="Courier New"><i>na</i></font><font size=2 face="Courier New">;</font>
<br><font size=2 face="Courier New">}</font>
<br>
<br><font size=2 color=#820040 face="Courier New"><b>public</b></font><font size=2 face="Courier New">
Point getToolTipShift(</font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
Object object) {</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>return</b></font><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>new</b></font><font size=2 face="Courier New">
Point(5, 5);</font>
<br><font size=2 face="Courier New">}</font>
<br>
<br><font size=2 color=#820040 face="Courier New"><b>public</b></font><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>int</b></font><font size=2 face="Courier New">
getToolTipDisplayDelayTime(</font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
Object object) {</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>return</b></font><font size=2 face="Courier New">
200;</font>
<br><font size=2 face="Courier New">}</font>
<br>
<br><font size=2 color=#820040 face="Courier New"><b>public</b></font><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>int</b></font><font size=2 face="Courier New">
getToolTipTimeDisplayed(</font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
Object object) {</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>return</b></font><font size=2 face="Courier New">
5000;</font>
<br><font size=2 face="Courier New">}</font>
<br>
<br><font size=2 face="Courier New">plus the getText etc that was there
before.</font>
--=_alternative 005D3141802573E5_=--
Re: Two sets of tooltips [message #324954 is a reply to message #324933] Mon, 04 February 2008 13:46 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I've never tested on Windows Vista. What we are doing to disable native
tooltips is to call Table.setToolTipText("") which seems to be wrong at
least how I read the Javadoc at the moment.

On the other hand it seems to work on other controls as well as on Vista
a sometime. Maybe the problem is that the ToolTip is already shown
before we ever set the value to "". Could you try to call
setToolTipText("") yourself when you setup the control?

I'm going to see if setToolTipText("") is correct or setToolTipText(null).

Tom

Phill_Perryman@Mitel.COM schrieb:
>
> I have added a fancy tool tip provider which just provides a multiline
> wrapped Text object to display the tooltip. The problem I am
> encountering is that the first one or two times I hover the mouse I get
> the normal tooltip and mine appearing. After that I just get mine. How
> do I stop the normal ones appearing. Using Windows Vista if that makes
> any difference. Borrowed the code straight out of the snipet.
>
> *private* *static* *class* FancyToolTipSupport *extends*
> ColumnViewerToolTipSupport {
>
> *protected* FancyToolTipSupport(*final* ColumnViewer viewer, *final*
> *int* style, *final* *boolean* manualActivation) {
> *super*(viewer, style, manualActivation);
> }
>
> *protected* Composite createToolTipContentArea(*final* Event event,
> *final* Composite parent) {
> *final* Composite composite = *new* Composite(parent, SWT./NONE/);
> *final* Text text = *new* Text(composite, SWT./MULTI/ |
> SWT./WRAP/);
> text.setText(getText(event));
> text.setSize(800, 60);
> *return* composite;
> }
>
> *public* *boolean* isHideOnMouseDown() {
> *return* *false*;
> }
>
> *public* *static* *final* *void* enableFor(*final* ColumnViewer viewer) {
> *new* FancyToolTipSupport(viewer, ToolTip./NO_RECREATE/, *false*);
> }
> }
>
> FancyToolTipSupport./enableFor/(tableViewer);
>
> descriptionColumn.setLabelProvider(*new* ColumnLabelProvider() {
>
> *public* String getToolTipText(*final* Object element) {
> *if* (element *instanceof* Counter) {
> *final* Counter counter = (Counter) element;
> *return* counter.getQuoteItemName() + " : " +
> counter.getWarningDescription(); //$NON-NLS-1$
> }
> *return* Messages./na/;
> }
>
> *public* Point getToolTipShift(*final* Object object) {
> *return* *new* Point(5, 5);
> }
>
> *public* *int* getToolTipDisplayDelayTime(*final* Object object) {
> *return* 200;
> }
>
> *public* *int* getToolTipTimeDisplayed(*final* Object object) {
> *return* 5000;
> }
>
> plus the getText etc that was there before.


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Two sets of tooltips [message #325071 is a reply to message #324954] Thu, 07 February 2008 10:38 Go to previous messageGo to next message
Eclipse UserFriend
This is a multipart message in MIME format.
--=_alternative 0055EB39802573E8_=
Content-Type: text/plain; charset="US-ASCII"

Calling table.setTooltipText("") when I create the table stops the normal
tooltip from appearing. If I use setTooltipText(null) I still get the
double tooltips.

So setting to "" on creation works for me.
--=_alternative 0055EB39802573E8_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">Calling table.setTooltipText(&quot;&quot;)
when I create the table stops the normal tooltip from appearing. If I use
setTooltipText(null) I still get the double tooltips.</font>
<br>
<br><font size=2 face="sans-serif">So setting to &quot;&quot; on creation
works for me.</font>
--=_alternative 0055EB39802573E8_=--
Re: Two sets of tooltips [message #325073 is a reply to message #325071] Thu, 07 February 2008 10:56 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Could you please file a bug so that we can do this when calling this for
your when we attach the tooltip-support.

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=UI&short_desc=[Viewers]

Tom

Phill_Perryman@Mitel.COM schrieb:
>
> Calling table.setTooltipText("") when I create the table stops the
> normal tooltip from appearing. If I use setTooltipText(null) I still get
> the double tooltips.
>
> So setting to "" on creation works for me.


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Two sets of tooltips [message #325148 is a reply to message #325073] Mon, 11 February 2008 04:31 Go to previous message
Eclipse UserFriend
This is a multipart message in MIME format.
--=_alternative 003446F6802573EC_=
Content-Type: text/plain; charset="US-ASCII"

https://bugs.eclipse.org/bugs/show_bug.cgi?id=218471
--=_alternative 003446F6802573EC_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">https://bugs.eclipse.org/bugs/show_bug.cgi?id=218471</font>
--=_alternative 003446F6802573EC_=--
Previous Topic:Editor resize listener
Next Topic:Problems on starting an RCP with EclipseStarter
Goto Forum:
  


Current Time: Thu Sep 18 19:37:15 EDT 2025

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

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

Back to the top