43 /**
44 * Concrete implementation of the interface {@code DesktopPeer} for
45 * the Gnome desktop on Linux and Unix platforms.
46 *
47 * @see DesktopPeer
48 */
49 public class XDesktopPeer implements DesktopPeer {
50
51 // supportedActions may be changed from native within an init() call
52 private static final List<Action> supportedActions
53 = new ArrayList<>(Arrays.asList(Action.OPEN, Action.MAIL, Action.BROWSE));
54
55 private static boolean nativeLibraryLoaded = false;
56 private static boolean initExecuted = false;
57
58 private static void initWithLock(){
59 XToolkit.awtLock();
60 try {
61 if (!initExecuted) {
62 nativeLibraryLoaded = init(UNIXToolkit.getEnabledGtkVersion()
63 .ordinal(), UNIXToolkit.isGtkVerbose());
64 }
65 } finally {
66 initExecuted = true;
67 XToolkit.awtUnlock();
68 }
69 }
70
71 //package-private
72 XDesktopPeer(){
73 initWithLock();
74 }
75
76 static boolean isDesktopSupported() {
77 initWithLock();
78 return nativeLibraryLoaded && !supportedActions.isEmpty();
79 }
80
81 public boolean isSupported(Action type) {
82 return supportedActions.contains(type);
83 }
|
43 /**
44 * Concrete implementation of the interface {@code DesktopPeer} for
45 * the Gnome desktop on Linux and Unix platforms.
46 *
47 * @see DesktopPeer
48 */
49 public class XDesktopPeer implements DesktopPeer {
50
51 // supportedActions may be changed from native within an init() call
52 private static final List<Action> supportedActions
53 = new ArrayList<>(Arrays.asList(Action.OPEN, Action.MAIL, Action.BROWSE));
54
55 private static boolean nativeLibraryLoaded = false;
56 private static boolean initExecuted = false;
57
58 private static void initWithLock(){
59 XToolkit.awtLock();
60 try {
61 if (!initExecuted) {
62 nativeLibraryLoaded = init(UNIXToolkit.getEnabledGtkVersion()
63 .getNumber(), UNIXToolkit.isGtkVerbose());
64 }
65 } finally {
66 initExecuted = true;
67 XToolkit.awtUnlock();
68 }
69 }
70
71 //package-private
72 XDesktopPeer(){
73 initWithLock();
74 }
75
76 static boolean isDesktopSupported() {
77 initWithLock();
78 return nativeLibraryLoaded && !supportedActions.isEmpty();
79 }
80
81 public boolean isSupported(Action type) {
82 return supportedActions.contains(type);
83 }
|