]> gerrit.simantics Code Review - simantics/interop.git/commitdiff
Started Simantics 1.6 / Apros 6.02 porting
authorluukkainen <luukkainen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 12 Jan 2012 14:03:51 +0000 (14:03 +0000)
committerMarko Luukkainen <marko.luukkainen@vtt.fi>
Thu, 2 Feb 2017 09:22:18 +0000 (11:22 +0200)
git-svn-id: https://www.simantics.org/svn/simantics/interoperability/trunk@23939 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.interop/META-INF/MANIFEST.MF
org.simantics.interop/adapters.xml
org.simantics.interop/graph.tg
org.simantics.interop/graph/Interop.pgraph
org.simantics.interop/plugin.xml
org.simantics.interop/src/org/simantics/interop/browsing/ImportNode.java [deleted file]
org.simantics.interop/src/org/simantics/interop/handlers/Contributor1.java [deleted file]
org.simantics.interop/src/org/simantics/interop/handlers/Contributor2.java [deleted file]
org.simantics.interop/src/org/simantics/interop/stubs/InteropResource.java
org.simantics.interop/src/org/simantics/interop/test/GraphComparatorViewer.java

index a425bcdb5140983fe3ccacccb14fc574d03129f9..cc325d769ee488ec3b3a4c8e6d48d3b253cce01d 100644 (file)
@@ -7,6 +7,9 @@ Bundle-Activator: org.simantics.interop.Activator
 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",
index 9de4ffae04670726d8a9ad22f0c32db10fa2975a..7403f0aa9820b0d4d4205ad77293aeb48a7fb3af 100644 (file)
@@ -1,5 +1,5 @@
 <?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
index e4f909a43660bcc93c5cfe6e4d3539fe3df94757..0e0253962f84678f35d22ee40166c6b84b556638 100644 (file)
Binary files a/org.simantics.interop/graph.tg and b/org.simantics.interop/graph.tg differ
index ef6359ab16589dba4e8d5b506c866e0696fafa8d..453c640c94b4865cced80570b89f3b41fcb4bb9e 100644 (file)
@@ -1,9 +1,8 @@
 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
index 8143ecfc89b176dee18d6f9de9aa5ce8d2b9ae47..729df964051f048256470f03214e1427a201f91c 100644 (file)
@@ -1,44 +1,19 @@
 <?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
diff --git a/org.simantics.interop/src/org/simantics/interop/browsing/ImportNode.java b/org.simantics.interop/src/org/simantics/interop/browsing/ImportNode.java
deleted file mode 100644 (file)
index 18296c6..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-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
diff --git a/org.simantics.interop/src/org/simantics/interop/handlers/Contributor1.java b/org.simantics.interop/src/org/simantics/interop/handlers/Contributor1.java
deleted file mode 100644 (file)
index 1f90997..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-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
diff --git a/org.simantics.interop/src/org/simantics/interop/handlers/Contributor2.java b/org.simantics.interop/src/org/simantics/interop/handlers/Contributor2.java
deleted file mode 100644 (file)
index 62dd734..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-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
index 6115e7a2ffcd65fddb4c79b21a163074b521ffb4..48c0e3a7774971f6660cb9bd499bb52fd4414246 100644 (file)
@@ -5,6 +5,7 @@ import org.simantics.db.ReadGraph;
 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
@@ -61,7 +62,8 @@ public class InteropResource {
         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
@@ -72,7 +74,8 @@ public class InteropResource {
         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
index 2ca1a8f072ad67686f615d0be90e4defbfaf7acf..d9c8ff69d0951ceb36202bf96f0f551f1c74820b 100644 (file)
@@ -377,14 +377,12 @@ public class GraphComparatorViewer extends ViewPart{
                        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