Bundle-Vendor: VTT
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
+ org.simantics.modeling.ontology;bundle-version="1.1.0",
+ org.simantics.project.ontology;bundle-version="1.1.0",
+ org.simantics.viewpoint.ontology;bundle-version="1.1.0",
org.simantics.db;bundle-version="0.8.0",
org.simantics.db.common;bundle-version="0.8.0",
org.simantics.browsing.ui;bundle-version="0.9.0",
<?xml version="1.0" encoding="UTF-8"?>\r\r
<adapters>\r
-\r <target interface="org.simantics.browsing.ui.model.children.ChildRule">\r <baseType uri="http://www.simantics.org/Viewpoint-1.0/ChildRule" />\r <resource\r uri="http://www.simantics.org/Interop-1.0/InteropBrowseContext/InteropChildRule"\r class="org.simantics.interop.browsing.InteropChildRule"/>\r </target>\r\r \r\r
+\r <target interface="org.simantics.browsing.ui.model.children.ChildRule">\r <baseType uri="http://www.simantics.org/Viewpoint-1.1/ChildRule" />\r <resource\r uri="http://www.simantics.org/Interop-1.0/InteropBrowseContext/InteropChildRule"\r class="org.simantics.interop.browsing.InteropChildRule"/>\r </target>\r\r \r\r
</adapters>
\ No newline at end of file
L0 = <http://www.simantics.org/Layer0-1.0>\r
-PROJ = <http://www.simantics.org/Project-1.0>\r
-\r
-MOD = <http://www.simantics.org/Modeling-1.0>\r
-VP = <http://www.simantics.org/Viewpoint-1.0>\r
+PROJ = <http://www.simantics.org/Project-1.1>\r
\r
+MOD = <http://www.simantics.org/Modeling-1.1>\r
+VP = <http://www.simantics.org/Viewpoint-1.1>\r
\r
\r
INTEROP = <http://www.simantics.org/Interop-1.0> : L0.Ontology\r
<?xml version="1.0" encoding="UTF-8"?>\r
<?eclipse version="3.4"?>\r
<plugin>\r
- <extension\r
- point="org.simantics.browsing.ui.common.viewpointContributionBinding">\r
- <binding\r
- browseContext="http://www.apros.fi/Apros-6.0/AprosModelBrowser">\r
- <implementation\r
- class="org.simantics.interop.handlers.Contributor2"\r
- preference="1.0">\r
- </implementation>\r
- </binding>\r
- <!--\r
- <binding\r
- browseContext="http://www.simantics.org/Project-1.0/ProjectBrowseContext">\r
- <implementation\r
- class="org.simantics.interop.handlers.Contributor2"\r
- preference="-1.0">\r
- </implementation>\r
- </binding>\r
- -->\r
- </extension>\r
+ \r
<extension\r
point="org.simantics.browsing.ui.common.evaluatorBinding">\r
+ \r
<binding\r
- browseContext="http://www.apros.fi/Apros-6.0/AprosModelBrowser">\r
- <implementation\r
- class="org.simantics.interop.handlers.EvaluatorFactory1"\r
- preference="1">\r
- </implementation>\r
- </binding>\r
-\r
- <binding\r
- browseContext="http://www.simantics.org/Project-1.0/ProjectBrowseContext">\r
+ browseContext="http://www.simantics.org/Interop-1.0/InteropBrowseContext">\r
<implementation\r
class="org.simantics.interop.handlers.EvaluatorFactory1"\r
preference="1">\r
</implementation>\r
</binding>\r
- \r
</extension>\r
+ \r
<extension\r
point="org.eclipse.ui.views">\r
<view\r
+++ /dev/null
-package org.simantics.interop.browsing;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.interop.Activator;\r
-import org.simantics.interop.stubs.InteropResource;\r
-\r
-public class ImportNode implements INode {\r
- \r
- private Resource model;\r
- \r
- public ImportNode(Resource project) {\r
- this.model = project;\r
- }\r
- \r
- @SuppressWarnings("rawtypes")\r
- @Override\r
- public Object getAdapter(Class adapter) {\r
- return null;\r
- }\r
-\r
- \r
- @Override\r
- public ImageDescriptor getImage(ReadGraph graph) throws DatabaseException {\r
- return Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/silk/database_connect.png");\r
- }\r
- \r
- @Override\r
- public String getLabel(ReadGraph graph) throws DatabaseException {\r
- return "Imports";\r
- }\r
-\r
- \r
- @Override\r
- public boolean hasChildren(ReadGraph graph) throws DatabaseException {\r
- return getChildren(graph).size() > 0;\r
- }\r
- \r
- @Override\r
- public Collection<?> getChildren(ReadGraph graph) throws DatabaseException {\r
- List<INode> nodes = new ArrayList<INode>();\r
- InteropResource i = InteropResource.getInstance(graph);\r
- \r
- Collection<Resource> objs = graph.getObjects(model, i.HasImportData);\r
- for (Resource o : objs) {\r
- if (graph.isInstanceOf(o, i.ImportLibrary)) {\r
- INode node = graph.adapt(o, INode.class);\r
- nodes.add(node);\r
- }\r
- }\r
- return nodes;\r
- \r
- }\r
- \r
- @Override\r
- public int getCategory(ReadGraph graph) throws DatabaseException {\r
- return 0;\r
- }\r
- \r
-\r
-}\r
+++ /dev/null
-package org.simantics.interop.handlers;\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.interop.browsing.INode;\r
-import org.simantics.interop.browsing.ImportNode;\r
-import org.simantics.structural.ui.modelBrowser.nodes.ModelNode;\r
-\r
-\r
-public class Contributor1 extends ViewpointContributor<ModelNode> {\r
-\r
- \r
- public Contributor1() {\r
- super();\r
- }\r
- @Override\r
- public Collection<?> getContribution(ReadGraph graph, ModelNode input)\r
- throws DatabaseException {\r
- Collection<INode> nodes = new ArrayList<INode>();\r
- nodes.add(new ImportNode(input.resource));\r
- return nodes;\r
- }\r
- \r
- @Override\r
- public String getViewpointId() {\r
- return "Standard";\r
- }\r
- \r
- \r
-\r
-}\r
-\r
+++ /dev/null
-package org.simantics.interop.handlers;\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.interop.browsing.INode;\r
-import org.simantics.interop.browsing.ImportNode2;\r
-\r
-\r
-\r
-public class Contributor2 extends ViewpointContributor<Resource> {\r
-\r
- \r
- public Contributor2() {\r
- super();\r
- }\r
- @Override\r
- public Collection<?> getContribution(ReadGraph graph, Resource input)\r
- throws DatabaseException {\r
- Collection<INode> nodes = new ArrayList<INode>();\r
- nodes.add(new ImportNode2(input));\r
- return nodes;\r
- }\r
- \r
- @Override\r
- public String getViewpointId() {\r
- return "Standard";\r
- }\r
-\r
-}\r
import org.simantics.db.request.Read;\r
import org.simantics.db.Session;\r
import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.service.QueryControl;\r
\r
public class InteropResource {\r
\r
Session session = graph.getSession();\r
InteropResource ret = session.peekService(InteropResource.class);\r
if(ret == null) {\r
- ret = new InteropResource(graph);\r
+ QueryControl qc = graph.getService(QueryControl.class);\r
+ ret = new InteropResource(qc.getIndependentGraph(graph));\r
session.registerService(InteropResource.class, ret);\r
}\r
return ret;\r
if(ret == null) {\r
ret = session.syncRequest(new Read<InteropResource>() {\r
public InteropResource perform(ReadGraph graph) throws DatabaseException {\r
- return new InteropResource(graph);\r
+ QueryControl qc = graph.getService(QueryControl.class);\r
+ return new InteropResource(qc.getIndependentGraph(graph));\r
}\r
});\r
session.registerService(InteropResource.class, ret);\r
if (event.data instanceof String) {\r
try {\r
SerialisationSupport support = session.getService(SerialisationSupport.class);\r
- return ResourceTransferUtils.readStringTransferable(support.getResourceSerializer(), (String) event.data).toResourceArrayArray();\r
+ return ResourceTransferUtils.readStringTransferable(support, (String) event.data).toResourceArrayArray();\r
} catch (IllegalArgumentException e) {\r
e.printStackTrace();\r
- } catch (IOException e) {\r
+ } catch (DatabaseException e) {\r
e.printStackTrace();\r
- } catch (InvalidResourceReferenceException e) {\r
- e.printStackTrace();\r
- }\r
+ } \r
}\r
ResourceArray[] ret = ResourceAdaptionUtils.toResourceArrays(event.data);\r
if (ret.length > 0)\r