]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling/scl/Simantics/Misc.scl
setSystemProperty function to Simantics/Misc SCL-module
[simantics/platform.git] / bundles / org.simantics.modeling / scl / Simantics / Misc.scl
index 081c0e8f388a0bd2ae852814d25543b99015c9c9..8b76629928f2a3ffca982025af3378de13be89a3 100644 (file)
-import "Simantics/Entity" hiding (nameOf)\r
-include "File"\r
-import "StandardLibrary" hiding (group)\r
-\r
-/*\r
-importJava "java.io.File" where\r
-    data File\r
-    \r
-    @JavaName "<init>"\r
-    file :: String -> File\r
-    \r
-*/\r
-\r
-importJava "java.util.Scanner" where\r
-    data Scanner\r
-    \r
-    @JavaName "<init>"\r
-    scanner :: File -> <Proc> Scanner\r
-    \r
-    @JavaName "hasNext"\r
-    hasNext :: Scanner -> Boolean\r
-    \r
-    @JavaName "nextLine"\r
-    nextLine :: Scanner -> String\r
-    \r
-    @JavaName "next"\r
-    scanNext :: Scanner -> String\r
-    \r
-    @JavaName "nextLine"\r
-    scanNextLine :: Scanner -> String\r
-\r
-importJava "java.util.regex.Pattern" where\r
-    data Pattern\r
-    \r
-    @JavaName "compile"\r
-    compile :: String -> <Proc> Pattern\r
-    \r
-    @JavaName "matcher"\r
-    matcher :: Pattern -> String -> Matcher\r
-\r
-importJava "java.util.regex.Matcher" where\r
-    data Matcher\r
-    \r
-    @JavaName "matches"\r
-    matches :: Matcher -> Boolean\r
-    \r
-    group :: Matcher -> String\r
-\r
-importJava "org.simantics.utils.ui.BundleUtils" where\r
-    @JavaName "findFile"\r
-    bundleFile :: String -> String -> File\r
-\r
-importJava "org.simantics.modeling.SCL" where\r
-\r
-    killPlatformWrite :: () -> <WriteGraph> ()\r
-    killPlatformRead :: () -> <ReadGraph> ()\r
-    killPlatform :: () -> ()\r
-    shutdownPlatform :: () -> ()\r
-    reconnectPlatform :: () -> ()\r
-    sleep :: Integer -> <Proc> ()\r
-    synchronizeOntologies :: () -> <Proc> ()\r
-    \r
-    syncGraph :: () -> <Proc> ()\r
-    \r
-    deleteMBNode :: [Resource] -> Boolean\r
-    \r
-    hasSomethingToPaste :: Resource -> <ReadGraph> Boolean\r
-    canDelete :: Resource -> <ReadGraph> Boolean\r
-    canRename :: Resource -> <ReadGraph> Boolean\r
-    \r
-    currentDate :: String -> String\r
-\r
-    workspaceDirectory :: () -> File\r
-    \r
-    queryPreference :: String -> String -> <ReadGraph> String\r
-\r
-importJava "java.lang.Math" where\r
-    @JavaName random\r
-    javaRandom :: () -> Double\r
-    \r
-loop :: Scanner -> String -> Pattern -> [String] -> <Proc> [String]    \r
-loop testScan testName testPattern testList = do\r
-    if (hasNext testScan) == True\r
-    then do\r
-        testName = nextLine testScan\r
-        show "asd"\r
-        testMatcher = matcher testPattern testName\r
-        if (matches testMatcher) == True\r
-        then loop testScan testName testPattern (testList + [(scanNext testScan)])\r
-        else loop testScan testName testPattern testList\r
-    else testList\r
-    \r
-loop1 :: Scanner -> [String] -> <Proc> [String]\r
-loop1 testScan testList = do\r
-    if (hasNext testScan) == True\r
-    then do\r
-        newList = testList + [trim (scanNextLine testScan)]\r
-        loop1 testScan newList\r
-    else testList\r
-\r
-loop2 :: Scanner -> [String] -> Boolean -> <Proc> [String]\r
-loop2 testScan testList found = do\r
-    if hasNext testScan\r
-    then do\r
-        nextline = (scanNextLine testScan)\r
-        if found\r
-        then do\r
-            nextString1 = replaceString nextline "M7: " ""\r
-            newList = testList + [replaceString nextString1 "_CM1" ""]\r
-            found = (contains nextline "omposition ")\r
-            loop2 testScan newList found\r
-        else do\r
-            found = (contains nextline "omposition ")\r
-            loop2 testScan testList found\r
-    else testList\r
-    \r
-loop3 ::  Scanner -> [String] -> <Proc> [String]\r
-loop3 testScan testList = do\r
-    if hasNext testScan\r
-    then do\r
-        nextString = scanNext testScan\r
-        found = (contains nextString "_NO1")\r
-        if found\r
-        then do\r
-            nextString1 = (replaceString nextString "M6: " "")\r
-            newList = testList + [replaceString nextString1 "_NO1" ""]\r
-            loop3 testScan newList\r
-        else do\r
-            loop3 testScan testList\r
-    else testList\r
-    \r
-loop4 ::  Scanner -> [String] -> Boolean -> <Proc> [String]\r
-loop4 testScan testList found = do\r
-    if (hasNext testScan) == True\r
-    then do\r
-        nextString = (scanNext testScan)\r
-        newList = testList + [nextString]\r
-        loop4 testScan newList found\r
-    else testList\r
-\r
-importJava "java.lang.System" where\r
-    @JavaName "getProperty"\r
-    getSystemProperty :: String -> String\r
-    \r
-importJava "org.simantics.modeling.LifeCycleContext" where\r
-    data LifeCycleContext\r
-\r
-importJava "org.simantics.modeling.ModelingUtils" where\r
-    trackDependencies :: <Proc> ()\r
-    untrackDependencies :: <Proc> ()\r
-    \r
+import "Simantics/Entity" hiding (nameOf)
+include "File"
+import "StandardLibrary" hiding (group)
+
+/*
+importJava "java.io.File" where
+    data File
+    
+    @JavaName "<init>"
+    file :: String -> File
+    
+*/
+
+importJava "java.util.Scanner" where
+    data Scanner
+    
+    @JavaName "<init>"
+    scanner :: File -> <Proc> Scanner
+    
+    @JavaName "hasNext"
+    hasNext :: Scanner -> Boolean
+    
+    @JavaName "nextLine"
+    nextLine :: Scanner -> String
+    
+    @JavaName "next"
+    scanNext :: Scanner -> String
+    
+    @JavaName "nextLine"
+    scanNextLine :: Scanner -> String
+
+importJava "java.util.regex.Pattern" where
+    data Pattern
+    
+    @JavaName "compile"
+    compile :: String -> <Proc> Pattern
+    
+    @JavaName "matcher"
+    matcher :: Pattern -> String -> Matcher
+
+importJava "java.util.regex.Matcher" where
+    data Matcher
+    
+    @JavaName "matches"
+    matches :: Matcher -> Boolean
+    
+    group :: Matcher -> String
+
+importJava "org.simantics.utils.ui.BundleUtils" where
+    @JavaName "findFile"
+    bundleFile :: String -> String -> File
+
+importJava "org.simantics.modeling.SCL" where
+
+    killPlatformWrite :: () -> <WriteGraph> ()
+    killPlatformRead :: () -> <ReadGraph> ()
+    killPlatform :: () -> ()
+    shutdownPlatform :: () -> ()
+    reconnectPlatform :: () -> ()
+    sleep :: Integer -> <Proc> ()
+    synchronizeOntologies :: () -> <Proc> ()
+    
+    syncGraph :: () -> <Proc> ()
+    
+    deleteMBNode :: [Resource] -> Boolean
+    
+    hasSomethingToPaste :: Resource -> <ReadGraph> Boolean
+    canDelete :: Resource -> <ReadGraph> Boolean
+    canRename :: Resource -> <ReadGraph> Boolean
+    
+    currentDate :: String -> String
+
+    workspaceDirectory :: () -> File
+    
+    queryPreference :: String -> String -> <ReadGraph> String
+
+importJava "java.lang.Math" where
+    @JavaName random
+    javaRandom :: () -> Double
+    
+loop :: Scanner -> String -> Pattern -> [String] -> <Proc> [String]    
+loop testScan testName testPattern testList = do
+    if (hasNext testScan) == True
+    then do
+        testName = nextLine testScan
+        show "asd"
+        testMatcher = matcher testPattern testName
+        if (matches testMatcher) == True
+        then loop testScan testName testPattern (testList + [(scanNext testScan)])
+        else loop testScan testName testPattern testList
+    else testList
+    
+loop1 :: Scanner -> [String] -> <Proc> [String]
+loop1 testScan testList = do
+    if (hasNext testScan) == True
+    then do
+        newList = testList + [trim (scanNextLine testScan)]
+        loop1 testScan newList
+    else testList
+
+loop2 :: Scanner -> [String] -> Boolean -> <Proc> [String]
+loop2 testScan testList found = do
+    if hasNext testScan
+    then do
+        nextline = (scanNextLine testScan)
+        if found
+        then do
+            nextString1 = replaceString nextline "M7: " ""
+            newList = testList + [replaceString nextString1 "_CM1" ""]
+            found = (contains nextline "omposition ")
+            loop2 testScan newList found
+        else do
+            found = (contains nextline "omposition ")
+            loop2 testScan testList found
+    else testList
+    
+loop3 ::  Scanner -> [String] -> <Proc> [String]
+loop3 testScan testList = do
+    if hasNext testScan
+    then do
+        nextString = scanNext testScan
+        found = (contains nextString "_NO1")
+        if found
+        then do
+            nextString1 = (replaceString nextString "M6: " "")
+            newList = testList + [replaceString nextString1 "_NO1" ""]
+            loop3 testScan newList
+        else do
+            loop3 testScan testList
+    else testList
+    
+loop4 ::  Scanner -> [String] -> Boolean -> <Proc> [String]
+loop4 testScan testList found = do
+    if (hasNext testScan) == True
+    then do
+        nextString = (scanNext testScan)
+        newList = testList + [nextString]
+        loop4 testScan newList found
+    else testList
+
+importJava "java.lang.System" where
+    @JavaName "getProperty"
+    getSystemProperty :: String -> Maybe String
+    @JavaName setProperty
+    setSystemProperty :: String -> String -> <Proc> String
+
+importJava "org.simantics.modeling.LifeCycleContext" where
+    data LifeCycleContext
+
+importJava "org.simantics.modeling.ModelingUtils" where
+    trackDependencies :: <Proc> ()
+    untrackDependencies :: <Proc> ()
+    trackOntologicalRequirements :: <Proc> ()
+    untrackOntologicalRequirements :: <Proc> ()
+
+importJava "org.simantics.modeling.scl.SCLDependencyChangeListener" where
+    @JavaName "create"
+    createDependencyChangeListener :: (<Proc> Boolean) -> (MetadataI -> DependencyChanges -> <ReadGraph,Proc> ()) -> ChangeListener
     
\ No newline at end of file