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 216833 - Highlight matches in "Go to Type"-dialog
Summary: Highlight matches in "Go to Type"-dialog
Status: RESOLVED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Jump To (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords: PATCH_AVAILABLE
Depends on:
Blocks:
 
Reported: 2012-08-14 00:22 UTC by markiewb
Modified: 2012-10-31 14:40 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
proposal-patch for this feature (24.68 KB, application/octet-stream)
2012-08-14 00:22 UTC, markiewb
Details
proposal-patch for this feature (24.68 KB, patch)
2012-08-14 00:23 UTC, markiewb
Details | Diff
Screenshot showing the patch in action (22.00 KB, image/png)
2012-08-14 00:27 UTC, markiewb
Details
Simplified patch based on main (12.93 KB, patch)
2012-08-17 20:42 UTC, markiewb
Details | Diff
Proposed patch - simplified and added license header (133.02 KB, patch)
2012-08-17 21:00 UTC, markiewb
Details | Diff
Non broken patch (18.07 KB, patch)
2012-08-24 00:01 UTC, markiewb
Details | Diff
bold highlighting is hardly to notice (39.29 KB, image/png)
2012-08-29 18:11 UTC, markiewb
Details
Patch to support colors (3.18 KB, patch)
2012-09-14 23:15 UTC, markiewb
Details | Diff
Patch to support colors in action (58.66 KB, image/png)
2012-09-14 23:16 UTC, markiewb
Details
Selected item cannot be read - foreground color has to be set too (19.67 KB, image/png)
2012-09-24 18:33 UTC, markiewb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2012-08-14 00:22:24 UTC
Created attachment 123069 [details]
proposal-patch for this feature

Highlight the matches when searching in the "Go to Type"-dialog (like other IDEs)

Textual example:
The type 'AbstractDummyBarTest' is highlighted as '[A]bstract[D]ummy[B]ar[Test]' when searching for 'ADBTest'

Graphical example:
See attached screenshot

I attached a proposal-patch for this feature. Please have a look and try to integrate. Please ask, when there are any doubts.
Comment 1 markiewb 2012-08-14 00:23:22 UTC
Created attachment 123070 [details]
proposal-patch for this feature
Comment 2 markiewb 2012-08-14 00:27:17 UTC
Created attachment 123071 [details]
Screenshot showing the patch in action
Comment 3 markiewb 2012-08-17 20:42:59 UTC
Created attachment 123270 [details]
Simplified patch based on main
Comment 4 markiewb 2012-08-17 21:00:38 UTC
Created attachment 123272 [details]
Proposed patch - simplified and added license header
Comment 5 Tomas Zezula 2012-08-23 10:13:09 UTC
The last (final) patch is broken.
It shows that jumpto/src/org/netbeans/modules/jumpto/type/GoToPanel.java was completely changed, the same happened for GoToTypeAction.java.
It's nearly impossible to find out the actual change in these classes.

I will do some small changes to HighlightingTypeNameFormatter to allow eclipse like highlighting (bold font). Otherwise seems OK to me. I specially appreciate the unit test.

As soon as you fix the formatting problems causing the broken patch I will integrate it.
Thanks for the patch.
Comment 6 markiewb 2012-08-24 00:01:22 UTC
Created attachment 123489 [details]
Non broken patch
Comment 7 Tomas Zezula 2012-08-27 17:27:21 UTC
Fixed jet-main ff117dceedbe

Thanks Benno for both the patch and the idea!
I've integrated it, currently I use just bold font for matched name parts and I am letting the UI to choose colors.
I've also moved the HighlightingTypeNameFormatter to o.n.modules.jumpto.common.HighlightingNameFormatter and will use the highlighting also in Go To File and Go To Symbol dialogs.
It's really nice.
THANKS!
Comment 8 markiewb 2012-08-27 20:23:57 UTC
(In reply to comment #7)
> Fixed jet-main ff117dceedbe
> .... and will use the
> highlighting also in Go To File and Go To Symbol dialogs.

You could also use it
* in the code-completion popup, 
* in the "Go to Spring bean"-dialog
* while filtering in the inspect members/hierarchy
* ...
Comment 9 Tomas Zezula 2012-08-28 06:56:34 UTC
Fixed case sensitivity: jet-main  5e47ea187933
Highlighting for Go To Symbol: jet-main 0475bf9dd5de
Highlighting for Go To File: jet-main 72a75d3ad5c4
Comment 10 Tomas Zezula 2012-08-28 07:16:13 UTC
>You could also use it
>* in the code-completion popup, 
Right
>* in the "Go to Spring bean"-dialog
It should work out of the box, the Go To Spring Bean uses Go To Type by jumpto friend API.
>* while filtering in the inspect members/hierarchy
The inspect members/hierarchy was completely redesigned in NB 7.3. There are no more members/hierarchy dialogs. The Inspect Hierarchy has it's own component in main window and Inspect Members reuses Navigator. The new UI can be seen http://wiki.netbeans.org/File:Ide_hierarchy_mockup1.png.
I will think about the filtering.
Comment 11 Quality Engineering 2012-08-29 02:42:43 UTC
Integrated into 'main-golden', will be available in build *201208290001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/ff117dceedbe
User: Tomas Zezula <tzezula@netbeans.org>
Log: #216833:Highlight matches in "Go to Type"-dialog
Comment 12 markiewb 2012-08-29 18:11:53 UTC
Created attachment 123711 [details]
bold highlighting is hardly to notice

@Tomas:
The bold highlighting is hardly to notice. See the screenshot. 

Product Version: NetBeans IDE Dev (Build 201208290001)
Java: 1.6.0_30; Java HotSpot(TM) 64-Bit Server VM 20.5-b03
System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE (nb)
Comment 13 Tomas Zezula 2012-08-30 09:00:02 UTC
On Mac OS X is' much bolder.
I am still waiting for UI to select colors, when it's done I will enable the coloring as well.
Comment 14 Tomas Zezula 2012-08-31 07:24:22 UTC
Need to replace <span> tag as it causes UI problems on some L&F.
jet main f6575c11b351
Comment 15 Tomas Zezula 2012-08-31 08:18:35 UTC
Seems I will need to disable it.
The problem is that JLabel with HTML does not print the dots when there is not enough of space to render. :-(
For example for type:

SwingUtilities

there will be just

S

Instead of

S...

Wich is unacceptable as user does not see that the type name is incomplete.
Comment 16 Tomas Zezula 2012-08-31 20:49:23 UTC
Seems that I am able to render some subset of HTML with the "..." using NB HTMLRenderer.
But it's limited to support only <b> and <font color> no support for background color.
Also I need to do some tricks to keep it working when doing setText().
Comment 17 Tomas Zezula 2012-09-03 06:26:23 UTC
Highlighting done by HtmlRenderer using <b> tag.
jet-main 5c550f75d0ec
Comment 18 Quality Engineering 2012-09-04 01:09:40 UTC
Integrated into 'main-golden', will be available in build *201209040001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/5c550f75d0ec
User: Tomas Zezula <tzezula@netbeans.org>
Log: #216833:Highlight matches in "Go to Type"-dialog
Comment 19 markiewb 2012-09-14 23:15:10 UTC
Created attachment 124393 [details]
Patch to support colors

(In reply to comment #13)
> I am still waiting for UI to select colors, when it's done I will enable the
> coloring as well.

Any news about the colors?

In the meantime i propose another patch to introduce colors (based on current bgColor/fgColor and your committed code). It looks very neat IMHO. See screenshot.
Comment 20 markiewb 2012-09-14 23:16:31 UTC
Created attachment 124394 [details]
Patch to support colors in action

Here the screenshot with the mentioned colors (after applying the patch)
Comment 21 Petr Somol 2012-09-18 13:36:59 UTC
In view of the problem to be solved - to emphasize letters in displayed entity names while user is typing, and respecting the limitation that bold font must not be used due to a problem with Win7 - I have the following comments:

From UEX point of view introducing a specific color to emphasize letters (to display the letters themselves in that color) is not advisable. There is no standard color elsewhere in IDE for that purpose, so it would look out-of context, and, more seriously, it would introduce a color constant that could fail to work well if look-and-feel is changed. Another point is that while the main text is in black, any color would have to be brighter, so effectively the emphasized letters could visually slightly "tear" the entity names apart.

A better option seems to be to re-use a mechanism that already exists for emphasis of this kind in the editor - mark occurrences, or highlighting of search results. This means, the letters in question would be underlied by a bright colored background. The advantage is that the color to be used has a well defined meaning in the editor, thus is supported by LaFs. Another advantage is that it would feel familiar because it would work similarly as in the editor, while actually serving the same purpose as in the editor.
Comment 22 markiewb 2012-09-24 18:33:56 UTC
Created attachment 124824 [details]
Selected item cannot be read - foreground color has to be set too

There is an issue regarding the background color. See the attached screenshot. I had to reopen this issue.

Product Version: NetBeans IDE Dev (Build 201209240001)
Java: 1.6.0_33; Java HotSpot(TM) Client VM 20.8-b03
System: Windows XP version 5.1 running on x86; Cp1252; de_DE (nb)
Comment 23 Petr Somol 2012-09-27 13:40:24 UTC
copying valuable comment from Benno's e-mail which we should take into account, although I do not have a unanimous recommendation yet:

--------
...please have a look at highlighting in the quicksearch:
There is used a other font and this way the bold highlighting works - even now on my windows os.

But one time hightlighting via bold font and one time hightlighting via background color (in the future) is not very consequent. Please have a talk with the UI team about it.
--------
Comment 24 Tomas Zezula 2012-10-31 14:40:58 UTC
>Selected item cannot be read - foreground color has to be set too
Resolved