Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c39
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java23
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java53
6 files changed, 110 insertions, 25 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index 0d85ddb3ea..d63668cf19 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -10312,22 +10312,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1file_1chooser_1get_1uris)
#ifndef NO__1gtk_1file_1chooser_1set_1current_1folder
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1file_1chooser_1set_1current_1folder)
- (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
{
- jbyte *lparg1=NULL;
OS_NATIVE_ENTER(env, that, _1gtk_1file_1chooser_1set_1current_1folder_FUNC);
- if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
/*
- gtk_file_chooser_set_current_folder(arg0, lparg1);
+ gtk_file_chooser_set_current_folder(arg0, arg1);
*/
{
OS_LOAD_FUNCTION(fp, gtk_file_chooser_set_current_folder)
if (fp) {
- ((void (CALLING_CONVENTION*)(jintLong, jbyte *))fp)(arg0, lparg1);
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1);
}
}
-fail:
- if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
OS_NATIVE_EXIT(env, that, _1gtk_1file_1chooser_1set_1current_1folder_FUNC);
}
#endif
@@ -10414,22 +10410,18 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1file_1chooser_1set_1extra_1widget)
#ifndef NO__1gtk_1file_1chooser_1set_1filename
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1file_1chooser_1set_1filename)
- (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
{
- jbyte *lparg1=NULL;
OS_NATIVE_ENTER(env, that, _1gtk_1file_1chooser_1set_1filename_FUNC);
- if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
/*
- gtk_file_chooser_set_filename(arg0, lparg1);
+ gtk_file_chooser_set_filename(arg0, arg1);
*/
{
OS_LOAD_FUNCTION(fp, gtk_file_chooser_set_filename)
if (fp) {
- ((void (CALLING_CONVENTION*)(jintLong, jbyte *))fp)(arg0, lparg1);
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1);
}
}
-fail:
- if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
OS_NATIVE_EXIT(env, that, _1gtk_1file_1chooser_1set_1filename_FUNC);
}
#endif
@@ -22421,6 +22413,25 @@ fail:
}
#endif
+#ifndef NO_realpath
+JNIEXPORT jintLong JNICALL OS_NATIVE(realpath)
+ (JNIEnv *env, jclass that, jbyteArray arg0, jbyteArray arg1)
+{
+ jbyte *lparg0=NULL;
+ jbyte *lparg1=NULL;
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, realpath_FUNC);
+ if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ rc = (jintLong)realpath((const char *)lparg0, (char *)lparg1);
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
+ if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
+ OS_NATIVE_EXIT(env, that, realpath_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_strcmp
JNIEXPORT jint JNICALL OS_NATIVE(strcmp)
(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index 94ee49552c..cc04542d6e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2013 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -1817,6 +1817,7 @@ char * OS_nativeFunctionNames[] = {
"memmove__Lorg_eclipse_swt_internal_gtk_XVisibilityEvent_2JJ",
#endif
"pangoLayoutNewProc_1CALLBACK",
+ "realpath",
"strcmp",
};
#define NATIVE_FUNCTION_COUNT sizeof(OS_nativeFunctionNames) / sizeof(char*)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index 45e07cc7ef..575f5109e0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2013 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -1827,5 +1827,6 @@ typedef enum {
memmove__Lorg_eclipse_swt_internal_gtk_XVisibilityEvent_2JJ_FUNC,
#endif
pangoLayoutNewProc_1CALLBACK_FUNC,
+ realpath_FUNC,
strcmp_FUNC,
} OS_FUNCS;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index 542f0999a2..c2a181f855 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -715,6 +715,12 @@ public static final native int XFocusChangeEvent_sizeof();
public static final native int XVisibilityEvent_sizeof();
public static final native int XWindowChanges_sizeof();
public static final native long /*int*/ localeconv_decimal_point();
+/**
+ * @param path cast=(const char *)
+ * @param realPath cast=(char *)
+ */
+public static final native long /*int*/ realpath(byte[] path, byte[] realPath);
+
/** Object private fields accessors */
@@ -7493,8 +7499,8 @@ public static final long /*int*/ gtk_file_chooser_get_filter(long /*int*/ choose
}
}
/** @method flags=dynamic */
-public static final native void _gtk_file_chooser_set_current_folder(long /*int*/ chooser, byte [] filename);
-public static final void gtk_file_chooser_set_current_folder(long /*int*/ chooser, byte [] filename) {
+public static final native void _gtk_file_chooser_set_current_folder(long /*int*/ chooser, long /*int*/ filename);
+public static final void gtk_file_chooser_set_current_folder(long /*int*/ chooser, long /*int*/ filename) {
lock.lock();
try {
_gtk_file_chooser_set_current_folder(chooser, filename);
@@ -7553,8 +7559,8 @@ public static final void gtk_file_chooser_set_extra_widget(long /*int*/ chooser,
}
}
/** @method flags=dynamic */
-public static final native void _gtk_file_chooser_set_filename(long /*int*/ chooser, byte [] name);
-public static final void gtk_file_chooser_set_filename(long /*int*/ chooser, byte [] name) {
+public static final native void _gtk_file_chooser_set_filename(long /*int*/ chooser, long /*int*/ name);
+public static final void gtk_file_chooser_set_filename(long /*int*/ chooser, long /*int*/ name) {
lock.lock();
try {
_gtk_file_chooser_set_filename(chooser, name);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
index e3c8ea3d7a..90ee138fb9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
@@ -36,6 +36,7 @@ import org.eclipse.swt.internal.gtk.*;
public class DirectoryDialog extends Dialog {
String message = "", filterPath = "";
static final String SEPARATOR = System.getProperty ("file.separator");
+ private static final int PATH_MAX = 1024;
/**
* Constructs a new instance of this class given only its parent.
@@ -144,7 +145,27 @@ String openChooserDialog () {
}
stringBuffer.append (filterPath);
byte [] buffer = Converter.wcsToMbcs (null, stringBuffer.toString (), true);
- OS.gtk_file_chooser_set_current_folder (handle, buffer);
+ /*
+ * in GTK version 2.10, gtk_file_chooser_set_current_folder requires path
+ * to be true canonical path. So using realpath to convert the path to
+ * true canonical path.
+ */
+ if (OS.IsAIX) {
+ byte [] outputBuffer = new byte [PATH_MAX];
+ long /*int*/ ptr = OS.realpath (buffer, outputBuffer);
+ if (ptr != 0) {
+ OS.gtk_file_chooser_set_current_folder (handle, ptr);
+ }
+ /* We are not doing free here because realpath returns the address of outputBuffer
+ * which is created in this code and we let the garbage collector to take care of this
+ */
+ } else {
+ long /*int*/ ptr = OS.realpath (buffer, null);
+ if (ptr != 0) {
+ OS.gtk_file_chooser_set_current_folder (handle, ptr);
+ OS.g_free (ptr);
+ }
+ }
}
if (message.length () > 0) {
byte [] buffer = Converter.wcsToMbcs (null, message, true);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java
index 38de0c0634..84936ed9f5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java
@@ -49,6 +49,7 @@ public class FileDialog extends Dialog {
static final char SEPARATOR = System.getProperty ("file.separator").charAt (0);
static final char EXTENSION_SEPARATOR = ';';
static final char FILE_EXTENSION_SEPARATOR = '.';
+ private static final int PATH_MAX = 1024;
/**
* Constructs a new instance of this class given only its parent.
@@ -375,7 +376,27 @@ void presetChooserDialog () {
} else {
/* filename must be a full path */
byte [] buffer = Converter.wcsToMbcs (null, SEPARATOR + filterPath, true);
- OS.gtk_file_chooser_set_current_folder (handle, buffer);
+ /*
+ * in GTK version 2.10, gtk_file_chooser_set_current_folder requires path
+ * to be true canonical path. So using realpath to convert the path to
+ * true canonical path.
+ */
+ if (OS.IsAIX) {
+ byte [] outputBuffer = new byte [PATH_MAX];
+ long /*int*/ ptr = OS.realpath (buffer, outputBuffer);
+ if (ptr != 0) {
+ OS.gtk_file_chooser_set_current_folder (handle, ptr);
+ }
+ /* We are not doing free here because realpath returns the address of outputBuffer
+ * which is created in this code and we let the garbage collector to take care of this
+ */
+ } else {
+ long /*int*/ ptr = OS.realpath (buffer, null);
+ if (ptr != 0) {
+ OS.gtk_file_chooser_set_current_folder (handle, ptr);
+ OS.g_free (ptr);
+ }
+ }
}
}
if (fileName.length () > 0) {
@@ -424,10 +445,34 @@ void presetChooserDialog () {
if (uriMode) {
OS.gtk_file_chooser_set_uri (handle, buffer);
} else {
- if (fileName.length() > 0) {
- OS.gtk_file_chooser_set_filename (handle, buffer);
+ /*
+ * in GTK version 2.10, gtk_file_chooser_set_current_folder requires path
+ * to be true canonical path. So using realpath to convert the path to
+ * true canonical path.
+ */
+ if (OS.IsAIX) {
+ byte [] outputBuffer = new byte [PATH_MAX];
+ long /*int*/ ptr = OS.realpath (buffer, outputBuffer);
+ if (ptr != 0) {
+ if (fileName.length() > 0) {
+ OS.gtk_file_chooser_set_filename (handle, ptr);
+ } else {
+ OS.gtk_file_chooser_set_current_folder (handle, ptr);
+ }
+ /* We are not doing free here because realpath returns the address of outputBuffer
+ * which is created in this code and we let the garbage collector to take care of this
+ */
+ }
} else {
- OS.gtk_file_chooser_set_current_folder (handle, buffer);
+ long /*int*/ ptr = OS.realpath (buffer, null);
+ if (ptr != 0) {
+ if (fileName.length() > 0) {
+ OS.gtk_file_chooser_set_filename (handle, ptr);
+ } else {
+ OS.gtk_file_chooser_set_current_folder (handle, ptr);
+ }
+ OS.g_free (ptr);
+ }
}
}
}

Back to the top