PageRenderTime 510ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/core/tool/builder/source_gen/jetbrains/mps/tool/common/util/SystemInfo.java

https://github.com/alperovich/MPS
Java | 87 lines | 53 code | 9 blank | 25 comment | 22 complexity | a0f332241d0d3424b7795cf237044f19 MD5 | raw file
Possible License(s): Apache-2.0
  1. package jetbrains.mps.tool.common.util;
  2. /*Generated by MPS */
  3. @SuppressWarnings(value = {"HardCodedStringLiteral", "UtilityClassWithoutPrivateConstructor"})
  4. public class SystemInfo {
  5. private static final String OS_NAME = System.getProperty("os.name").toLowerCase();
  6. public static final String OS_VERSION = System.getProperty("os.version").toLowerCase();
  7. public static final String OS_ARCH = System.getProperty("os.arch");
  8. public static final String JAVA_VERSION = System.getProperty("java.version");
  9. public static final String JAVA_RUNTIME_VERSION = System.getProperty("java.runtime.version");
  10. public static final String ARCH_DATA_MODEL = System.getProperty("sun.arch.data.model");
  11. public static final String SUN_DESKTOP = System.getProperty("sun.desktop");
  12. public static final boolean isWindows = OS_NAME.startsWith("windows");
  13. public static final boolean isWindowsNT = OS_NAME.startsWith("windows nt");
  14. public static final boolean isWindows2000 = OS_NAME.startsWith("windows 2000");
  15. public static final boolean isWindows2003 = OS_NAME.startsWith("windows 2003");
  16. public static final boolean isWindowsXP = OS_NAME.startsWith("windows xp");
  17. public static final boolean isWindowsVista = OS_NAME.startsWith("windows vista");
  18. public static final boolean isWindows7 = OS_NAME.startsWith("windows 7");
  19. public static final boolean isWindows9x = OS_NAME.startsWith("windows 9") || OS_NAME.startsWith("windows me");
  20. public static final boolean isOS2 = OS_NAME.startsWith("os/2") || OS_NAME.startsWith("os2");
  21. public static final boolean isMac = OS_NAME.startsWith("mac");
  22. public static final boolean isFreeBSD = OS_NAME.startsWith("freebsd");
  23. public static final boolean isLinux = OS_NAME.startsWith("linux");
  24. public static final boolean isUnix = !(isWindows) && !(isOS2);
  25. public static final boolean isKDE = SUN_DESKTOP != null && SUN_DESKTOP.toLowerCase().indexOf("kde") >= 0;
  26. public static final boolean isGnome = SUN_DESKTOP != null && SUN_DESKTOP.toLowerCase().indexOf("gnome") >= 0;
  27. public static final boolean isMacSystemMenu = isMac && "true".equals(System.getProperty("apple.laf.useScreenMenuBar"));
  28. public static final boolean isFileSystemCaseSensitive = !(isWindows) && !(isOS2) && !(isMac);
  29. public static final boolean is32Bit = ARCH_DATA_MODEL == null || ARCH_DATA_MODEL.equals("32");
  30. public static final boolean is64Bit = !(is32Bit);
  31. public static final boolean isAMD64 = "amd64".equals(OS_ARCH);
  32. /**
  33. * * Whether IDEA is running under MacOS X version 10.4 or later.
  34. * *
  35. * * @since 5.0.2
  36. */
  37. public static final boolean isMacOSTiger = SystemInfo.isTiger();
  38. /**
  39. * * Whether IDEA is running under MacOS X on an Intel Machine
  40. * *
  41. * * @since 5.0.2
  42. */
  43. public static final boolean isIntelMac = SystemInfo.isIntelMac();
  44. /**
  45. * * Running under MacOS X version 10.5 or later;
  46. * *
  47. * * @since 7.0.2
  48. */
  49. public static final boolean isMacOSLeopard = SystemInfo.isLeopard();
  50. /**
  51. * * Running under MacOS X version 10.6 or later;
  52. * *
  53. * * @since 9.0
  54. */
  55. public static final boolean isMacOSSnowLeopard = SystemInfo.isSnowLeopard();
  56. /**
  57. * * Operating system is supposed to have middle mouse button click occupied by paste action.
  58. * * @since 6.0
  59. */
  60. public static boolean X11PasteEnabledSystem = isUnix && !(isMac);
  61. public SystemInfo() {
  62. }
  63. private static boolean isTiger() {
  64. return isMac && !(OS_VERSION.startsWith("10.0")) && !(OS_VERSION.startsWith("10.1")) && !(OS_VERSION.startsWith("10.2")) && !(OS_VERSION.startsWith("10.3"));
  65. }
  66. private static boolean isIntelMac() {
  67. return isMac && "i386".equals(OS_ARCH);
  68. }
  69. private static boolean isLeopard() {
  70. return isMac && SystemInfo.isTiger() && !(OS_VERSION.startsWith("10.4"));
  71. }
  72. private static boolean isSnowLeopard() {
  73. return isMac && SystemInfo.isLeopard() && !(OS_VERSION.startsWith("10.5"));
  74. }
  75. public static boolean isJavaVersionAtLeast(String v) {
  76. return StringUtil.compareVersionNumbers(JAVA_RUNTIME_VERSION, v) >= 0;
  77. }
  78. }