src/Pure/System/platform.scala
changeset 31828 31584cf201cc
parent 31825 d47a9dc1f064
child 35002 fbb40a1091ea
equal deleted inserted replaced
31827:b54362b9fbef 31828:31584cf201cc
     4 Raw platform identification.
     4 Raw platform identification.
     5 */
     5 */
     6 
     6 
     7 package isabelle
     7 package isabelle
     8 
     8 
       
     9 import javax.swing.UIManager
       
    10 
     9 import scala.util.matching.Regex
    11 import scala.util.matching.Regex
    10 
    12 
    11 
    13 
    12 object Platform
    14 object Platform
    13 {
    15 {
       
    16   /* main OS variants */
       
    17 
    14   val is_macos = System.getProperty("os.name") == "Mac OS X"
    18   val is_macos = System.getProperty("os.name") == "Mac OS X"
    15   val is_windows = System.getProperty("os.name").startsWith("Windows")
    19   val is_windows = System.getProperty("os.name").startsWith("Windows")
       
    20 
       
    21 
       
    22   /* Isabelle platform identifiers */
    16 
    23 
    17   private val Solaris = new Regex("SunOS|Solaris")
    24   private val Solaris = new Regex("SunOS|Solaris")
    18   private val Linux = new Regex("Linux")
    25   private val Linux = new Regex("Linux")
    19   private val Darwin = new Regex("Mac OS X")
    26   private val Darwin = new Regex("Mac OS X")
    20   private val Cygwin = new Regex("Windows.*")
    27   private val Cygwin = new Regex("Windows.*")
    42           case PPC() => Some(("ppc-" + name, None))
    49           case PPC() => Some(("ppc-" + name, None))
    43         }
    50         }
    44       case None => None
    51       case None => None
    45     }
    52     }
    46   }
    53   }
       
    54 
       
    55 
       
    56   /* Swing look-and-feel */
       
    57 
       
    58   def look_and_feel(): String =
       
    59   {
       
    60     if (is_windows || is_macos) UIManager.getSystemLookAndFeelClassName()
       
    61     else {
       
    62       UIManager.getInstalledLookAndFeels().find(laf => laf.getName == "Nimbus") match {
       
    63         case None => UIManager.getCrossPlatformLookAndFeelClassName()
       
    64         case Some(laf) => laf.getClassName
       
    65       }
       
    66     }
       
    67   }
    47 }
    68 }
    48 
    69