version="0.0.0"\r
unpack="false"/>\r
\r
+ <plugin\r
+ id="org.simantics.operating"\r
+ download-size="0"\r
+ install-size="0"\r
+ version="0.0.0"\r
+ unpack="false"/>\r
+\r
+ <plugin\r
+ id="org.simantics.operating.ontology"\r
+ download-size="0"\r
+ install-size="0"\r
+ version="0.0.0"\r
+ unpack="false"/>\r
+\r
</feature>\r
org.simantics.diagram.ontology;bundle-version="1.0.0"
Bundle-Activator: org.simantics.sysdyn.ui.Activator
Bundle-ActivationPolicy: lazy
+Export-Package: org.simantics.sysdyn.ui.browser.nodes
<resource\r
uri="http://www.simantics.org/Sysdyn-1.0/SysdynProject"\r
class="org.simantics.sysdyn.ui.project.SysdynProject" />\r
- <resource\r uri="http://www.simantics.org/Sysdyn-1.0/SysdynModelManager"\r class="org.simantics.sysdyn.ui.project.SysdynProject" />\r </target>\r \r <target interface="org.simantics.project.IProjectLifecycle">\r <resource\r uri="http://www.simantics.org/Sysdyn-1.0/SysdynProject"\r class="org.simantics.sysdyn.ui.project.SysdynProjectLifeCycle" />\r </target>\r \r <target\r interface="org.simantics.sysdyn.ui.browser.nodes.AbstractNode">\r <type\r uri="http://www.simantics.org/Sysdyn-1.0/SysdynModel"\r class="org.simantics.sysdyn.ui.browser.nodes.ModelNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-1.0/IndependentVariable"\r class="org.simantics.sysdyn.ui.browser.nodes.VariableNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-1.0/Input"\r class="org.simantics.sysdyn.ui.browser.nodes.InputNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-1.0/Module"\r class="org.simantics.sysdyn.ui.browser.nodes.ModuleNode">\r <this />\r </type>\r \r <resource\r uri="http://www.simantics.org/Sysdyn-1.0/Module"\r class="org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode">\r <this />\r </resource>\r\r <resource\r uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.browser.nodes.SymbolNode">\r <this />\r </resource>\r\r <type\r uri="http://www.simantics.org/Simulation-1.0/Experiment"\r class="org.simantics.sysdyn.ui.browser.nodes.ExperimentNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-1.0/Result"\r class="org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode">\r <this />\r </type>\r \r </target>\r\r <!-- Inject default connection routing algorithm for sysdyn diagrams -->\r <target interface="org.simantics.g2d.diagram.DiagramClass">\r <adapter uri="http://www.simantics.org/Sysdyn-1.0/ConfigurationDiagram"\r adapterClass="org.simantics.sysdyn.ui.elements2.ConfigurationDiagramClassAdapter" />\r </target>\r\r <!-- Sysdyn symbols -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <resource uri="http://www.simantics.org/Sysdyn-1.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/InputSymbol"\r class="org.simantics.sysdyn.ui.elements2.InputFactory" />\r\r <type uri="http://www.simantics.org/Sysdyn-1.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/InputSymbol"\r class="org.simantics.sysdyn.ui.elements2.InputFactory" /> \r </target>\r \r <!-- Sysdyn connections -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <!-- Edges -->\r <resource uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.FlowEdgeFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.FlowEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r <!-- : SYSDYN.Connection-->\r <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.FlowConnectionFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.DependencyConnectionFactory" />\r </target>\r \r <target interface="org.simantics.g2d.connection.EdgeVisualsConfigurer">\r <baseType uri="http://www.simantics.org/Diagram-2.0/HasConnector" />\r <resource uri="http://www.simantics.org/Diagram-2.0/HasPlainConnector"\r class="org.simantics.diagram.content.ArrowConfigurer">\r <string>none 0</string>\r </resource>\r <resource uri="http://www.simantics.org/Diagram-2.0/HasArrowConnector"\r class="org.simantics.diagram.content.ArrowConfigurer">\r <string>fill 1</string>\r </resource>\r </target>\r \r
+ <resource\r uri="http://www.simantics.org/Sysdyn-1.0/SysdynModelManager"\r class="org.simantics.sysdyn.ui.project.SysdynProject" />\r </target>\r \r <target interface="org.simantics.project.IProjectLifecycle">\r <resource\r uri="http://www.simantics.org/Sysdyn-1.0/SysdynProject"\r class="org.simantics.sysdyn.ui.project.SysdynProjectLifeCycle" />\r </target>\r \r <target\r interface="org.simantics.browsing.ui.common.node.AbstractNode">\r <type\r uri="http://www.simantics.org/Sysdyn-1.0/SysdynModel"\r class="org.simantics.sysdyn.ui.browser.nodes.ModelNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-1.0/IndependentVariable"\r class="org.simantics.sysdyn.ui.browser.nodes.VariableNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-1.0/Input"\r class="org.simantics.sysdyn.ui.browser.nodes.InputNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-1.0/Module"\r class="org.simantics.sysdyn.ui.browser.nodes.ModuleNode">\r <this />\r </type>\r \r <resource\r uri="http://www.simantics.org/Sysdyn-1.0/Module"\r class="org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode">\r <this />\r </resource>\r\r <resource\r uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.browser.nodes.SymbolNode">\r <this />\r </resource>\r\r <type\r uri="http://www.simantics.org/Simulation-1.0/Experiment"\r class="org.simantics.sysdyn.ui.browser.nodes.ExperimentNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-1.0/Result"\r class="org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode">\r <this />\r </type>\r \r </target>\r\r <!-- Inject default connection routing algorithm for sysdyn diagrams -->\r <target interface="org.simantics.g2d.diagram.DiagramClass">\r <adapter uri="http://www.simantics.org/Sysdyn-1.0/ConfigurationDiagram"\r adapterClass="org.simantics.sysdyn.ui.elements2.ConfigurationDiagramClassAdapter" />\r </target>\r\r <!-- Sysdyn symbols -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <resource uri="http://www.simantics.org/Sysdyn-1.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/InputSymbol"\r class="org.simantics.sysdyn.ui.elements2.InputFactory" />\r\r <type uri="http://www.simantics.org/Sysdyn-1.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/InputSymbol"\r class="org.simantics.sysdyn.ui.elements2.InputFactory" /> \r </target>\r \r <!-- Sysdyn connections -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <!-- Edges -->\r <resource uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.FlowEdgeFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.FlowEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r <!-- : SYSDYN.Connection-->\r <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.FlowConnectionFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.DependencyConnectionFactory" />\r </target>\r \r <target interface="org.simantics.g2d.connection.EdgeVisualsConfigurer">\r <baseType uri="http://www.simantics.org/Diagram-2.0/HasConnector" />\r <resource uri="http://www.simantics.org/Diagram-2.0/HasPlainConnector"\r class="org.simantics.diagram.content.ArrowConfigurer">\r <string>none 0</string>\r </resource>\r <resource uri="http://www.simantics.org/Diagram-2.0/HasArrowConnector"\r class="org.simantics.diagram.content.ArrowConfigurer">\r <string>fill 1</string>\r </resource>\r </target>\r \r
</adapters>
\ No newline at end of file
</menuContribution>\r
<menuContribution\r
locationURI="popup:#SysdynBrowserPopup?after=wbStart">\r
- <menu\r
+ <menu id="org.simantics.new"\r
label="New">\r
<command\r
commandId="org.simantics.sysdyn.ui.newModel"\r
class="org.simantics.sysdyn.ui.browser.contributions.ModulesLabeler"\r
preference="2.0">\r
</implementation>\r
- <implementation\r
+<!-- <implementation\r
class="org.simantics.sysdyn.ui.browser.contributions.OperatingInterfacesLabeler"\r
preference="2.0">\r
- </implementation>\r
+ </implementation>-->\r
<implementation\r
class="org.simantics.sysdyn.ui.browser.contributions.ExperimentLabeler"\r
preference="2.0">\r
*******************************************************************************/\r
package org.simantics.sysdyn.ui;\r
\r
+import java.net.URL;\r
+\r
import org.apache.log4j.BasicConfigurator;\r
import org.apache.log4j.ConsoleAppender;\r
import org.apache.log4j.Level;\r
throw new IllegalStateException("ResourceManager of bundle '" + PLUGIN_ID + "' is not initialized.");\r
return resourceManager;\r
}\r
+ \r
+ public static URL getDefaultResource(String name) {\r
+ Activator plugin = getDefault();\r
+ if(plugin == null) throw new IllegalStateException("The plugin is not active.");\r
+ return plugin.getBundle().getResource(name);\r
+ }\r
}\r
*******************************************************************************/\r
package org.simantics.sysdyn.ui.browser;\r
\r
+import java.util.Arrays;\r
import java.util.Collections;\r
+import java.util.HashSet;\r
import java.util.Set;\r
\r
import org.eclipse.swt.widgets.Composite;\r
\r
public class SysdynBrowser extends GraphExplorerView {\r
\r
- private static final Set<String> browseContexts = Collections.singleton("http://www.simantics.org/Sysdyn-1.0/Browser");\r
- \r
+// private static final Set<String> browseContexts = Collections.singleton("http://www.simantics.org/Sysdyn-1.0/Browser");\r
+ private static final Set<String> browseContexts = new HashSet<String>(Arrays.asList("http://www.simantics.org/Sysdyn-1.0/Browser", "http://www.simantics.org/Operating-1.0/Browser")); \r
+\r
@Override\r
protected IContextMenuInitializer getContextMenuInitializer() {\r
return new ContextMenuInitializer("#SysdynBrowserPopup");\r
package org.simantics.sysdyn.ui.browser.contributions;\r
\r
import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.swt.ImagerContributor;\r
import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.sysdyn.ui.Activator;\r
-import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
import org.simantics.sysdyn.ui.browser.nodes.ConfigurationNode;\r
import org.simantics.sysdyn.ui.browser.nodes.ExperimentNode;\r
import org.simantics.sysdyn.ui.browser.nodes.ExperimentsFolder;\r
import org.simantics.sysdyn.ui.browser.nodes.OperatingInterfacesFolder;\r
import org.simantics.sysdyn.ui.browser.nodes.VariableNode;\r
\r
-public class AbstractNodeImager extends ImagerContributor<AbstractNode> {\r
+public class AbstractNodeImager extends ImagerContributor<AbstractNode<Resource>> {\r
\r
@Override\r
- public ImageDescriptor getDescriptor(ReadGraph graph, AbstractNode node) throws DatabaseException {\r
+ public ImageDescriptor getDescriptor(ReadGraph graph, AbstractNode<Resource> node) throws DatabaseException {\r
\r
String image = null;\r
if (node instanceof ExperimentsFolder || \r
- node instanceof OperatingInterfacesFolder || \r
+// node instanceof OperatingInterfacesFolder || \r
node instanceof ModulesNode)\r
image = "icons/folder.png";\r
else if (node instanceof ModuleTypeNode || node instanceof ModuleNode || node instanceof ConfigurationNode)\r
*******************************************************************************/\r
package org.simantics.sysdyn.ui.browser.contributions;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor;\r
import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
\r
-public class AbstractNodeLabeler extends LabelerContributor<AbstractNode> {\r
+public class AbstractNodeLabeler extends LabelerContributor<AbstractNode<Resource>> {\r
\r
@Override\r
- public String getLabel(ReadGraph graph, AbstractNode node) throws DatabaseException {\r
- if (!graph.hasStatement(node.resource))\r
+ public String getLabel(ReadGraph graph, AbstractNode<Resource> node) throws DatabaseException {\r
+ if (!graph.hasStatement(node.data))\r
return "";\r
- return graph.adapt(node.resource, String.class);\r
+ return graph.adapt(node.data, String.class);\r
}\r
\r
}\r
import java.util.ArrayList;\r
import java.util.Collection;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
import org.simantics.db.Builtins;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.common.request.ObjectsWithType;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
import org.simantics.sysdyn.ui.browser.nodes.ConfigurationNode;\r
\r
public class Configuration extends ViewpointContributor<ConfigurationNode> {\r
\r
@Override\r
public Collection<?> getContribution(ReadGraph graph, ConfigurationNode configuration) throws DatabaseException {\r
- ArrayList<AbstractNode> result = new ArrayList<AbstractNode>();\r
+ ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();\r
Builtins b = graph.getBuiltins();\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
- for(Resource r : graph.syncRequest(new ObjectsWithType(configuration.resource, b.ConsistsOf, sr.IndependentVariable))) {\r
+ for(Resource r : graph.syncRequest(new ObjectsWithType(configuration.data, b.ConsistsOf, sr.IndependentVariable))) {\r
try {\r
result.add(graph.adapt(r, AbstractNode.class));\r
} catch(DatabaseException e) {\r
e.printStackTrace();\r
}\r
}\r
- for(Resource r : graph.syncRequest(new ObjectsWithType(configuration.resource, b.ConsistsOf, sr.Input))) {\r
+ for(Resource r : graph.syncRequest(new ObjectsWithType(configuration.data, b.ConsistsOf, sr.Input))) {\r
try {\r
result.add(graph.adapt(r, AbstractNode.class));\r
} catch(DatabaseException e) {\r
e.printStackTrace();\r
}\r
}\r
- for(Resource r : graph.syncRequest(new ObjectsWithType(configuration.resource, b.ConsistsOf, sr.Module))) {\r
+ for(Resource r : graph.syncRequest(new ObjectsWithType(configuration.data, b.ConsistsOf, sr.Module))) {\r
try {\r
result.add(graph.adapt(r, AbstractNode.class));\r
} catch(DatabaseException e) {\r
import java.util.ArrayList;\r
import java.util.Collection;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
import org.simantics.db.Builtins;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.common.request.ObjectsWithType;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.simulation.ontology.SimulationResource;\r
-import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
import org.simantics.sysdyn.ui.browser.nodes.ExperimentsFolder;\r
\r
public class Experiment extends ViewpointContributor<ExperimentsFolder> {\r
\r
@Override\r
public Collection<?> getContribution(ReadGraph graph, ExperimentsFolder experimentsFolder) throws DatabaseException {\r
- ArrayList<AbstractNode> result = new ArrayList<AbstractNode>();\r
+ ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();\r
Builtins b = graph.getBuiltins();\r
- for(Resource r : graph.syncRequest(new ObjectsWithType(experimentsFolder.resource, b.ConsistsOf, SimulationResource.getInstance(graph).Experiment))) {\r
+ for(Resource r : graph.syncRequest(new ObjectsWithType(experimentsFolder.data, b.ConsistsOf, SimulationResource.getInstance(graph).Experiment))) {\r
try {\r
result.add(graph.adapt(r, AbstractNode.class));\r
} catch(DatabaseException e) {\r
\r
@Override\r
public LabelDecorator getDecorator(ReadGraph graph, ExperimentNode experimentNode) throws DatabaseException {\r
- if (graph.hasStatement(experimentNode.resource, SimulationResource.getInstance(graph).IsActive)) {\r
+ if (graph.hasStatement(experimentNode.data, SimulationResource.getInstance(graph).IsActive)) {\r
return new LabelDecorator.Stub() {\r
@Override\r
public String decorateLabel(String label, String column, int itemIndex) {\r
\r
@Override\r
public String getLabel(ReadGraph graph, ExperimentNode experiment) throws DatabaseException {\r
- String name = graph.getPossibleRelatedValue(experiment.resource, graph.getBuiltins().HasLabel);\r
+ String name = graph.getPossibleRelatedValue(experiment.data, graph.getBuiltins().HasLabel);\r
return name == null ? "Experiment (no name)" : name;\r
}\r
\r
@Override\r
public String getLabel(ReadGraph graph, InputNode var) throws DatabaseException {\r
Builtins b = graph.getBuiltins();\r
- Resource varres = var.resource;\r
+ Resource varres = var.data;\r
StringBuilder sb = new StringBuilder();\r
for(Resource r : graph.getObjects(varres, b.HasName))\r
sb.append(graph.getValue(r));\r
import java.util.ArrayList;\r
import java.util.Collection;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.simulation.ontology.SimulationResource;\r
-import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
import org.simantics.sysdyn.ui.browser.nodes.ConfigurationNode;\r
import org.simantics.sysdyn.ui.browser.nodes.ExperimentsFolder;\r
import org.simantics.sysdyn.ui.browser.nodes.ModelNode;\r
import org.simantics.sysdyn.ui.browser.nodes.ModulesNode;\r
-import org.simantics.sysdyn.ui.browser.nodes.OperatingInterfacesFolder;\r
\r
public class Model extends ViewpointContributor<ModelNode> {\r
\r
@Override\r
public Collection<?> getContribution(ReadGraph graph, ModelNode model)\r
throws DatabaseException {\r
- ArrayList<AbstractNode> result = new ArrayList<AbstractNode>();\r
+ ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();\r
result.add(new ConfigurationNode(\r
graph.getSingleObject(\r
- model.resource,\r
+ model.data,\r
SimulationResource.getInstance(graph).HasConfiguration))\r
);\r
- result.add(new ExperimentsFolder(model.resource));\r
- result.add(new OperatingInterfacesFolder(model.resource));\r
- result.add(new ModulesNode(model.resource));\r
+ result.add(new ExperimentsFolder(model.data));\r
+ result.add(new ModulesNode(model.data));\r
return result;\r
}\r
\r
\r
@Override\r
public String getLabel(ReadGraph graph, ModelNode model) throws DatabaseException {\r
- String label = graph.getPossibleRelatedValue(model.resource, graph.getBuiltins().HasLabel);\r
+ String label = graph.getPossibleRelatedValue(model.data, graph.getBuiltins().HasLabel);\r
return label == null ? "Model (no name)" : label;\r
}\r
}\r
import java.util.ArrayList;\r
import java.util.Collection;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
import org.simantics.db.Builtins;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.modeling.ModelingResources;\r
import org.simantics.structural.stubs.StructuralResource2;\r
import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
import org.simantics.sysdyn.ui.browser.nodes.ModuleNode;\r
\r
public class Module extends ViewpointContributor<ModuleNode> {\r
\r
@Override\r
public Collection<?> getContribution(ReadGraph graph, ModuleNode module) throws DatabaseException {\r
- ArrayList<AbstractNode> result = new ArrayList<AbstractNode>();\r
+ ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();\r
Builtins b = graph.getBuiltins();\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
StructuralResource2 str = StructuralResource2.getInstance(graph);\r
\r
// ModuleTypeNode extends ModuleNode, so we get the instance in two different ways\r
- Resource instance = graph.getPossibleObject(module.resource, b.InstanceOf);\r
- if(graph.isInheritedFrom(module.resource, sr.ModuleSymbol)) {\r
+ Resource instance = graph.getPossibleObject(module.data, b.InstanceOf);\r
+ if(graph.isInheritedFrom(module.data, sr.ModuleSymbol)) {\r
ModelingResources mr = ModelingResources.getInstance(graph);\r
- instance = graph.getPossibleObject(module.resource, mr.SymbolToComponentType);\r
+ instance = graph.getPossibleObject(module.data, mr.SymbolToComponentType);\r
}\r
\r
if(instance == null) return result;\r
@Override\r
public String getLabel(ReadGraph graph, ModuleNode module) throws DatabaseException {\r
Builtins b = graph.getBuiltins();\r
- Resource resource = module.resource;\r
+ Resource resource = module.data;\r
StringBuilder sb = new StringBuilder();\r
for(Resource r : graph.getObjects(resource, b.HasName))\r
sb.append(graph.getValue(r));\r
@Override\r
public String getLabel(ReadGraph graph, ModuleTypeNode moduleType) throws DatabaseException {\r
ModelingResources mr = ModelingResources.getInstance(graph);\r
- Resource typeResource = graph.getPossibleObject(moduleType.resource, mr.SymbolToComponentType);\r
+ Resource typeResource = graph.getPossibleObject(moduleType.data, mr.SymbolToComponentType);\r
String label = graph.getPossibleRelatedValue(typeResource, graph.getBuiltins().HasName);\r
return label == null ? "ModuleType (no name)" : label;\r
}\r
import java.util.ArrayList;\r
import java.util.Collection;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
import org.simantics.db.Builtins;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.modeling.ModelingResources;\r
import org.simantics.structural.stubs.StructuralResource2;\r
-import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
import org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode;\r
import org.simantics.sysdyn.ui.browser.nodes.ModulesNode;\r
\r
public Collection<?> getContribution(ReadGraph graph, ModulesNode model)\r
throws DatabaseException {\r
\r
- ArrayList<AbstractNode> result = new ArrayList<AbstractNode>();\r
+ ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();\r
Builtins b = graph.getBuiltins();\r
StructuralResource2 st = StructuralResource2.getInstance(graph);\r
- for(Resource r : graph.syncRequest(new ObjectsWithType(model.resource, b.ConsistsOf, st.ComponentType))) {\r
+ for(Resource r : graph.syncRequest(new ObjectsWithType(model.data, b.ConsistsOf, st.ComponentType))) {\r
Resource symbol = graph.getPossibleObject(r,ModelingResources.getInstance(graph).ComponentTypeToSymbol);\r
result.add(new ModuleTypeNode(symbol));\r
}\r
import java.util.ArrayList;\r
import java.util.Collection;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
import org.simantics.db.Builtins;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.common.request.ObjectsWithType;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
\r
public class Project extends ViewpointContributor<Resource> {\r
\r
public Collection<?> getContribution(ReadGraph graph, Resource project)\r
throws DatabaseException {\r
\r
- ArrayList<AbstractNode> result = new ArrayList<AbstractNode>();\r
+ ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();\r
Builtins b = graph.getBuiltins();\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
for(Resource r : graph.syncRequest(new ObjectsWithType(project, b.ConsistsOf, sr.SysdynModel))) {\r
import java.util.ArrayList;\r
import java.util.Collection;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
import org.simantics.db.common.request.WriteRequest;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
import org.simantics.sysdyn.ui.browser.nodes.ExperimentNode;\r
\r
public class SimulationResult extends ViewpointContributor<ExperimentNode> {\r
\r
@Override\r
public Collection<?> getContribution(ReadGraph graph, ExperimentNode experiment) throws DatabaseException {\r
- ArrayList<AbstractNode> result = new ArrayList<AbstractNode>();\r
+ ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
- for(final Resource r : graph.syncRequest(new ObjectsWithType(experiment.resource, sr.HasResult, sr.Result))) {\r
+ for(final Resource r : graph.syncRequest(new ObjectsWithType(experiment.data, sr.HasResult, sr.Result))) {\r
String resultPath = (String)graph.getPossibleRelatedValue(r, sr.HasResultFile);\r
File file = new File(resultPath);\r
if(file.exists()) {\r
\r
@Override\r
public LabelDecorator getDecorator(ReadGraph graph, SimulationResultNode result) throws DatabaseException {\r
- if (graph.hasStatement(result.resource, SimulationResource.getInstance(graph).IsActive)) {\r
+ if (graph.hasStatement(result.data, SimulationResource.getInstance(graph).IsActive)) {\r
return new LabelDecorator.Stub() {\r
\r
@SuppressWarnings("unchecked")\r
\r
@Override\r
public ImageDescriptor getDescriptor(ReadGraph graph, SimulationResultNode result) throws DatabaseException {\r
- if(graph.hasStatement(result.resource, SimulationResource.getInstance(graph).IsActive))\r
+ if(graph.hasStatement(result.data, SimulationResource.getInstance(graph).IsActive))\r
return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/chart_bar.png"));\r
else\r
return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/chart_bar_blackAndWhite.png"));\r
\r
@Override\r
public String getLabel(ReadGraph graph, SimulationResultNode result) throws DatabaseException {\r
- String name = graph.getPossibleRelatedValue(result.resource, graph.getBuiltins().HasLabel);\r
+ String name = graph.getPossibleRelatedValue(result.data, graph.getBuiltins().HasLabel);\r
return name == null ? "Experiment (no name)" : name;\r
}\r
\r
@Override\r
public String getLabel(ReadGraph graph, VariableNode var) throws DatabaseException {\r
Builtins b = graph.getBuiltins();\r
- Resource varres = var.resource;\r
+ Resource varres = var.data;\r
StringBuilder sb = new StringBuilder();\r
for(Resource r : graph.getObjects(varres, b.HasName))\r
sb.append(graph.getValue(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.browser.nodes;\r
-\r
-import org.eclipse.core.runtime.IAdaptable;\r
-import org.simantics.db.Resource;\r
-\r
-public abstract class AbstractNode implements IAdaptable {\r
- public final Resource resource;\r
-\r
- public AbstractNode(Resource resource) {\r
- assert(resource != null);\r
- this.resource = resource;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- return resource.hashCode() + getClass().hashCode();\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj)\r
- return true;\r
- if (obj == null)\r
- return false;\r
- if (getClass() != obj.getClass())\r
- return false;\r
- AbstractNode other = (AbstractNode) obj;\r
- return resource.equals(other.resource);\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- @Override\r
- public Object getAdapter(Class adapter) {\r
- if(adapter.equals(Resource.class))\r
- return resource;\r
- return null;\r
- }\r
-}\r
*******************************************************************************/\r
package org.simantics.sysdyn.ui.browser.nodes;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.common.node.IDeletable;\r
import org.simantics.db.Resource;\r
\r
-public class ConfigurationNode extends AbstractNode implements IDeletable {\r
+public class ConfigurationNode extends AbstractNode<Resource> implements IDeletable {\r
\r
public ConfigurationNode(Resource resource) {\r
super(resource);\r
\r
import java.util.Collection;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.common.node.DeleteException;\r
import org.simantics.browsing.ui.common.node.IDeletableNode;\r
import org.simantics.browsing.ui.common.node.IDoubleClickableNode;\r
import org.simantics.utils.ui.ErrorLogger;\r
import org.simantics.utils.ui.ExceptionUtils;\r
\r
-public class ExperimentNode extends AbstractNode implements IDoubleClickableNode, IDeletableNode, IModifiableNode{\r
+public class ExperimentNode extends AbstractNode<Resource> implements IDoubleClickableNode, IDeletableNode, IModifiableNode{\r
\r
public ExperimentNode(Resource resource) {\r
super(resource);\r
\r
@Override\r
public boolean handleDoubleClick() {\r
- if (resource == null)\r
+ if (data == null)\r
return false;\r
IProject project = SimanticsUI.getProject();\r
IExperimentManager experimentManager = project.getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER);\r
ErrorLogger.defaultLogWarning("Experiment manager not available.", new Exception());\r
return false;\r
}\r
- SysdynExperimentActivator.scheduleActivation(SimanticsUI.getSession(), project, experimentManager, resource);\r
+ SysdynExperimentActivator.scheduleActivation(SimanticsUI.getSession(), project, experimentManager, data);\r
return true;\r
}\r
\r
@Override\r
public Modifier getModifier(String columnId) {\r
- LabelModifier modifier = new LabelModifier(SimanticsUI.getSession(), resource) {\r
+ LabelModifier modifier = new LabelModifier(SimanticsUI.getSession(), data) {\r
@Override\r
public String isValid(String label) {\r
if (label.isEmpty())\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException, CancelTransactionException {\r
Builtins b = graph.getBuiltins();\r
- Collection<Resource> results = graph.getObjects(resource, SysdynResource.getInstance(graph).HasResult);\r
+ Collection<Resource> results = graph.getObjects(data, SysdynResource.getInstance(graph).HasResult);\r
if(results != null)\r
for(Resource result : results) \r
SimulationResultNode.unlinkResult(graph, result);\r
- graph.deny(resource, b.PartOf); \r
+ graph.deny(data, b.PartOf); \r
}\r
});\r
} catch (DatabaseException e) {\r
*******************************************************************************/\r
package org.simantics.sysdyn.ui.browser.nodes;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.db.Resource;\r
\r
-public class ExperimentsFolder extends AbstractNode {\r
+public class ExperimentsFolder extends AbstractNode<Resource> {\r
\r
public ExperimentsFolder(Resource resource) {\r
super(resource);\r
package org.simantics.sysdyn.ui.browser.nodes;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.db.Resource;\r
\r
-public class InputNode extends AbstractNode {\r
+public class InputNode extends AbstractNode<Resource> {\r
\r
public InputNode(Resource resource) {\r
super(resource);\r
package org.simantics.sysdyn.ui.browser.nodes;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.common.node.DeleteException;\r
import org.simantics.browsing.ui.common.node.IDeletableNode;\r
import org.simantics.browsing.ui.common.node.IModifiableNode;\r
import org.simantics.ui.SimanticsUI;\r
import org.simantics.utils.ui.ExceptionUtils;\r
\r
-public class ModelNode extends AbstractNode implements IDeletableNode, IModifiableNode {\r
+public class ModelNode extends AbstractNode<Resource> implements IDeletableNode, IModifiableNode {\r
\r
public ModelNode(Resource resource) {\r
super(resource);\r
\r
@Override\r
public Modifier getModifier(String columnId) {\r
- LabelModifier modifier = new LabelModifier(SimanticsUI.getSession(), resource) {\r
+ LabelModifier modifier = new LabelModifier(SimanticsUI.getSession(), data) {\r
@Override\r
public String isValid(String label) {\r
if (label.isEmpty())\r
public void perform(WriteGraph graph) throws DatabaseException, CancelTransactionException {\r
Builtins b = graph.getBuiltins();\r
\r
- for(Resource r : graph.getObjects(resource, b.ConsistsOf))\r
+ for(Resource r : graph.getObjects(data, b.ConsistsOf))\r
if(graph.isInstanceOf(r, SysdynResource.getInstance(graph).Result))\r
SimulationResultNode.deleteResultFiles(graph, r);\r
\r
- graph.deny(resource, b.PartOf);\r
+ graph.deny(data, b.PartOf);\r
}\r
});\r
} catch (DatabaseException e) {\r
package org.simantics.sysdyn.ui.browser.nodes;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.db.Resource;\r
\r
-public class ModuleNode extends AbstractNode {\r
+public class ModuleNode extends AbstractNode<Resource> {\r
\r
public ModuleNode(Resource resource) {\r
super(resource);\r
\r
import java.util.Collection;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.common.node.DeleteException;\r
import org.simantics.browsing.ui.common.node.IDeletableNode;\r
import org.simantics.browsing.ui.common.node.IModifiableNode;\r
import org.simantics.simulation.ontology.SimulationResource;\r
import org.simantics.structural.stubs.StructuralResource2;\r
import org.simantics.ui.SimanticsUI;\r
-\r
-public class ModuleTypeNode extends ModuleNode implements IDeletableNode, IModifiableNode {\r
+// FIXME: should extend ModuleNode\r
+public class ModuleTypeNode extends AbstractNode<Resource> implements IDeletableNode, IModifiableNode {\r
\r
public ModuleTypeNode(Resource resource) {\r
super(resource);\r
public Modifier perform(ReadGraph graph) throws ManyObjectsForFunctionalRelationException, ServiceException {\r
ModelingResources mr = ModelingResources.getInstance(graph);\r
Builtins b = graph.getBuiltins();\r
- Resource type = graph.getPossibleObject(resource, mr.SymbolToComponentType);\r
+ Resource type = graph.getPossibleObject(data, mr.SymbolToComponentType);\r
\r
LabelModifier modifier = new LabelModifier(SimanticsUI.getSession(), type, b.HasName) {\r
@Override\r
StructuralResource2 st = StructuralResource2.getInstance(graph);\r
ModelingResources mr = ModelingResources.getInstance(graph);\r
\r
- Resource type = graph.getPossibleObject(resource, mr.SymbolToComponentType);\r
+ Resource type = graph.getPossibleObject(data, mr.SymbolToComponentType);\r
Resource model = graph.getSingleObject(type, b.PartOf);\r
Resource modelConfiguration = graph.getSingleObject(model, SimulationResource.getInstance(graph).HasConfiguration);\r
if (!graph.syncRequest(new ObjectsWithType(modelConfiguration, b.ConsistsOf, type)).isEmpty()) {\r
*******************************************************************************/\r
package org.simantics.sysdyn.ui.browser.nodes;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.db.Resource;\r
\r
-public class ModulesNode extends AbstractNode {\r
+public class ModulesNode extends AbstractNode<Resource> {\r
\r
public ModulesNode(Resource resource) {\r
super(resource);\r
package org.simantics.sysdyn.ui.browser.nodes;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.db.Resource;\r
\r
-public class OperatingInterfacesFolder extends AbstractNode {\r
+public class OperatingInterfacesFolder extends AbstractNode<Resource> {\r
\r
public OperatingInterfacesFolder(Resource resource) {\r
super(resource);\r
\r
import java.io.File;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.common.node.DeleteException;\r
import org.simantics.browsing.ui.common.node.IDeletableNode;\r
import org.simantics.browsing.ui.common.node.IModifiableNode;\r
import org.simantics.ui.SimanticsUI;\r
import org.simantics.utils.ui.ExceptionUtils;\r
\r
-public class SimulationResultNode extends AbstractNode implements IDeletableNode, IModifiableNode {\r
+public class SimulationResultNode extends AbstractNode<Resource> implements IDeletableNode, IModifiableNode {\r
\r
public SimulationResultNode(Resource resource) {\r
super(resource);\r
\r
@Override\r
public Modifier getModifier(String columnId) {\r
- LabelModifier modifier = new LabelModifier(SimanticsUI.getSession(), resource) {\r
+ LabelModifier modifier = new LabelModifier(SimanticsUI.getSession(), data) {\r
@Override\r
public String isValid(String label) {\r
if (label.isEmpty())\r
SimanticsUI.getSession().syncRequest(new WriteRequest() {\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException, CancelTransactionException {\r
- unlinkResult(graph, resource);\r
+ unlinkResult(graph, data);\r
}\r
});\r
} catch (DatabaseException e) {\r
package org.simantics.sysdyn.ui.browser.nodes;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.common.node.IDeletable;\r
import org.simantics.db.Resource;\r
\r
-public class SymbolNode extends AbstractNode implements IDeletable {\r
+public class SymbolNode extends AbstractNode<Resource> implements IDeletable {\r
\r
public SymbolNode(Resource resource) {\r
super(resource);\r
*******************************************************************************/\r
package org.simantics.sysdyn.ui.browser.nodes;\r
\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.db.Resource;\r
\r
-public class VariableNode extends AbstractNode {\r
+public class VariableNode extends AbstractNode<Resource> {\r
\r
public VariableNode(Resource resource) {\r
super(resource);\r