*/
package jalview.util;
-import java.awt.Toolkit;
import java.awt.event.MouseEvent;
/**
*/
public class Platform
{
- private static Boolean isAMac = null;
+ private static Boolean isAMac = null, isWindows = null;
private static Boolean isHeadless = null;
{
isAMac = System.getProperty("os.name").indexOf("Mac") > -1;
}
+
return isAMac.booleanValue();
}
+ /**
+ * Check if we are on a Microsoft plaform...
+ *
+ * @return true if we have to cope with another platform variation
+ */
+ public static boolean isWindows()
+ {
+ if (isWindows == null)
+ {
+ isWindows = System.getProperty("os.name").indexOf("Win") > -1;
+ }
+ return isWindows.booleanValue();
+ }
+
+ /**
+ *
+ * @return true if we are running in non-interactive no UI mode
+ */
public static boolean isHeadless()
{
if (isHeadless == null)
{
return false;
}
- return (Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
- & e.getModifiers()) != 0;
- // could we use e.isMetaDown() here?
+ return (jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx() // .getMenuShortcutKeyMaskEx()
+ & e.getModifiersEx()) != 0; // getModifiers()) != 0;
}
return e.isControlDown();
}
+
+ /**
+ * A (case sensitive) file path comparator that ignores the difference between /
+ * and \
+ *
+ * @param path1
+ * @param path2
+ * @return
+ */
+ public static boolean pathEquals(String path1, String path2)
+ {
+ if (path1 == null)
+ {
+ return path2 == null;
+ }
+ if (path2 == null)
+ {
+ return false;
+ }
+ String p1 = path1.replace('\\', '/');
+ String p2 = path2.replace('\\', '/');
+ return p1.equals(p2);
+ }
}