/* * Copyright 2016 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package dorkbox.swt; import java.security.AccessController; import java.security.PrivilegedAction; /** * Utility methods for SWT. SWT is always available for compiling, so it is not necessary to use reflection to compile it. *
* SWT system tray types are GtkStatusIcon trays (so we don't want to use them)
*/
public
class Swt {
public final static boolean isLoaded;
public final static boolean isGtk3;
private static final int version;
// NOTE: This class cannot have SWT **ANYTHING** in it
static {
// There is a silly amount of redirection, simply because we have to be able to access SWT, but only if it's in use.
// Since this class is the place other code interacts with, we can use SWT stuff if necessary without loading/linking
// the SWT classes by accident
Class> swtErrorClass = AccessController.doPrivileged(new PrivilegedAction