Bug 82821 - Choose file dialog is not Mac native
Choose file dialog is not Mac native
Status: RESOLVED FIXED
Product: platform
Classification: Unclassified
Component: Window System
5.x
Macintosh Mac OS X
: P2 with 2 votes (vote)
: 7.3
Assigned To: Stanislav Aubrecht
issues@platform
: PLAN
: 85173 (view as bug list)
Depends on: 237716
Blocks: 219555 223859
  Show dependency treegraph
 
Reported: 2006-08-16 16:23 UTC by elharo
Modified: 2013-10-30 13:37 UTC (History)
4 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description elharo 2006-08-16 16:23:04 UTC
The Open file dialogs used by various commands; e.g. File/New Project..., is an
old fashioned Mac OS 9 style dialog. It looks very out of place on today's Mac
OS X, and is not nearly as functional as the native file dialog.
Comment 1 Milos Kleint 2006-08-17 08:11:09 UTC
We use swing JFileChooser (which is created by apple)
At some places we probably could use awt FileChoosers that have more uptodate
visuals, but some locations (like the Open project action) cannot use that one
because it doesns't allow to plug custom UI in there.

I believe this issue ought to be closed as wontfix as it's as designed. Feel
free to file an issue against apple's jdk.

CCing people who might have a deeper understands of the issue.
Comment 2 fabriziogiudici 2006-08-17 21:22:05 UTC
I suggest using Quaqua (quaqua.dev.java.net) which provides a nice UI for the
JFileChooser which mimics perfectly the look of the Mac OS X. I could integrate
it with my NetBeans-base application with no issues (so far :-)
Comment 3 Milos Kleint 2006-09-18 19:53:05 UTC
*** Issue 85173 has been marked as a duplicate of this issue. ***
Comment 4 backspaces 2006-09-18 20:23:45 UTC
This is the text of the duplicate 85173 issue:

The various file browsing dialogs within the NB IDE do not use the standard Mac file dialog.  I believe 
this simply means NB does not use or provide a user configuration for the AWT file dialog. 

Specifically:  I just downloaded the latest 5.5 beta 2 for Mac OS X.  I then click on "New Project".  When I 
browse in that dialog, I get: 
  http://backspaces.net/files/NetBeans002.png 
But when I do the same in Eclipse, I get: 
  http://backspaces.net/files/Eclipse004.png 

I discussed this on the nbeans-users list and was advised to submit an issue.

You may find this a good guide to Mac/Java integration:
  Java Development Guide for Mac OS X: Mac OS X Integration for Java 
  http://tinyurl.com/dzak4 
Comment 5 backspaces 2006-09-18 20:30:53 UTC
I would like to disagree with both the idea that JFileChooser should be modified by Apple, and with the 
idea that Quaqua is the solution.  The issue is simpler: there are times that applications, such as the NB 
IDE, must make some very small adjustments for specific desktops such as Mac, Windows, and Unix/Linux 
X-Windows.

Apple provides very specific Java integration suggestions in: http://tinyurl.com/dzak4

Eclipse provides native file browsing, as do other applications.  For example, see the NetLogo application, 
which uses the standard Mac dialogs, even though it is a Java application.
Comment 6 _ tboudreau 2006-09-20 01:45:45 UTC
The two choices are the Swing JFileChooser or the AWT FileChooser.

There's one specific thing that makes it impossible not to use JFileChooser in
NetBeans:  With the JFileChooser you can provide your own FileSystemView (i.e.
your own file icons, etc.).  Particularly in the open project dialog, we need to
be able to badge the icons of folders which are projects.  There is simply no
way to do that with an AWT File Dialog.

There are quite a lot of mac-specific adjustments to make NetBeans UI more
mac-friendly - keybindings are altered (for example, Find Next is Command-G not
F3 on mac, and Ctrl-based mappings are judiciously mapped to Command unless they
clash with Apple system keybindings, there are special UI delegates for the tab
control that fit with Aqua, Apple-style 11AM drop shadows on floating windows,
etc.)  I should know, as I wrote most of them.  

To quote the page from Apple about their design guidelines, "Unless you need the
functional advantages of JFileChooser you probably want to use
java.awt.FileDialog."  Unfortunately this is a case where we need the
"functional advantages" of JFileChooser.

It would be possible to use the AWT file chooser for those file dialogs which do
not need to provide custom icons or a custom filesystem, etc.  However, since
open project is so prominent, having the dialogs be inconsistent would probably
be worse than sticking with JFileChooser;  and it would require review and
modification of hundreds of sites in the NetBeans codebase to accomplish such a
change.

This really needs to be fixed in Apple's Swing implementation - it's rather
surprising that such a glaring issue hasn't been dealt with already.  I wish it
were otherwise, but it is not.

There in fact is one file dialog in NetBeans that does use the AWT file dialog -
right click in the output window and choose Save As :-)  However, it is not
usable for many of the most prominent cases.
Comment 7 Milos Kleint 2008-03-13 14:40:43 UTC
reassigning
Comment 8 David Simonek 2008-03-18 14:46:12 UTC
Currently (in NB 6.0) we implemented our own JFileChooser UI for opening projects and generally folders. While it
certainly doesn't feel Mac native, it has improved functionality such as directory name completion, multiselection of
nested directories and so on.

Currently I believe that's all we could do (as we must stick with JFileChooser as explained), so closing this issue.
Comment 9 Bithammer 2012-02-04 19:55:40 UTC
You need to rethink the decision to not use the AWT File dialog. This the the only reason I don't use NetBeans, and why I steer my students away from using it. Every major release I check back to see if you've improved the situation, but every time I'm disappointed.  Please please please dump JFileChooser.
Comment 10 _ tboudreau 2012-02-04 23:07:55 UTC
One option:  For a few releases we have had org.openide.filesystems.FileChooserBuilder

It has enough information to know if JFileChooser can be used or not.  For most file chooser uses, it is never necessary for the code to touch a JFileChooser directly.  So, for most cases it would be possible to use the AWT file dialog on Mac, in a way that is transparent to the caller.

Someone would need to take a pass over the entire codebase and convert every place it's possible to use FileChooserBuilder (maybe that could be automated?).

Note that the main Open Project dialog would still be using JFileChooser - since it needs to mark files which are projects, there is no way to do that in the AWT file chooser.
Comment 11 sungmoonc 2012-05-15 15:50:20 UTC
I read all of the comments above. I understand why JFileChooser had to be used. However, I would prefer a native file dialog to seeing icons in front of projects. I use "Favorites" folder a lot, and there is simply no way to navigate to my favorite folders from JFileChooser. Plus, JFileChooser looks so ugly and outdated on my Mac. As Bithammer mentioned, this is also a big "turn-off" for me.
Comment 12 Bithammer 2012-07-20 03:25:37 UTC
The use of JFileChooser is the main reason I don't use Netbeans. It's the reason  I've not recommended Netbeans to my Java students, my java user group co-members, and my coworkers. So it may not seem like a big deal for whoever prioritizes these usability bugs, but it has the potential to affect hundreds (thousands?) of potential users. I'm happy to help rethink where you see that it's 'impossible' to use AWT FileDialog. This isn't an OS X only issue, JFileChooser looks bad in all UIs.
Comment 13 Stanislav Aubrecht 2012-08-01 10:35:20 UTC
Running the IDE with command line option -J-Dnb.native.filechooser=true enables native file chooser in Open Project and Open File actions. 
If there is any other IDE feature that uses FileChooserBuilder.showOpenDialog or showSaveDialog methods it will switch to native file chooser too.

Note that it's possible to set that system property at runtime to switch from Swing's file chooser to AWT native one. So we can even add a check box to Options window. Cc'ing UI experts for guidance where such a checkbox should appear (if at all)

core-main 79ed67cdec94
Comment 14 Quality Engineering 2012-08-02 02:32:07 UTC
Integrated into 'main-golden', will be available in build *201208020001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/79ed67cdec94
User: S. Aubrecht <saubrecht@netbeans.org>
Log: #82821 - enable native FileDialog where possible
Comment 15 Petr Somol 2012-08-02 15:08:58 UTC
Clearly this issue does not have a universally good solution due to the conflicting demands of two groups of users, where none can be neglected. Due to the continuing deficiency in JFileChooser native feel we face the trade off between users demanding the familiar functionality of Mac file chooser and NB users that take advantage of the extra functionality that can not be realized through awt FileDialog - here the project path code completion alone can be considered by many to be essential.

Thanks Standa for implementing the system property.

As for adding switches of this kind to IDE Options, it can rightfully be considered bad practice, making the Options UI less clean and focused. However, given the strength of voices taking part in this debate, it seems we need to add the switch anyway as there seems to be no other resolution in sight.

From the existing categories and tabs in Options dialog the closest relevant is probably Miscellaneous->Windows. What would you say to add below the Document Tabs section a new one named, e.g., "Native Look and Feel", under which there would be a checkbox named, e.g., "Maximize use of native look and feel" ? This should be accompanied by a ToolTip to explain that "By default NetBeans takes use of native UI components whenever possible, except in cases where native components restrict standard NetBeans functionality. Check this switch to enforce use of native components despite possible impact on standard NetBeans UI behavior. (Affects file chooser dialogs on Mac.)"

Wording can of course be changed, preferably by native speaker.
Comment 16 _ tboudreau 2012-08-02 15:35:10 UTC
Here's an edit to that text:

"NetBeans uses native UI components when those components offer sufficient functionality.  Select this option to force use of native components, even when that may limit functionality (e.g. standard Mac OS file chooser)."
Comment 17 _ tboudreau 2012-08-02 15:57:55 UTC
I know a guy who works on Swing at Apple, and asked him about this.

------------
Mike:  There is no way to do that from the native level, short of actually setting a custom icon on the folder itself so it would be visible in the Finder (presumably, a fine thing to do, if you actually "own" the folder).
(Imagine the issue of a sandboxed app, presumably interposing it's own 1024x1024 icons in full icon view, over paths it shouldn't even know exists)

Tim:  Argh.  Setting a custom icon would be fine for projects created by NetBeans, but I think it would be a little bit rude if it were done to, say, any folder NetBeans saw that contained a pom.xml
However, how *would* you set a custom icon, and can it be done from Java?  There is a module of Apple-specific code that could go in.
Just reread my message to you - "work at Apple" -> "work at Oracle".  Tim needs more coffee!

Mike:  There isn't anything in the OS X JDK that will do it, but from the command line it's pretty straightforward if you pre-bake the icon resource file, copy it into the directory, and call /usr/bin/SetFile.
-------------

So the upshot of that is that the applemenu module *could* set the icons on folders persistently, by running a program which is on all Macs.

As I mentioned to Mike, I don't think it's a good idea to do that for any folder NetBeans stumbles across (or at least that should be off by default), but it would probably be fine for project folders NetBeans creates.
Comment 18 Stanislav Aubrecht 2012-08-29 10:52:58 UTC
I've added that option in core-main 4b169fa721b7
Comment 19 Quality Engineering 2012-08-30 02:13:30 UTC
Integrated into 'main-golden', will be available in build *201208300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/4b169fa721b7
User: S. Aubrecht <saubrecht@netbeans.org>
Log: #82821 - option to toggle native file chooser usage
Comment 20 Quality Engineering 2012-11-30 02:45:17 UTC
Integrated into 'main-golden', will be available in build *201211300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/1105e678d393
User: Maria Tishkova <mromashova@netbeans.org>
Log: to support nb.native.filechooser  option (Options->Miscellaneous->Windows check box "Maximize use of native look and feel " (see bz#82821 - Choose file dialog is not Mac native and bz#219555 - Open file dialog and add item dialog on mac does not have file text edit box like Linux and Windows for more details)


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo