<Swing Dev> Bug 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros

Costantino Cerbo c.cerbo at gmail.com
Sun Jan 10 22:15:08 UTC 2010


Hello Pavel,

I hope you had a good holiday!

As said, I began to port the native GTK FileChooser in
java.awt.FileDialog (bug id 6913179).
You can get this initial code from (it's an eclipse project):
 svn checkout http://gtkjfilechooser.googlecode.com/svn/trunk/GTKFileDialog

Then type "make test" in your shell to run a simple demo.

I'd like now to integrate it with the real OpenJDK codebase, but I've
see that the GTK libraries aren't invoked through #include <gtk/gtk.h>
but through "gtk2_interface.h" (in
jdk7/mytl/jdk/src/solaris/native/sun/awt).
That means, I should extend this header file to accept also the
GtkFileChooser related functions that are in my
native/src/GtkFileDialogPeer.c.
Could you (or somebody else) please explain me, how to do that?

Besides I have the following questions/comments:
1) Maybe should we write a new class sun.awt.X11.GtkFileDialogPeer
instead of modify sun.awt.X11.XFileDialogPeer?
The old XFileDialogPeer will be continued to be used in system without
the GTK libraries. That means, we should modify
sun.awt.X11.XToolkit#createFileDialog(FileDialog) to return
GtkFileDialogPeer instead of XFileDialogPeer, if GTK is avalaible.
By the way, how can we check in the JDK the presence of GTK? (I think,
it's already done for the availability of the GTK L&F, but I could not
find how).

2) java.awt.FileDialog supports only the selection of files but not of
folders: Why don't we allow its method setMode(.) to accept also other
values than LOAD (0) or SAVE (1). For example we could pass the value
2 to allow only the selection of folders? It's a minimal change that
doesn't broke the existing API. On platforms where the new selection
mode for folders isn't yet implemented, the behaviour should be the
same as for the mode LOAD (0).

3) I could compile the entire OpenJdk 7 without problem, but when I
try to compile only the awt part, it fails with the error message in
the attached file (error.log).
My compile variables are set as follows:
  export LANG=C
  export ALT_BOOTDIR=/usr/lib/jvm/java-openjdk
  export ALT_BINARY_PLUGS_PATH=/home/c.cerbo/openjdk/openjdk-binary-plugs
  export ALT_JDK_IMPORT_PATH=/home/c.cerbo/openjdk/jdk7/mytl/build/linux-i586/j2sdk-image

I Hope this is all clear and this is probably the longest e-mail you
will receive from me! ;-)

Cheers,
Costantino from Stuttgart
-------------- next part --------------
A non-text attachment was scrubbed...
Name: error.log
Type: application/octet-stream
Size: 4747 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20100110/910f69f9/error.log>


More information about the swing-dev mailing list