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 31135 - tooltip in filesystem explorer
Summary: tooltip in filesystem explorer
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Explorer (show other bugs)
Version: 3.x
Hardware: All All
: P3 blocker (vote)
Assignee: jrojcek
URL:
Keywords: UI
Depends on:
Blocks:
 
Reported: 2003-02-17 09:12 UTC by miks
Modified: 2008-12-22 21:59 UTC (History)
5 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Implementation (26.57 KB, patch)
2005-07-10 08:14 UTC, _ tboudreau
Details | Diff
Patch with mac workaround (42.00 KB, patch)
2005-07-26 00:55 UTC, _ tboudreau
Details | Diff
Final diff (popupfactory in lookup via applement module) (43.94 KB, patch)
2005-08-24 07:04 UTC, _ tboudreau
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description miks 2003-02-17 09:12:35 UTC
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.
Comment 1 Marian Mirilovic 2003-02-17 09:22:46 UTC
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.
Comment 2 miks 2003-02-17 21:31:54 UTC
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?
Comment 3 _ tboudreau 2005-07-10 08:14:45 UTC
Created attachment 23047 [details]
Implementation
Comment 4 _ tboudreau 2005-07-10 08:20:20 UTC
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.
Comment 5 _ tboudreau 2005-07-26 00:55:16 UTC
Created attachment 23280 [details]
Patch with mac workaround
Comment 6 _ tboudreau 2005-07-26 01:06:13 UTC
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.
Comment 7 Milos Kleint 2005-07-26 09:04:46 UTC
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.
Comment 8 _ tboudreau 2005-08-24 07:04:31 UTC
Created attachment 24167 [details]
Final diff (popupfactory in lookup via applement module)
Comment 9 _ tboudreau 2005-08-24 09:51:48 UTC
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