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.
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.
Created attachment 2697 [details] EvalAnnotationOriginal.java
I have tested the sample annotation and it's no longer a problem *** This issue has been marked as a duplicate of 16270 ***
Resolved for 3.3.x or earlier, no new info since then -> closing.