This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 15915 - ToolTips: problems with asynchronous support
Summary: ToolTips: problems with asynchronous support
Status: CLOSED DUPLICATE of bug 16270
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@editor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-09-26 08:33 UTC by Torbjorn Norbye
Modified: 2007-11-05 13:44 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
EvalAnnotationOriginal.java (972 bytes, patch)
2001-09-26 08:37 UTC, Torbjorn Norbye
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Torbjorn Norbye 2001-09-26 08:33:39 UTC
In editor/www/doc/Proposals/Tooltip/UsersView.html the sample code
for tooltip computation is not asynchronous - it calls doc.render,
and doc.render turns right around and calls run() from the same
thread so by the end of the call we return the string, not null,
from getShortDescription().

When I implement this asynchronously, such that getShortDescription
just returns null and a second later we set the tooltip text,
things don't seem to work (or, perhaps my code for setting the
text/visibility isn't right?)       All I see is a small black line
near the cursor (where the tooltip should be) - and that's only
the first time I hover over text - the second time I see nothing.

Here's a very basic program which shows this: add this as your tooltip
computation class (I'll add it as an attachment too, but I've had
problems with issuezilla and attachments in the past so I'm inlining
it as well:


package com.sun.forte.developer.ipe.debugger;

import java.lang.Thread;
import java.awt.*;
import javax.swing.*;
import javax.swing.text.*;
import java.io.*;

import org.openide.text.*;
import org.openide.util.RequestProcessor;

public class EvalAnnotationOriginal extends Annotation {
    
    public String getShortDescription() {
	RequestProcessor.postRequest (new Runnable () {
		public void run () {
		    SwingUtilities.invokeLater(new Runnable () {
			    public void run () {
				try {
				    Thread.sleep(1000);
				    run2();
				} catch (Exception e) {
				    e.printStackTrace();
				}
			    }
			});
		}
	    });
	return null;
    }
    
    public void run2() {
	firePropertyChange(PROP_SHORT_DESCRIPTION,
			   null, "Delayed Result");
    }

    public String getAnnotationType() {
	return null; // Currently return null annotation type
    }
}

All the program does is basically return null from getShortDescription,
and then arrange for the short description property to be updated 1 second
later asynchronously.
Comment 1 Torbjorn Norbye 2001-09-26 08:37:15 UTC
Created attachment 2697 [details]
EvalAnnotationOriginal.java
Comment 2 Miloslav Metelka 2001-10-11 16:50:29 UTC
I have tested the sample annotation and it's no longer a problem

*** This issue has been marked as a duplicate of 16270 ***
Comment 3 Quality Engineering 2003-06-30 18:05:38 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.
Comment 4 Quality Engineering 2003-06-30 18:15:09 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.