def getdown_alt_java_min_version
// this property is assigned below and expanded to multiple lines in the getdown task
def getdown_alt_multi_java_location
+// this property is for the Java library used in eclipse
+def eclipse_java_runtime_name
if (JAVA_VERSION.equals("1.8")) {
JAVA_INTEGER_VERSION = "8"
+ //libDir = j8libDir
libDir = j11libDir
libDistDir = j8libDir
compile_source_compatibility = 1.8
compile_target_compatibility = 1.8
getdown_alt_java_min_version = getdown_alt_java8_min_version
getdown_alt_multi_java_location = getdown_alt_java8_txt_multi_java_location
+ eclipse_java_runtime_name = "JavaSE-1.8"
} else if (JAVA_VERSION.equals("11")) {
JAVA_INTEGER_VERSION = "11"
libDir = j11libDir
compile_target_compatibility = 11
getdown_alt_java_min_version = getdown_alt_java11_min_version
getdown_alt_multi_java_location = getdown_alt_java11_txt_multi_java_location
+ eclipse_java_runtime_name = "JavaSE-11"
additional_compiler_args += [
'--module-path', ext.modules_compileClasspath.asPath,
'--add-modules', j11modules
jdt {
// for the IDE, use java 11 compatibility
- sourceCompatibility = 11
- targetCompatibility = 11
- javaRuntimeName = "JavaSE-11"
+ sourceCompatibility = JAVA_VERSION
+ targetCompatibility = JAVA_VERSION
+ javaRuntimeName = eclipse_java_runtime_name
file {
withProperties { props ->
exec {
commandLine "git", "rev-parse", "--short", "HEAD"
standardOutput = hashStdOut
+ ignoreExitValue true
}
def branchStdOut = new ByteArrayOutputStream()
exec {
commandLine "git", "rev-parse", "--abbrev-ref", "HEAD"
standardOutput = branchStdOut
+ ignoreExitValue true
}
project.ext.gitHash = hashStdOut.toString().trim()
return false;
}
return (jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx() // .getMenuShortcutKeyMaskEx()
- & e.getModifiersEx()) != 0; // getModifiers()) != 0;
+ & jalview.util.ShortcutKeyMaskExWrapper
+ .getModifiersEx(e)) != 0; // getModifiers()) != 0;
}
return e.isControlDown();
}
package jalview.util;
-import java.awt.Toolkit;
-import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
public class ShortcutKeyMaskExWrapper
{
- private static boolean init = false;
+ private static final Float specversion;
- private static final Float specversion = Float
- .parseFloat(System.getProperty("java.specification.version"));
+ private static final float modern;
- private static final float modern = 11;
+ public static final int SHIFT_DOWN_MASK;
- public static int SHIFT_DOWN_MASK = KeyEvent.SHIFT_DOWN_MASK;
+ public static final int ALT_DOWN_MASK;
- public static int ALT_DOWN_MASK = KeyEvent.ALT_DOWN_MASK;
+ private static final ShortcutKeyMaskExWrapperI wrapper;
- public ShortcutKeyMaskExWrapper()
+ static
{
- }
+ specversion = Float
+ .parseFloat(System.getProperty("java.specification.version"));
+ modern = 11;
- private static void init()
- {
- if (init)
- {
- return;
- }
- if (specversion < modern)
+ if (specversion >= modern)
{
- SHIFT_DOWN_MASK = KeyEvent.SHIFT_MASK;
- ALT_DOWN_MASK = KeyEvent.ALT_MASK;
+ wrapper = new ShortcutKeyMaskExWrapper11();
}
else
{
- SHIFT_DOWN_MASK = KeyEvent.SHIFT_DOWN_MASK;
- ALT_DOWN_MASK = KeyEvent.ALT_DOWN_MASK;
+ wrapper = new ShortcutKeyMaskExWrapper8();
}
-
- init = true;
+ SHIFT_DOWN_MASK = wrapper.SHIFT_DOWN_MASK;
+ ALT_DOWN_MASK = wrapper.ALT_DOWN_MASK;
}
public static int getMenuShortcutKeyMaskEx()
{
- init();
- if (specversion < modern)
- {
- return Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
- }
- else
- {
- return Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx();
- }
+ return wrapper.getMenuShortcutKeyMaskEx();
+ }
+
+ public static int getModifiersEx(MouseEvent e)
+ {
+ return wrapper.getModifiersEx(e);
}
}
--- /dev/null
+package jalview.util;
+
+import java.awt.GraphicsEnvironment;
+import java.awt.Toolkit;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+
+public class ShortcutKeyMaskExWrapper11 implements ShortcutKeyMaskExWrapperI
+{
+ public final static int SHIFT_DOWN_MASK = KeyEvent.SHIFT_DOWN_MASK;
+ public final static int ALT_DOWN_MASK = KeyEvent.ALT_DOWN_MASK;
+
+ @Override
+ public int getMenuShortcutKeyMaskEx()
+ {
+ try
+ {
+ if (!GraphicsEnvironment.isHeadless())
+ {
+ return Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx();
+ }
+ } catch (java.lang.Throwable t)
+ {
+ }
+ return 0;
+ }
+
+ @Override
+ public int getModifiersEx(MouseEvent e)
+ {
+ return e.getModifiersEx();
+ }
+
+}
--- /dev/null
+package jalview.util;
+
+import java.awt.GraphicsEnvironment;
+import java.awt.Toolkit;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+
+public class ShortcutKeyMaskExWrapper8 implements ShortcutKeyMaskExWrapperI
+{
+ public final static int SHIFT_DOWN_MASK = KeyEvent.SHIFT_MASK;
+ public final static int ALT_DOWN_MASK = KeyEvent.ALT_MASK;
+
+ @Override
+ public int getMenuShortcutKeyMaskEx()
+ {
+ try
+ {
+ if (!GraphicsEnvironment.isHeadless())
+ {
+ return Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
+ }
+ } catch (java.lang.Throwable t)
+ {
+ }
+ return 0;
+ }
+
+ @Override
+ public int getModifiersEx(MouseEvent e)
+ {
+ return e.getModifiers();
+ }
+
+}
--- /dev/null
+package jalview.util;
+
+import java.awt.event.MouseEvent;
+
+public interface ShortcutKeyMaskExWrapperI
+{
+ public static int SHIFT_DOWN_MASK = 0;
+
+ public static int ALT_DOWN_MASK = 0;
+
+ public int getMenuShortcutKeyMaskEx();
+
+ public int getModifiersEx(MouseEvent e);
+}