It seems we need an API method to work around a
severe Swing bug in a common way. See issue #46014
Created attachment 16397 [details]
Proposed addition to FileUtil, plus example of its application to the Open Project dialog (tested and functional in contrast to the unpatched Add Favorites dialog, tried on Linux under 1.4.2_04 Metal, 1.5.0 b58 Ocean, 1.5.0 b58 GTK)
Note #1: might be necessary to have the method actually take a File
currentDirectory (optional, may be null), and if non-null wrap it
before setting it. Otherwise it seems that while you can select a
noncanonicalized symlink dir to open a project from, the persisted
default directory for the dialog gets set as a plain java.io.File on
the file chooser, causing the path to get "polluted" with an unwrapped
File temporarily, so that the dialog opens with the canonicalized
path. You can browse to the uncanonicalized path, so this is only a
Note #2: of course if and when the Swing bug is fixed, we can patch
the method to do nothing for fixed JREs; and when we take as a minimum
a JRE which already has the fix, we can just make the method do
nothing and deprecate it.
Note #3: I put the method into FileUtil rather than Utilities since it
does depend on the normalizeFile method and separation of openide
dictates that Utilities should not depend on FileUtil.
No objections; I will commit it.
committed * Up-To-Date 1.152 openide/openide-spec-vers.properties
committed * Up-To-Date 1.212
committed * Up-To-Date 1.106