L0.SCLValue.expression %canHandle\r
L0.HasValueType "Resource -> <ReadGraph> Boolean"\r
\r
+MOD.SVGTabContribution : SEL.SCLTabContribution\r
+ @MOD.scl SEL.SCLTabContribution.instantiate\r
+ "svgTabContribution"\r
+ "() -> <Proc> TabContribution"\r
\r
\ No newline at end of file
public final Resource SCLTest_test;\r
public final Resource SCLTest_test_Inverse;\r
public final Resource SCLValue;\r
+ public final Resource SVGTabContribution;\r
public final Resource SharedOntology;\r
public final Resource SourceInformation;\r
public final Resource SourceInformation_copiedAtRevision;\r
public static final String SCLTest_test = "http://www.simantics.org/Modeling-1.2/SCLTest/test";\r
public static final String SCLTest_test_Inverse = "http://www.simantics.org/Modeling-1.2/SCLTest/test/Inverse";\r
public static final String SCLValue = "http://www.simantics.org/Modeling-1.2/SCLValue";\r
+ public static final String SVGTabContribution = "http://www.simantics.org/Modeling-1.2/SVGTabContribution";\r
public static final String SharedOntology = "http://www.simantics.org/Modeling-1.2/SharedOntology";\r
public static final String SourceInformation = "http://www.simantics.org/Modeling-1.2/SourceInformation";\r
public static final String SourceInformation_copiedAtRevision = "http://www.simantics.org/Modeling-1.2/SourceInformation/copiedAtRevision";\r
SCLTest_test = getResourceOrNull(graph, URIs.SCLTest_test);\r
SCLTest_test_Inverse = getResourceOrNull(graph, URIs.SCLTest_test_Inverse);\r
SCLValue = getResourceOrNull(graph, URIs.SCLValue);\r
+ SVGTabContribution = getResourceOrNull(graph, URIs.SVGTabContribution);\r
SharedOntology = getResourceOrNull(graph, URIs.SharedOntology);\r
SourceInformation = getResourceOrNull(graph, URIs.SourceInformation);\r
SourceInformation_copiedAtRevision = getResourceOrNull(graph, URIs.SourceInformation_copiedAtRevision);\r
--- /dev/null
+include "File"\r
+include "Simantics/SelectionView"\r
+\r
+importJava "org.simantics.modeling.ui.property.svg.SVGElementComposite" where\r
+ svgTabContribution :: () -> <Proc> TabContribution
\ No newline at end of file
include "File"\r
+include "Simantics/SelectionView"\r
\r
importJava "org.simantics.modeling.ModelingUtils" where\r
"""Queries for a file using a common file dialog."""\r
fileDialog :: String -> [(String,String)] -> <Proc> Maybe File\r
-
\ No newline at end of file
*******************************************************************************/\r
package org.simantics.modeling.ui.property.svg;\r
\r
+import java.util.Collection;\r
+\r
import org.eclipse.jface.dialogs.IInputValidator;\r
import org.eclipse.jface.layout.GridDataFactory;\r
import org.eclipse.jface.resource.ColorDescriptor;\r
import org.simantics.browsing.ui.swt.widgets.Label;\r
import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
+import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.management.ISessionContext;\r
+import org.simantics.diagram.stubs.DiagramResource;\r
import org.simantics.selectionview.ComparableTabContributor;\r
import org.simantics.selectionview.ConfigurationComposite;\r
+import org.simantics.selectionview.TabContribution;\r
+import org.simantics.ui.selection.WorkbenchSelectionUtils;\r
\r
/**\r
* @author Tuukka Lehtonen\r
*/\r
public class SVGElementComposite extends ConfigurationComposite {\r
\r
+ public static TabContribution<Object> svgTabContribution() {\r
+ return new TabContribution<Object>() {\r
+\r
+ @Override\r
+ public boolean accept(ReadGraph graph, Object input) throws DatabaseException {\r
+ Resource res = WorkbenchSelectionUtils.getPossibleResource(input);\r
+ if(res == null) return false;\r
+ return graph.isInstanceOf(res, DiagramResource.getInstance(graph).SVGElement);\r
+ }\r
+\r
+ @Override\r
+ public void contribute(ReadGraph graph, Object selection, Collection<ComparableTabContributor> result)\r
+ throws DatabaseException {\r
+ Resource res = WorkbenchSelectionUtils.getPossibleResource(selection);\r
+ if(res != null) {\r
+ if(graph.isInstanceOf(res, DiagramResource.getInstance(graph).SVGElement)) {\r
+ result.add(make(res, 100.0, "SVG"));\r
+ }\r
+ }\r
+ }\r
+ };\r
+ }\r
+ \r
public static ComparableTabContributor make(Resource input, double priority, String tabLabel) {\r
return make(new SVGInput(input), priority, tabLabel);\r
}\r
L0.IsLinkedTo SEL
L0.IsLinkedTo ANNO
L0.IsLinkedTo TEMPLATE
+ L0.IsLinkedTo MOD
PlatformUI.SCLMain : L0.SCLModule
L0.SCLModule.definition _ : L0.String
VTT Technical Research Centre of Finland - initial API and implementation\r
-->\r
-<adapters>\r\r <target interface="org.simantics.selectionview.TabContribution">\r <type uri="http://www.simantics.org/SelectionView-0.0/TypedVariableTabContribution"\r class="org.simantics.selectionview.TypedVariableTabContribution">\r <graph/>\r <this/>\r </type>\r <type uri="http://www.simantics.org/SelectionView-0.0/VariableTabContribution"\r class="org.simantics.selectionview.VariableTabContribution">\r <graph/>\r <this/>\r </type>\r </target>\r\r\r <target interface="org.simantics.browsing.ui.model.children.ChildRule">\r <type uri="http://www.simantics.org/SelectionViewUI-0.0/VariablePropertyCategoryRule"\r class="org.simantics.selectionview.VariablePropertyCategoryRule">\r <graph/>\r <this/>\r </type>\r </target>\r\r <target interface="org.simantics.browsing.ui.model.visuals.VisualsRule">\r <resource uri="http://www.simantics.org/SelectionViewUI-0.0/CategoryNodeLabelRule"\r class="org.simantics.selectionview.CategoryNodeLabelRule"/>\r <type uri="http://www.simantics.org/SelectionViewUI-0.0/StandardPropertySorterRuleType"\r class="org.simantics.selectionview.StandardPropertySorterRule">\r <this/>\r </type>\r \r <resource uri="http://www.simantics.org/SelectionViewUI-0.0/VariablePropertyLabelRule"\r class="org.simantics.selectionview.VariablePropertyLabelRule"/>\r <resource uri="http://www.simantics.org/SelectionViewUI-0.0/VariablePropertyModifierRule"\r class="org.simantics.selectionview.VariablePropertyModifierRule"/>\r <resource uri="http://www.simantics.org/SelectionViewUI-0.0/VariableColoringDecorationRule"\r class="org.simantics.selectionview.VariableColoringDecorationRule"/>\r </target>\r\r <target interface="org.simantics.db.layer0.variable.Variable">\r <!--<adapter uri="http://www.simantics.org/SelectionView-0.0/StandardPropertyInfo"\r contextClass="org.simantics.db.layer0.variable.ModelledVariablePropertyDescriptor"\r adapterClass="org.simantics.selectionview.PropertyInfoVariableAdapter" />-->\r <adapter uri="http://www.simantics.org/SelectionView-0.0/DisplayProperty"\r contextClass="org.simantics.db.layer0.variable.ModelledVariablePropertyDescriptor"\r adapterClass="org.simantics.selectionview.DisplayPropertyVariableAdapter" />\r <adapter uri="http://www.simantics.org/SelectionView-0.0/DisplayValue"\r contextClass="org.simantics.db.layer0.variable.ModelledVariablePropertyDescriptor"\r adapterClass="org.simantics.selectionview.DisplayValueVariableAdapter" />\r <adapter uri="http://www.simantics.org/SelectionView-0.0/DisplayUnit"\r contextClass="org.simantics.db.layer0.variable.ModelledVariablePropertyDescriptor"\r adapterClass="org.simantics.selectionview.DisplayUnitVariableAdapter" />\r </target>\r\r
+<adapters>\r\r <target interface="org.simantics.selectionview.TabContribution">\r <type uri="http://www.simantics.org/SelectionView-0.0/SCLTabContribution"\r class="org.simantics.selectionview.SCLTabContribution">\r <graph/>\r <this/>\r </type>\r <type uri="http://www.simantics.org/SelectionView-0.0/TypedVariableTabContribution"\r class="org.simantics.selectionview.TypedVariableTabContribution">\r <graph/>\r <this/>\r </type>\r <type uri="http://www.simantics.org/SelectionView-0.0/VariableTabContribution"\r class="org.simantics.selectionview.VariableTabContribution">\r <graph/>\r <this/>\r </type>\r </target>\r\r\r <target interface="org.simantics.browsing.ui.model.children.ChildRule">\r <type uri="http://www.simantics.org/SelectionViewUI-0.0/VariablePropertyCategoryRule"\r class="org.simantics.selectionview.VariablePropertyCategoryRule">\r <graph/>\r <this/>\r </type>\r </target>\r\r <target interface="org.simantics.browsing.ui.model.visuals.VisualsRule">\r <resource uri="http://www.simantics.org/SelectionViewUI-0.0/CategoryNodeLabelRule"\r class="org.simantics.selectionview.CategoryNodeLabelRule"/>\r <type uri="http://www.simantics.org/SelectionViewUI-0.0/StandardPropertySorterRuleType"\r class="org.simantics.selectionview.StandardPropertySorterRule">\r <this/>\r </type>\r \r <resource uri="http://www.simantics.org/SelectionViewUI-0.0/VariablePropertyLabelRule"\r class="org.simantics.selectionview.VariablePropertyLabelRule"/>\r <resource uri="http://www.simantics.org/SelectionViewUI-0.0/VariablePropertyModifierRule"\r class="org.simantics.selectionview.VariablePropertyModifierRule"/>\r <resource uri="http://www.simantics.org/SelectionViewUI-0.0/VariableColoringDecorationRule"\r class="org.simantics.selectionview.VariableColoringDecorationRule"/>\r </target>\r\r <target interface="org.simantics.db.layer0.variable.Variable">\r <!--<adapter uri="http://www.simantics.org/SelectionView-0.0/StandardPropertyInfo"\r contextClass="org.simantics.db.layer0.variable.ModelledVariablePropertyDescriptor"\r adapterClass="org.simantics.selectionview.PropertyInfoVariableAdapter" />-->\r <adapter uri="http://www.simantics.org/SelectionView-0.0/DisplayProperty"\r contextClass="org.simantics.db.layer0.variable.ModelledVariablePropertyDescriptor"\r adapterClass="org.simantics.selectionview.DisplayPropertyVariableAdapter" />\r <adapter uri="http://www.simantics.org/SelectionView-0.0/DisplayValue"\r contextClass="org.simantics.db.layer0.variable.ModelledVariablePropertyDescriptor"\r adapterClass="org.simantics.selectionview.DisplayValueVariableAdapter" />\r <adapter uri="http://www.simantics.org/SelectionView-0.0/DisplayUnit"\r contextClass="org.simantics.db.layer0.variable.ModelledVariablePropertyDescriptor"\r adapterClass="org.simantics.selectionview.DisplayUnitVariableAdapter" />\r </target>\r\r
</adapters>\r