From 4fb2bb0dac3c463447ba22f36aeb0d2358ad6624 Mon Sep 17 00:00:00 2001 From: luukkainen Date: Thu, 12 Jan 2012 14:03:51 +0000 Subject: [PATCH] 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 --- org.simantics.interop/META-INF/MANIFEST.MF | 3 + org.simantics.interop/adapters.xml | 2 +- org.simantics.interop/graph.tg | Bin 2027 -> 2156 bytes org.simantics.interop/graph/Interop.pgraph | 7 +- org.simantics.interop/plugin.xml | 33 ++------- .../interop/browsing/ImportNode.java | 67 ------------------ .../interop/handlers/Contributor1.java | 36 ---------- .../interop/handlers/Contributor2.java | 34 --------- .../interop/stubs/InteropResource.java | 7 +- .../interop/test/GraphComparatorViewer.java | 8 +-- 10 files changed, 19 insertions(+), 178 deletions(-) delete mode 100644 org.simantics.interop/src/org/simantics/interop/browsing/ImportNode.java delete mode 100644 org.simantics.interop/src/org/simantics/interop/handlers/Contributor1.java delete mode 100644 org.simantics.interop/src/org/simantics/interop/handlers/Contributor2.java 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 e4f909a43660bcc93c5cfe6e4d3539fe3df94757..0e0253962f84678f35d22ee40166c6b84b556638 100644 GIT binary patch delta 439 zcmaFO|3;vmodE(EIg3)$Qi~Fka#C5-5_5`Efx@i3MXAO4rA5i9&iSQzB}^cdT$w4U zc_o=8nW@DbAU;0*OdK%%5UnYxX_ zsVso7I9w}AQj78ubMWe9D@ZH?IvDH#gee^U1t4c6=1g2DT+dZpl30?O3seR15?C!; zSz=Bp>3(DdYXgT2Bgna2sX#~O6$9-m<^=J%8#nGmTnI9PHwa@14VpBmwCKv^9H5WlO~hL$a|SEz zYc;hh_`m;g>s;H%I(wdKc|ceAADFnp2EkaGt-yvXWPtjO3H`z%v4VAGiE#Go86)M= zx$wcIHCsqXl;Mz9kDl%WcxyHhI#xE3 -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) -- 2.47.1