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.
When files/filesystem names are too long to be displayed in the file explorer window a tooltip should be displayed with the name of the file/filesystem when the mouse will point in it.
In my opinion, this is ENHANCEMENT not DEFECT, and it't WONTFIX, because the tooltip is now decribtion on node , it was request of UI team.
So do ou mean that for a java file node, we will see java file and for a text file we will see text file in the tooltip? If it is, do you really think that it worth to have tooltip to not display TIPs?
Created attachment 23047 [details] Implementation
I've attached a patch which implements the requested tooltips - actually it will work for any JList/JTree in a scroll pane - no NB specific code. In particular, it bounds correctly - there may be 2 popups if the cell is partially obscured on both the right and left (such a popup should never obscure the tree/list or mouse events won't reach the tree/list). Tested it also on mac - there's a minor glitch there, really an apple JDK bug, that sometimes it uses a heavyweight popup with a drop-shadow (making the popups look like they're not really part of the tree/list). I've asked on the apple java dev list how to create a JWindow w/o drop shadow (there's probably some dirty hack that will do it - if so, I'll fix that). Anyway, that shouldn't be an obstacle to integrating the patch.
Created attachment 23280 [details] Patch with mac workaround
I've attached a patch which fixes the popup drop shadow problem on the mac as follows: By default, on macintosh only, it will use a custom PopupFactory, which will always provide a lightweight Popup if the popup will fit inside the window, and a no-op Popup if it won't. Everywhere else it will use the standard Swing PopupFactory.getSharedInstance() with no special code. *If* you run with -J-Dnb.explorer.hw.completions=true on macintosh, then that will enable heavyweight Popups with the background color set to transparent to get rid of the drop shadow. So with this line switch, it is possible to have the popups extend out of a window (for example, in a horizontally-scrolled Explorer when the window is not maximized). These popups will have no drop shadow unless you move the mouse fast. Then once in a while you'll see a drop shadow. If you run with -J-Dnb.explorer.hw.completions=true *and* -J-Dnb.explorer.hw.cocoahack=true *and* --cp /System/Library/Java/ the custom popup factory will use reflection to look up the Cocoa NSWindow and eliminate drop shadows 100% of the time. If the classpath entry is omitted, it will fall back to the standard Swing PopupFactory gracefully. So, by default no special hackery is used - just there won't be popups that extend out of the main window on mac os. -- Note, a possible long-term solution: Implement what we do using Cocoa in a small JNI library as part of the applemenu module and have it install the custom PopupFactory in the default lookup, and have ViewTooltips.getPopupFactory() try to find its PopupFactory there the first time it's called.
1. if the cocoa hack is only available with the heavyweight hack, it's value should reflect it. private static final boolean APPLE_COCOA_HACK = APPLE_HEAVYWEIGHT && Boolean.getBoolean ("nb.explorer.hw.cocoahack"); //NOI18N 2. I do not understand why you setVisible(true) in the hide method of lightweight popup. at first it looks like a hack. plus why is the component added to the parent in constructor and not the doShow() method? 3. the cocoa hack, I assume you have tried with 1.4.2 and 1.5 on mac.. 4. I would rather have the Macosx custom popup factory in the applemenu module stright away, and not in the long term. That allows us to get rid of reflection (?) plus is the correct place for macosx only code.
Created attachment 24167 [details] Final diff (popupfactory in lookup via applement module)
Checking in openide/awt/src/org/openide/awt/HtmlLabelUI.java; /cvs/openide/awt/src/org/openide/awt/HtmlLabelUI.java,v <-- HtmlLabelUI.java new revision: 1.5; previous revision: 1.4 done Checking in openide/explorer/src/org/openide/explorer/view/ListView.java; /cvs/openide/explorer/src/org/openide/explorer/view/ListView.java,v <-- ListVi ew.java new revision: 1.4; previous revision: 1.3 done Checking in openide/explorer/src/org/openide/explorer/view/TreeView.java; /cvs/openide/explorer/src/org/openide/explorer/view/TreeView.java,v <-- TreeVi ew.java new revision: 1.2; previous revision: 1.1 done RCS file: /cvs/openide/explorer/src/org/openide/explorer/view/ViewTooltips.java, v done Checking in openide/explorer/src/org/openide/explorer/view/ViewTooltips.java; /cvs/openide/explorer/src/org/openide/explorer/view/ViewTooltips.java,v <-- Vi ewTooltips.java initial revision: 1.1 done RCS file: /cvs/ide/applemenu/src/META-INF/services/javax.swing.PopupFactory,v done Checking in ide/applemenu/src/META-INF/services/javax.swing.PopupFactory; /cvs/ide/applemenu/src/META-INF/services/javax.swing.PopupFactory,v <-- javax. swing.PopupFactory initial revision: 1.1 done RCS file: /cvs/ide/applemenu/src/org/netbeans/modules/applemenu/ApplePopupFactor y.java,v done Checking in ide/applemenu/src/org/netbeans/modules/applemenu/ApplePopupFactory.j ava; /cvs/ide/applemenu/src/org/netbeans/modules/applemenu/ApplePopupFactory.java,v <-- ApplePopupFactory.java initial revision: 1.1 done