<graph />\r
<this />\r
</type>\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/Variable"\r class="org.simantics.sysdyn.ui.browser.nodes.VariableNode">\r <this />\r </type>\r </target>\r \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 </target>\r \r
</adapters>
\ No newline at end of file
<with\r
variable="selection">\r
<test\r
- args="http://www.simantics.org/Sysdyn-1.0/Configuration"\r
- property="org.simantics.graph.resourceType">\r
+ args="org.simantics.sysdyn.ui.browser.nodes.ModelNode"\r
+ property="org.simantics.sysdyn.ui.nodeClass">\r
</test>\r
</with>\r
</activeWhen>\r
<with\r
variable="selection">\r
<test\r
- args="http://www.simantics.org/Sysdyn-1.0/Configuration"\r
- property="org.simantics.graph.resourceType">\r
+ args="org.simantics.sysdyn.ui.browser.nodes.ModelNode"\r
+ property="org.simantics.sysdyn.ui.nodeClass">\r
</test>\r
</with>\r
</activeWhen>\r
point="org.simantics.browsing.ui.common.viewpointContributionBinding">\r
<binding\r
browseContext="http://www.simantics.org/Sysdyn-1.0/Browser">\r
- <implementation\r
- class="org.simantics.sysdyn.ui.browser.contributions.Configuration"\r
- preference="1.0">\r
- </implementation>\r
<implementation\r
class="org.simantics.sysdyn.ui.browser.contributions.Variable"\r
preference="1.0">\r
</implementation>\r
- <implementation\r
- class="org.simantics.sysdyn.ui.browser.contributions.Experiments"\r
- preference="1.0">\r
- </implementation>\r
<implementation\r
class="org.simantics.sysdyn.ui.browser.contributions.Model"\r
preference="1.0">\r
</implementation>\r
<implementation\r
- class="org.simantics.sysdyn.ui.browser.contributions.OperatingInterfaces"\r
- preference="1.0">\r
+ class="org.simantics.sysdyn.ui.browser.contributions.ModelChildren"\r
+ preference="2.0">\r
</implementation>\r
</binding>\r
</extension>\r
browseContext="http://www.simantics.org/Sysdyn-1.0/Browser">\r
<implementation\r
class="org.simantics.sysdyn.ui.browser.contributions.ConfigurationLabeler"\r
- preference="1.0">\r
+ preference="2.0">\r
</implementation>\r
<implementation\r
class="org.simantics.sysdyn.ui.browser.contributions.VariableLabeler"\r
- preference="1.0">\r
+ preference="2.0">\r
</implementation>\r
<implementation\r
class="org.simantics.sysdyn.ui.browser.contributions.ExperimentsLabeler"\r
- preference="1.0">\r
+ preference="2.0">\r
</implementation>\r
<implementation\r
class="org.simantics.sysdyn.ui.browser.contributions.ModelLabeler"\r
- preference="1.0">\r
+ preference="2.0">\r
</implementation>\r
<implementation\r
class="org.simantics.sysdyn.ui.browser.contributions.ModulesLabeler"\r
- preference="1.0">\r
+ preference="2.0">\r
</implementation>\r
<implementation\r
class="org.simantics.sysdyn.ui.browser.contributions.OperatingInterfacesLabeler"\r
- preference="1.0">\r
+ preference="2.0">\r
+ </implementation>\r
+ </binding>\r
+ </extension>\r
+ <extension\r
+ point="org.simantics.browsing.ui.common.imagerBinding">\r
+ <binding\r
+ browseContext="http://www.simantics.org/Sysdyn-1.0/Browser">\r
+ <implementation\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
</binding>\r
+ </extension>\r
+ <extension\r
+ point="org.eclipse.core.expressions.propertyTesters">\r
+ <propertyTester\r
+ class="org.simantics.browsing.ui.swt.NodePropertyTester"\r
+ id="org.simantics.browsing.ui.nodePropertyTester"\r
+ namespace="org.simantics.sysdyn.ui"\r
+ properties="nodeClass"\r
+ type="org.eclipse.jface.viewers.IStructuredSelection">\r
+ </propertyTester>\r
</extension>
</plugin>\r
\r
// The plug-in ID\r
public static final String PLUGIN_ID = "org.simantics.sysdyn.ui";\r
+ \r
+ // The shared instance\r
+ private static Activator plugin;\r
\r
@Override\r
public void start(BundleContext context) throws Exception {\r
new ConsoleAppender(new SimpleLayout());\r
BasicConfigurator.configure(appender);\r
Logger.getRootLogger().setLevel(Level.WARN);\r
+ plugin = this;\r
+ }\r
+ \r
+ @Override\r
+ public void stop(BundleContext context) throws Exception {\r
+ plugin = null;\r
+ super.stop(context);\r
}\r
\r
+ public static Activator getDefault() {\r
+ return plugin;\r
+ }\r
}\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.AbstractNode;\r
-import org.simantics.ui.icons.ImageDescriptorProvider;\r
+import org.simantics.sysdyn.ui.browser.nodes.ExperimentsFolder;\r
+import org.simantics.sysdyn.ui.browser.nodes.ModulesNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.OperatingInterfacesFolder;\r
\r
public class AbstractNodeImager extends ImagerContributor<AbstractNode> {\r
\r
@Override\r
public ImageDescriptor getDescriptor(ReadGraph graph, AbstractNode node) throws DatabaseException {\r
- if (!graph.hasStatement(node.resource))\r
- return null;\r
- ImageDescriptorProvider provider = graph.adapt(node.resource, ImageDescriptorProvider.class);\r
- return provider != null ? provider.get() : null;\r
+ \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
+ return null;\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.browser.contributions;\r
-\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.sysdyn.ui.browser.nodes.AbstractNode;\r
-import org.simantics.sysdyn.ui.browser.nodes.ConfigurationNode;\r
-import org.simantics.sysdyn.ui.browser.nodes.ModelNode;\r
-import org.simantics.utils.DataContainer;\r
-\r
-public class Configuration extends ViewpointContributor<ModelNode> {\r
-\r
- @Override\r
- public Collection<?> getContribution(ReadGraph graph, ModelNode model)\r
- throws DatabaseException {\r
- return new DataContainer<AbstractNode>(new ConfigurationNode(\r
- graph.getSingleObject(\r
- model.resource, \r
- graph.getBuiltins().HasConfiguration))\r
- );\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.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
package org.simantics.sysdyn.ui.browser.contributions;\r
\r
import java.util.Collection;\r
+import java.util.Collections;\r
\r
import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
import org.simantics.db.ReadGraph;\r
@Override\r
public Collection<?> getContribution(ReadGraph graph, ExperimentsFolder input) throws DatabaseException {\r
// hasExperiment or something\r
- return null;\r
+ return Collections.EMPTY_LIST;\r
}\r
\r
@Override\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
-\r
-package org.simantics.sysdyn.ui.browser.contributions;\r
-\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.sysdyn.ui.browser.nodes.AbstractNode;\r
-import org.simantics.sysdyn.ui.browser.nodes.ExperimentsFolder;\r
-import org.simantics.sysdyn.ui.browser.nodes.ModelNode;\r
-import org.simantics.utils.DataContainer;\r
-\r
-public class Experiments extends ViewpointContributor<ModelNode> {\r
-\r
- @Override\r
- public Collection<?> getContribution(ReadGraph graph, ModelNode model) throws DatabaseException {\r
- return new DataContainer<AbstractNode>(new ExperimentsFolder(model.resource));\r
- }\r
-\r
- @Override\r
- public String getViewpointId() {\r
- return "Standard";\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 java.util.ArrayList;\r
+import java.util.Collection;\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.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.OperatingInterfacesFolder;\r
+\r
+public class ModelChildren 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
+ result.add(new ConfigurationNode(\r
+ graph.getSingleObject(\r
+ model.resource, \r
+ graph.getBuiltins().HasConfiguration))\r
+ );\r
+ result.add(new ExperimentsFolder(model.resource));\r
+ result.add(new OperatingInterfacesFolder(model.resource));\r
+ return result;\r
+ }\r
+\r
+ @Override\r
+ public String getViewpointId() {\r
+ return "Standard";\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 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.sysdyn.ui.browser.nodes.AbstractNode;\r
-import org.simantics.sysdyn.ui.browser.nodes.ModelNode;\r
-import org.simantics.sysdyn.ui.browser.nodes.OperatingInterfacesFolder;\r
-import org.simantics.utils.DataContainer;\r
-\r
-public class OperatingInterfaces extends ViewpointContributor<ModelNode> {\r
-\r
- @Override\r
- public Collection<?> getContribution(ReadGraph graph, ModelNode model) throws DatabaseException {\r
- return new DataContainer<AbstractNode>(new OperatingInterfacesFolder(model.resource));\r
- }\r
-\r
- @Override\r
- public String getViewpointId() {\r
- return "Standard";\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.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
package org.simantics.sysdyn.ui.browser.nodes;\r
\r
import org.simantics.browsing.ui.common.node.IDeletable;\r
-import org.simantics.browsing.ui.common.node.IModifiableNode;\r
-import org.simantics.browsing.ui.content.Labeler.Modifier;\r
-import org.simantics.browsing.ui.graph.impl.LabelModifier;\r
import org.simantics.db.Resource;\r
-import org.simantics.ui.SimanticsUI;\r
\r
-public class ConfigurationNode extends AbstractNode implements IDeletable, IModifiableNode {\r
+public class ConfigurationNode extends AbstractNode implements IDeletable {\r
\r
public ConfigurationNode(Resource resource) {\r
super(resource);\r
}\r
\r
- @Override\r
- public Modifier getModifier(String columnId) {\r
- LabelModifier modifier = new LabelModifier(SimanticsUI.getSession(), resource) {\r
- @Override\r
- public String isValid(String label) {\r
- if (label.isEmpty())\r
- return "Empty label not allowed";\r
- if (label.contains(" "))\r
- return "Spaces are not allowed";\r
- return null;\r
- }\r
- };\r
- return modifier;\r
- }\r
}\r
for(IElement element : diagram.getElements())\r
element.addListener(elementUpdateListener);\r
} catch (MappingException e) {\r
- // TODO Auto-generated catch block\r
e.printStackTrace();\r
}\r
\r
} \r
});\r
} catch (DatabaseException e) {\r
- // TODO Auto-generated catch block\r
e.printStackTrace();\r
} \r
}\r
}\r
});\r
} catch (DatabaseException e) {\r
- // TODO Auto-generated catch block\r
e.printStackTrace();\r
} \r
}\r
});\r
\r
SimanticsUI.getSession().asyncRequest(\r
- new TitleRequest(site.getId(), getResourceInput()),\r
+ new TitleRequest(site.getId(), getResourceInput()) {\r
+ @Override\r
+ public String perform(ReadGraph graph) throws DatabaseException {\r
+ Resource r = graph.getSingleObject(\r
+ getResourceInput().getResource(),\r
+ graph.getBuiltins().IsConfigurationOf);\r
+ String n = null;\r
+ n = graph.adapt(r, String.class);\r
+ return n;\r
+ }\r
+ },\r
new TitleUpdater(site.getShell().getDisplay(), new Callback<String>() {\r
@Override\r
public void run(String partName) {\r
}\r
}));\r
} catch (DatabaseException e) {\r
- // TODO Auto-generated catch block\r
e.printStackTrace();\r
} \r
}\r