X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fscl%2FSimantics%2FTesting%2FBrowseContext.scl;fp=bundles%2Forg.simantics.modeling.ui%2Fscl%2FSimantics%2FTesting%2FBrowseContext.scl;h=a4b06495a4b6f155b1a4abd73170e960e1e1cde1;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=485f886c6d04a5af72f7d7f0ebc726c56bf0d29c;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling.ui/scl/Simantics/Testing/BrowseContext.scl b/bundles/org.simantics.modeling.ui/scl/Simantics/Testing/BrowseContext.scl index 485f886c6..a4b06495a 100644 --- a/bundles/org.simantics.modeling.ui/scl/Simantics/Testing/BrowseContext.scl +++ b/bundles/org.simantics.modeling.ui/scl/Simantics/Testing/BrowseContext.scl @@ -1,120 +1,120 @@ -import "Simantics/DB" -import "Map" as Map -import "Simantics/Testing/BuiltinKeys" - -importJava "org.simantics.browsing.ui.model.browsecontexts.BrowseContext" where - """ - BrowseContext holds all contributions related to given set of browse contexts. - """ - data BrowseContext - - @JavaName getChildren - """ - Returns the possible children of the given NodeContext parameter. - """ - browseContextChildren :: BrowseContext -> NodeContext -> Collection NodeContext - - @JavaName getParents - """ - Returns the possible parents of the given NodeContext parameter. - """ - browseContextParents:: BrowseContext -> NodeContext -> Collection NodeContext - - @JavaName getLabel - """ - Finds labels for the given NodeContext parameter. - """ - browseContextLabel :: BrowseContext -> NodeContext -> Map.T String String - - @JavaName getImage - """ - Finds @link ImageDescriptors for the given NodeContext parameter. - """ - browseContextImage :: BrowseContext -> NodeContext -> Map.T String ImageDescriptor - - @JavaName getCheckedState - """ - Finds if the given NodeContext is checked or not. - """ - browseContextCheckedState :: BrowseContext -> NodeContext -> CheckedState - - @JavaName getLabelDecorator - """ - Finds LabelDecorator for the given NodeContext parameter. - """ - browseContextLabelDecorator :: BrowseContext -> NodeContext -> LabelDecorator - - @JavaName getImageDecorator - """ - Finds ImageDecorator for the given NodeContext parameter. - """ - browseContextImageDecorator :: BrowseContext -> NodeContext -> ImageDecorator - - @JavaName getModifier - """ - Finds Modifier for the given NodeContext parameter. - """ - browseContextModifier :: BrowseContext -> NodeContext -> String -> Maybe Modifier - - @private - create :: [Resource] -> BrowseContext - -importJava "org.simantics.browsing.ui.NodeContext" where - """ - A context used to represent a single visible UI item. - """ - data NodeContext - - """ - Finds value with the specified key or null if there was no value for the key - """ - getConstant :: NodeContext -> ConstantKey -> a - -importJava "org.eclipse.jface.resource.ImageDescriptor" where - data ImageDescriptor - -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.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. - """ - data LabelDecorator - - """ - Decorates the given label with the name of the UI column which the label is for and the index of this label within its parenting INodeContext. - Returns the decorated Label - """ - decorateLabel :: LabelDecorator -> String -> String -> Integer -> String - decorateForeground :: LabelDecorator -> a -> String -> Integer -> a - decorateBackground :: LabelDecorator -> a -> String -> Integer -> a - decorateFont :: LabelDecorator -> a -> String -> Integer -> a - -importJava "org.simantics.browsing.ui.CheckedState" where - data CheckedState - -importJava "org.simantics.browsing.ui.content.Labeler$Modifier" where - data Modifier - - getValue :: Modifier -> String - isValid :: Modifier -> String -> String - -importJava "org.simantics.browsing.ui.model.browsecontexts.BrowseContexts" where - toBrowseContextG :: Vector String -> BrowseContext - getNodeContextForResource :: Resource -> NodeContext - -""" -Creates a new BrowseContext for the given Collection of Resources. -""" -createBrowseContext :: [Resource] -> BrowseContext -createBrowseContext resource = do - create resource - +import "Simantics/DB" +import "Map" as Map +import "Simantics/Testing/BuiltinKeys" + +importJava "org.simantics.browsing.ui.model.browsecontexts.BrowseContext" where + """ + BrowseContext holds all contributions related to given set of browse contexts. + """ + data BrowseContext + + @JavaName getChildren + """ + Returns the possible children of the given NodeContext parameter. + """ + browseContextChildren :: BrowseContext -> NodeContext -> Collection NodeContext + + @JavaName getParents + """ + Returns the possible parents of the given NodeContext parameter. + """ + browseContextParents:: BrowseContext -> NodeContext -> Collection NodeContext + + @JavaName getLabel + """ + Finds labels for the given NodeContext parameter. + """ + browseContextLabel :: BrowseContext -> NodeContext -> Map.T String String + + @JavaName getImage + """ + Finds @link ImageDescriptors for the given NodeContext parameter. + """ + browseContextImage :: BrowseContext -> NodeContext -> Map.T String ImageDescriptor + + @JavaName getCheckedState + """ + Finds if the given NodeContext is checked or not. + """ + browseContextCheckedState :: BrowseContext -> NodeContext -> CheckedState + + @JavaName getLabelDecorator + """ + Finds LabelDecorator for the given NodeContext parameter. + """ + browseContextLabelDecorator :: BrowseContext -> NodeContext -> LabelDecorator + + @JavaName getImageDecorator + """ + Finds ImageDecorator for the given NodeContext parameter. + """ + browseContextImageDecorator :: BrowseContext -> NodeContext -> ImageDecorator + + @JavaName getModifier + """ + Finds Modifier for the given NodeContext parameter. + """ + browseContextModifier :: BrowseContext -> NodeContext -> String -> Maybe Modifier + + @private + create :: [Resource] -> BrowseContext + +importJava "org.simantics.browsing.ui.NodeContext" where + """ + A context used to represent a single visible UI item. + """ + data NodeContext + + """ + Finds value with the specified key or null if there was no value for the key + """ + getConstant :: NodeContext -> ConstantKey -> a + +importJava "org.eclipse.jface.resource.ImageDescriptor" where + data ImageDescriptor + +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.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. + """ + data LabelDecorator + + """ + Decorates the given label with the name of the UI column which the label is for and the index of this label within its parenting INodeContext. + Returns the decorated Label + """ + decorateLabel :: LabelDecorator -> String -> String -> Integer -> String + decorateForeground :: LabelDecorator -> a -> String -> Integer -> a + decorateBackground :: LabelDecorator -> a -> String -> Integer -> a + decorateFont :: LabelDecorator -> a -> String -> Integer -> a + +importJava "org.simantics.browsing.ui.CheckedState" where + data CheckedState + +importJava "org.simantics.browsing.ui.content.Labeler$Modifier" where + data Modifier + + getValue :: Modifier -> String + isValid :: Modifier -> String -> String + +importJava "org.simantics.browsing.ui.model.browsecontexts.BrowseContexts" where + toBrowseContextG :: Vector String -> BrowseContext + getNodeContextForResource :: Resource -> NodeContext + +""" +Creates a new BrowseContext for the given Collection of Resources. +""" +createBrowseContext :: [Resource] -> BrowseContext +createBrowseContext resource = do + create resource +