提交 f97be1d9 编写于 作者: D dcherepanov

6959174: Need to introduce sun.awt.disableGtkFileDialogs system property

Reviewed-by: art, anthony
上级 cc9a8c3c
...@@ -1944,6 +1944,25 @@ public abstract class SunToolkit extends Toolkit ...@@ -1944,6 +1944,25 @@ public abstract class SunToolkit extends Toolkit
return (Window)comp; return (Window)comp;
} }
/**
* Returns the value of the system property indicated by the specified key.
*/
public static String getSystemProperty(final String key) {
return (String)AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return System.getProperty(key);
}
});
}
/**
* Returns the boolean value of the system property indicated by the specified key.
*/
protected static Boolean getBooleanSystemProperty(String key) {
return Boolean.valueOf(AccessController.
doPrivileged(new GetBooleanAction(key)));
}
private static Boolean sunAwtDisableMixing = null; private static Boolean sunAwtDisableMixing = null;
/** /**
...@@ -1952,9 +1971,7 @@ public abstract class SunToolkit extends Toolkit ...@@ -1952,9 +1971,7 @@ public abstract class SunToolkit extends Toolkit
*/ */
public synchronized static boolean getSunAwtDisableMixing() { public synchronized static boolean getSunAwtDisableMixing() {
if (sunAwtDisableMixing == null) { if (sunAwtDisableMixing == null) {
sunAwtDisableMixing = Boolean.valueOf( sunAwtDisableMixing = getBooleanSystemProperty("sun.awt.disableMixing");
AccessController.doPrivileged(
new GetBooleanAction("sun.awt.disableMixing")));
} }
return sunAwtDisableMixing.booleanValue(); return sunAwtDisableMixing.booleanValue();
} }
......
...@@ -1053,10 +1053,28 @@ public final class XToolkit extends UNIXToolkit implements Runnable { ...@@ -1053,10 +1053,28 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
return peer; return peer;
} }
private static Boolean sunAwtDisableGtkFileDialogs = null;
/**
* Returns the value of "sun.awt.disableGtkFileDialogs" property. Default
* value is {@code false}.
*/
public synchronized static boolean getSunAwtDisableGtkFileDialogs() {
if (sunAwtDisableGtkFileDialogs == null) {
sunAwtDisableGtkFileDialogs =
getBooleanSystemProperty("sun.awt.disableGtkFileDialogs");
}
return sunAwtDisableGtkFileDialogs.booleanValue();
}
public FileDialogPeer createFileDialog(FileDialog target) { public FileDialogPeer createFileDialog(FileDialog target) {
FileDialogPeer peer = null;
// The current GtkFileChooser is available from GTK+ 2.4 // The current GtkFileChooser is available from GTK+ 2.4
FileDialogPeer peer = checkGtkVersion(2, 4, 0) ? new GtkFileDialogPeer( if (!getSunAwtDisableGtkFileDialogs() && checkGtkVersion(2, 4, 0)) {
target) : new XFileDialogPeer(target); peer = new GtkFileDialogPeer(target);
} else {
peer = new XFileDialogPeer(target);
}
targetCreatedPeer(target, peer); targetCreatedPeer(target, peer);
return peer; return peer;
} }
...@@ -1201,14 +1219,6 @@ public final class XToolkit extends UNIXToolkit implements Runnable { ...@@ -1201,14 +1219,6 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
} }
} }
static String getSystemProperty(final String name) {
return (String)AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return System.getProperty(name);
}
});
}
public PrintJob getPrintJob(final Frame frame, final String doctitle, public PrintJob getPrintJob(final Frame frame, final String doctitle,
final Properties props) { final Properties props) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册