name="Dependencies"\r
restorable="true">\r
</view>\r
+ <view\r
+ category="org.simantics.sysdyn.ui.category"\r
+ class="org.simantics.sysdyn.ui.browser.SysdynOperationBrowser"\r
+ icon="icons/chart_organisation.png"\r
+ id="org.simantics.sysdyn.ui.operationBrowser"\r
+ name="Operation Browser"\r
+ restorable="true">\r
+ <description>\r
+ Operation view browser for Sysdyn.\r
+ </description>\r
+ </view>\r
</extension>\r
<extension\r
point="org.eclipse.ui.perspectives">\r
preference="2.0">\r
</implementation>\r
</binding>\r
+ <binding browseContext="http://www.simantics.org/Sysdyn-1.0/SysdynOperationBrowser">\r
+ <implementation class="org.simantics.sysdyn.ui.property.OperationProjectContributor" preference="1.0"/>\r
+ <implementation class="org.simantics.sysdyn.ui.property.OperationModelContributor" preference="1.0"/>\r
+ <implementation class="org.simantics.sysdyn.ui.property.OperationVariableContributor" preference="1.0"/>\r
+ </binding>\r
</extension>\r
<extension\r
point="org.simantics.browsing.ui.common.labelerBinding">\r
class="org.simantics.sysdyn.ui.browser.contributions.ModulesLabeler"\r
preference="2.0">\r
</implementation>\r
-<!-- <implementation\r
- class="org.simantics.sysdyn.ui.browser.contributions.OperatingInterfacesLabeler"\r
- preference="2.0">\r
- </implementation>-->\r
<implementation\r
class="org.simantics.sysdyn.ui.browser.contributions.ExperimentLabeler"\r
preference="2.0">\r
preference="2.0">\r
</implementation>\r
</binding>\r
+ <binding browseContext="http://www.simantics.org/Sysdyn-1.0/SysdynOperationBrowser">\r
+ <implementation class="org.simantics.sysdyn.ui.property.OperationModelLabels" preference="1.0"/>\r
+ <implementation class="org.simantics.sysdyn.ui.property.OperationVariableLabels" preference="1.0"/>\r
+ </binding>\r
</extension>\r
<extension\r
point="org.simantics.browsing.ui.common.imagerBinding">\r
preference="2.0">\r
</implementation>\r
</binding>\r
+ <binding browseContext="http://www.simantics.org/Sysdyn-1.0/SysdynOperationBrowser">\r
+<!-- <implementation class="org.simantics.sysdyn.ui.property.LibraryVariableImager" preference="2.0"/> -->\r
+ <implementation class="org.simantics.sysdyn.ui.property.OperationVariableImager" preference="1.0"/>\r
+ </binding>\r
</extension>\r
<extension\r
point="org.simantics.browsing.ui.common.labelDecoratorBinding">\r
--- /dev/null
+package org.simantics.sysdyn.ui.browser;\r
+\r
+import java.util.Collections;\r
+import java.util.Set;\r
+\r
+import org.simantics.browsing.ui.swt.GraphExplorerView;\r
+\r
+public class SysdynOperationBrowser extends GraphExplorerView {\r
+\r
+ final private Set<String> browseContexts = Collections.singleton("http://www.simantics.org/Sysdyn-1.0/SysdynOperationBrowser");\r
+\r
+ @Override\r
+ protected Set<String> getBrowseContexts() {\r
+ return browseContexts;\r
+ }\r
+\r
+}\r
--- /dev/null
+package org.simantics.sysdyn.ui.property;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+\r
+import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+\r
+public class OperationModelContributor extends ViewpointContributor<OperationModelNode> {\r
+\r
+ @Override\r
+ public Collection<?> getContribution(ReadGraph graph, OperationModelNode model) throws DatabaseException {\r
+ \r
+ Variable modelVariable = model.data;\r
+ Variable config = modelVariable.getChild(graph, "BaseRealization");\r
+ ArrayList<Variable> result = new ArrayList<Variable>();\r
+ result.addAll(config.browseChildren(graph));\r
+ return result;\r
+ \r
+ }\r
+\r
+ @Override\r
+ public String getViewpointId() {\r
+ return "Standard";\r
+ }\r
+\r
+}
\ No newline at end of file
--- /dev/null
+package org.simantics.sysdyn.ui.property;\r
+\r
+import java.util.Map;\r
+\r
+import org.simantics.browsing.ui.common.ColumnKeys;\r
+import org.simantics.browsing.ui.graph.contributor.labeler.ColumnLabelerContributor;\r
+import org.simantics.databoard.binding.java.StringBindingDefault;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.utils.datastructures.ArrayMap;\r
+\r
+public class OperationModelLabels extends ColumnLabelerContributor<OperationModelNode> {\r
+\r
+ @Override\r
+ public Map<String, String> getLabel(ReadGraph graph, OperationModelNode model) throws DatabaseException {\r
+\r
+ String label = model.data.getPropertyValue(graph, "Name", StringBindingDefault.INSTANCE);\r
+\r
+ return new ArrayMap<String, String>(new String[] { ColumnKeys.SINGLE } , new String[] { label });\r
+\r
+ }\r
+\r
+}\r
--- /dev/null
+package org.simantics.sysdyn.ui.property;\r
+\r
+import org.simantics.browsing.ui.common.ColumnKeys;\r
+import org.simantics.browsing.ui.common.imagers.ImageURLs;\r
+import org.simantics.browsing.ui.common.imagers.SingleImageURLs;\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.sysdyn.ui.Activator;\r
+\r
+public class OperationModelNode extends AbstractNode<Variable> {\r
+\r
+ public OperationModelNode(Variable data) {\r
+ super(data);\r
+ }\r
+\r
+ @Override\r
+ protected ImageURLs getImageURLs() {\r
+ return new SingleImageURLs(ColumnKeys.SINGLE, Activator.getDefaultResource("icons/chart_organisation.png"));\r
+ }\r
+ \r
+}\r
--- /dev/null
+package org.simantics.sysdyn.ui.property;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+\r
+import org.simantics.browsing.ui.Tester;\r
+import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
+import org.simantics.browsing.ui.graph.tester.GraphTesters;\r
+import org.simantics.db.Builtins;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.common.request.ObjectsWithType;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.project.ontology.ProjectResource;\r
+import org.simantics.simulation.ontology.SimulationResource;\r
+\r
+public class OperationProjectContributor extends ViewpointContributor<Resource> {\r
+\r
+ @Override\r
+ public Collection<?> getContribution(ReadGraph graph, Resource project) throws DatabaseException {\r
+\r
+ ArrayList<OperationModelNode> result = new ArrayList<OperationModelNode>();\r
+ for(Resource model : graph.syncRequest(new ObjectsWithType(project, b.ConsistsOf, SimulationResource.getInstance(graph).Model))) {\r
+ result.add(new OperationModelNode(graph.adapt(model, Variable.class)));\r
+ }\r
+ return result;\r
+ \r
+ }\r
+ \r
+ @Override\r
+ public Tester getNodeContextTester() {\r
+ \r
+ return GraphTesters.type(ProjectResource.URIs.Project);\r
+ }\r
+\r
+ @Override\r
+ public String getViewpointId() {\r
+ return "Standard";\r
+ }\r
+\r
+}
\ No newline at end of file
--- /dev/null
+package org.simantics.sysdyn.ui.property;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+\r
+import org.simantics.browsing.ui.graph.impl.contributor.viewpoint.ViewpointContributorImpl;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+\r
+public class OperationVariableContributor extends ViewpointContributorImpl<Variable> {\r
+\r
+ @Override\r
+ public Collection<?> getContribution(ReadGraph graph, Variable input) throws DatabaseException {\r
+ ArrayList<Variable> result = new ArrayList<Variable>();\r
+ result.addAll(input.browseProperties(graph));\r
+ result.addAll(input.browseChildren(graph));\r
+ return result;\r
+ }\r
+ \r
+ @Override\r
+ public String getViewpointId() {\r
+ return "Properties";\r
+ }\r
+\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.property;\r
+\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.simantics.browsing.ui.swt.ImagerContributor;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.modeling.ui.Activator;\r
+\r
+public class OperationVariableImager extends ImagerContributor<Variable> {\r
+\r
+ @Override\r
+ public ImageDescriptor getDescriptor(ReadGraph graph, Variable var) throws DatabaseException {\r
+ return Activator.BULLET_ICON;\r
+ }\r
+\r
+}\r
--- /dev/null
+package org.simantics.sysdyn.ui.property;\r
+\r
+import java.util.Map;\r
+\r
+import org.simantics.browsing.ui.common.ColumnKeys;\r
+import org.simantics.browsing.ui.graph.contributor.labeler.ColumnLabelerContributor;\r
+import org.simantics.databoard.binding.java.StringBindingDefault;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.utils.datastructures.ArrayMap;\r
+\r
+public class OperationVariableLabels extends ColumnLabelerContributor<Variable> {\r
+\r
+ @Override\r
+ public Map<String, String> getLabel(ReadGraph graph, Variable variable) throws DatabaseException {\r
+\r
+ String label = variable.getPropertyValue(graph, "Name", StringBindingDefault.INSTANCE);\r
+\r
+ return new ArrayMap<String, String>(new String[] { ColumnKeys.SINGLE } , new String[] { label });\r
+\r
+ }\r
+\r
+}\r