6959174: Need to introduce sun.awt.disableGtkFileDialogs system property
Reviewed-by: art, anthony
This commit is contained in:
parent
6d38b07902
commit
dcc737282d
@ -1944,6 +1944,25 @@ public abstract class SunToolkit extends Toolkit
|
||||
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;
|
||||
|
||||
/**
|
||||
@ -1952,9 +1971,7 @@ public abstract class SunToolkit extends Toolkit
|
||||
*/
|
||||
public synchronized static boolean getSunAwtDisableMixing() {
|
||||
if (sunAwtDisableMixing == null) {
|
||||
sunAwtDisableMixing = Boolean.valueOf(
|
||||
AccessController.doPrivileged(
|
||||
new GetBooleanAction("sun.awt.disableMixing")));
|
||||
sunAwtDisableMixing = getBooleanSystemProperty("sun.awt.disableMixing");
|
||||
}
|
||||
return sunAwtDisableMixing.booleanValue();
|
||||
}
|
||||
|
@ -1053,10 +1053,28 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
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) {
|
||||
FileDialogPeer peer = null;
|
||||
// The current GtkFileChooser is available from GTK+ 2.4
|
||||
FileDialogPeer peer = checkGtkVersion(2, 4, 0) ? new GtkFileDialogPeer(
|
||||
target) : new XFileDialogPeer(target);
|
||||
if (!getSunAwtDisableGtkFileDialogs() && checkGtkVersion(2, 4, 0)) {
|
||||
peer = new GtkFileDialogPeer(target);
|
||||
} else {
|
||||
peer = new XFileDialogPeer(target);
|
||||
}
|
||||
targetCreatedPeer(target, peer);
|
||||
return peer;
|
||||
}
|
||||
@ -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,
|
||||
final Properties props) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user