From: luukkainen Date: Thu, 12 Jan 2012 14:03:51 +0000 (+0000) Subject: Started Simantics 1.6 / Apros 6.02 porting X-Git-Tag: v1.31.0~98 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=4fb2bb0dac3c463447ba22f36aeb0d2358ad6624;p=simantics%2Finterop.git Started Simantics 1.6 / Apros 6.02 porting git-svn-id: https://www.simantics.org/svn/simantics/interoperability/trunk@23939 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.interop/META-INF/MANIFEST.MF b/org.simantics.interop/META-INF/MANIFEST.MF index a425bcd..cc325d7 100644 --- a/org.simantics.interop/META-INF/MANIFEST.MF +++ b/org.simantics.interop/META-INF/MANIFEST.MF @@ -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", diff --git a/org.simantics.interop/adapters.xml b/org.simantics.interop/adapters.xml index 9de4ffa..7403f0a 100644 --- a/org.simantics.interop/adapters.xml +++ b/org.simantics.interop/adapters.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/org.simantics.interop/graph.tg b/org.simantics.interop/graph.tg index e4f909a..0e02539 100644 Binary files a/org.simantics.interop/graph.tg and b/org.simantics.interop/graph.tg differ diff --git a/org.simantics.interop/graph/Interop.pgraph b/org.simantics.interop/graph/Interop.pgraph index ef6359a..453c640 100644 --- a/org.simantics.interop/graph/Interop.pgraph +++ b/org.simantics.interop/graph/Interop.pgraph @@ -1,9 +1,8 @@ L0 = -PROJ = - -MOD = -VP = +PROJ = +MOD = +VP = INTEROP = : L0.Ontology diff --git a/org.simantics.interop/plugin.xml b/org.simantics.interop/plugin.xml index 8143ecf..729df96 100644 --- a/org.simantics.interop/plugin.xml +++ b/org.simantics.interop/plugin.xml @@ -1,44 +1,19 @@ - - - - - - - + + - - - - - + browseContext="http://www.simantics.org/Interop-1.0/InteropBrowseContext"> - + 0; - } - - @Override - public Collection getChildren(ReadGraph graph) throws DatabaseException { - List nodes = new ArrayList(); - InteropResource i = InteropResource.getInstance(graph); - - Collection objs = graph.getObjects(model, i.HasImportData); - for (Resource o : objs) { - if (graph.isInstanceOf(o, i.ImportLibrary)) { - INode node = graph.adapt(o, INode.class); - nodes.add(node); - } - } - return nodes; - - } - - @Override - public int getCategory(ReadGraph graph) throws DatabaseException { - return 0; - } - - -} 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 index 1f90997..0000000 --- a/org.simantics.interop/src/org/simantics/interop/handlers/Contributor1.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.simantics.interop.handlers; - -import java.util.ArrayList; -import java.util.Collection; - -import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor; -import org.simantics.db.ReadGraph; -import org.simantics.db.exception.DatabaseException; -import org.simantics.interop.browsing.INode; -import org.simantics.interop.browsing.ImportNode; -import org.simantics.structural.ui.modelBrowser.nodes.ModelNode; - - -public class Contributor1 extends ViewpointContributor { - - - public Contributor1() { - super(); - } - @Override - public Collection getContribution(ReadGraph graph, ModelNode input) - throws DatabaseException { - Collection nodes = new ArrayList(); - nodes.add(new ImportNode(input.resource)); - return nodes; - } - - @Override - public String getViewpointId() { - return "Standard"; - } - - - -} - 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 index 62dd734..0000000 --- a/org.simantics.interop/src/org/simantics/interop/handlers/Contributor2.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.simantics.interop.handlers; - -import java.util.ArrayList; -import java.util.Collection; - -import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor; -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.exception.DatabaseException; -import org.simantics.interop.browsing.INode; -import org.simantics.interop.browsing.ImportNode2; - - - -public class Contributor2 extends ViewpointContributor { - - - public Contributor2() { - super(); - } - @Override - public Collection getContribution(ReadGraph graph, Resource input) - throws DatabaseException { - Collection nodes = new ArrayList(); - nodes.add(new ImportNode2(input)); - return nodes; - } - - @Override - public String getViewpointId() { - return "Standard"; - } - -} diff --git a/org.simantics.interop/src/org/simantics/interop/stubs/InteropResource.java b/org.simantics.interop/src/org/simantics/interop/stubs/InteropResource.java index 6115e7a..48c0e3a 100644 --- a/org.simantics.interop/src/org/simantics/interop/stubs/InteropResource.java +++ b/org.simantics.interop/src/org/simantics/interop/stubs/InteropResource.java @@ -5,6 +5,7 @@ import org.simantics.db.ReadGraph; import org.simantics.db.request.Read; import org.simantics.db.Session; import org.simantics.db.exception.DatabaseException; +import org.simantics.db.service.QueryControl; public class InteropResource { @@ -61,7 +62,8 @@ public class InteropResource { Session session = graph.getSession(); InteropResource ret = session.peekService(InteropResource.class); if(ret == null) { - ret = new InteropResource(graph); + QueryControl qc = graph.getService(QueryControl.class); + ret = new InteropResource(qc.getIndependentGraph(graph)); session.registerService(InteropResource.class, ret); } return ret; @@ -72,7 +74,8 @@ public class InteropResource { if(ret == null) { ret = session.syncRequest(new Read() { public InteropResource perform(ReadGraph graph) throws DatabaseException { - return new InteropResource(graph); + QueryControl qc = graph.getService(QueryControl.class); + return new InteropResource(qc.getIndependentGraph(graph)); } }); session.registerService(InteropResource.class, ret); diff --git a/org.simantics.interop/src/org/simantics/interop/test/GraphComparatorViewer.java b/org.simantics.interop/src/org/simantics/interop/test/GraphComparatorViewer.java index 2ca1a8f..d9c8ff6 100644 --- a/org.simantics.interop/src/org/simantics/interop/test/GraphComparatorViewer.java +++ b/org.simantics.interop/src/org/simantics/interop/test/GraphComparatorViewer.java @@ -377,14 +377,12 @@ public class GraphComparatorViewer extends ViewPart{ if (event.data instanceof String) { try { SerialisationSupport support = session.getService(SerialisationSupport.class); - return ResourceTransferUtils.readStringTransferable(support.getResourceSerializer(), (String) event.data).toResourceArrayArray(); + return ResourceTransferUtils.readStringTransferable(support, (String) event.data).toResourceArrayArray(); } catch (IllegalArgumentException e) { e.printStackTrace(); - } catch (IOException e) { + } catch (DatabaseException e) { e.printStackTrace(); - } catch (InvalidResourceReferenceException e) { - e.printStackTrace(); - } + } } ResourceArray[] ret = ResourceAdaptionUtils.toResourceArrays(event.data); if (ret.length > 0)