]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.ui/scl/Simantics/Testing/BrowseContext.scl
Add org.simantics.db.testing to org.simantics.sdk feature
[simantics/platform.git] / bundles / org.simantics.modeling.ui / scl / Simantics / Testing / BrowseContext.scl
index a4b06495a4b6f155b1a4abd73170e960e1e1cde1..cd4e9755dfa1e9a81d343c19189e235a8bf9e2d7 100644 (file)
@@ -1,4 +1,4 @@
-import "Simantics/DB"
+import "Simantics/Variables"
 import "Map" as Map
 import "Simantics/Testing/BuiltinKeys"
 
 import "Map" as Map
 import "Simantics/Testing/BuiltinKeys"
 
@@ -76,13 +76,17 @@ importJava "org.eclipse.jface.resource.ImageDescriptor" where
 importJava "org.simantics.browsing.ui.content.ImageDecorator" where
     data ImageDecorator
 
 importJava "org.simantics.browsing.ui.content.ImageDecorator" where
     data ImageDecorator
 
-importJava "org.eclipse.jface.resource.JFaceResources" where
-    getDefaultFontDescriptor :: FontDescriptor
-
 importJava "org.eclipse.jface.resource.DeviceResourceDescriptor" where
     data FontDescriptor
     data ColorDescriptor
 
 importJava "org.eclipse.jface.resource.DeviceResourceDescriptor" where
     data FontDescriptor
     data ColorDescriptor
 
+importJava "org.eclipse.jface.resource.FontDescriptor" where
+    @private
+    @JavaName createFrom
+    createFontDescriptorFrom :: String -> Integer -> Integer -> FontDescriptor
+
+defaultFontDescriptor = createFontDescriptorFrom "Arial" 12 0 
+
 importJava "org.simantics.browsing.ui.content.LabelDecorator" where
     """
     An interface for decorating aesthetic properties of an UI item, including the label text, font, background color and foreground color.
 importJava "org.simantics.browsing.ui.content.LabelDecorator" where
     """
     An interface for decorating aesthetic properties of an UI item, including the label text, font, background color and foreground color.
@@ -96,7 +100,7 @@ importJava "org.simantics.browsing.ui.content.LabelDecorator" where
     decorateLabel :: LabelDecorator -> String -> String -> Integer -> <Proc> String
     decorateForeground :: LabelDecorator -> a -> String -> Integer -> <Proc> a
     decorateBackground :: LabelDecorator -> a -> String -> Integer -> <Proc> a
     decorateLabel :: LabelDecorator -> String -> String -> Integer -> <Proc> String
     decorateForeground :: LabelDecorator -> a -> String -> Integer -> <Proc> a
     decorateBackground :: LabelDecorator -> a -> String -> Integer -> <Proc> a
-    decorateFont :: LabelDecorator -> a -> String -> Integer -> <Proc> a
+    decorateFont :: LabelDecorator -> Maybe a -> String -> Integer -> <Proc> Maybe a
 
 importJava "org.simantics.browsing.ui.CheckedState" where
     data CheckedState
 
 importJava "org.simantics.browsing.ui.CheckedState" where
     data CheckedState
@@ -105,7 +109,8 @@ importJava "org.simantics.browsing.ui.content.Labeler$Modifier" where
     data Modifier
     
     getValue :: Modifier -> <Proc> String
     data Modifier
     
     getValue :: Modifier -> <Proc> String
-    isValid :: Modifier -> String -> <Proc> String
+    isValid :: Modifier -> String -> <Proc> Maybe String
+    modify :: Modifier -> String -> <Proc> ()
 
 importJava "org.simantics.browsing.ui.model.browsecontexts.BrowseContexts" where
     toBrowseContextG :: Vector String -> <ReadGraph> BrowseContext
 
 importJava "org.simantics.browsing.ui.model.browsecontexts.BrowseContexts" where
     toBrowseContextG :: Vector String -> <ReadGraph> BrowseContext
@@ -118,3 +123,10 @@ createBrowseContext :: [Resource] -> <ReadGraph> BrowseContext
 createBrowseContext resource = do
     create resource
 
 createBrowseContext resource = do
     create resource
 
+importJava "org.simantics.browsing.ui.common.NodeContextBuilder" where
+    buildWithInput :: a -> <Proc> NodeContext
+
+instanceOfTest :: Variable -> <ReadGraph> (Resource -> <ReadGraph> Boolean)
+instanceOfTest self = do
+  typeResource = singleObject (represents $ parent self) MOD.InstanceOfTest.HasType
+  (\r -> isInstanceOf r typeResource)