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.
Summary: | Problems with handling tooltips in o.o.awt.Actions.ButtonBridge | ||
---|---|---|---|
Product: | platform | Reporter: | Jan Lahoda <jlahoda> |
Component: | Actions | Assignee: | Jan Lahoda <jlahoda> |
Status: | VERIFIED FIXED | ||
Severity: | blocker | CC: | apireviews |
Priority: | P3 | Keywords: | API, API_REVIEW_FAST |
Version: | 5.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | |||
Bug Blocks: | 54851 | ||
Attachments: |
The patch.
Refined patch using runInEQ for tests. |
Description
Jan Lahoda
2005-04-18 09:50:46 UTC
Passing to actions subcomponent. I propose the following behavior: 1. if an action has a tooltip, it is always prefered over the name when the button's tooltip is created 2. the button's tooltip is automatically augmented with a shortcut even in case the action specifies the tooltip As the later is an incompatible change (actions which already augment the tooltip with the shortcut will have the shortcut doubled), I am asking for a fasttrack API review. I am attaching a diff that does the change in Actions, adds three tests to test the behavior, adds a note to apichanges.xml and increments spec version. Created attachment 21729 [details]
The patch.
Suggestion: if there is an existing tooltip, look for something that appears to be shortcut info - "(something)" where "something" could be produced by Actions.findKey - and if there is one, leave the tooltip along but log a warning to console giving the action class name and requesting that any keystroke info be removed from its tooltip. Should not + if (!SwingUtilities.isEventDispatchThread()) { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + try { + testTooltipsContainAccelerator(); + } catch (Exception e) { + IllegalStateException exc = new IllegalStateException(e.getMessage()); + + exc.initCause(e); + throw exc; + } + } + }); + return ; + } be replaced with protected boolean runInEQ () { return true; } That would automatically switch to AWT event thread. Re: runInEQ, yes, the tests should use this. I am attaching corrected patch (using this method). Created attachment 21758 [details]
Refined patch using runInEQ for tests.
Regarding inspecting the tooltip for potential shortcut: I am a bit afraid that this may unpredictably fail (not provide shortcut info in cases where it should be provided). If the tooltip is not inspected, the worst case is that the user sees two shortcut infos in the tooltip, which is not a big problem in my opinion. I have grepped the 4.1 codebase, and I did not find any action that would augment the tooltip with the shortcut info (some actions provide a custom tooltip, like JUnit/Open Test, and these are shown without the shortcut info). But, I can implement the tooltip inspection if it is a requirement. I don't think it's a requirement, given your comments. Was just checking if it had been considered. Unless there are any objections, I will commit this change tomorrow. Committed: Checking in openide-spec-vers.properties; /cvs/openide/openide-spec-vers.properties,v <-- openide-spec-vers.properties new revision: 1.173; previous revision: 1.172 done Checking in awt/apichanges.xml; /cvs/openide/awt/apichanges.xml,v <-- apichanges.xml new revision: 1.3; previous revision: 1.2 done Checking in awt/manifest.mf; /cvs/openide/awt/manifest.mf,v <-- manifest.mf new revision: 1.4; previous revision: 1.3 done Checking in awt/src/org/openide/awt/Actions.java; /cvs/openide/awt/src/org/openide/awt/Actions.java,v <-- Actions.java new revision: 1.2; previous revision: 1.1 done Checking in test/unit/src/org/openide/awt/ActionsTest.java; /cvs/openide/test/unit/src/org/openide/awt/ActionsTest.java,v <-- ActionsTest.java new revision: 1.11; previous revision: 1.10 done Verified. |