restorable="true">\r
</view>\r
<view\r
+ category="org.simantics.sysdyn.ui.category"\r
class="org.simantics.sysdyn.ui.browser.SysdynBrowser"\r
id="org.simantics.sysdyn.ui.browser"\r
name="Sysdyn Model Browser"\r
</menu>\r
<command\r
commandId="org.simantics.sysdyn.ui.showModule"\r
- icon="icons/silk/palette.png"\r
+ icon="icons/palette.png"\r
label="Show Module"\r
style="push">\r
<visibleWhen>\r
class="org.simantics.sysdyn.ui.browser.contributions.Module"\r
preference="1.0">\r
</implementation>\r
- <implementation\r
- class="org.simantics.sysdyn.ui.browser.contributions.ModuleType"\r
- preference="1.0">\r
- </implementation>\r
</binding>\r
</extension>\r
<extension\r
class="org.simantics.sysdyn.ui.browser.contributions.AbstractNodeImager"\r
preference="2.0">\r
</implementation>\r
- <implementation\r
- class="org.simantics.sysdyn.ui.browser.contributions.ModelImager"\r
- preference="2.0">\r
- </implementation>\r
- <implementation\r
- class="org.simantics.sysdyn.ui.browser.contributions.ConfigurationImager"\r
- preference="2.0">\r
- </implementation>\r
- <implementation\r
- class="org.simantics.sysdyn.ui.browser.contributions.VariableImager"\r
- preference="2.0">\r
- </implementation>\r
- <implementation\r
- class="org.simantics.sysdyn.ui.browser.contributions.ExperimentImager"\r
- preference="2.0">\r
- </implementation>\r
<implementation\r
class="org.simantics.sysdyn.ui.browser.contributions.SimulationResultImager"\r
preference="2.0">\r
</implementation>\r
- <implementation\r
- class="org.simantics.sysdyn.ui.browser.contributions.ModuleImager"\r
- preference="2.0">\r
- </implementation>\r
- <implementation\r
- class="org.simantics.sysdyn.ui.browser.contributions.InputImager"\r
- preference="2.0">\r
- </implementation>\r
</binding>\r
</extension>\r
<extension\r
class="org.simantics.sysdyn.ui.properties.ResourceSelectionProcessor">\r
</implementation>\r
</binding>\r
- </extension>\r
- <extension\r
- point="org.eclipse.ui.propertyPages">\r
- <page\r
- class="org.simantics.sysdyn.ui.WorkbenchPropertyPage1"\r
- id="org.simantics.sysdyn.ui.page1"\r
- name="name">\r
- </page>\r
</extension>
</plugin>\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.InputNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.ModelNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.ModuleNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode;\r
import org.simantics.sysdyn.ui.browser.nodes.ModulesNode;\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
\r
@Override\r
public ImageDescriptor getDescriptor(ReadGraph graph, AbstractNode node) throws DatabaseException {\r
\r
+ String image = null;\r
if (node instanceof ExperimentsFolder || \r
node instanceof OperatingInterfacesFolder || \r
node instanceof ModulesNode)\r
- return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/folder.png"));\r
- \r
+ image = "icons/folder.png";\r
+ else if (node instanceof ModuleTypeNode || node instanceof ModuleNode || node instanceof ConfigurationNode)\r
+ image = "icons/bricks.png";\r
+ else if (node instanceof ExperimentNode)\r
+ image = "icons/time.png";\r
+ else if (node instanceof InputNode)\r
+ image = "icons/brick_link.png";\r
+ else if (node instanceof ModelNode)\r
+ image = "icons/chart_organisation.png";\r
+ else if (node instanceof VariableNode)\r
+ image = "icons/brick.png";\r
+ \r
+ if (image != null)\r
+ return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource(image));\r
return null;\r
}\r
\r
+++ /dev/null
-package org.simantics.sysdyn.ui.browser.contributions;\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.sysdyn.ui.Activator;\r
-import org.simantics.sysdyn.ui.browser.nodes.ConfigurationNode;\r
-\r
-public class ConfigurationImager extends ImagerContributor<ConfigurationNode> {\r
-\r
- @Override\r
- public ImageDescriptor getDescriptor(ReadGraph graph, ConfigurationNode node) throws DatabaseException {\r
- return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/bricks.png"));\r
- }\r
-}\r
+++ /dev/null
-package org.simantics.sysdyn.ui.browser.contributions;\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.project.IProject;\r
-import org.simantics.simulation.project.IExperimentManager;\r
-import org.simantics.sysdyn.ui.Activator;\r
-import org.simantics.sysdyn.ui.browser.nodes.ExperimentNode;\r
-import org.simantics.ui.SimanticsUI;\r
-\r
-public class ExperimentImager extends ImagerContributor<ExperimentNode> {\r
- \r
- @Override\r
- public ImageDescriptor getDescriptor(ReadGraph graph, ExperimentNode experiment) throws DatabaseException {\r
- IProject project = SimanticsUI.getProject();\r
- IExperimentManager experimentManager = project.getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER);\r
- System.out.println(experimentManager.getActiveExperiment());\r
- return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/time.png"));\r
- }\r
-\r
-}\r
+++ /dev/null
-package org.simantics.sysdyn.ui.browser.contributions;\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.sysdyn.ui.Activator;\r
-import org.simantics.sysdyn.ui.browser.nodes.ExperimentsFolder;\r
-\r
-public class ExperimentsImager extends ImagerContributor<ExperimentsFolder> {\r
-\r
- @Override\r
- public ImageDescriptor getDescriptor(ReadGraph graph, ExperimentsFolder node) throws DatabaseException {\r
- return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/folder.png"));\r
- }\r
-}\r
+++ /dev/null
-package org.simantics.sysdyn.ui.browser.contributions;\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.sysdyn.ui.Activator;\r
-import org.simantics.sysdyn.ui.browser.nodes.InputNode;\r
-\r
-public class InputImager extends ImagerContributor<InputNode> {\r
-\r
- @Override\r
- public ImageDescriptor getDescriptor(ReadGraph graph, InputNode node) throws DatabaseException {\r
- return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/brick_link.png"));\r
- }\r
-\r
-}\r
+++ /dev/null
-package org.simantics.sysdyn.ui.browser.contributions;\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.sysdyn.ui.Activator;\r
-import org.simantics.sysdyn.ui.browser.nodes.ModelNode;\r
-\r
-public class ModelImager extends ImagerContributor<ModelNode> {\r
-\r
- @Override\r
- public ImageDescriptor getDescriptor(ReadGraph graph, ModelNode node) throws DatabaseException {\r
- return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/chart_organisation.png"));\r
- }\r
-}\r
+++ /dev/null
-package org.simantics.sysdyn.ui.browser.contributions;\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.sysdyn.ui.Activator;\r
-import org.simantics.sysdyn.ui.browser.nodes.ModuleNode;\r
-\r
-public class ModuleImager extends ImagerContributor<ModuleNode> {\r
-\r
- @Override\r
- public ImageDescriptor getDescriptor(ReadGraph graph, ModuleNode node) throws DatabaseException {\r
- return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/bricks.png"));\r
- }\r
-}\r
+++ /dev/null
-package org.simantics.sysdyn.ui.browser.contributions;\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.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.modeling.ModelingResources;\r
-import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
-import org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode;\r
-\r
-public class ModuleType extends ViewpointContributor<ModuleTypeNode> {\r
-\r
- @Override\r
- public Collection<?> getContribution(ReadGraph graph, ModuleTypeNode module) throws DatabaseException {\r
- ArrayList<AbstractNode> result = new ArrayList<AbstractNode>();\r
- ModelingResources mr = ModelingResources.getInstance(graph);\r
- Resource symbol = graph.getPossibleObject(module.resource, mr.ComponentTypeToSymbol);\r
- result.add(graph.adapt(symbol, AbstractNode.class));\r
- return result;\r
- }\r
-\r
- @Override\r
- public String getViewpointId() {\r
- return "Standard";\r
- }\r
-\r
-}\r
\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.modeling.ModelingResources;\r
import org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode;\r
\r
public class ModuleTypeLabeler extends LabelerContributor<ModuleTypeNode>{\r
\r
@Override\r
public String getLabel(ReadGraph graph, ModuleTypeNode moduleType) throws DatabaseException {\r
- String label = graph.getPossibleRelatedValue(moduleType.resource, graph.getBuiltins().HasLabel);\r
+ ModelingResources mr = ModelingResources.getInstance(graph);\r
+ Resource typeResource = graph.getPossibleObject(moduleType.resource, mr.SymbolToComponentType);\r
+ String label = graph.getPossibleRelatedValue(typeResource, graph.getBuiltins().HasName);\r
return label == null ? "ModuleType (no name)" : label;\r
}\r
\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.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
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
- result.add(new ModuleTypeNode(r));\r
+ Resource symbol = graph.getPossibleObject(r,ModelingResources.getInstance(graph).ComponentTypeToSymbol);\r
+ result.add(new ModuleTypeNode(symbol));\r
}\r
return result;\r
\r
+++ /dev/null
-package org.simantics.sysdyn.ui.browser.contributions;\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.sysdyn.ui.Activator;\r
-import org.simantics.sysdyn.ui.browser.nodes.VariableNode;\r
-\r
-public class VariableImager extends ImagerContributor<VariableNode> {\r
-\r
- @Override\r
- public ImageDescriptor getDescriptor(ReadGraph graph, VariableNode node) throws DatabaseException {\r
- return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/brick.png"));\r
- }\r
-}\r
\r
Resource moduleType = g.newResource();\r
g.claimValue(moduleType, mu.b.HasName, "New Module Type");\r
- g.claimValue(moduleType, mu.b.HasLabel, "New Module Type");\r
g.claim(moduleType, mu.b.Inherits, sr.Module);\r
g.claim(moduleType, mu.b.PartOf, model);\r
\r
0,\r
r,\r
"Dependency Properties"));\r
- if (backend.isInheritedFrom(r, sr.Module))\r
- return Collections.singleton(\r
+ if (backend.isInheritedFrom(r, sr.ModuleSymbol)) {\r
+ r = backend.getPossibleObject(r, mr.SymbolToComponentType);\r
+ if(r != null)\r
+ return Collections.singleton(\r
new ComparableTabContributor(\r
new ModuleTypeTab(),\r
0,\r
r,\r
"Module Type Properties"));\r
+ }\r
} catch (ServiceException e) {\r
e.printStackTrace();\r
} catch (ManyObjectsForFunctionalRelationException e) {\r