From: Jussi Koskela Date: Wed, 2 Sep 2020 09:17:31 +0000 (+0300) Subject: Fixed multiple issues causing dangling references to discarded queries X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=HEAD;hp=dac7a40d1cf85956aeac63ccbdf5b7a0d9977ac3 Fixed multiple issues causing dangling references to discarded queries gitlab #594 Change-Id: Iaa6b12f60d7dfa2bbcbc9614ef837973885586cc --- diff --git a/.gitignore b/.gitignore index cf73f85b6..0bb583472 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ /bundles/*/target/ /releng/**/target/ /tests/*/target/ -/**/.polyglot.build.properties +/**/.polyglot.* org.eclipse.core.resources.prefs org.eclipse.m2e.core.prefs com.vaadin.designer.prefs \ No newline at end of file diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml index 3b43bdfdd..e73295bbd 100644 --- a/.mvn/extensions.xml +++ b/.mvn/extensions.xml @@ -3,6 +3,6 @@ org.eclipse.tycho.extras tycho-pomless - 1.5.0 + 1.6.0 diff --git a/README.md b/README.md index d0d9155e4..7567cd62f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,101 @@ +## Headless Builds + +Official builds and testing of the platform are done with Maven. + To build the platform, run: -mvn -s settings.xml package +mvn package or to run unit tests as well: -mvn -s settings.xml verify +mvn verify + +## Development + +### Eclipse IDE Setup + +It is generally recommended to using the latest Eclipse IDE release. + +However, use of Eclipse IDE 2020-03 (4.15) release is not recommended +because of [JDT bug 561338](https://bugs.eclipse.org/bugs/show_bug.cgi?id=561338). + +Therefore the current recommended versions are +* 2019-12 (4.14) +* 2020-06 (4.16) Milestone builds for the adventurous, which have the mentioned bug fixed. + +#### Install Eclipse IDE Plug-ins + +Two plug-ins need to be installed into the IDE from P2 repositories: + +1. Eclipse Target Platform Definition DSL and Generator from the P2 repository at http://www.simantics.org/update/cbi/tpd/3.0.0-SNAPSHOT/ + * Please read the detailed installation and basic use instructions + from [the tool's own GitHub site](https://github.com/eclipse-cbi/targetplatform-dsl) +2. Simantics Graph Compiler plug-in from http://www.simantics.org/update/utils/ + * Enables the IDE to compile `/graph/*.pgraph` files + into `/graph.tg` for installation into Simantics database. + +#### Install Required JDK + +This version of the platform requires at least JDK 11. + +It is recommended to download the Hotspot variant from [AdoptOpenJDK.net](https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=hotspot). +You can also use newer JDKs but 11 as an LTS version is recommended, especially for bundling with built products. + +1. Download and install a compatible JDK version + * For Windows, download the `.msi` installer and install it +2. Open IDE preference page **Java / Installed JREs**. + If the previously installed JDK is not already in use, add it as a *Standard VM* + installation to the list and select the added JRE as the active JRE. +3. Open IDE preference page **Java / Installed JREs / Execution Environments** + and ensure that your selected JDK is selected in the *Compatible JREs* for `JavaSE-1.6` - `JavaSE-11`. +4. **Important:** Ensure that IDE preference page **Java / Compiler** has *Compiler compliance level* set to **11**. + Otherwise the IDE will use the JDTs compiler to produce the binary classes with the designated compliance level + regardless of what JRE you've installed to use for running your programs from the IDE. + +#### Clone Repository into Eclipse + +Use [Eclipse Git Integration - EGit](https://wiki.eclipse.org/EGit/User_Guide) to clone repositories. + +##### gerrit.simantics.org + +Gerrit is currently still the authoritative repository for the platform, so use the following for now + +Anonymous HTTP cloning without push rights: + + git clone "https://gerrit.simantics.org/r/simantics/platform" + +Developers with push access: + + git clone "ssh://lehtonen@gerrit.simantics.org:29418/simantics/platform" + +##### gitlab.simantics.org + +GitLab will become the authoritative repository for the platform in the future. +Until then, please do not push directly to this repository. + +Just follow GitLab's cloning instructions at https://gitlab.simantics.org/simantics/platform. +Use HTTP cloning for anonymous access and SSH for developer access. + +#### Import Projects into Workspace + +From the main menu, uncheck *Build Automatically* from the *Project* +menu to prevent unnecessary build failures from happening before the +setup is complete. + +From the *Git Repositories* view in Eclipse, choose *Import Projects* from the repository context menu. +Import all projects into their own working set. + +#### Set Target Platform + +To get the platform to compile in the IDE, you will need to use one of the custom target platforms +provided [releng/org.simantics.sdk.build.targetdefinition/](releng/org.simantics.sdk.build.targetdefinition). + +To use a minimal target platform, open [releng/org.simantics.sdk.build.targetdefinition/org.simantics.sdk.build.targetdefinition.tpd](releng/org.simantics.sdk.build.targetdefinition/org.simantics.sdk.build.targetdefinition.tpd) +using the *Target Platform DSL Editor* and press `CTRL+R` in the editor to +re-build the corresponding .target file and set it as the current platform. + +Re-enable *Build Automatically* from the *Project* main menu to start the build +which should now succeed. + +#### Test -If you're building the platform inside Eclipse IDE, remember to give -the settings.xml file to the Maven / User Settings preference page -User Settings field. +Open [releng/org.simantics.desktop.rcp.product/simantics-desktop.product](releng/org.simantics.desktop.rcp.product/simantics-desktop.product) +and press `Launch an Eclipse application in Debug mode`. The basic desktop product should start. diff --git a/bundles/hdf.hdf5lib/.classpath b/bundles/hdf.hdf5lib/.classpath index f0eb4b56a..ca6a24379 100644 --- a/bundles/hdf.hdf5lib/.classpath +++ b/bundles/hdf.hdf5lib/.classpath @@ -1,8 +1,8 @@ - - - - - - - - + + + + + + + + diff --git a/bundles/hdf.hdf5lib/.settings/org.eclipse.jdt.core.prefs b/bundles/hdf.hdf5lib/.settings/org.eclipse.jdt.core.prefs index 295926d96..7adc0fb9a 100644 --- a/bundles/hdf.hdf5lib/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/hdf.hdf5lib/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/hdf.hdf5lib/META-INF/MANIFEST.MF b/bundles/hdf.hdf5lib/META-INF/MANIFEST.MF index 66804effb..6bd238946 100644 --- a/bundles/hdf.hdf5lib/META-INF/MANIFEST.MF +++ b/bundles/hdf.hdf5lib/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Java HDF5 Interface (JHI5) Bundle-SymbolicName: hdf.hdf5lib Bundle-Version: 1.10.2 Bundle-Vendor: Semantum Oy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ClassPath: ., jarhdf5-1.10.2.jar Eclipse-BundleShape: dir @@ -14,5 +14,5 @@ Export-Package: hdf.hdf5lib, hdf.hdf5lib.structs Bundle-NativeCode: hdf5_java.dll; processor=x86_64; osname=win32, libhdf5.so.101; libhdf5_java.so; processor=x86_64; osname=linux -Require-Bundle: org.slf4j.api;bundle-version="1.7.2" +Require-Bundle: org.slf4j.api Automatic-Module-Name: hdf.hdf5lib diff --git a/bundles/org.simantics.acorn/.classpath b/bundles/org.simantics.acorn/.classpath index 22f30643c..c3ba59e4c 100644 --- a/bundles/org.simantics.acorn/.classpath +++ b/bundles/org.simantics.acorn/.classpath @@ -1,7 +1,7 @@ - + diff --git a/bundles/org.simantics.acorn/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.acorn/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.acorn/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.acorn/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.acorn/META-INF/MANIFEST.MF b/bundles/org.simantics.acorn/META-INF/MANIFEST.MF index 3bf81207b..2441affe3 100644 --- a/bundles/org.simantics.acorn/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.acorn/META-INF/MANIFEST.MF @@ -11,8 +11,8 @@ Require-Bundle: gnu.trove3;bundle-version="3.0.0", org.simantics.backup, org.eclipse.core.runtime;bundle-version="3.11.1", org.simantics.db.procore, - org.slf4j.api;bundle-version="1.7.2" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 + org.slf4j.api +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Bundle-Activator: org.simantics.acorn.internal.Activator Service-Component: OSGI-INF/component.xml, OSGI-INF/org.simantics.acorn.AcornDriver.xml diff --git a/bundles/org.simantics.acorn/src/org/simantics/acorn/MainProgram.java b/bundles/org.simantics.acorn/src/org/simantics/acorn/MainProgram.java index 1e4b5cbac..52be328eb 100644 --- a/bundles/org.simantics.acorn/src/org/simantics/acorn/MainProgram.java +++ b/bundles/org.simantics.acorn/src/org/simantics/acorn/MainProgram.java @@ -70,7 +70,7 @@ public class MainProgram implements Runnable, Closeable { this.updateSchedules = new ArrayList[CLUSTER_THREADS]; for(int i=0;i(); + updateSchedules[i] = new ArrayList<>(); } } @@ -93,11 +93,13 @@ public class MainProgram implements Runnable, Closeable { try { + TreeMap> updates = new TreeMap<>(clusterComparator); + main: while(alive) { - TreeMap> updates = new TreeMap>(clusterComparator); - + if (!updates.isEmpty()) + updates.clear(); operationQueue.pumpUpdates(updates); if(updates.isEmpty()) { @@ -165,6 +167,9 @@ public class MainProgram implements Runnable, Closeable { for(int i=0;i> entry : updates.entrySet()) { diff --git a/bundles/org.simantics.action.ontology/.classpath b/bundles/org.simantics.action.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.action.ontology/.classpath +++ b/bundles/org.simantics.action.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.action.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.action.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.action.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.action.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.action.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.action.ontology/META-INF/MANIFEST.MF index ecd3249c9..6a381777e 100644 --- a/bundles/org.simantics.action.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.action.ontology/META-INF/MANIFEST.MF @@ -4,6 +4,6 @@ Bundle-Name: http://www.simantics.org/Action Bundle-SymbolicName: org.simantics.action.ontology Bundle-Version: 1.1.0.qualifier Require-Bundle: org.simantics.layer0 -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.action.ontology Automatic-Module-Name: org.simantics.action.ontology diff --git a/bundles/org.simantics.annotation.ontology/.classpath b/bundles/org.simantics.annotation.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.annotation.ontology/.classpath +++ b/bundles/org.simantics.annotation.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.annotation.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.annotation.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.annotation.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.annotation.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.annotation.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.annotation.ontology/META-INF/MANIFEST.MF index 678e472fb..679467d20 100644 --- a/bundles/org.simantics.annotation.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.annotation.ontology/META-INF/MANIFEST.MF @@ -14,7 +14,7 @@ Require-Bundle: org.simantics.layer0, org.simantics.scenegraph.ontology;bundle-version="1.1.0", org.simantics.selectionview.ui.ontology;bundle-version="1.1.0", org.simantics.selectionview.ontology;bundle-version="1.2.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.annotation.ontology Bundle-Vendor: VTT Technical Research Centre of Finland Automatic-Module-Name: org.simantics.annotation.ontology diff --git a/bundles/org.simantics.annotation.ui/.classpath b/bundles/org.simantics.annotation.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.annotation.ui/.classpath +++ b/bundles/org.simantics.annotation.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.annotation.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.annotation.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.annotation.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.annotation.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.annotation.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.annotation.ui/META-INF/MANIFEST.MF index 752c445b5..49285d070 100644 --- a/bundles/org.simantics.annotation.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.annotation.ui/META-INF/MANIFEST.MF @@ -17,9 +17,9 @@ Require-Bundle: org.eclipse.ui, org.simantics.modeling.ui;bundle-version="1.1.1", org.simantics.graph.db;bundle-version="1.1.9", org.simantics.views.swt.client;bundle-version="1.0.0", - org.slf4j.api;bundle-version="1.7.20" + org.slf4j.api Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-Vendor: VTT Technical Research Centre of Finland Export-Package: org.simantics.annotation.ui Automatic-Module-Name: org.simantics.annotation.ui diff --git a/bundles/org.simantics.application/.classpath b/bundles/org.simantics.application/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.application/.classpath +++ b/bundles/org.simantics.application/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.application/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.application/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.application/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.application/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.application/META-INF/MANIFEST.MF b/bundles/org.simantics.application/META-INF/MANIFEST.MF index 61b0f0b74..11fbec03d 100644 --- a/bundles/org.simantics.application/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.application/META-INF/MANIFEST.MF @@ -15,6 +15,6 @@ Require-Bundle: org.eclipse.core.runtime, org.simantics.db.common;bundle-version="0.6.2" Bundle-ActivationPolicy: lazy Bundle-Activator: org.simantics.application.internal.Activator -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Import-Package: org.simantics.db.procore Automatic-Module-Name: org.simantics.application diff --git a/bundles/org.simantics.auditlogging/.classpath b/bundles/org.simantics.auditlogging/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.auditlogging/.classpath +++ b/bundles/org.simantics.auditlogging/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.auditlogging/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.auditlogging/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.auditlogging/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.auditlogging/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.auditlogging/META-INF/MANIFEST.MF b/bundles/org.simantics.auditlogging/META-INF/MANIFEST.MF index 245787d59..2ed0b2ba4 100644 --- a/bundles/org.simantics.auditlogging/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.auditlogging/META-INF/MANIFEST.MF @@ -9,16 +9,16 @@ Require-Bundle: org.eclipse.core.runtime, com.fasterxml.jackson.core.jackson-core, org.slf4j.api, javax.servlet-api, - javax.ws.rs-api, - org.eclipse.jetty.server, - org.eclipse.jetty.servlet, - org.eclipse.jetty.util, + jakarta.ws.rs-api, + org.eclipse.jetty.server;bundle-version="9.4.24", + org.eclipse.jetty.servlet;bundle-version="9.4.24", + org.eclipse.jetty.util;bundle-version="9.4.24", org.glassfish.jersey.core.jersey-server, org.glassfish.jersey.media.jersey-media-json-jackson, org.glassfish.jersey.containers.jersey-container-servlet-core, org.glassfish.jersey.core.jersey-client, org.glassfish.jersey.core.jersey-common -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.audit.server Automatic-Module-Name: org.simantics.auditlogging diff --git a/bundles/org.simantics.backup.db/.classpath b/bundles/org.simantics.backup.db/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.backup.db/.classpath +++ b/bundles/org.simantics.backup.db/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.backup.db/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.backup.db/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.backup.db/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.backup.db/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.backup.db/META-INF/MANIFEST.MF b/bundles/org.simantics.backup.db/META-INF/MANIFEST.MF index 7293ca150..ae4014eec 100644 --- a/bundles/org.simantics.backup.db/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.backup.db/META-INF/MANIFEST.MF @@ -7,7 +7,7 @@ Bundle-Activator: org.simantics.backup.db.Activator Require-Bundle: org.simantics, org.simantics.backup.ontology, org.simantics.backup -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/component.xml Automatic-Module-Name: org.simantics.backup.db diff --git a/bundles/org.simantics.backup.ontology/.classpath b/bundles/org.simantics.backup.ontology/.classpath index 098194ca4..e801ebfb4 100644 --- a/bundles/org.simantics.backup.ontology/.classpath +++ b/bundles/org.simantics.backup.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.backup.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.backup.ontology/.settings/org.eclipse.jdt.core.prefs index f42de363a..7adc0fb9a 100644 --- a/bundles/org.simantics.backup.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.backup.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.backup.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.backup.ontology/META-INF/MANIFEST.MF index 690b6e2b1..3166fff28 100644 --- a/bundles/org.simantics.backup.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.backup.ontology/META-INF/MANIFEST.MF @@ -7,7 +7,7 @@ Bundle-Activator: org.simantics.backup.ontology.Activator Require-Bundle: org.eclipse.core.runtime, org.simantics.layer0, org.simantics.structural.ontology;bundle-version="1.2.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.backup.ontology Automatic-Module-Name: org.simantics.backup.ontology diff --git a/bundles/org.simantics.backup/.classpath b/bundles/org.simantics.backup/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.backup/.classpath +++ b/bundles/org.simantics.backup/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.backup/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.backup/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.backup/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.backup/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.backup/META-INF/MANIFEST.MF b/bundles/org.simantics.backup/META-INF/MANIFEST.MF index 083c6d375..4f1487e09 100644 --- a/bundles/org.simantics.backup/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.backup/META-INF/MANIFEST.MF @@ -5,7 +5,7 @@ Bundle-SymbolicName: org.simantics.backup Bundle-Version: 1.0.0.qualifier Bundle-Activator: org.simantics.backup.Activator Require-Bundle: org.eclipse.core.runtime -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.backup Automatic-Module-Name: org.simantics.backup diff --git a/bundles/org.simantics.basicexpression/.classpath b/bundles/org.simantics.basicexpression/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.basicexpression/.classpath +++ b/bundles/org.simantics.basicexpression/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.basicexpression/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.basicexpression/.settings/org.eclipse.jdt.core.prefs index ac83d5cf0..a2e07366c 100644 --- a/bundles/org.simantics.basicexpression/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.basicexpression/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,8 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -16,6 +16,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled @@ -45,6 +46,7 @@ org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled @@ -70,4 +72,5 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.basicexpression/META-INF/MANIFEST.MF b/bundles/org.simantics.basicexpression/META-INF/MANIFEST.MF index 29026a5ac..b13c011fb 100644 --- a/bundles/org.simantics.basicexpression/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.basicexpression/META-INF/MANIFEST.MF @@ -4,12 +4,12 @@ Bundle-Name: Basic Expression Parser Bundle-SymbolicName: org.simantics.basicexpression Bundle-Version: 1.1.0.qualifier Bundle-Vendor: VTT Technical Research Centre of Finland -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.basicexpression, org.simantics.basicexpression.analysis, org.simantics.basicexpression.lexer, org.simantics.basicexpression.node, org.simantics.basicexpression.parser -Require-Bundle: org.slf4j.api;bundle-version="1.7.25" +Require-Bundle: org.slf4j.api Automatic-Module-Name: org.simantics.basicexpression diff --git a/bundles/org.simantics.browsing.ui.common/.classpath b/bundles/org.simantics.browsing.ui.common/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.browsing.ui.common/.classpath +++ b/bundles/org.simantics.browsing.ui.common/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.browsing.ui.common/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.browsing.ui.common/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.browsing.ui.common/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.browsing.ui.common/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.browsing.ui.common/META-INF/MANIFEST.MF b/bundles/org.simantics.browsing.ui.common/META-INF/MANIFEST.MF index 0b734538c..040121acb 100644 --- a/bundles/org.simantics.browsing.ui.common/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.browsing.ui.common/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Common Tree Browsing Implementations Bundle-SymbolicName: org.simantics.browsing.ui.common;singleton:=true Bundle-Version: 1.1.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.browsing.ui;bundle-version="[0.9.0,2.0.0)";visibility:=reexport, org.simantics.utils;bundle-version="1.0.0", org.eclipse.core.expressions;bundle-version="3.4.200", diff --git a/bundles/org.simantics.browsing.ui.graph.impl/.classpath b/bundles/org.simantics.browsing.ui.graph.impl/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.browsing.ui.graph.impl/.classpath +++ b/bundles/org.simantics.browsing.ui.graph.impl/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.browsing.ui.graph.impl/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.browsing.ui.graph.impl/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.browsing.ui.graph.impl/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.browsing.ui.graph.impl/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.browsing.ui.graph.impl/META-INF/MANIFEST.MF b/bundles/org.simantics.browsing.ui.graph.impl/META-INF/MANIFEST.MF index 7e1375f96..df548f25d 100644 --- a/bundles/org.simantics.browsing.ui.graph.impl/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.browsing.ui.graph.impl/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Graph-based browsing Internals Bundle-SymbolicName: org.simantics.browsing.ui.graph.impl Bundle-Version: 1.1.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.browsing.ui.common;bundle-version="[0.9.0,2.0.0)", org.simantics.utils.ui;bundle-version="1.0.0", org.simantics.db.layer0;bundle-version="0.8.0", diff --git a/bundles/org.simantics.browsing.ui.graph/.classpath b/bundles/org.simantics.browsing.ui.graph/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.browsing.ui.graph/.classpath +++ b/bundles/org.simantics.browsing.ui.graph/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.browsing.ui.graph/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.browsing.ui.graph/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.browsing.ui.graph/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.browsing.ui.graph/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.browsing.ui.graph/META-INF/MANIFEST.MF b/bundles/org.simantics.browsing.ui.graph/META-INF/MANIFEST.MF index 833cc2f62..8d96dd46b 100644 --- a/bundles/org.simantics.browsing.ui.graph/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.browsing.ui.graph/META-INF/MANIFEST.MF @@ -7,7 +7,7 @@ Require-Bundle: org.simantics.browsing.ui.common;bundle-version="[0.9.0,2.0.0)"; org.simantics.browsing.ui.graph.impl;bundle-version="1.0.0";visibility:=reexport, org.simantics.db.layer0;bundle-version="0.8.0";visibility:=reexport, org.simantics;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.browsing.ui.graph.contributor.imager, org.simantics.browsing.ui.graph.contributor.labeler, org.simantics.browsing.ui.graph.contributor.layer0, diff --git a/bundles/org.simantics.browsing.ui.model/.classpath b/bundles/org.simantics.browsing.ui.model/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.browsing.ui.model/.classpath +++ b/bundles/org.simantics.browsing.ui.model/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.browsing.ui.model/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.browsing.ui.model/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.browsing.ui.model/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.browsing.ui.model/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.browsing.ui.model/META-INF/MANIFEST.MF b/bundles/org.simantics.browsing.ui.model/META-INF/MANIFEST.MF index e33714f53..2730d5f0d 100644 --- a/bundles/org.simantics.browsing.ui.model/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.browsing.ui.model/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Modelled viewpoint support Bundle-SymbolicName: org.simantics.browsing.ui.model Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.browsing.ui.common;bundle-version="1.1.0", org.simantics.ui;bundle-version="1.0.0", org.slf4j.api diff --git a/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/browsecontexts/BrowseContext.java b/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/browsecontexts/BrowseContext.java index c4f8c2682..3a185f585 100644 --- a/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/browsecontexts/BrowseContext.java +++ b/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/browsecontexts/BrowseContext.java @@ -57,11 +57,13 @@ import org.simantics.browsing.ui.model.visuals.VisualsContribution; import org.simantics.db.ReadGraph; import org.simantics.db.RequestProcessor; import org.simantics.db.Resource; +import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener; +import org.simantics.db.common.request.ResourceRead; +import org.simantics.db.common.request.UnaryRead; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; import org.simantics.db.exception.ResourceNotFoundException; import org.simantics.db.layer0.variable.Variable; -import org.simantics.db.request.Read; import org.simantics.scl.reflection.OntologyVersions; import org.simantics.viewpoint.ontology.ViewpointResource; import org.slf4j.Logger; @@ -77,21 +79,21 @@ public class BrowseContext { private static final Logger LOGGER = LoggerFactory.getLogger(BrowseContext.class); public static final boolean DEBUG = false; - NodeTypeMultiMap childContributions = new NodeTypeMultiMap(); - NodeTypeMultiMap parentContributions = new NodeTypeMultiMap(); - OrderedNodeTypeMultiMap labelContributions = new OrderedNodeTypeMultiMap(); - OrderedNodeTypeMultiMap imageContributions = new OrderedNodeTypeMultiMap(); - OrderedNodeTypeMultiMap checkedStateContributions = new OrderedNodeTypeMultiMap(); - OrderedNodeTypeMultiMap labelDecorationContributions = new OrderedNodeTypeMultiMap(); - OrderedNodeTypeMultiMap imageDecorationContributions = new OrderedNodeTypeMultiMap(); - OrderedNodeTypeMultiMap modifierContributions = new OrderedNodeTypeMultiMap(); - OrderedNodeTypeMultiMap sorterContributions = new OrderedNodeTypeMultiMap(); - OrderedNodeTypeMultiMap flatNodeContributions = new OrderedNodeTypeMultiMap(); + NodeTypeMultiMap childContributions = new NodeTypeMultiMap<>(); + NodeTypeMultiMap parentContributions = new NodeTypeMultiMap<>(); + OrderedNodeTypeMultiMap labelContributions = new OrderedNodeTypeMultiMap<>(); + OrderedNodeTypeMultiMap imageContributions = new OrderedNodeTypeMultiMap<>(); + OrderedNodeTypeMultiMap checkedStateContributions = new OrderedNodeTypeMultiMap<>(); + OrderedNodeTypeMultiMap labelDecorationContributions = new OrderedNodeTypeMultiMap<>(); + OrderedNodeTypeMultiMap imageDecorationContributions = new OrderedNodeTypeMultiMap<>(); + OrderedNodeTypeMultiMap modifierContributions = new OrderedNodeTypeMultiMap<>(); + OrderedNodeTypeMultiMap sorterContributions = new OrderedNodeTypeMultiMap<>(); + OrderedNodeTypeMultiMap flatNodeContributions = new OrderedNodeTypeMultiMap<>(); OrderedNodeTypeMultiMap tooltipContributions = new OrderedNodeTypeMultiMap<>(); private final String[] uris; - private BrowseContext(String[] uris) { + private BrowseContext(String... uris) { if (uris == null) throw new NullPointerException("null URIs"); this.uris = uris; @@ -110,6 +112,38 @@ public class BrowseContext { return defaultContext; } + private static BrowseContext loadCachedVisuals(ReadGraph g, Resource visualsContributionResource) throws DatabaseException, InvalidContribution { + try { + return g.syncRequest(new ResourceRead(visualsContributionResource) { + @Override + public BrowseContext perform(ReadGraph graph) throws DatabaseException { + try { + BrowseContext bc = new BrowseContext(); + VisualsContribution.load(g, visualsContributionResource, + bc.labelContributions, + bc.imageContributions, + bc.checkedStateContributions, + bc.labelDecorationContributions, + bc.imageDecorationContributions, + bc.modifierContributions, + bc.sorterContributions, + bc.flatNodeContributions, + bc.tooltipContributions + ); + return bc; + } catch (InvalidContribution e) { + throw new DatabaseException(e); + } + } + }, TransientCacheAsyncListener.instance()); + } catch (DatabaseException e) { + Throwable c = e.getCause(); + if (c instanceof InvalidContribution) + throw (InvalidContribution) c; + throw e; + } + } + /** * Creates a new BrowseContext for the given Collection of {@link Resource}s. * @@ -127,7 +161,7 @@ public class BrowseContext { for(Resource childContributionResource : g.getObjects(browseContextResource, vr.BrowseContext_HasChildContribution)) { try { - ChildContribution contribution = ChildContribution.create(g, childContributionResource); + ChildContribution contribution = ChildContribution.createCached(g, childContributionResource); browseContext.childContributions.put(contribution.getParentNodeType(), contribution); browseContext.parentContributions.put(contribution.getChildNodeType(), contribution); } catch (DatabaseException e) { @@ -138,17 +172,16 @@ public class BrowseContext { for(Resource visualsContributionResource : g.getObjects(browseContextResource, vr.BrowseContext_HasVisualsContribution)) { try { - VisualsContribution.load(g, visualsContributionResource, - browseContext.labelContributions, - browseContext.imageContributions, - browseContext.checkedStateContributions, - browseContext.labelDecorationContributions, - browseContext.imageDecorationContributions, - browseContext.modifierContributions, - browseContext.sorterContributions, - browseContext.flatNodeContributions, - browseContext.tooltipContributions - ); + BrowseContext visuals = loadCachedVisuals(g, visualsContributionResource); + visuals.labelContributions.appendTo(browseContext.labelContributions); + visuals.imageContributions.appendTo(browseContext.imageContributions); + visuals.checkedStateContributions.appendTo(browseContext.checkedStateContributions); + visuals.labelDecorationContributions.appendTo(browseContext.labelDecorationContributions); + visuals.imageDecorationContributions.appendTo(browseContext.imageDecorationContributions); + visuals.modifierContributions.appendTo(browseContext.modifierContributions); + visuals.sorterContributions.appendTo(browseContext.sorterContributions); + visuals.flatNodeContributions.appendTo(browseContext.flatNodeContributions); + visuals.tooltipContributions.appendTo(browseContext.tooltipContributions); } catch (DatabaseException e) { LOGGER.error("Failed to load visuals contribution " + NameUtils.getSafeName(g, visualsContributionResource), e); } @@ -159,11 +192,11 @@ public class BrowseContext { } public static Set getBrowseContextClosure(RequestProcessor processor, final Set browseContexts) throws DatabaseException { - return processor.syncRequest(new Read>() { + return processor.syncRequest(new UnaryRead, Set>(browseContexts) { @Override public Set perform(ReadGraph graph) throws DatabaseException { - Collection browseContextResources = new ArrayList(browseContexts.size()); - for (String browseContext : browseContexts) { + Collection browseContextResources = new ArrayList<>(parameter.size()); + for (String browseContext : parameter) { try { browseContextResources.add(graph.getResource(browseContext)); } catch (ResourceNotFoundException e) { @@ -171,19 +204,29 @@ public class BrowseContext { } } Collection allBrowseContextResources = BrowseContext.findSubcontexts(graph, browseContextResources); - Set result = new HashSet(); + Set result = new HashSet<>(); for (Resource r : allBrowseContextResources) result.add(graph.getURI(r)); - return result; + return result; } - }); + }, TransientCacheAsyncListener.instance()); } - public static Collection findSubcontexts(ReadGraph g, + public static Collection findSubcontexts(ReadGraph g, Collection browseContexts) + throws DatabaseException { + return g.syncRequest(new UnaryRead, Collection>(browseContexts) { + @Override + public Collection perform(ReadGraph graph) throws DatabaseException { + return findSubcontexts0(graph, parameter); + } + }, TransientCacheAsyncListener.instance()); + } + + private static Collection findSubcontexts0(ReadGraph g, Collection browseContexts) throws DatabaseException { ViewpointResource vr = ViewpointResource.getInstance(g); - HashSet result = new HashSet(browseContexts); - ArrayList stack = new ArrayList(browseContexts); + HashSet result = new HashSet<>(browseContexts); + ArrayList stack = new ArrayList<>(browseContexts); while(!stack.isEmpty()) { Resource cur = stack.remove(stack.size()-1); for(Resource sc : g.getObjects(cur, vr.BrowseContext_Includes)) @@ -192,7 +235,7 @@ public class BrowseContext { } return result; } - + /** * Finds the possible children of the given {@link NodeContext} parameter. * diff --git a/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/children/ChildContribution.java b/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/children/ChildContribution.java index ca9f59da0..09a15fefc 100644 --- a/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/children/ChildContribution.java +++ b/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/children/ChildContribution.java @@ -22,6 +22,8 @@ import org.simantics.browsing.ui.model.nodetypes.NodeType; import org.simantics.databoard.Bindings; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; +import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener; +import org.simantics.db.common.request.ResourceRead; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.exception.PendingVariableException; @@ -52,6 +54,26 @@ public class ChildContribution { this.priority = priority; } + public static ChildContribution createCached(ReadGraph g, Resource childContributionResource) throws DatabaseException, InvalidContribution { + try { + return g.syncRequest(new ResourceRead(childContributionResource) { + @Override + public ChildContribution perform(ReadGraph graph) throws DatabaseException { + try { + return create(g, resource); + } catch (InvalidContribution e) { + throw new DatabaseException(e); + } + } + }, TransientCacheAsyncListener.instance()); + } catch (DatabaseException e) { + Throwable c = e.getCause(); + if (c instanceof InvalidContribution) + throw (InvalidContribution) c; + throw e; + } + } + public static ChildContribution create(ReadGraph g, Resource childContributionResource) throws DatabaseException, InvalidContribution { ViewpointResource vr = ViewpointResource.getInstance(g); diff --git a/bundles/org.simantics.browsing.ui.nattable/.classpath b/bundles/org.simantics.browsing.ui.nattable/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.browsing.ui.nattable/.classpath +++ b/bundles/org.simantics.browsing.ui.nattable/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.browsing.ui.nattable/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.browsing.ui.nattable/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.browsing.ui.nattable/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.browsing.ui.nattable/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.browsing.ui.nattable/META-INF/MANIFEST.MF b/bundles/org.simantics.browsing.ui.nattable/META-INF/MANIFEST.MF index f158246fa..4c12cb034 100644 --- a/bundles/org.simantics.browsing.ui.nattable/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.browsing.ui.nattable/META-INF/MANIFEST.MF @@ -13,7 +13,7 @@ Require-Bundle: org.eclipse.ui, org.simantics.browsing.ui.swt;bundle-version="1.1.0", org.eclipse.nebula.widgets.nattable.core;bundle-version="1.4.0", it.unimi.dsi.fastutil;bundle-version="7.0.6" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.browsing.ui.nattable Bundle-Vendor: VTT Technical Research Centre of Finland diff --git a/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/GENatTableThemeConfiguration.java b/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/GENatTableThemeConfiguration.java index 80882b46c..c1551274e 100644 --- a/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/GENatTableThemeConfiguration.java +++ b/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/GENatTableThemeConfiguration.java @@ -15,12 +15,14 @@ public class GENatTableThemeConfiguration extends ModernNatTableThemeConfigurati public GENatTableThemeConfiguration(GETreeData treeData, int style) { super(); + TextPainter cellTextPainter = new TextPainter(); + cellTextPainter.setTrimText(false); this.oddRowBgColor = GUIHelper.getColor(250, 250, 250); this.defaultCellPainter = new GEStyler(treeData, new GEIconPainter( new PaddingDecorator( - new TextPainter(), + cellTextPainter, 0, 5, 0, diff --git a/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/GEStyler.java b/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/GEStyler.java index c9c37ab50..e773ebb00 100644 --- a/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/GEStyler.java +++ b/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/GEStyler.java @@ -42,6 +42,8 @@ public class GEStyler extends CellPainterWrapper{ style.setAttributeValue(CellStyleAttributes.IMAGE, image); wrapper.setSpecificConfigAttribute(CellConfigAttributes.CELL_STYLE, DisplayMode.NORMAL, "BODY", style); + wrapper.setSpecificConfigAttribute(CellConfigAttributes.CELL_STYLE, DisplayMode.SELECT, "BODY", style); + wrapper.setSpecificConfigAttribute(CellConfigAttributes.CELL_STYLE, DisplayMode.SELECT_HOVER, "BODY", style); // wrapper.setSpecificConfigAttribute(CellStyleAttributes.FOREGROUND_COLOR, DisplayMode.NORMAL, "BODY", style.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR)); // wrapper.setSpecificConfigAttribute(CellStyleAttributes.BACKGROUND_COLOR, DisplayMode.NORMAL, "BODY", style.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR)); // wrapper.setSpecificConfigAttribute(CellStyleAttributes.FONT, DisplayMode.NORMAL, "BODY", style.getAttributeValue(CellStyleAttributes.FONT)); diff --git a/bundles/org.simantics.browsing.ui.ontology/.classpath b/bundles/org.simantics.browsing.ui.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.browsing.ui.ontology/.classpath +++ b/bundles/org.simantics.browsing.ui.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.browsing.ui.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.browsing.ui.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.browsing.ui.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.browsing.ui.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.browsing.ui.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.browsing.ui.ontology/META-INF/MANIFEST.MF index 874f7e1c3..5e88348a9 100644 --- a/bundles/org.simantics.browsing.ui.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.browsing.ui.ontology/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: http://www.simantics.org/Browsing Bundle-SymbolicName: org.simantics.browsing.ui.ontology Bundle-Version: 1.1.0.qualifier Require-Bundle: org.simantics.layer0 -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.browsing.ui.swt.stubs Bundle-Vendor: VTT Technical Research Centre of Finland Automatic-Module-Name: org.simantics.browsing.ui.ontology diff --git a/bundles/org.simantics.browsing.ui.platform/.classpath b/bundles/org.simantics.browsing.ui.platform/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.browsing.ui.platform/.classpath +++ b/bundles/org.simantics.browsing.ui.platform/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.browsing.ui.platform/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.browsing.ui.platform/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.browsing.ui.platform/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.browsing.ui.platform/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.browsing.ui.platform/META-INF/MANIFEST.MF b/bundles/org.simantics.browsing.ui.platform/META-INF/MANIFEST.MF index f70303d53..a884e5b90 100644 --- a/bundles/org.simantics.browsing.ui.platform/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.browsing.ui.platform/META-INF/MANIFEST.MF @@ -15,7 +15,7 @@ Require-Bundle: org.eclipse.ui, org.simantics.utils.thread.swt;bundle-version="1.1.0", org.eclipse.e4.core.contexts;bundle-version="1.1.0" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.browsing.ui.platform Bundle-Vendor: VTT Technical Research Centre of Finland Automatic-Module-Name: org.simantics.browsing.ui.platform diff --git a/bundles/org.simantics.browsing.ui.swt/.classpath b/bundles/org.simantics.browsing.ui.swt/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.browsing.ui.swt/.classpath +++ b/bundles/org.simantics.browsing.ui.swt/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.browsing.ui.swt/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.browsing.ui.swt/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.browsing.ui.swt/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.browsing.ui.swt/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.browsing.ui.swt/META-INF/MANIFEST.MF b/bundles/org.simantics.browsing.ui.swt/META-INF/MANIFEST.MF index 132fd69fc..006684e3d 100644 --- a/bundles/org.simantics.browsing.ui.swt/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.browsing.ui.swt/META-INF/MANIFEST.MF @@ -15,10 +15,10 @@ Require-Bundle: org.simantics.utils.thread.swt;bundle-version="1.0.0", org.eclipse.ui.forms;bundle-version="3.4.1", com.lowagie.text;bundle-version="2.1.5", org.eclipse.e4.core.contexts;bundle-version="1.4.0", - org.slf4j.api;bundle-version="1.7.20", + org.slf4j.api, org.eclipse.mylyn.wikitext;bundle-version="3.0.6", org.eclipse.mylyn.wikitext.mediawiki;bundle-version="3.0.6" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.browsing.ui.swt, org.simantics.browsing.ui.swt.contentassist, org.simantics.browsing.ui.swt.inputs, diff --git a/bundles/org.simantics.browsing.ui/.classpath b/bundles/org.simantics.browsing.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.browsing.ui/.classpath +++ b/bundles/org.simantics.browsing.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.browsing.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.browsing.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.browsing.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.browsing.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.browsing.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.browsing.ui/META-INF/MANIFEST.MF index 15adb3e11..da71e8582 100644 --- a/bundles/org.simantics.browsing.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.browsing.ui/META-INF/MANIFEST.MF @@ -6,7 +6,7 @@ Bundle-Version: 1.1.0.qualifier Require-Bundle: org.eclipse.core.runtime;bundle-version="3.5.0";visibility:=reexport, org.simantics.utils.datastructures;bundle-version="1.0.0";visibility:=reexport Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.browsing.ui, org.simantics.browsing.ui.content, org.simantics.browsing.ui.exception diff --git a/bundles/org.simantics.charts.ontology/.classpath b/bundles/org.simantics.charts.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.charts.ontology/.classpath +++ b/bundles/org.simantics.charts.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.charts.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.charts.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.charts.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.charts.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.charts.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.charts.ontology/META-INF/MANIFEST.MF index 01c6ad2d8..6c261f05e 100644 --- a/bundles/org.simantics.charts.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.charts.ontology/META-INF/MANIFEST.MF @@ -13,6 +13,6 @@ Require-Bundle: org.simantics.layer0;bundle-version="1.0.0", org.simantics.image2.ontology;bundle-version="1.1.0", org.simantics.selectionview.ontology;bundle-version="1.2.0", org.simantics.simulation.ontology;bundle-version="1.1.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.charts.ontology Automatic-Module-Name: org.simantics.charts.ontology diff --git a/bundles/org.simantics.charts/.classpath b/bundles/org.simantics.charts/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.charts/.classpath +++ b/bundles/org.simantics.charts/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.charts/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.charts/.settings/org.eclipse.jdt.core.prefs index 3a2153707..7adc0fb9a 100644 --- a/bundles/org.simantics.charts/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.charts/.settings/org.eclipse.jdt.core.prefs @@ -1,11 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.charts/META-INF/MANIFEST.MF b/bundles/org.simantics.charts/META-INF/MANIFEST.MF index b0c49505b..0920f6766 100644 --- a/bundles/org.simantics.charts/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.charts/META-INF/MANIFEST.MF @@ -49,6 +49,6 @@ Require-Bundle: org.eclipse.ui, org.eclipse.e4.core.services, com.fasterxml.jackson.core.jackson-core;bundle-version="2.8.2", org.slf4j.api -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Automatic-Module-Name: org.simantics.charts diff --git a/bundles/org.simantics.charts/fragment.e4xmi b/bundles/org.simantics.charts/fragment.e4xmi index 59ed5915c..ecea0073c 100644 --- a/bundles/org.simantics.charts/fragment.e4xmi +++ b/bundles/org.simantics.charts/fragment.e4xmi @@ -54,21 +54,21 @@ - + - + - + - + - - - + + + diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartCopyHandler.java b/bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartCopyHandler.java index 65108d6f7..1e1c6e1b3 100644 --- a/bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartCopyHandler.java +++ b/bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartCopyHandler.java @@ -1,6 +1,6 @@ /******************************************************************************* - * Copyright (c) 2011 Association for Decentralized Information Management in - * Industry THTH ry. + * Copyright (c) 2011,2020 Association for Decentralized Information Management + * in Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,6 +8,7 @@ * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation + * Semantum Oy - #501 *******************************************************************************/ package org.simantics.charts.editor; @@ -33,11 +34,14 @@ import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.jface.action.IStatusLineManager; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferenceDialog; +import org.eclipse.jface.window.Window; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.dialogs.PreferencesUtil; import org.eclipse.ui.handlers.HandlerUtil; import org.eclipse.ui.preferences.ScopedPreferenceStore; import org.simantics.charts.ui.CSVProgressMonitor; @@ -74,8 +78,28 @@ public class ChartCopyHandler extends AbstractHandler { IStatusLineManager status = editor.getEditorSite().getActionBars().getStatusLineManager(); final Shell shell = HandlerUtil.getActiveShell(event); - final AtomicBoolean result = new AtomicBoolean(false); + // Find a good value to use for START_TIME based on the current horizontal ruler + // time range and the data start time. + IPreferenceStore csvnode = new ScopedPreferenceStore( InstanceScope.INSTANCE, CSVPreferences.P_NODE ); + double oldStartTime = csvnode.getDouble(CSVPreferences.P_CSV_START_TIME); + double timeStep = csvnode.getDouble(CSVPreferences.P_CSV_TIME_STEP); + double visibleChartMinTime = trendNode.horizRuler.from; + double dataStartTime = trendNode.horizRuler.getItemFromTime(); + // Find the first sample time that contains data if startTime < _from + double n = Math.max(0, Math.ceil((visibleChartMinTime-dataStartTime) / timeStep)); + double temporaryStartTime = dataStartTime + n*timeStep; + csvnode.setValue(CSVPreferences.P_CSV_START_TIME, temporaryStartTime); + try { + PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn( + shell, "org.simantics.modeling.csv.preferences", + new String[] { "org.simantics.modeling.csv.preferences" }, + null); + dialog.setMessage("Select Used CSV Export Settings"); + if (dialog.open() != Window.OK) + return null; + + AtomicBoolean result = new AtomicBoolean(false); PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { @@ -92,6 +116,8 @@ public class ChartCopyHandler extends AbstractHandler { ErrorLogger.defaultLogError(e.getCause()); } catch (InterruptedException e) { ErrorLogger.defaultLogError(e); + } finally { + csvnode.setValue(CSVPreferences.P_CSV_START_TIME, oldStartTime); } return null; @@ -132,7 +158,7 @@ public class ChartCopyHandler extends AbstractHandler { for (TrendItem i : t.spec.items) { if (i.hidden) continue; - List items = im.search("variableId", i.variableId); + List items = im.search("groupItemId", i.groupItemId, "variableId", i.variableId); Collections.sort(items, SamplingFormat.INTERVAL_COMPARATOR); if (items.isEmpty()) continue; Bean config = items.get(0); diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartPreferencesAction.java b/bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartPreferencesAction.java new file mode 100644 index 000000000..0cc582024 --- /dev/null +++ b/bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartPreferencesAction.java @@ -0,0 +1,38 @@ +package org.simantics.charts.editor; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.preference.PreferenceDialog; +import org.eclipse.jface.window.IShellProvider; +import org.eclipse.ui.dialogs.PreferencesUtil; + +/** + * @author Tuukka Lehtonen + */ +public class ChartPreferencesAction extends Action { + + private static final String CHART_DEFAULTS_PREF_PAGE_ID = "org.simantics.charts.defaults"; //$NON-NLS-1$ + private static final String CHART_PREF_PAGE_ID = "org.simantics.charts.pref"; //$NON-NLS-1$ + private static final String CSV_PREF_PAGE_ID = "org.simantics.modeling.csv.preferences"; //$NON-NLS-1$ + + private IShellProvider shell; + + public ChartPreferencesAction(IShellProvider shell) { + super(Messages.ChartPreferencesAction_ChartPreferences); + this.shell = shell; + } + + @Override + public void run() { + PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn( + shell.getShell(), + CHART_PREF_PAGE_ID, + new String[] { + CHART_PREF_PAGE_ID, + CHART_DEFAULTS_PREF_PAGE_ID, + CSV_PREF_PAGE_ID + }, + null); + dialog.open(); + } + +} \ No newline at end of file diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/editor/Messages.java b/bundles/org.simantics.charts/src/org/simantics/charts/editor/Messages.java new file mode 100644 index 000000000..5771b1421 --- /dev/null +++ b/bundles/org.simantics.charts/src/org/simantics/charts/editor/Messages.java @@ -0,0 +1,15 @@ +package org.simantics.charts.editor; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.charts.editor.messages"; //$NON-NLS-1$ + public static String ChartPreferencesAction_ChartPreferences; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/editor/TimeSeriesEditor.java b/bundles/org.simantics.charts/src/org/simantics/charts/editor/TimeSeriesEditor.java index bffd4c8a2..ad718e49e 100644 --- a/bundles/org.simantics.charts/src/org/simantics/charts/editor/TimeSeriesEditor.java +++ b/bundles/org.simantics.charts/src/org/simantics/charts/editor/TimeSeriesEditor.java @@ -635,6 +635,8 @@ public class TimeSeriesEditor extends ResourceEditorPart { if (chartItem != null) { manager.add(new HideItemsAction("Hide Item", true, Collections.singletonList(chartItem))); manager.add(new Separator()); + manager.add(new ChartPreferencesAction(getSite())); + manager.add(new Separator()); manager.add(new PropertiesAction("Item Properties", canvas, chartItem)); manager.add(new PropertiesAction("Chart Properties", canvas, chart)); } @@ -674,6 +676,8 @@ public class TimeSeriesEditor extends ResourceEditorPart { manager.add(new SendCommandAction("Zoom to Fit Vertically", IMG_ZOOM_TO_FIT_VERT, cvsCtx, Commands.ZOOM_TO_FIT_VERT)); manager.add(new SendCommandAction("Autoscale Chart", IMG_AUTOSCALE, cvsCtx, Commands.AUTOSCALE)); manager.add(new Separator()); + manager.add(new ChartPreferencesAction(getSite())); + manager.add(new Separator()); manager.add(new PropertiesAction("Chart Properties", canvas, chart)); } } diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/editor/messages.properties b/bundles/org.simantics.charts/src/org/simantics/charts/editor/messages.properties new file mode 100644 index 000000000..37bbe90f6 --- /dev/null +++ b/bundles/org.simantics.charts/src/org/simantics/charts/editor/messages.properties @@ -0,0 +1 @@ +ChartPreferencesAction_ChartPreferences=Chart Preferences diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/export/ExportChartCSV.java b/bundles/org.simantics.charts/src/org/simantics/charts/export/ExportChartCSV.java index 7e6bdc3b7..57f1ed33f 100644 --- a/bundles/org.simantics.charts/src/org/simantics/charts/export/ExportChartCSV.java +++ b/bundles/org.simantics.charts/src/org/simantics/charts/export/ExportChartCSV.java @@ -102,7 +102,7 @@ public class ExportChartCSV extends org.simantics.simulation.export.ExperimentEx labelBuilder.append(")"); } - List historyItems = im.search("variableId", item.variableReference); + List historyItems = im.search("groupItemId", item.groupItemId, "variableId", item.variableReference); Collections.sort(historyItems, SamplingFormat.INTERVAL_COMPARATOR); if (items.isEmpty()) continue; Bean config = historyItems.get(0); diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/query/ChartAndSubscriptionItemData.java b/bundles/org.simantics.charts/src/org/simantics/charts/query/ChartAndSubscriptionItemData.java index 9438e404b..8f2bd26f8 100644 --- a/bundles/org.simantics.charts/src/org/simantics/charts/query/ChartAndSubscriptionItemData.java +++ b/bundles/org.simantics.charts/src/org/simantics/charts/query/ChartAndSubscriptionItemData.java @@ -48,7 +48,7 @@ public class ChartAndSubscriptionItemData extends Bean { // Output @Optional public String subscription = "Default"; - @Optional public String unit = ""; + @Optional public String unit; @Optional public Double min, max, deadband, interval, gain, bias; @Optional public DrawMode drawmode; @Optional public Scale scale; diff --git a/bundles/org.simantics.color.ontology/.classpath b/bundles/org.simantics.color.ontology/.classpath index ad32c83a7..e801ebfb4 100644 --- a/bundles/org.simantics.color.ontology/.classpath +++ b/bundles/org.simantics.color.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.color.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.color.ontology/.settings/org.eclipse.jdt.core.prefs index c9773dba7..7adc0fb9a 100644 --- a/bundles/org.simantics.color.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.color.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,10 @@ -#Mon Oct 03 15:37:46 EEST 2011 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.color.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.color.ontology/META-INF/MANIFEST.MF index 8ef329e89..fb5d1e29c 100644 --- a/bundles/org.simantics.color.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.color.ontology/META-INF/MANIFEST.MF @@ -4,6 +4,6 @@ Bundle-Name: http://www.simantics.org/Color Bundle-SymbolicName: org.simantics.color.ontology Bundle-Version: 1.1.0.qualifier Require-Bundle: org.simantics.layer0 -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.color Automatic-Module-Name: org.simantics.color.ontology diff --git a/bundles/org.simantics.common/.classpath b/bundles/org.simantics.common/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.common/.classpath +++ b/bundles/org.simantics.common/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.common/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.common/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.common/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.common/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.common/META-INF/MANIFEST.MF b/bundles/org.simantics.common/META-INF/MANIFEST.MF index 7de26d40d..ee5971f31 100644 --- a/bundles/org.simantics.common/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.common/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Simantics Common Classes Bundle-SymbolicName: org.simantics.common Bundle-Version: 1.0.0.qualifier Bundle-Vendor: Semantum Oy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.common.color, org.simantics.common.format, org.simantics.common.utils diff --git a/bundles/org.simantics.compressions/.classpath b/bundles/org.simantics.compressions/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.compressions/.classpath +++ b/bundles/org.simantics.compressions/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.compressions/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.compressions/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.compressions/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.compressions/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.compressions/META-INF/MANIFEST.MF b/bundles/org.simantics.compressions/META-INF/MANIFEST.MF index 939df8a23..fd24c516f 100644 --- a/bundles/org.simantics.compressions/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.compressions/META-INF/MANIFEST.MF @@ -5,7 +5,7 @@ Bundle-SymbolicName: org.simantics.compressions Bundle-Version: 1.0.0.qualifier Bundle-Activator: org.simantics.compressions.Activator Require-Bundle: org.eclipse.core.runtime -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.compressions, org.simantics.compressions.impl diff --git a/bundles/org.simantics.databoard/.classpath b/bundles/org.simantics.databoard/.classpath index 60bca2129..35a38d845 100644 --- a/bundles/org.simantics.databoard/.classpath +++ b/bundles/org.simantics.databoard/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.databoard/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.databoard/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.databoard/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.databoard/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.databoard/META-INF/MANIFEST.MF b/bundles/org.simantics.databoard/META-INF/MANIFEST.MF index efa481726..cca05d9c3 100644 --- a/bundles/org.simantics.databoard/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.databoard/META-INF/MANIFEST.MF @@ -3,16 +3,16 @@ Bundle-ManifestVersion: 2 Bundle-Name: Databoard Plug-in Bundle-SymbolicName: org.simantics.databoard;singleton:=true Bundle-Version: 0.6.6.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.junit;resolution:=optional, - org.objectweb.asm;bundle-version="[5.0.0,8.0.0)";resolution:=optional;visibility:=reexport, + org.objectweb.asm;bundle-version="[7.0.0,8.0.0)";resolution:=optional;visibility:=reexport, gnu.trove3;bundle-version="3.0.0", org.eclipse.help;bundle-version="3.5.100";resolution:=optional, org.eclipse.swt;bundle-version="3.7.1";resolution:=optional, org.eclipse.jface;bundle-version="3.7.0";resolution:=optional, org.eclipse.core.runtime;bundle-version="3.7.0";resolution:=optional, - org.apache.commons.collections;bundle-version="3.2.1", - org.slf4j.api + org.slf4j.api, + org.apache.commons.collections4;bundle-version="4.1.0" Export-Package: org.simantics.databoard, org.simantics.databoard.accessor, org.simantics.databoard.accessor.binary, diff --git a/bundles/org.simantics.databoard/src/org/simantics/databoard/adapter/AdapterFactory.java b/bundles/org.simantics.databoard/src/org/simantics/databoard/adapter/AdapterFactory.java index a674943d5..066ed4c88 100644 --- a/bundles/org.simantics.databoard/src/org/simantics/databoard/adapter/AdapterFactory.java +++ b/bundles/org.simantics.databoard/src/org/simantics/databoard/adapter/AdapterFactory.java @@ -14,8 +14,8 @@ package org.simantics.databoard.adapter; import java.util.ArrayList; import java.util.Map; -import org.apache.commons.collections.map.ReferenceMap; -import org.simantics.databoard.Bindings; +import org.apache.commons.collections4.map.AbstractReferenceMap.ReferenceStrength; +import org.apache.commons.collections4.map.ReferenceMap; import org.simantics.databoard.Units; import org.simantics.databoard.binding.ArrayBinding; import org.simantics.databoard.binding.Binding; @@ -52,9 +52,8 @@ import org.simantics.databoard.util.ObjectUtils; */ public class AdapterFactory { - @SuppressWarnings( "unchecked" ) - Map cache = (Map) new ReferenceMap(ReferenceMap.SOFT, ReferenceMap.HARD); - + Map cache = new ReferenceMap<>(ReferenceStrength.SOFT, ReferenceStrength.HARD); + public synchronized Adapter getAdapter(Binding domain, Binding range, boolean typeAdapter, boolean mustClone) throws AdapterConstructionException { diff --git a/bundles/org.simantics.datatypes.ontology/.classpath b/bundles/org.simantics.datatypes.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.datatypes.ontology/.classpath +++ b/bundles/org.simantics.datatypes.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.datatypes.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.datatypes.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.datatypes.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.datatypes.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.datatypes.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.datatypes.ontology/META-INF/MANIFEST.MF index 58b2bc0cd..6f18a736b 100644 --- a/bundles/org.simantics.datatypes.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.datatypes.ontology/META-INF/MANIFEST.MF @@ -6,6 +6,6 @@ Bundle-Version: 1.1.0.qualifier Bundle-Vendor: Semantum Oy Require-Bundle: org.simantics.layer0, org.simantics.selectionview.ontology;bundle-version="1.2.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.datatypes Automatic-Module-Name: org.simantics.datatypes.ontology diff --git a/bundles/org.simantics.datatypes/.classpath b/bundles/org.simantics.datatypes/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.datatypes/.classpath +++ b/bundles/org.simantics.datatypes/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.datatypes/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.datatypes/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.datatypes/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.datatypes/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.datatypes/META-INF/MANIFEST.MF b/bundles/org.simantics.datatypes/META-INF/MANIFEST.MF index d5dac6975..a75fdc1e8 100644 --- a/bundles/org.simantics.datatypes/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.datatypes/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Standard Datatype Library Bundle-SymbolicName: org.simantics.datatypes;singleton:=true Bundle-Version: 1.0.0.qualifier Bundle-Vendor: Semantum Oy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.db.common;bundle-version="1.1.0", org.simantics.datatypes.ontology;bundle-version="1.0.0", gnu.trove3;bundle-version="3.0.0", diff --git a/bundles/org.simantics.db.common/.classpath b/bundles/org.simantics.db.common/.classpath index a3361b46b..13a532f8e 100644 --- a/bundles/org.simantics.db.common/.classpath +++ b/bundles/org.simantics.db.common/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.db.common/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.db.common/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.db.common/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.db.common/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.db.common/META-INF/MANIFEST.MF b/bundles/org.simantics.db.common/META-INF/MANIFEST.MF index 27e433851..a29371495 100644 --- a/bundles/org.simantics.db.common/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.db.common/META-INF/MANIFEST.MF @@ -4,10 +4,9 @@ Bundle-Name: DB Client Common Implementation Bundle-SymbolicName: org.simantics.db.common Bundle-Version: 1.1.0.qualifier Bundle-Vendor: VTT Technical Research Centre of Finland -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.db;bundle-version="1.1.0";visibility:=reexport, gnu.trove3;bundle-version="3.0.3", - org.apache.log4j;bundle-version="1.2.15", org.simantics.layer0;bundle-version="1.0.0";visibility:=reexport, org.simantics.graph;bundle-version="1.1.4", org.simantics.scl.reflection;bundle-version="1.0.0";visibility:=reexport, diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/UndoMetadata.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/UndoMetadata.java index f8026f594..0568b3103 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/UndoMetadata.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/UndoMetadata.java @@ -116,4 +116,11 @@ public class UndoMetadata extends ACommentMetadata { public String getHeader() { return getType() + getRange(); } + + /** + * Returns true when no change sets are included. + */ + public boolean isEmpty() { + return begin == 0 && end == 0; + } } diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/processor/MergingGraphRequestProcessor.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/processor/MergingGraphRequestProcessor.java index e9523c0c8..dfb5780f9 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/processor/MergingGraphRequestProcessor.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/processor/MergingGraphRequestProcessor.java @@ -33,7 +33,6 @@ import org.simantics.db.common.procedure.adapter.SyncMultiProcedureAdapter; import org.simantics.db.common.procedure.wrapper.NoneToAsyncProcedure; import org.simantics.db.common.request.ReadRequest; import org.simantics.db.common.request.WriteRequest; -import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.CancelTransactionException; import org.simantics.db.exception.DatabaseException; import org.simantics.db.procedure.AsyncListener; @@ -63,9 +62,13 @@ import org.simantics.db.request.WriteOnlyResult; import org.simantics.db.request.WriteResult; import org.simantics.utils.DataContainer; import org.simantics.utils.datastructures.Pair; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class MergingGraphRequestProcessor implements AsyncRequestProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(MergingGraphRequestProcessor.class); + private static class SyncWriteRequestAdapter implements Write { private Semaphore semaphore = new Semaphore(0); @@ -128,7 +131,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { try { semaphore.acquire(); } catch (InterruptedException e) { - Logger.defaultLogError(e); + LOGGER.error("SyncWriteRequestAdapter interrupted", e); } } @@ -223,7 +226,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { try { MergingGraphRequestProcessor.this.wait(transactionKeepalivePeriod); } catch (InterruptedException e) { - Logger.defaultLogError(e); + LOGGER.error("MergedRead interrupted", e); } if (requestQueue.isEmpty()) break; @@ -262,7 +265,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { } catch(Throwable t) { - Logger.defaultLogError(t); + LOGGER.error("MergedRead failed", t); // if(currentRequest.second instanceof AsyncProcedure) { // ((AsyncProcedure)currentRequest.second).exception(graph, t); @@ -281,7 +284,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { } else { - try{ + try { if(currentRequest.second instanceof AsyncProcedure) { if(currentRequest.first instanceof AsyncRead) { @@ -298,7 +301,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { } catch(Throwable t) { - Logger.defaultLogError(t); + LOGGER.error("MergedRead failed", t); // if(currentRequest.second instanceof AsyncProcedure) { // ((AsyncProcedure)currentRequest.second).exception(graph, t); @@ -355,7 +358,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { try { MergingGraphRequestProcessor.this.wait(transactionKeepalivePeriod); } catch (InterruptedException e) { - Logger.defaultLogError(e); + LOGGER.error("RunnerWriteGraphRequest interrupted", e); } if (requestQueue.isEmpty()) break; @@ -385,7 +388,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { graph.syncRequest(adapter); if(callback != null) callback.accept(null); } catch(Throwable t) { - Logger.defaultLogError(t); + LOGGER.error("RunnerWriteGraphRequest failed", t); if(callback != null) callback.accept(t); } @@ -399,7 +402,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { else if(currentRequest.first instanceof DelayedWrite) graph.syncRequest((DelayedWrite)currentRequest.first); if(callback != null) callback.accept(null); } catch(Throwable t) { - Logger.defaultLogError(t); + LOGGER.error("RunnerWriteGraphRequest failed", t); if(callback != null) callback.accept(t); } @@ -572,7 +575,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { Throwable t = throwable.get(); if(t != null) { - Logger.defaultLogError(t); + LOGGER.error("syncRequest(AsyncMultiRead, AsyncMultiProcedure) failed", t); throw new RuntimeException(t.getMessage()); } @@ -625,7 +628,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { Throwable t = throwable.get(); if(t != null) { - Logger.defaultLogError(t); + LOGGER.error("syncRequest(AsyncRead, AsyncProcedure) failed", t); throw new RuntimeException(t.getMessage()); } @@ -691,7 +694,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { @Override public void exception(Throwable t) { - Logger.defaultLogError(t); + LOGGER.error("asyncRequest(AsyncRead) failed", t); } }); @@ -736,7 +739,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { Throwable t = throwable.get(); if(t != null) { - Logger.defaultLogError(t); + LOGGER.error("syncRequest(AsyncRead) failed", t); throw new RuntimeException(t.getMessage()); } @@ -775,7 +778,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { Throwable t = throwable.get(); if(t != null) { - Logger.defaultLogError(t); + LOGGER.error("syncRequest(AsyncMultiRead) failed", t); throw new RuntimeException(t.getMessage()); } @@ -878,7 +881,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { @Override public void exception(Throwable t) { - Logger.defaultLogError(t); + LOGGER.error("asyncRequest(Read) failed", t); } }); @@ -1305,4 +1308,9 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { throw new UnsupportedOperationException(); } + @Override + public T l0() { + return processor.l0(); + } + } diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/processor/ProcessorBase.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/processor/ProcessorBase.java index 1f00ff008..f47ebb3f3 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/processor/ProcessorBase.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/processor/ProcessorBase.java @@ -46,6 +46,11 @@ import org.simantics.db.request.WriteResult; public class ProcessorBase implements AsyncRequestProcessor { + @Override + public T l0() { + throw new UnsupportedOperationException(); + } + @Override public void asyncRequest(AsyncMultiRead request, AsyncMultiProcedure procedure) { throw new UnsupportedOperationException(); diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/request/AdaptValue.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/request/AdaptValue.java index b3eba37fb..aeea33f02 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/request/AdaptValue.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/request/AdaptValue.java @@ -14,7 +14,7 @@ import org.simantics.scl.runtime.function.FunctionImpl3; * @author Hannu Niemistö */ public class AdaptValue extends ResourceRead { - + public AdaptValue(Resource resource) { super(resource); } @@ -31,14 +31,14 @@ public class AdaptValue extends ResourceRead { } }; - + @Override public Object perform(ReadGraph graph) throws DatabaseException { - String uri = graph.getURI(resource); - if(Layer0.URIs.Functions_functionApplication.equals(uri)) return functionApplication; + Layer0 L0 = graph.l0(); + if (L0.Functions_functionApplication.equalsResource(resource)) + return functionApplication; ComputationalValue ev = graph.adapt(resource, ComputationalValue.class); return ev.getValue(graph, resource); - } } diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/request/TransientResourceRead.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/request/TransientResourceRead.java index 117a1a27f..73e612a9f 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/request/TransientResourceRead.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/request/TransientResourceRead.java @@ -19,37 +19,41 @@ import org.simantics.db.service.QueryControl; abstract public class TransientResourceRead extends BinaryRead implements ReadExt { - protected static final Object WITH_PARENT = new Object(); - - public TransientResourceRead(ReadGraph graph, Resource parameter) throws DatabaseException { - this(graph, graph.getService(QueryControl.class), parameter); - } - - public TransientResourceRead(ReadGraph graph, QueryControl qc, Resource parameter) throws DatabaseException { - super(resolveFirstParameter(graph, qc), parameter); - } - - final private static Object resolveFirstParameter(ReadGraph graph, QueryControl qc) throws DatabaseException { - if(qc.hasParentRequest(graph)) return WITH_PARENT; - else return graph.getModificationCounter(); - } - - @Override - final public R perform(ReadGraph _graph) throws DatabaseException { - if(parameter == WITH_PARENT) { - return perform(_graph, parameter2); - } else { - QueryControl qc = _graph.getService(QueryControl.class); - ReadGraph graph = qc.getIndependentGraph(_graph); - return perform(graph, parameter2); - } - } - - abstract public R perform(ReadGraph graph, Resource parameter) throws DatabaseException; - - @Override - public boolean isImmutable(ReadGraph graph) throws DatabaseException { - return graph.isImmutable(parameter2); - } - + protected static final Object WITH_PARENT = new Object(); + + public TransientResourceRead(ReadGraph graph, Resource parameter) throws DatabaseException { + this(graph, graph.getService(QueryControl.class), parameter); + } + + public TransientResourceRead(ReadGraph graph, QueryControl qc, Resource parameter) throws DatabaseException { + super(resolveFirstParameter(graph, qc), parameter); + } + + final private static Object resolveFirstParameter(ReadGraph graph, QueryControl qc) throws DatabaseException { + if(qc.hasParentRequest(graph)) return WITH_PARENT; + else return graph.getModificationCounter(); + } + + @Override + final public R perform(ReadGraph _graph) throws DatabaseException { + if(parameter == WITH_PARENT) { + return perform(_graph, parameter2); + } else { + QueryControl qc = _graph.getService(QueryControl.class); + return qc.syncRequestIndependent(_graph, new UniqueRead() { + @Override + public R perform(ReadGraph graph) throws DatabaseException { + return TransientResourceRead.this.perform(graph, parameter2); + } + }); + } + } + + abstract public R perform(ReadGraph graph, Resource parameter) throws DatabaseException; + + @Override + public boolean isImmutable(ReadGraph graph) throws DatabaseException { + return graph.isImmutable(parameter2); + } + } diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/ErrorLogger.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/ErrorLogger.java deleted file mode 100644 index 68ad37438..000000000 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/ErrorLogger.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.db.common.utils; - -import java.util.Properties; - -import org.apache.log4j.Logger; - -/* - * - * @deprecated in favor of org.simantics.db.common.Logger. Will be removed in Simantics 1.2 - * - */ -@Deprecated -public class ErrorLogger { - public static final boolean ECHO = false; - public static final Properties defaultProperties = new Properties(); - static { - defaultProperties.put("log4j.rootCategory", "ERROR, default"); - defaultProperties.put("log4j.appender.default", "org.apache.log4j.FileAppender"); - defaultProperties.put("log4j.appender.default.File", "db-client-deprecated.log"); - defaultProperties.put("log4j.appender.default.append", "false"); - defaultProperties.put("log4j.appender.default.layout", "org.apache.log4j.PatternLayout"); - defaultProperties.put("log4j.appender.default.layout.ConversionPattern", "%-6r [%15.15t] %-5p %30.30c - %m%n"); - } - private static LogManager defaultLogManager = new LogManager(defaultProperties); - private static final ErrorLogger defaultErrorLogger = new ErrorLogger(LogManager.class); - private Logger logger; - ErrorLogger(Class clazz) { - logger = defaultLogManager.getLogger(clazz); - } - - /** - * Log a trace event. - * - * @param message message of the trace - * @param exception the exception, or null - */ - public void logTrace(String message, Throwable exception) { - // Errors are much more useful with a stack trace! - if (exception == null) { - exception = new RuntimeException(); - } - logger.trace(message, exception); - } - - /** - * Log an info event. - * - * @param message message of the info - * @param exception the exception, or null - */ - public void logInfo(String message, Throwable exception) { - // Errors are much more useful with a stack trace! - if (exception == null) { - exception = new RuntimeException(); - } - logger.info(message, exception); - } - - /** - * Log an error event. - * - * @param message message of the error - * @param exception the exception, or null - */ - public void logError(String message, Throwable exception) { - // Errors are much more useful with a stack trace! - if (exception == null) { - exception = new RuntimeException(); - } - logger.error(message, exception); - } - - public static ErrorLogger getDefault() { - return defaultErrorLogger; - } - - public static LogManager getDefaultLogManager() { - return defaultLogManager; - } - public static void defaultLogError(Throwable exception) { - getDefault().logError(exception.getLocalizedMessage(), exception); - if(ECHO) exception.printStackTrace(); - } - public static void defaultLogError(String message) { - getDefault().logError(message, null); - if(ECHO) - System.err.println(message); - } - public static void defaultLogError(String message, Throwable exception) { - getDefault().logError(message, exception); - if(ECHO) - System.err.println(message); - } - public static void defaultLogInfo(String message) { - getDefault().logInfo(message, null); - if(ECHO) - System.err.println(message); - } - public static void defaultLogTrace(String message) { - getDefault().logTrace(message, null); - if(ECHO) - System.err.println(message); - } -} diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/LogManager.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/LogManager.java deleted file mode 100644 index 9abae439d..000000000 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/LogManager.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.db.common.utils; - -import java.util.Properties; - -import org.apache.log4j.Hierarchy; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; -import org.apache.log4j.PropertyConfigurator; -import org.apache.log4j.spi.LoggerFactory; -import org.apache.log4j.spi.RootLogger; - -/** - * This class encapsulates a Log4J Hierarchy and centralizes all Logger access. - */ -public class LogManager { - - private Hierarchy hierarchy; - - /** - * Creates a new LogManager. Saves the log and state location. - * Creates a new Hierarchy and add a new EventListener to it. - * Configure the hierarchy with the properties passed. Add this object to - * the list of active log managers. - * - * @param properties log configuration properties - */ - public LogManager(Properties properties) { - this.hierarchy = new Hierarchy(new RootLogger(Level.DEBUG)); - new PropertyConfigurator().doConfigure(properties, this.hierarchy); - } - - /** - * Checks if this PluginLogManager is disabled for this level. - * - * @param level level value - * @return boolean true if it is disabled - */ - public boolean isDisabled(int level) { - return this.hierarchy.isDisabled(level); - } - - /** - * Enable logging for logging requests with level l or higher. By default - * all levels are enabled. - * - * @param level level object - */ - public void setThreshold(Level level) { - this.hierarchy.setThreshold(level); - } - - /** - * The string version of setThreshold(Level level) - * - * @param level level string - */ - public void setThreshold(String level) { - this.hierarchy.setThreshold(level); - } - - /** - * Get the repository-wide threshold. - * - * @return Level - */ - public Level getThreshold() { - return this.hierarchy.getThreshold(); - } - - /** - * Returns a new logger instance named as the first parameter using the - * default factory. If a logger of that name already exists, then it will be - * returned. Otherwise, a new logger will be instantiated and then linked - * with its existing ancestors as well as children. - * - * @param clazz the class to get the logger for - * @return Logger - */ - public Logger getLogger(Class clazz) { - return this.hierarchy.getLogger(clazz.getName()); - } - - /** - * Returns a new logger instance named as the first parameter using the - * default factory. If a logger of that name already exists, then it will be - * returned. Otherwise, a new logger will be instantiated and then linked - * with its existing ancestors as well as children. - * - * @param name logger name - * @return Logger - */ - public Logger getLogger(String name) { - return this.hierarchy.getLogger(name); - } - - /** - * The same as getLogger(String name) but using a factory instance instead - * of a default factory. - * - * @param name logger name - * @param factory factory instance - * @return Logger - */ - public Logger getLogger(String name, LoggerFactory factory) { - return this.hierarchy.getLogger(name, factory); - } - - /** - * Returns the root of this hierarchy. - * - * @return Logger - */ - public Logger getRootLogger() { - return this.hierarchy.getRootLogger(); - } - - /** - * Checks if this logger exists. - * - * @return Logger - */ - public Logger exists(String name) { - return this.hierarchy.exists(name); - } - - /** - * Disposes the logger hierarchy - */ - public void shutdown() { - this.hierarchy.shutdown(); - } - - /** - * Resets configuration values to its defaults. - */ - public void resetConfiguration() { - this.hierarchy.resetConfiguration(); - } - -} \ No newline at end of file diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/OrderedSetUtils.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/OrderedSetUtils.java index 143d3e443..8e8171f85 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/OrderedSetUtils.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/OrderedSetUtils.java @@ -220,6 +220,27 @@ public class OrderedSetUtils { } } + /** + * Reorders elements with a minimum number of writes. The set of elements must remain the same. + */ + public static void reorder(WriteGraph g, Resource l, Iterable order) throws DatabaseException { + Resource newPrev = l; + for (Resource r : order) { + Resource prev = OrderedSetUtils.prev(g, l, r); + if (!prev.equals(newPrev)) { + g.deny(prev, l, r); + g.claim(newPrev, l, r); + } + newPrev = r; + } + Resource newLast = newPrev; + Resource last = OrderedSetUtils.prev(g, l, l); + if (!last.equals(newLast)) { + g.deny(last, l, l); + g.claim(newLast, l, l); + } + } + /** * Converts ordered set into a list. */ diff --git a/bundles/org.simantics.db.impl/.classpath b/bundles/org.simantics.db.impl/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.db.impl/.classpath +++ b/bundles/org.simantics.db.impl/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.db.impl/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.db.impl/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.db.impl/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.db.impl/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.db.impl/META-INF/MANIFEST.MF b/bundles/org.simantics.db.impl/META-INF/MANIFEST.MF index 21c4223f2..b20d9aa0a 100644 --- a/bundles/org.simantics.db.impl/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.db.impl/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Common DB implementation Bundle-SymbolicName: org.simantics.db.impl Bundle-Version: 1.1.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.db.common;bundle-version="0.8.0", org.eclipse.core.runtime;bundle-version="3.6.0", gnu.trove3;bundle-version="3.0.0", diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/BlockingAsyncProcedure.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/BlockingAsyncProcedure.java index 8f96bb9e6..9f89a0d8f 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/BlockingAsyncProcedure.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/BlockingAsyncProcedure.java @@ -19,34 +19,31 @@ import org.simantics.db.impl.query.AsyncReadEntry; import org.simantics.db.impl.query.PendingTaskSupport; import org.simantics.db.procedure.AsyncProcedure; import org.simantics.db.request.AsyncRead; -public class BlockingAsyncProcedure implements AsyncProcedure { + +public class BlockingAsyncProcedure implements AsyncProcedure, Runnable { private static final Object NO_RESULT = new Object(); private final Object key; private final ReadGraphImpl queryGraph; private final ReadGraphImpl callerGraph; + private final AsyncReadEntry entry; private final AsyncProcedure procedure; private PendingTaskSupport pendingTaskSupport; private final boolean needsToBlock; private Object result = NO_RESULT; private Throwable exception = null; - - private ReadGraphImpl queryGraph() { - return queryGraph; - } public BlockingAsyncProcedure(ReadGraphImpl callerGraph, AsyncReadEntry entry, AsyncProcedure procedure, Object key, boolean needsToBlock) { // A new graph for evaluating the query with correct parent and asyncBarrier - queryGraph = callerGraph.withParent(entry, () -> { - - dispatchProcedure(queryGraph(), callerGraph, entry, procedure, needsToBlock); - - }, needsToBlock); - + queryGraph = callerGraph.withParent(entry, this, needsToBlock); queryGraph.asyncBarrier.inc(); + + // This makes sure that caller does not quit before dispatch + callerGraph.asyncBarrier.inc(); + this.entry = entry; this.procedure = procedure; this.key = key; this.queryGraph.asyncBarrier.inc(); @@ -112,34 +109,39 @@ public class BlockingAsyncProcedure implements AsyncProcedure { return "." + procedure; } - private void dispatchProcedure(ReadGraphImpl queryGraph, ReadGraphImpl parentGraph, AsyncReadEntry entry, AsyncProcedure procedure_, boolean needsToBlock) { + @Override + public void run() { - AsyncProcedure procedure = entry != null ? entry : procedure_; + AsyncProcedure procedure__ = entry != null ? entry : procedure; - ReadGraphImpl executeGraph = parentGraph.withParent(parentGraph.parent, null, needsToBlock); + ReadGraphImpl executeGraph = callerGraph.withParent(callerGraph.parent, null, needsToBlock); executeGraph.asyncBarrier.inc(); + + // This counters the inc in the constructor + callerGraph.asyncBarrier.dec(); + try { - if(procedure != null) { - procedure.execute(executeGraph, get()); + if(procedure__ != null) { + procedure__.execute(executeGraph, get()); } } catch (DatabaseException e) { - if(procedure != null) procedure.exception(executeGraph, e); + if(procedure__ != null) procedure__.exception(executeGraph, e); exception = e; } catch (Throwable t) { DatabaseException dbe = new DatabaseException(t); - if(procedure != null) procedure.exception(executeGraph, dbe); + if(procedure__ != null) procedure__.exception(executeGraph, dbe); exception = dbe; } finally { if (entry != null) { assert(entry.isReady()); // This does not throw - entry.performFromCache(executeGraph, procedure_); + entry.performFromCache(executeGraph, procedure); } executeGraph.asyncBarrier.dec(); if(needsToBlock) - executeGraph.asyncBarrier.waitBarrier(procedure, executeGraph); + executeGraph.asyncBarrier.waitBarrier(procedure__, executeGraph); } if (BarrierTracing.BOOKKEEPING) { diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ArraySet.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ArraySet.java deleted file mode 100644 index 1360cef74..000000000 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ArraySet.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.db.impl.graph; - -import java.util.Collection; -import java.util.Iterator; -import java.util.Set; - -import org.simantics.db.Resource; -import org.simantics.db.impl.query.IntSet; -import org.simantics.db.impl.query.QuerySupport; - -public class ArraySet implements Set { - - final Resource[] set; - - ArraySet(IntSet intSet, QuerySupport support) { - - if(intSet.data == null) { - if(intSet.sizeOrData != IntSet.NO_DATA) { - set = new Resource[] { support.getResource(intSet.sizeOrData) }; - } else { - set = Resource.NONE; - } - } else { - set = new Resource[intSet.sizeOrData]; - for(int i=0;i c) { - throw new UnsupportedOperationException(); - } - - @Override - public void clear() { - throw new UnsupportedOperationException(); - } - - @Override - public boolean contains(Object o) { - for(int i=0;i c) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean isEmpty() { - return set.length == 0; - } - - @Override - public Iterator iterator() { - - class ArraySetIterator implements Iterator { - - int next = 0; - - @Override - public boolean hasNext() { - return next < set.length; - } - - @Override - public Resource next() { - return set[next++]; - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - - } - - return new ArraySetIterator(); - - } - - @Override - public boolean remove(Object o) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean removeAll(Collection c) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean retainAll(Collection c) { - throw new UnsupportedOperationException(); - } - - @Override - public int size() { - return set.length; - } - - @Override - public Object[] toArray() { - throw new UnsupportedOperationException(); - } - - @Override - public T[] toArray(T[] a) { - throw new UnsupportedOperationException(); - } - -} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/AsyncBarrierImpl.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/AsyncBarrierImpl.java index 637db3f26..f1e5b5cce 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/AsyncBarrierImpl.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/AsyncBarrierImpl.java @@ -14,13 +14,15 @@ package org.simantics.db.impl.graph; import java.util.Collection; import java.util.concurrent.atomic.AtomicInteger; -import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.RuntimeDatabaseException; import org.simantics.db.impl.query.CacheEntry; import org.simantics.db.impl.query.QueryProcessor.AsyncBarrier; +import org.slf4j.LoggerFactory; public class AsyncBarrierImpl extends AtomicInteger implements AsyncBarrier { + private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(AsyncBarrierImpl.class); + private static final long serialVersionUID = 4724463372850048672L; static final int WAIT_TIME = 60000; @@ -107,7 +109,7 @@ public class AsyncBarrierImpl extends AtomicInteger implements AsyncBarrier { } } if (count < 0) { - Logger.defaultLogError( + LOGGER.error( "Database request processing error. The application code has performed illegal actions (probably called multiple times the execute or exception method of a single result request.", new Exception()); } diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java index 48662d190..2309af764 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java @@ -50,6 +50,7 @@ import org.simantics.db.DevelopmentKeys; import org.simantics.db.ExternalValueSupport; import org.simantics.db.ReadGraph; import org.simantics.db.RelationContext; +import org.simantics.db.RelationInfo; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.Statement; @@ -188,8 +189,6 @@ import org.simantics.utils.DataContainer; import org.simantics.utils.Development; import org.simantics.utils.datastructures.Pair; import org.simantics.utils.datastructures.collections.CollectionUtils; -import org.simantics.utils.threads.logger.ITask; -import org.simantics.utils.threads.logger.ThreadLogger; import org.slf4j.LoggerFactory; import gnu.trove.map.hash.TObjectIntHashMap; @@ -1351,7 +1350,10 @@ public class ReadGraphImpl implements AsyncReadGraph { Statement stm = getSingleStatement(resource, relation); - return adaptContextual(stm.getObject(), new RelationContextImpl(resource, stm), RelationContext.class, clazz); + Object o = adaptContextual(stm.getObject(), new RelationContextImpl(resource, stm), RelationContext.class, clazz); + if (clazz.isInstance(o)) + return (T)o; + throw new AdaptionException("Returned value is not expected class , got " + o.getClass().getName()+ " , expected " + clazz.getName()); } @@ -1513,15 +1515,15 @@ public class ReadGraphImpl implements AsyncReadGraph { try { - int result = processor.getSingleObject(this, subject, relation); - if(result == 0) return null; - - return processor.querySupport.getResource(result); + int result = processor.getSingleObject(this, subject, relation); + if(result == 0) return null; + + return processor.querySupport.getResource(result); + + } catch (ManyObjectsForFunctionalRelationException e) { - } catch (ManyObjectsForFunctionalRelationException e) { + throw new ManyObjectsForFunctionalRelationException("Many objects in " + subject + " for functional relation " + relation); - throw new ManyObjectsForFunctionalRelationException("subject=" + subject + ", relation=" + relation, e); - } catch (DatabaseException e) { throw new ServiceException(e); @@ -1848,13 +1850,42 @@ public class ReadGraphImpl implements AsyncReadGraph { try { - Collection objects = getObjects(subject, relation); - return !objects.isEmpty(); + RelationInfo rinfo = processor.getRelationInfo(this, relation); + Collection predicates = getPredicates(subject); + + if (rinfo.isFinal) { + + return predicates.contains(relation); + + } else if (rinfo.isFunctional) { + + try { + return processor.getSingleObject(this, subject, relation) != 0; + } catch (ManyObjectsForFunctionalRelationException e) { + return true; + } catch (DatabaseException e) { + throw new ServiceException(e); + } + + } else { + + for (Resource predicate : getPredicates(subject)) { + if (isSubrelationOf(predicate, relation)) + return true; + } + + } + + return false; } catch (ServiceException e) { throw new ServiceException(e); + } catch (DatabaseException e) { + + throw new ServiceException(INTERNAL_ERROR_STRING, e); + } } @@ -1922,14 +1953,11 @@ public class ReadGraphImpl implements AsyncReadGraph { * Implementation of the interface RequestProcessor */ - @Override - public T syncRequest(final Read request) throws DatabaseException { - assert (request != null); - - T result = (T)QueryCache.runnerReadEntry(this, request, parent, null, null, true); - return result; - - } + @Override + public T syncRequest(final Read request) throws DatabaseException { + assert (request != null); + return (T)QueryCache.runnerReadEntry(this, request, parent, null, null, true); + } @Override public T syncRequest(Read request, SyncListener procedure) @@ -1943,16 +1971,12 @@ public class ReadGraphImpl implements AsyncReadGraph { return syncRequest(request, new NoneToAsyncListener(procedure)); } - @Override - public T syncRequest(final Read request, final AsyncProcedure procedure) throws DatabaseException { - - assert (request != null); - - ListenerBase listener = procedure != null ? getListenerBase(procedure) : null; - T result = (T)QueryCache.runnerReadEntry(this, request, parent, listener, procedure, true); - return result; - - } + @Override + public T syncRequest(final Read request, final AsyncProcedure procedure) throws DatabaseException { + assert (request != null); + ListenerBase listener = procedure != null ? getListenerBase(procedure) : null; + return (T)QueryCache.runnerReadEntry(this, request, parent, listener, procedure, true); + } @Override public T syncRequest(final Read request, @@ -2028,17 +2052,13 @@ public class ReadGraphImpl implements AsyncReadGraph { return syncRequest(request, new NoneToAsyncListener(procedure)); } - @Override - final public T syncRequest(final AsyncRead request, - final AsyncProcedure procedure) throws DatabaseException { - - assert (request != null); - - ListenerBase listener = getListenerBase(procedure); - T result = (T)QueryCache.runnerAsyncReadEntry(this, request, parent, listener, procedure, true); - return result; - - } + @Override + final public T syncRequest(final AsyncRead request, + final AsyncProcedure procedure) throws DatabaseException { + assert (request != null); + ListenerBase listener = getListenerBase(procedure); + return (T)QueryCache.runnerAsyncReadEntry(this, request, parent, listener, procedure, true); + } @Override public T syncRequest(AsyncRead request, @@ -5235,54 +5255,55 @@ public class ReadGraphImpl implements AsyncReadGraph { asyncRequest(request, new NoneToAsyncListener(procedure)); } - @Override - final public void asyncRequest(final AsyncRead request, - final AsyncProcedure procedure) { + @Override + final public void asyncRequest(final AsyncRead request, + final AsyncProcedure procedure) { - assert (request != null); - assert (procedure != null); + assert (request != null); + assert (procedure != null); AsyncBarrierImpl barrier = asyncBarrier; if(barrier != null) barrier.inc(); - processor.scheduleNow(new SessionTask(this) { + processor.scheduleNow(new SessionTask(this) { - @Override - public void run0(int thread) { + @Override + public void run0(int thread) { - if(barrier != null) - barrier.inc(); + if(barrier != null) + barrier.inc(); - try { - final ListenerBase listener = getListenerBase(procedure); - QueryCache.runnerAsyncReadEntry(ReadGraphImpl.this, request, parent, listener, new AsyncProcedure() { + try { + final ListenerBase listener = getListenerBase(procedure); + QueryCache.runnerAsyncReadEntry(ReadGraphImpl.this, request, parent, listener, new AsyncProcedure() { - @Override - public void execute(AsyncReadGraph graph, T result) { - procedure.execute(graph, result); - if(barrier != null) - barrier.dec(); - } + @Override + public void execute(AsyncReadGraph graph, T result) { + procedure.execute(graph, result); + if(barrier != null) + barrier.dec(); + } - @Override - public void exception(AsyncReadGraph graph, Throwable throwable) { - procedure.exception(graph, throwable); + @Override + public void exception(AsyncReadGraph graph, Throwable throwable) { + procedure.exception(graph, throwable); if(barrier != null) barrier.dec(); - } - - }, false); - if(barrier != null) - barrier.dec(); - } catch (DatabaseException e) { - Logger.defaultLogError(e); - } - } - - }); + } + + }, false); + } catch (DatabaseException e) { + LOGGER.error("Error while executing async request", e); + } finally { + if(barrier != null) + barrier.dec(); + } + } - } + }); + + } @Override public void asyncRequest(AsyncRead request, @@ -6399,4 +6420,10 @@ public class ReadGraphImpl implements AsyncReadGraph { else return getTopLevelGraphStatic(impl.parentGraph); } + @SuppressWarnings("unchecked") + @Override + public T l0() { + return (T) processor.getL0(); + } + } diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/WriteGraphImpl.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/WriteGraphImpl.java index 0c4e68138..8cb1688fb 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/WriteGraphImpl.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/WriteGraphImpl.java @@ -14,10 +14,13 @@ package org.simantics.db.impl.graph; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; +import java.util.IdentityHashMap; +import java.util.Map; import java.util.TreeMap; import java.util.function.Consumer; import org.simantics.databoard.Bindings; +import org.simantics.databoard.Datatypes; import org.simantics.databoard.accessor.Accessor; import org.simantics.databoard.binding.Binding; import org.simantics.databoard.binding.error.BindingConstructionException; @@ -31,7 +34,16 @@ import org.simantics.databoard.primitives.MutableLong; import org.simantics.databoard.primitives.MutableString; import org.simantics.databoard.serialization.SerializationException; import org.simantics.databoard.serialization.Serializer; +import org.simantics.databoard.type.ArrayType; +import org.simantics.databoard.type.BooleanType; +import org.simantics.databoard.type.ByteType; import org.simantics.databoard.type.Datatype; +import org.simantics.databoard.type.DoubleType; +import org.simantics.databoard.type.FloatType; +import org.simantics.databoard.type.IntegerType; +import org.simantics.databoard.type.LongType; +import org.simantics.databoard.type.StringType; +import org.simantics.databoard.type.VariantType; import org.simantics.databoard.util.binary.RandomAccessBinary; import org.simantics.db.DevelopmentKeys; import org.simantics.db.ExternalValueSupport; @@ -69,8 +81,6 @@ import org.simantics.layer0.Layer0; import org.simantics.utils.Development; import org.simantics.utils.datastructures.Pair; -import gnu.trove.map.hash.THashMap; - final public class WriteGraphImpl extends ReadGraphImpl implements WriteGraph { @@ -683,7 +693,7 @@ final public class WriteGraphImpl extends ReadGraphImpl implements WriteGraph { } - THashMap, Resource> builtinValues = new THashMap, Resource>(32); + Map builtinValues = new IdentityHashMap<>(40); private void initBuiltinValues(Layer0 b) { @@ -714,6 +724,76 @@ final public class WriteGraphImpl extends ReadGraphImpl implements WriteGraph { builtinValues.put(MutableByte.class, b.Byte); builtinValues.put(MutableBoolean.class, b.Boolean); + builtinValues.put(Datatypes.DOUBLE, b.Double); + builtinValues.put(Datatypes.STRING, b.String); + builtinValues.put(Datatypes.INTEGER, b.Integer); + builtinValues.put(Datatypes.LONG, b.Long); + builtinValues.put(Datatypes.FLOAT, b.Float); + builtinValues.put(Datatypes.BYTE, b.Byte); + builtinValues.put(Datatypes.BOOLEAN, b.Boolean); + builtinValues.put(Datatypes.VARIANT, b.Variant); + + builtinValues.put(Datatypes.DOUBLE_ARRAY, b.DoubleArray); + builtinValues.put(Datatypes.STRING_ARRAY, b.StringArray); + builtinValues.put(Datatypes.INTEGER_ARRAY, b.IntegerArray); + builtinValues.put(Datatypes.LONG_ARRAY, b.LongArray); + builtinValues.put(Datatypes.FLOAT_ARRAY, b.FloatArray); + builtinValues.put(Datatypes.BYTE_ARRAY, b.ByteArray); + builtinValues.put(Datatypes.BOOLEAN_ARRAY, b.BooleanArray); + builtinValues.put(Datatypes.VARIANT_ARRAY, b.VariantArray); + } + + private static Datatype canonicalizeToBuiltinDatatype(Datatype datatype) { + if (datatype instanceof ArrayType) { + ArrayType at = (ArrayType) datatype; + datatype = at.componentType(); + if (datatype instanceof ByteType) { + return Datatypes.BYTE_ARRAY; + } else if (datatype instanceof DoubleType) { + return Datatypes.DOUBLE_ARRAY; + } else if (datatype instanceof FloatType) { + return Datatypes.FLOAT_ARRAY; + } else if (datatype instanceof IntegerType) { + return Datatypes.INTEGER_ARRAY; + } else if (datatype instanceof LongType) { + return Datatypes.LONG_ARRAY; + } else if (datatype instanceof BooleanType) { + return Datatypes.BOOLEAN_ARRAY; + } else if (datatype instanceof StringType) { + return Datatypes.STRING_ARRAY; + } else if (datatype instanceof VariantType) { + return Datatypes.VARIANT_ARRAY; + } + return null; + } + if (datatype instanceof ByteType) { + return Datatypes.BYTE; + } else if (datatype instanceof DoubleType) { + return Datatypes.DOUBLE; + } else if (datatype instanceof FloatType) { + return Datatypes.FLOAT; + } else if (datatype instanceof IntegerType) { + return Datatypes.INTEGER; + } else if (datatype instanceof LongType) { + return Datatypes.LONG; + } else if (datatype instanceof BooleanType) { + return Datatypes.BOOLEAN; + } else if (datatype instanceof StringType) { + return Datatypes.STRING; + } else if (datatype instanceof VariantType) { + return Datatypes.VARIANT; + } + return null; + } + + private Resource resolveBuiltinResourceType(Class valueClass, Datatype datatype) { + Resource type = builtinValues.get(valueClass); + return type != null ? type : builtinValues.get(datatype); + } + + private Resource resolveBuiltinResourceTypeByCanonicalizedDatatype(Datatype datatype, Resource defaultResult) { + Datatype cdt = canonicalizeToBuiltinDatatype(datatype); + return cdt != null ? builtinValues.get(cdt) : defaultResult; } @Override @@ -734,13 +814,13 @@ final public class WriteGraphImpl extends ReadGraphImpl implements WriteGraph { initBuiltinValues(b); Resource literal = newResource(); - Class clazz = value.getClass(); - Resource type = builtinValues.get(clazz); + Datatype dt = binding.type(); + Resource type = resolveBuiltinResourceType(value.getClass(), dt); if (type == null) { - type = b.Literal; + type = resolveBuiltinResourceTypeByCanonicalizedDatatype(dt, b.Literal); Resource dataType = newResource(); claim(dataType, b.InstanceOf, null, b.DataType); - claimValue(dataType, binding.type(), DATA_TYPE_BINDING); + claimValue(dataType, dt, DATA_TYPE_BINDING); claim(literal, b.HasDataType, b.HasDataType_Inverse, dataType); } @@ -805,14 +885,14 @@ final public class WriteGraphImpl extends ReadGraphImpl implements WriteGraph { } else { - Class clazz = value.getClass(); - Resource type = builtinValues.get(clazz); Resource literal = newResource(); + Datatype dt = binding.type(); + Resource type = resolveBuiltinResourceType(value.getClass(), dt); if (type == null) { - type = b.Literal; + type = resolveBuiltinResourceTypeByCanonicalizedDatatype(dt, b.Literal); Resource dataType = newResource(); claim(dataType, b.InstanceOf, null, b.DataType); - claimValue(dataType, binding.type(), DATA_TYPE_BINDING); + claimValue(dataType, dt, DATA_TYPE_BINDING); claim(literal, b.HasDataType, null, dataType); } claim(literal, b.InstanceOf, null, type); diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/AssertedPredicates.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/AssertedPredicates.java index b4104e965..23fbe95ec 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/AssertedPredicates.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/AssertedPredicates.java @@ -241,5 +241,11 @@ final public class AssertedPredicates extends UnaryQuery { }); } - + + @Override + public void serializeValue(QuerySerializer serializer) { + IntArray is = getResult(); + is.serialize(serializer); + } + } diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/AssertedPredicatesFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/AssertedPredicatesFactory.java new file mode 100644 index 000000000..c76bc51ee --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/AssertedPredicatesFactory.java @@ -0,0 +1,21 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; + +public class AssertedPredicatesFactory extends QueryFactoryBase { + + @Override + public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException { + AssertedPredicates result = reference(deserializer); + IntArray ia = IntArray.deserialize(deserializer); + result.setResult(ia); + result.setReady(); + return result; + } + + @Override + public T reference(QueryDeserializer deserializer) throws DatabaseException { + return (T)deserializer.readAssertedPredicates(); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/AssertedStatementsFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/AssertedStatementsFactory.java new file mode 100644 index 000000000..708ce6686 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/AssertedStatementsFactory.java @@ -0,0 +1,21 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; + +public class AssertedStatementsFactory extends QueryFactoryBase { + + @Override + public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException { + AssertedStatements result = reference(deserializer); + IntArray ia = IntArray.deserialize(deserializer); + result.setResult(ia); + result.setReady(); + return result; + } + + @Override + public T reference(QueryDeserializer deserializer) throws DatabaseException { + return (T)deserializer.readAssertedStatements(); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/AsyncMultiReadEntry.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/AsyncMultiReadEntry.java index ea88d1791..788044807 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/AsyncMultiReadEntry.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/AsyncMultiReadEntry.java @@ -190,4 +190,9 @@ final public class AsyncMultiReadEntry extends CacheEntryBase extends CacheEntryBase> i } } + @Override + public String classId() { + return null; + } + } diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/BinaryQuery.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/BinaryQuery.java index d699ea825..04df0d00c 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/BinaryQuery.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/BinaryQuery.java @@ -66,4 +66,15 @@ public abstract class BinaryQuery extends CacheEntryBase i abstract public void removeEntry(QueryProcessor provider); + @Override + public long cluster(QueryProcessor processor) { + return processor.cluster(r1()); + } + + @Override + public void serializeKey(QuerySerializer serializer) { + serializer.addResource(r1()); + serializer.addResource(r2()); + } + } diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CacheEntry.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CacheEntry.java index 1cdcbde9d..a650f32ce 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CacheEntry.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CacheEntry.java @@ -11,6 +11,8 @@ *******************************************************************************/ package org.simantics.db.impl.query; +import java.util.Collection; + import org.simantics.db.exception.DatabaseException; import org.simantics.db.impl.graph.ReadGraphImpl; @@ -40,10 +42,11 @@ public abstract class CacheEntry { abstract Query getQuery(); abstract CacheEntry pruneFirstParents(); + abstract void pruneParentSet(); abstract void removeParent(CacheEntry entry); abstract void addParent(CacheEntry entry); abstract boolean hasParents(); - abstract Iterable> getParents(QueryProcessor processor); + abstract Collection> getParents(QueryProcessor processor); abstract CacheEntry getFirstParent(QueryProcessor processor); abstract boolean moreThanOneParent(QueryProcessor processor); abstract int parentCount(QueryProcessor processor); diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CacheEntryBase.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CacheEntryBase.java index e79f99dea..98e7f0d00 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CacheEntryBase.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CacheEntryBase.java @@ -12,6 +12,7 @@ package org.simantics.db.impl.query; import java.util.ArrayList; +import java.util.Collection; import java.util.Iterator; import org.simantics.databoard.Bindings; @@ -277,7 +278,31 @@ public abstract class CacheEntryBase extends CacheEntry { } } - + + @Override + void pruneParentSet() { + // First parent is discarded => look for more parents + if(p2OrParents instanceof QueryIdentityHashSet) { + + QueryIdentityHashSet set = (QueryIdentityHashSet)p2OrParents; + set.removeDiscardedReally(); + if(set.isEmpty()) p2OrParents = null; + + } else if(p2OrParents instanceof CacheEntry) { + + CacheEntry entry = (CacheEntry)p2OrParents; + if(entry.isDiscarded()) { + // Second entry is also discarded => all empty + p2OrParents = null; + } + + } else { + + // Nothing left + + } + } + @Override final public void removeParent(CacheEntry entry) { @@ -339,7 +364,7 @@ public abstract class CacheEntryBase extends CacheEntry { } @Override - final public Iterable> getParents(QueryProcessor processor) { + final public Collection> getParents(QueryProcessor processor) { ArrayList> result = new ArrayList>(); if(p1 != null) result.add(p1); @@ -471,5 +496,44 @@ public abstract class CacheEntryBase extends CacheEntry { public CacheEntryBase() { } + + public String classId() { + return getClass().getName(); + } + + public void serializeKey(QuerySerializer serializer) { + throw new IllegalStateException("Cannot serialize query key for " + this); + } + + public void serializeValue(QuerySerializer serializer) { + throw new IllegalStateException("Cannot serialize query value for " + this); + } + + public void serializeParents(QuerySerializer serializer) { + Collection> ps = getParents(serializer.getQueryProcessor()); + int sizePos = serializer.writeUnknownSize(); + int actual = 0; + for(CacheEntry entry : ps) { + CacheEntryBase b = (CacheEntryBase)entry; + String cid = b.classId(); + if(cid == null) + continue; + serializer.serializeId(b.classId()); + b.serializeKey(serializer); + actual++; + } + serializer.setUnknownSize(sizePos, actual); + } + + public long cluster(QueryProcessor processor) { + throw new IllegalStateException("Cannot compute query cluster for " + this); + } + + public void serialize(QuerySerializer serializer) { + serializer.serializeId(classId()); + serializeKey(serializer); + serializeValue(serializer); + serializeParents(serializer); + } } diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ChildMap.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ChildMap.java index 8effbb1d5..79d3106a8 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ChildMap.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ChildMap.java @@ -142,6 +142,16 @@ public final class ChildMap extends UnaryQueryP> { } + @Override + public void serializeValue(QuerySerializer serializer) { + ObjectResourceIdMap is = getResult(); + serializer.writeLE(is.size()); + for(String s : is.keySet()) { + serializer.addString(s); + serializer.addResource(is.getId(s)); + } + } + @Override public String toString() { return "ChildMap[" + id + "]"; diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ChildMapFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ChildMapFactory.java new file mode 100644 index 000000000..bf179b523 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ChildMapFactory.java @@ -0,0 +1,28 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.ObjectResourceIdMap; +import org.simantics.db.exception.DatabaseException; + +public class ChildMapFactory extends QueryFactoryBase { + + @Override + public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException { + ChildMap result = reference(deserializer); + ObjectResourceIdMap map = deserializer.createChildMap(); + int size = deserializer.readLE4(); + for(int i=0;i T reference(QueryDeserializer deserializer) throws DatabaseException { + return (T)deserializer.readChildMap(); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CollectionBinaryQuery.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CollectionBinaryQuery.java index cd139655c..6e1692ba4 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CollectionBinaryQuery.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CollectionBinaryQuery.java @@ -11,9 +11,6 @@ *******************************************************************************/ package org.simantics.db.impl.query; - - - abstract public class CollectionBinaryQuery extends BinaryQuery { public CollectionBinaryQuery(final int r1, final int r2) { @@ -33,5 +30,11 @@ abstract public class CollectionBinaryQuery extends BinaryQuery { if(size == 0) setResult(IntArray.EMPTY); else v.trim(); } - + + @Override + public void serializeValue(QuerySerializer serializer) { + IntArray is = getResult(); + is.serialize(serializer); + } + } diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CollectionUnaryQuery.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CollectionUnaryQuery.java index 90bb03554..2eaeca472 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CollectionUnaryQuery.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CollectionUnaryQuery.java @@ -96,4 +96,10 @@ public abstract class CollectionUnaryQuery extends UnaryQuery impl except(throwable); } + @Override + public void serializeValue(QuerySerializer serializer) { + IntArray is = getResult(); + is.serialize(serializer); + } + } diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/DirectObjectsFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/DirectObjectsFactory.java new file mode 100644 index 000000000..323ec2134 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/DirectObjectsFactory.java @@ -0,0 +1,21 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; + +public class DirectObjectsFactory extends QueryFactoryBase { + + @Override + public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException { + DirectObjects result = reference(deserializer); + IntArray ia = IntArray.deserialize(deserializer); + result.setResult(ia); + result.setReady(); + return result; + } + + @Override + public T reference(QueryDeserializer deserializer) throws DatabaseException { + return (T)deserializer.readDirectObjects(); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/DirectPredicates.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/DirectPredicates.java index 1a006369a..ee0faa1cf 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/DirectPredicates.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/DirectPredicates.java @@ -16,7 +16,7 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.impl.graph.ReadGraphImpl; import org.simantics.db.impl.procedure.InternalProcedure; -public final class DirectPredicates extends UnaryQueryP { +public final class DirectPredicates extends UnaryQueryPIntSet { DirectPredicates(final int resource) { super(resource); diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/DirectPredicatesFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/DirectPredicatesFactory.java new file mode 100644 index 000000000..e707e62e7 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/DirectPredicatesFactory.java @@ -0,0 +1,21 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; + +public class DirectPredicatesFactory extends QueryFactoryBase { + + @Override + public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException { + DirectPredicates result = reference(deserializer); + IntSet is = IntSet.deserialize(deserializer); + result.setResult(is); + result.setReady(); + return result; + } + + @Override + public T reference(QueryDeserializer deserializer) throws DatabaseException { + return (T)deserializer.readDirectPredicates(); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ExternalReadEntry.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ExternalReadEntry.java index d04404339..2980b9b15 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ExternalReadEntry.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ExternalReadEntry.java @@ -28,7 +28,7 @@ final public class ExternalReadEntry extends CacheEntryBase final LinkedList items = new LinkedList(); protected ExternalRead id; - protected ReadGraphImpl graph; + protected QueryProcessor processor; protected boolean registered = false; @Override @@ -49,7 +49,7 @@ final public class ExternalReadEntry extends CacheEntryBase public void discard() { id.unregistered(); id = null; - graph = null; + processor = null; super.discard(); } @@ -65,7 +65,7 @@ final public class ExternalReadEntry extends CacheEntryBase public ExternalReadEntry(ExternalRead request, ReadGraphImpl graph) { assert request != null; this.id = request; - this.graph = graph; + this.processor = graph.processor; } @Override @@ -213,7 +213,7 @@ final public class ExternalReadEntry extends CacheEntryBase synchronized(items) { items.addLast(result); - graph.processor.updatePrimitive(id); + processor.updatePrimitive(id); // TODO: implement flags/logic in ExternalRead to state that all but the latest request result can be evaporated // In some cases where data is produced really fast this might be necessary but currently this queueing will do. } @@ -229,7 +229,12 @@ final public class ExternalReadEntry extends CacheEntryBase @Override public boolean isDisposed() { - return registered && (isDiscarded() || !graph.processor.isBound(this)); + return registered && (isDiscarded() || !processor.isBound(this)); } - + + @Override + public String classId() { + return null; + } + } diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/IntArray.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/IntArray.java index 6ee30ad70..53b447f08 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/IntArray.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/IntArray.java @@ -13,6 +13,8 @@ package org.simantics.db.impl.query; import java.util.Arrays; +import org.simantics.db.exception.DatabaseException; + final public class IntArray { @@ -111,7 +113,27 @@ final public class IntArray { } return result; } - + + public void serialize(QuerySerializer serializer) { + int size = size(); + serializer.writeLE(size); + if(size == 1) { + serializer.addResource(sizeOrData); + } else { + for(int i=0;i implements IntProcedure { - public Objects(final int r1, final int r2) { - super(r1, r2); - } - - @Override - final public void removeEntry(QueryProcessor provider) { - provider.cache.remove(this); - } - - final static private IntArray getAssertionMap(ReadGraphImpl graph, final int r1, final int r2, final Objects entry) throws DatabaseException { - - class AssertionMapProc implements IntProcedure { - - boolean first = true; - - private IntArray result; - - public void addStatement(int s, int p, int o) { - - if(result.size() == 0) { - result.add(s); - result.add(p); - result.add(o); - } else { - for(int i = 0;i < result.sizeOrData ; i+=3) { - int existingP = result.data[i+1]; - if(p == existingP) { - int existingO = result.data[i+2]; - if(existingO == o) return; - } - } - result.add(s); - result.add(p); - result.add(o); - } - - } - - @Override - public void execute(ReadGraphImpl graph, int type) throws DatabaseException { - if(result == null) { - result = QueryCacheBase.resultAssertedStatements(graph, type, r2, entry, null); - } else { - if (first) { - IntArray ia = result; - result = new IntArray(); - if(ia.data != null) { - for(int i = 0;i < ia.sizeOrData ; i+=3) addStatement(ia.data[i],ia.data[i+1],ia.data[i+2]); - } - first = false; - } - IntArray ia = QueryCacheBase.resultAssertedStatements(graph, type, r2, entry, null); - if(ia.data != null) { - for(int i = 0;i < ia.sizeOrData ; i+=3) addStatement(ia.data[i],ia.data[i+1],ia.data[i+2]); - } - } - } + public Objects(final int r1, final int r2) { + super(r1, r2); + } - @Override - public void finished(ReadGraphImpl graph) { - } + @Override + final public void removeEntry(QueryProcessor provider) { + provider.cache.remove(this); + } - @Override - public void exception(ReadGraphImpl graph, Throwable throwable) { - } + final static private IntArray getAssertionMap(ReadGraphImpl graph, final int r1, final int r2, final Objects entry) throws DatabaseException { + + class AssertionMapProc implements IntProcedure { + + boolean first = true; + + private IntArray result; + + public void addStatement(int s, int p, int o) { + + if(result.size() == 0) { + result.add(s); + result.add(p); + result.add(o); + } else { + for(int i = 0;i < result.sizeOrData ; i+=3) { + int existingP = result.data[i+1]; + if(p == existingP) { + int existingO = result.data[i+2]; + if(existingO == o) return; + } + } + result.add(s); + result.add(p); + result.add(o); + } + + } + + @Override + public void execute(ReadGraphImpl graph, int type) throws DatabaseException { + if(result == null) { + result = QueryCacheBase.resultAssertedStatements(graph, type, r2, entry, null); + } else { + if (first) { + IntArray ia = result; + result = new IntArray(); + if(ia.data != null) { + for(int i = 0;i < ia.sizeOrData ; i+=3) addStatement(ia.data[i],ia.data[i+1],ia.data[i+2]); + } + first = false; + } + IntArray ia = QueryCacheBase.resultAssertedStatements(graph, type, r2, entry, null); + if(ia.data != null) { + for(int i = 0;i < ia.sizeOrData ; i+=3) addStatement(ia.data[i],ia.data[i+1],ia.data[i+2]); + } + } + } + + @Override + public void finished(ReadGraphImpl graph) { + } + + @Override + public void exception(ReadGraphImpl graph, Throwable throwable) { + } - } + } - AssertionMapProc amp = new AssertionMapProc(); + AssertionMapProc amp = new AssertionMapProc(); - // This dependency could be cut - QueryCache.runnerPrincipalTypes(graph, r1, entry, null, amp); + // This dependency could be cut + QueryCache.runnerPrincipalTypes(graph, r1, entry, null, amp); - return amp.result; + return amp.result; - } + } - final static private void forSingleAssertion(ReadGraphImpl graph, final int r1, final int r2, final Objects parent, final IntProcedure procedure) throws DatabaseException { + final static private void forSingleAssertion(ReadGraphImpl graph, final int r1, final int r2, final Objects parent, final IntProcedure procedure) throws DatabaseException { - IntArray map = getAssertionMap(graph, r1, r2, parent); - if(map == null) { - procedure.finished(graph); - return; - } + IntArray map = getAssertionMap(graph, r1, r2, parent); + if(map == null) { + procedure.finished(graph); + return; + } - int size = map.size(); - if(size == 3) { - int value = map.data[2]; - procedure.execute(graph, value); - procedure.finished(graph); - } else if(size == 0) { - procedure.finished(graph); - } else { + int size = map.size(); + if(size == 3) { + int value = map.data[2]; + procedure.execute(graph, value); + procedure.finished(graph); + } else if(size == 0) { + procedure.finished(graph); + } else { - int candidateS = map.data[0]; - int candidateO = map.data[2]; + int candidateS = map.data[0]; + int candidateO = map.data[2]; - IntSet candidateIs = null; - try { - candidateIs = QueryCache.resultSuperTypes(graph, candidateS, parent, null); - } catch (DatabaseException e) { - procedure.exception(graph, e); - return; - } + IntSet candidateIs = null; + try { + candidateIs = QueryCache.resultSuperTypes(graph, candidateS, parent, null); + } catch (DatabaseException e) { + procedure.exception(graph, e); + return; + } - for(int i=3;i ignore next + // Next is a super type of candidate => ignore next - } else { + } else { - IntSet nextIs = null; - try { - nextIs = QueryCache.resultSuperTypes(graph, nextS, parent, null); - } catch (DatabaseException e) { - procedure.exception(graph, e); - return; - } + IntSet nextIs = null; + try { + nextIs = QueryCache.resultSuperTypes(graph, nextS, parent, null); + } catch (DatabaseException e) { + procedure.exception(graph, e); + return; + } - if(nextIs.contains(candidateS)) { + if(nextIs.contains(candidateS)) { - // Candidate is a super type of next => next is the new candidate + // Candidate is a super type of next => next is the new candidate - candidateS = nextS; - candidateO = nextO; - candidateIs = nextIs; + candidateS = nextS; + candidateO = nextO; + candidateIs = nextIs; - } else { + } else { - // candidate and next are unrelated => error - ManyObjectsForFunctionalRelationException exception = new ManyObjectsForFunctionalRelationException("Functional relation has conflicting assertions " + r1 + ", " + r2 + " " + map , r1); - procedure.exception(graph, exception); - return; + // candidate and next are unrelated => error + ManyObjectsForFunctionalRelationException exception = new ManyObjectsForFunctionalRelationException("Functional relation has conflicting assertions " + r1 + ", " + r2 + " " + map , r1); + procedure.exception(graph, exception); + return; - } + } - } + } - } + } - } + } - procedure.execute(graph, candidateO); - procedure.finished(graph); + procedure.execute(graph, candidateO); + procedure.finished(graph); - } + } - } + } - final static InternalProcedure NOP = new InternalProcedure() { + final static InternalProcedure NOP = new InternalProcedure() { - @Override - public void execute(ReadGraphImpl graph, IntSet result) { - } + @Override + public void execute(ReadGraphImpl graph, IntSet result) { + } - @Override - public void exception(ReadGraphImpl graph, Throwable throwable) { - } + @Override + public void exception(ReadGraphImpl graph, Throwable throwable) { + } - }; + }; - final static TripleIntProcedure NOPT = new TripleIntProcedure() { + final static TripleIntProcedure NOPT = new TripleIntProcedure() { - @Override - public void exception(ReadGraphImpl graph, Throwable throwable) { - } + @Override + public void exception(ReadGraphImpl graph, Throwable throwable) { + } - @Override - public void execute(ReadGraphImpl graph, int s, int p, int o) { - } + @Override + public void execute(ReadGraphImpl graph, int s, int p, int o) { + } - @Override - public void finished(ReadGraphImpl graph) { - } + @Override + public void finished(ReadGraphImpl graph) { + } - }; + }; - // Search for one statement - final public void computeFunctionalIndex(ReadGraphImpl graph, final QueryProcessor provider, final RelationInfo ri, final IntProcedure procedure) throws DatabaseException { - computeFunctionalIndex(graph, r1(), r2(), this, ri, procedure); - } + // Search for one statement + final public void computeFunctionalIndex(ReadGraphImpl graph, final QueryProcessor provider, final RelationInfo ri, final IntProcedure procedure) throws DatabaseException { + computeFunctionalIndex(graph, r1(), r2(), this, ri, procedure); + } - // Search for one statement - final static public void computeFunctionalIndex(ReadGraphImpl graph, final int r1, final int r2, final Objects parent, final RelationInfo ri, final IntProcedure procedure) throws DatabaseException { + // Search for one statement + final static public void computeFunctionalIndex(ReadGraphImpl graph, final int r1, final int r2, final Objects parent, final RelationInfo ri, final IntProcedure procedure) throws DatabaseException { - if(ri.isFinal) { + if(ri.isFinal) { - int result = graph.processor.querySupport.getFunctionalObject(r1, r2); + int result = graph.processor.querySupport.getFunctionalObject(r1, r2); - if(result == 0) { + if(result == 0) { - // Check for assertions - forSingleAssertion(graph, r1, r2, parent, procedure); + // Check for assertions + forSingleAssertion(graph, r1, r2, parent, procedure); - } else if (result == -1) { + } else if (result == -1) { - graph.processor.querySupport.getObjects(graph, r1, r2, new IntProcedure() { + graph.processor.querySupport.getObjects(graph, r1, r2, new IntProcedure() { - @Override - public void execute(ReadGraphImpl graph, int i) throws DatabaseException { - procedure.execute(graph, i); - } + @Override + public void execute(ReadGraphImpl graph, int i) throws DatabaseException { + procedure.execute(graph, i); + } - @Override - public void exception(ReadGraphImpl graph, Throwable t) { - if(DebugException.DEBUG) new DebugException(t).printStackTrace(); - } + @Override + public void exception(ReadGraphImpl graph, Throwable t) { + if(DebugException.DEBUG) new DebugException(t).printStackTrace(); + } - @Override - public void finished(ReadGraphImpl graph) { - } + @Override + public void finished(ReadGraphImpl graph) { + } - }); + }); - // Check for assertions - forSingleAssertion(graph, r1, r2, parent, procedure); + // Check for assertions + forSingleAssertion(graph, r1, r2, parent, procedure); - } else { + } else { - // If functional relation was found there is no need to check assertions + // If functional relation was found there is no need to check assertions procedure.execute(graph, result); procedure.finished(graph); - - } + } - } else { + } else { - // Note! The dependency is intentionally cut! + // Note! The dependency is intentionally cut! IntSet direct = QueryCache.resultDirectPredicates(graph, r1, null, null); direct.forEach(graph, new SyncIntProcedure() { - boolean found = false; - - @Override - public void run(ReadGraphImpl graph) throws DatabaseException { - - if(found) { - procedure.finished(graph); - } else { - - // Check for assertions - forSingleAssertion(graph, r1, r2, parent, procedure); + /* + * 0 = not found + * 1 = found + * 2 = exception + */ + int found = 0; - } + @Override + public void run(ReadGraphImpl graph) throws DatabaseException { - } + if(found == 1) { - @Override - public void execute(ReadGraphImpl graph, final int pred) throws DatabaseException { + procedure.finished(graph); - if(found) return; + } else if(found == 0) { - if(pred == r2) { + // Check for assertions + forSingleAssertion(graph, r1, r2, parent, procedure); - // Note! The dependency is intentionally cut! - QueryCache.runnerDirectObjects(graph, r1, pred, null, null, new IntProcedure() { + } - @Override - public void execute(ReadGraphImpl graph, int i) throws DatabaseException { + } - if(!found) { + @Override + public void execute(ReadGraphImpl graph, final int pred) throws DatabaseException { - procedure.execute(graph, i); - found = true; + if(found > 0) + return; - } else { + if(pred == r2) { - ManyObjectsForFunctionalRelationException exception = new ManyObjectsForFunctionalRelationException("Functional relation has more than one statement (r1=" + r1 + ", r2=" + r2 + ").", r1); - procedure.exception(graph, exception); + // Note! The dependency is intentionally cut! + QueryCache.runnerDirectObjects(graph, r1, pred, null, null, new IntProcedure() { - } + @Override + public void execute(ReadGraphImpl graph, int i) throws DatabaseException { - } + if(found == 0) { - @Override - public void finished(ReadGraphImpl graph) { - } + procedure.execute(graph, i); + found = 1; - @Override - public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { - procedure.exception(graph, t); - } + } else { - }); + ManyObjectsForFunctionalRelationException exception = new ManyObjectsForFunctionalRelationException("Functional relation has more than one statement (r1=" + r1 + ", r2=" + r2 + ").", r1); + procedure.exception(graph, exception); + found = 2; - } else { + } - QueryCache.runnerSuperRelations(graph, pred, parent, null, new InternalProcedure() { + } - @Override - public void execute(ReadGraphImpl graph, IntSet result) throws DatabaseException { + @Override + public void finished(ReadGraphImpl graph) { + } - if(found) return; + @Override + public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { - if(result.contains(r2)) { + procedure.exception(graph, t); + found = 2; - // Note! The dependency is intentionally cut! - QueryCache.runnerDirectObjects(graph, r1, pred, null, null, new IntProcedure() { + } - @Override - public void execute(ReadGraphImpl graph, int i) throws DatabaseException { + }); - if(!found) { + } else { - procedure.execute(graph, i); - found = true; + QueryCache.runnerSuperRelations(graph, pred, parent, null, new InternalProcedure() { - } else { + @Override + public void execute(ReadGraphImpl graph, IntSet result) throws DatabaseException { - ManyObjectsForFunctionalRelationException exception = new ManyObjectsForFunctionalRelationException("Functional relation has more than one statement (r1=" + r1 + ", r2=" + r2 + ").", r1); - procedure.exception(graph, exception); + if(found > 0) + return; - } + if(result.contains(r2)) { - } + // Note! The dependency is intentionally cut! + QueryCache.runnerDirectObjects(graph, r1, pred, null, null, new IntProcedure() { - @Override - public void finished(ReadGraphImpl graph) { - } + @Override + public void execute(ReadGraphImpl graph, int i) throws DatabaseException { - @Override - public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { - procedure.exception(graph, t); - } + if(found == 0) { - }); + procedure.execute(graph, i); + found = 1; - } + } else { - } + ManyObjectsForFunctionalRelationException exception = new ManyObjectsForFunctionalRelationException("Functional relation has more than one statement (r1=" + r1 + ", r2=" + r2 + ").", r1); + procedure.exception(graph, exception); + found = 2; - @Override - public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { - procedure.exception(graph, t); - } + } - }); + } - } + @Override + public void finished(ReadGraphImpl graph) { + } - } + @Override + public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { + procedure.exception(graph, t); + found = 2; + } - @Override - public void finished(ReadGraphImpl graph) throws DatabaseException { + }); - dec(graph); + } - } + } - }); + @Override + public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { + procedure.exception(graph, t); + found = 2; + } + }); - } + } - } + } - final static private void forAssertions(ReadGraphImpl graph, final int r1, final int r2, final Objects parent, final IntProcedure procedure) throws DatabaseException { + @Override + public void finished(ReadGraphImpl graph) throws DatabaseException { + dec(graph); + } - // Note! The dependency is intentionally cut! - QueryCache.runnerPrincipalTypes(graph, r1, null, null, new SyncIntProcedure() { + }); - @Override - public void run(ReadGraphImpl graph) throws DatabaseException { - procedure.finished(graph); - } - TripleIntProcedure proc = new TripleIntProcedure() { + } - @Override - public void execute(ReadGraphImpl graph, int s, int p, int o) throws DatabaseException { - procedure.execute(graph, o); - } + } - @Override - public void finished(ReadGraphImpl graph) throws DatabaseException { - dec(graph); - } + final static private void forAssertions(ReadGraphImpl graph, final int r1, final int r2, final Objects parent, final IntProcedure procedure) throws DatabaseException { - @Override - public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { - if(DebugException.DEBUG) new DebugException(t).printStackTrace(); - procedure.exception(graph, t); - dec(graph); - } + // Note! The dependency is intentionally cut! + QueryCache.runnerPrincipalTypes(graph, r1, null, null, new SyncIntProcedure() { - }; + @Override + public void run(ReadGraphImpl graph) throws DatabaseException { + procedure.finished(graph); + } - @Override - public void execute(ReadGraphImpl graph, int type) throws DatabaseException { + TripleIntProcedure proc = new TripleIntProcedure() { - inc(); - QueryCache.runnerAssertedStatements(graph, type, r2, parent, null, proc); + @Override + public void execute(ReadGraphImpl graph, int s, int p, int o) throws DatabaseException { + procedure.execute(graph, o); + } - } + @Override + public void finished(ReadGraphImpl graph) throws DatabaseException { + dec(graph); + } - @Override - public void finished(ReadGraphImpl graph) throws DatabaseException { - dec(graph); - } + @Override + public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { + if(DebugException.DEBUG) new DebugException(t).printStackTrace(); + procedure.exception(graph, t); + dec(graph); + } - }); + }; + @Override + public void execute(ReadGraphImpl graph, int type) throws DatabaseException { - } + inc(); + QueryCache.runnerAssertedStatements(graph, type, r2, parent, null, proc); - final public static void computeNotFunctionalFinalIndex(ReadGraphImpl graph, final int r1, final int r2, final QueryProcessor provider, RelationInfo ri, AsyncMultiProcedure procedure) { - throw new Error(); - } + } - final public void computeNotFunctionalIndex(ReadGraphImpl graph, RelationInfo ri, final IntProcedure procedure) throws DatabaseException { - computeNotFunctionalIndex(graph, r1(), r2(), this, ri, procedure); - } + @Override + public void finished(ReadGraphImpl graph) throws DatabaseException { + dec(graph); + } - final static public void computeNotFunctionalIndex(ReadGraphImpl graph, final int r1, final int r2, final Objects parent, RelationInfo ri, final IntProcedure procedure) throws DatabaseException { + }); - if(ri.isFinal) { - graph.processor.querySupport.getObjects(graph, r1, r2, new IntProcedure() { + } - @Override - public void execute(ReadGraphImpl graph, int i) throws DatabaseException { - procedure.execute(graph, i); - } + final public static void computeNotFunctionalFinalIndex(ReadGraphImpl graph, final int r1, final int r2, final QueryProcessor provider, RelationInfo ri, AsyncMultiProcedure procedure) { + throw new Error(); + } - @Override - public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { - if(DebugException.DEBUG) new DebugException(t).printStackTrace(); - procedure.exception(graph, t); - } + final public void computeNotFunctionalIndex(ReadGraphImpl graph, RelationInfo ri, final IntProcedure procedure) throws DatabaseException { + computeNotFunctionalIndex(graph, r1(), r2(), this, ri, procedure); + } - @Override - public void finished(ReadGraphImpl graph) { - } + final static public void computeNotFunctionalIndex(ReadGraphImpl graph, final int r1, final int r2, final Objects parent, RelationInfo ri, final IntProcedure procedure) throws DatabaseException { - }); + if(ri.isFinal) { - if(ri.isAsserted) { - forAssertions(graph, r1, r2, parent, procedure); - } else { - procedure.finished(graph); - } + graph.processor.querySupport.getObjects(graph, r1, r2, new IntProcedure() { - } else { + @Override + public void execute(ReadGraphImpl graph, int i) throws DatabaseException { + procedure.execute(graph, i); + } - // Note! The dependency is intentionally cut! - IntSet direct = QueryCache.resultDirectPredicates(graph, r1, null, null); - direct.forEach(graph, new SyncIntProcedure() { + @Override + public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { + if(DebugException.DEBUG) new DebugException(t).printStackTrace(); + procedure.exception(graph, t); + } - @Override - public void run(ReadGraphImpl graph) throws DatabaseException { - forAssertions(graph, r1, r2, parent, procedure); - } + @Override + public void finished(ReadGraphImpl graph) { + } - @Override - public void execute(ReadGraphImpl graph, final int pred) throws DatabaseException { + }); - if(pred == r2) { + if(ri.isAsserted) { + forAssertions(graph, r1, r2, parent, procedure); + } else { + procedure.finished(graph); + } - inc(); + } else { - // Note! The dependency is intentionally cut! - QueryCache.runnerDirectObjects(graph, r1, pred, null, null, new IntProcedure() { + // Note! The dependency is intentionally cut! + IntSet direct = QueryCache.resultDirectPredicates(graph, r1, null, null); + direct.forEach(graph, new SyncIntProcedure() { - @Override - public void execute(ReadGraphImpl graph, int i) throws DatabaseException { - procedure.execute(graph, i); - } + @Override + public void run(ReadGraphImpl graph) throws DatabaseException { + forAssertions(graph, r1, r2, parent, procedure); + } - @Override - public void finished(ReadGraphImpl graph) throws DatabaseException { - dec(graph); - } + @Override + public void execute(ReadGraphImpl graph, final int pred) throws DatabaseException { - @Override - public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { - procedure.exception(graph, t); - dec(graph); - } + if(pred == r2) { - }); + // Note! The dependency is intentionally cut! + QueryCache.runnerDirectObjects(graph, r1, pred, null, null, new IntProcedure() { - } else { + @Override + public void execute(ReadGraphImpl graph, int i) throws DatabaseException { + procedure.execute(graph, i); + } - inc(); + @Override + public void finished(ReadGraphImpl graph) throws DatabaseException { + } - QueryCache.runnerSuperRelations(graph, pred, parent, null, new InternalProcedure() { + @Override + public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { + procedure.exception(graph, t); + } - @Override - public void execute(ReadGraphImpl graph, IntSet result) throws DatabaseException { + }); - if(result.contains(r2)) { + } else { - inc(); + try { - // Note! The dependency is intentionally cut! - QueryCache.runnerDirectObjects(graph, r1, pred, null, null, new IntProcedure() { + IntSet result = QueryCache.resultSuperRelations(graph, pred, parent, null); + if(result.contains(r2)) { - @Override - public void execute(ReadGraphImpl graph, int i) throws DatabaseException { - procedure.execute(graph, i); - } + inc(); - @Override - public void finished(ReadGraphImpl graph) throws DatabaseException { - dec(graph); - } + // Note! The dependency is intentionally cut! + QueryCache.runnerDirectObjects(graph, r1, pred, null, null, new IntProcedure() { - @Override - public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { - if(DebugException.DEBUG) new DebugException(t).printStackTrace(); - procedure.exception(graph, t); - dec(graph); - } + @Override + public void execute(ReadGraphImpl graph, int i) throws DatabaseException { + procedure.execute(graph, i); + } - }); + @Override + public void finished(ReadGraphImpl graph) throws DatabaseException { + dec(graph); + } - } + @Override + public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { + if(DebugException.DEBUG) new DebugException(t).printStackTrace(); + procedure.exception(graph, t); + dec(graph); + } - dec(graph); + }); - } + } - @Override - public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { - procedure.exception(graph, t); - dec(graph); - } + } catch (Throwable e) { + procedure.exception(graph, e); + } - }); + } - } + } - } + @Override + public void finished(ReadGraphImpl graph) throws DatabaseException { + dec(graph); + } - @Override - public void finished(ReadGraphImpl graph) throws DatabaseException { - dec(graph); - } + }); - }); + } - } + } - } + public Object compute(ReadGraphImpl graph, final IntProcedure procedure) throws DatabaseException { + computeForEach(graph, r1(), r2(), this, procedure); + return getResult(); + } - public Object compute(ReadGraphImpl graph, final IntProcedure procedure) throws DatabaseException { - computeForEach(graph, r1(), r2(), this, procedure); - return getResult(); - } + public static void computeForEach(ReadGraphImpl graph, final int r1, final int r2, final Objects entry, final IntProcedure procedure_) throws DatabaseException { - public static void computeForEach(ReadGraphImpl graph, final int r1, final int r2, final Objects entry, final IntProcedure procedure_) throws DatabaseException { + IntProcedure procedure = entry != null ? entry : procedure_; - IntProcedure procedure = entry != null ? entry : procedure_; - RelationInfo ri = QueryCache.resultRelationInfoQuery(graph, r2, entry, null); graph.ensureLoaded(r1, r2); if(ri.isFunctional) { @@ -607,63 +604,63 @@ public final class Objects extends CollectionBinaryQuery implement } else { computeNotFunctionalIndex(graph, r1, r2, entry, ri, procedure); } - - if(entry != null) entry.performFromCache(graph, procedure_); - } + if(entry != null) entry.performFromCache(graph, procedure_); + + } + + @Override + public String toString() { + return "Objects[" + r1() + " - " + r2() + "]"; + } - @Override - public String toString() { - return "Objects[" + r1() + " - " + r2() + "]"; - } + @Override + public Object performFromCache(ReadGraphImpl graph, final IntProcedure procedure) throws DatabaseException { - @Override - public Object performFromCache(ReadGraphImpl graph, final IntProcedure procedure) throws DatabaseException { + assert(isReady()); - assert(isReady()); + if(handleException(graph, procedure)) return getResult(); - if(handleException(graph, procedure)) return getResult(); + final IntArray value = (IntArray)getResult(); + if(value.data == null) { + if(value.sizeOrData != IntArray.NO_DATA) procedure.execute(graph, value.sizeOrData); + } else { + for(int i = 0;i < value.sizeOrData ; i++) procedure.execute(graph, value.data[i]); + } - final IntArray value = (IntArray)getResult(); - if(value.data == null) { - if(value.sizeOrData != IntArray.NO_DATA) procedure.execute(graph, value.sizeOrData); - } else { - for(int i = 0;i < value.sizeOrData ; i++) procedure.execute(graph, value.data[i]); - } + procedure.finished(graph); - procedure.finished(graph); - - return value; + return value; - } + } - @Override - public void recompute(ReadGraphImpl graph) throws DatabaseException { + @Override + public void recompute(ReadGraphImpl graph) throws DatabaseException { - compute(graph, new IntProcedureAdapter() { + compute(graph, new IntProcedureAdapter() { - @Override - public void finished(ReadGraphImpl graph) { - } + @Override + public void finished(ReadGraphImpl graph) { + } - @Override - public void exception(ReadGraphImpl graph, Throwable t) { - new Error("Error in recompute.", t).printStackTrace(); - } + @Override + public void exception(ReadGraphImpl graph, Throwable t) { + new Error("Error in recompute.", t).printStackTrace(); + } - }); + }); - } + } - @Override - public int type() { - return RequestFlags.IMMEDIATE_UPDATE; - } + @Override + public int type() { + return RequestFlags.IMMEDIATE_UPDATE; + } - @Override - boolean isImmutable(ReadGraphImpl graph) { - return graph.processor.isImmutable(r1()); - } + @Override + boolean isImmutable(ReadGraphImpl graph) { + return graph.processor.isImmutable(r1()); + } @Override public void execute(ReadGraphImpl graph, int i) throws DatabaseException { @@ -683,4 +680,10 @@ public final class Objects extends CollectionBinaryQuery implement except(throwable); } + @Override + public void serializeValue(QuerySerializer serializer) { + IntArray is = getResult(); + is.serialize(serializer); + } + } diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ObjectsFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ObjectsFactory.java new file mode 100644 index 000000000..f6758e618 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ObjectsFactory.java @@ -0,0 +1,21 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; + +public class ObjectsFactory extends QueryFactoryBase { + + @Override + public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException { + Objects result = reference(deserializer); + IntArray ia = IntArray.deserialize(deserializer); + result.setResult(ia); + result.setReady(); + return result; + } + + @Override + public T reference(QueryDeserializer deserializer) throws DatabaseException { + return (T)deserializer.readObjects(); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/OrderedSetFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/OrderedSetFactory.java new file mode 100644 index 000000000..9b5f581ba --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/OrderedSetFactory.java @@ -0,0 +1,21 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; + +public class OrderedSetFactory extends QueryFactoryBase { + + @Override + public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException { + OrderedSet result = reference(deserializer); + IntArray ia = IntArray.deserialize(deserializer); + result.setResult(ia); + result.setReady(); + return result; + } + + @Override + public T reference(QueryDeserializer deserializer) throws DatabaseException { + return (T)deserializer.readOrderedSet(); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/Predicates.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/Predicates.java index 9445db03b..982d8019c 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/Predicates.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/Predicates.java @@ -19,7 +19,7 @@ import org.simantics.db.request.RequestFlags; import gnu.trove.procedure.TIntProcedure; -final public class Predicates extends UnaryQueryP { +final public class Predicates extends UnaryQueryPIntSet { Predicates(final int r) { super(r); diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/PredicatesFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/PredicatesFactory.java new file mode 100644 index 000000000..c86e43ce6 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/PredicatesFactory.java @@ -0,0 +1,21 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; + +public class PredicatesFactory extends QueryFactoryBase { + + @Override + public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException { + Predicates result = reference(deserializer); + IntSet ia = IntSet.deserialize(deserializer); + result.setResult(ia); + result.setReady(); + return result; + } + + @Override + public T reference(QueryDeserializer deserializer) throws DatabaseException { + return (T)deserializer.readPredicates(); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/PrincipalTypesFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/PrincipalTypesFactory.java new file mode 100644 index 000000000..ccd4ddc47 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/PrincipalTypesFactory.java @@ -0,0 +1,21 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; + +public class PrincipalTypesFactory extends QueryFactoryBase { + + @Override + public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException { + PrincipalTypes result = reference(deserializer); + IntArray ia = IntArray.deserialize(deserializer); + result.setResult(ia); + result.setReady(); + return result; + } + + @Override + public T reference(QueryDeserializer deserializer) throws DatabaseException { + return (T)deserializer.readPrincipalTypes(); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCacheBase.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCacheBase.java index f80fb5098..b0bca1350 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCacheBase.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCacheBase.java @@ -4,13 +4,10 @@ import java.util.ArrayList; import java.util.Collection; import java.util.concurrent.Semaphore; -import org.simantics.databoard.Bindings; import org.simantics.db.AsyncReadGraph; -import org.simantics.db.DevelopmentKeys; import org.simantics.db.ObjectResourceIdMap; import org.simantics.db.ReadGraph; import org.simantics.db.RelationInfo; -import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; import org.simantics.db.impl.graph.ReadGraphImpl; import org.simantics.db.impl.procedure.InternalProcedure; @@ -24,7 +21,6 @@ import org.simantics.db.request.AsyncRead; import org.simantics.db.request.ExternalRead; import org.simantics.db.request.MultiRead; import org.simantics.db.request.Read; -import org.simantics.utils.Development; import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.TObjectIntHashMap; @@ -980,5 +976,158 @@ public class QueryCacheBase { static boolean shouldCache(QueryProcessor processor, Object o) { return false; } + + AssertedPredicates getOrCreateAssertedPredicates(int r) { + AssertedPredicates entry = (AssertedPredicates)assertedPredicatesMap.get(r); + if(entry == null) { + entry = new AssertedPredicates(r); + assertedPredicatesMap.put(keyR(r), entry); + } + return entry; + } + AssertedStatements getOrCreateAssertedStatements(int r1, int r2) { + AssertedStatements entry = (AssertedStatements)assertedStatementsMap.get(r1, r2); + if(entry == null) { + entry = new AssertedStatements(r1, r2); + assertedStatementsMap.put(keyR2(r1, r2), entry); + } + return entry; + } + + ChildMap getOrCreateChildMap(int r) { + ChildMap entry = (ChildMap)childMapMap.get(r); + if(entry == null) { + entry = new ChildMap(r); + childMapMap.put(keyR(r), entry); + } + return entry; + } + + DirectObjects getOrCreateDirectObjects(int r1, int r2) { + DirectObjects entry = (DirectObjects)directObjectsMap.get(r1, r2); + if(entry == null) { + entry = new DirectObjects(r1, r2); + directObjectsMap.put(keyR2(r1, r2), entry); + } + return entry; + } + + DirectPredicates getOrCreateDirectPredicates(int r) { + DirectPredicates entry = (DirectPredicates)directPredicatesMap.get(r); + if(entry == null) { + entry = new DirectPredicates(r); + directPredicatesMap.put(keyR(r), entry); + } + return entry; + } + + Objects getOrCreateObjects(int r1, int r2) { + Objects entry = (Objects)objectsMap.get(r1, r2); + if(entry == null) { + entry = new Objects(r1, r2); + objectsMap.put(keyR2(r1, r2), entry); + } + return entry; + } + + OrderedSet getOrCreateOrderedSet(int r) { + OrderedSet entry = (OrderedSet)orderedSetMap.get(r); + if(entry == null) { + entry = new OrderedSet(r); + orderedSetMap.put(keyR(r), entry); + } + return entry; + } + + Predicates getOrCreatePredicates(int r) { + Predicates entry = (Predicates)predicatesMap.get(r); + if(entry == null) { + entry = new Predicates(r); + predicatesMap.put(keyR(r), entry); + } + return entry; + } + + PrincipalTypes getOrCreatePrincipalTypes(int r) { + PrincipalTypes entry = (PrincipalTypes)principalTypesMap.get(r); + if(entry == null) { + entry = new PrincipalTypes(r); + principalTypesMap.put(keyR(r), entry); + } + return entry; + } + + RelationInfoQuery getOrCreateRelationInfoQuery(int r) { + RelationInfoQuery entry = (RelationInfoQuery)relationInfoQueryMap.get(r); + if(entry == null) { + entry = new RelationInfoQuery(r); + relationInfoQueryMap.put(keyR(r), entry); + } + return entry; + } + + Statements getOrCreateStatements(int r1, int r2) { + Statements entry = (Statements)statementsMap.get(r1, r2); + if(entry == null) { + entry = new Statements(r1, r2); + statementsMap.put(keyR2(r1, r2), entry); + } + return entry; + } + + SuperRelations getOrCreateSuperRelations(int r) { + SuperRelations entry = (SuperRelations)superRelationsMap.get(r); + if(entry == null) { + entry = new SuperRelations(r); + superRelationsMap.put(keyR(r), entry); + } + return entry; + } + + SuperTypes getOrCreateSuperTypes(int r) { + SuperTypes entry = (SuperTypes)superTypesMap.get(r); + if(entry == null) { + entry = new SuperTypes(r); + superTypesMap.put(keyR(r), entry); + } + return entry; + } + + TypeHierarchy getOrCreateTypeHierarchy(int r) { + TypeHierarchy entry = (TypeHierarchy)typeHierarchyMap.get(r); + if(entry == null) { + entry = new TypeHierarchy(r); + typeHierarchyMap.put(keyR(r), entry); + } + return entry; + } + + Types getOrCreateTypes(int r) { + Types entry = (Types)typesMap.get(r); + if(entry == null) { + entry = new Types(r); + typesMap.put(keyR(r), entry); + } + return entry; + } + + URIToResource getOrCreateURIToResource(String s) { + URIToResource entry = (URIToResource)uRIToResourceMap.get(s); + if(entry == null) { + entry = new URIToResource(s); + uRIToResourceMap.put(keyID(s), entry); + } + return entry; + } + + ValueQuery getOrCreateValueQuery(int r) { + ValueQuery entry = (ValueQuery)valueQueryMap.get(r); + if(entry == null) { + entry = new ValueQuery(r); + valueQueryMap.put(keyR(r), entry); + } + return entry; + } + } \ No newline at end of file diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCollectorImpl.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCollectorImpl.java index 7bab1a77a..e6dc252c4 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCollectorImpl.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCollectorImpl.java @@ -42,6 +42,10 @@ class QueryCollectorImpl implements QueryProcessor.QueryCollector { @Override public void collect(int youngTarget, int allowedTimeInMs) { + // Flush listener registrations to prevent the collector from trashing + // listeners that are still queued up waiting to be registered. + queryProcessor.listening.sync(); + long start = System.nanoTime(); // Refresh current size @@ -144,6 +148,7 @@ class QueryCollectorImpl implements QueryProcessor.QueryCollector { } else { + entry.pruneParentSet(); support.setLevel(entry, parent.getLevel() + 1); } diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryDeserializer.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryDeserializer.java new file mode 100644 index 000000000..0fe9b9c1e --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryDeserializer.java @@ -0,0 +1,227 @@ +package org.simantics.db.impl.query; + +import java.lang.reflect.InvocationTargetException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import org.simantics.db.ObjectResourceIdMap; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.impl.ClusterBase; +import org.simantics.db.impl.ClusterSupport; +import org.simantics.db.impl.ClusterTraitsBase; +import org.simantics.db.service.Bytes; +import org.slf4j.LoggerFactory; + +import gnu.trove.map.hash.TIntLongHashMap; + +public class QueryDeserializer { + + private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(QueryDeserializer.class); + + QueryCache qc; + QuerySupport qs; + ClusterSupport cs; + + private byte[] bytes; + private int byteIndex; + + private TIntLongHashMap clusterKeys = new TIntLongHashMap(); + private Map ids = new HashMap(); + + public QueryDeserializer(QueryProcessor qp, byte[] bytes) { + this.qc = qp.cache; + this.qs = qp.querySupport; + this.cs = qs.getClusterSupport();; + this.bytes = bytes; + } + + public byte readByte() { + return bytes[byteIndex++]; + } + + public int readLE4() { + int result = Bytes.readLE4(bytes, byteIndex); + byteIndex += 4; + return result; + } + + public long readLE8() { + long result = Bytes.readLE8(bytes, byteIndex); + byteIndex += 8; + return result; + } + + public byte[] readBytes(int len) { + byte[] result = Arrays.copyOfRange(bytes, byteIndex, byteIndex+len); + byteIndex += len; + return result; + } + + public void readHeaders() { + int idsSize = readLE4(); + for(int i=0;i clazz = (Class)getClass().getClassLoader().loadClass(id + "Factory"); + QueryFactory qf = clazz.getDeclaredConstructor().newInstance(); + ids.put(key, qf); + } catch (ClassNotFoundException e) { + LOGGER.error("Error while resolving QueryFactory", e); + } catch (InstantiationException e) { + LOGGER.error("Error while resolving QueryFactory", e); + } catch (IllegalAccessException e) { + LOGGER.error("Error while resolving QueryFactory", e); + } catch (IllegalArgumentException e) { + LOGGER.error("Error while resolving QueryFactory", e); + } catch (InvocationTargetException e) { + LOGGER.error("Error while resolving QueryFactory", e); + } catch (NoSuchMethodException e) { + LOGGER.error("Error while resolving QueryFactory", e); + } catch (SecurityException e) { + LOGGER.error("Error while resolving QueryFactory", e); + } + } + int clusterKeysSize = readLE4(); + for(int i=0;i createChildMap() { + return qs.createChildMap(); + } + + AssertedPredicates readAssertedPredicates() throws DatabaseException { + int r = readResource(); + return qc.getOrCreateAssertedPredicates(r); + } + + AssertedStatements readAssertedStatements() throws DatabaseException { + int r1 = readResource(); + int r2 = readResource(); + return qc.getOrCreateAssertedStatements(r1, r2); + } + + ChildMap readChildMap() throws DatabaseException { + int r = readResource(); + return qc.getOrCreateChildMap(r); + } + + DirectObjects readDirectObjects() throws DatabaseException { + int r1 = readResource(); + int r2 = readResource(); + return qc.getOrCreateDirectObjects(r1, r2); + } + + DirectPredicates readDirectPredicates() throws DatabaseException { + int r = readResource(); + return qc.getOrCreateDirectPredicates(r); + } + + Objects readObjects() throws DatabaseException { + int r1 = readResource(); + int r2 = readResource(); + return qc.getOrCreateObjects(r1, r2); + } + + OrderedSet readOrderedSet() throws DatabaseException { + int r = readResource(); + return qc.getOrCreateOrderedSet(r); + } + + Predicates readPredicates() throws DatabaseException { + int r = readResource(); + return qc.getOrCreatePredicates(r); + } + + PrincipalTypes readPrincipalTypes() throws DatabaseException { + int r = readResource(); + return qc.getOrCreatePrincipalTypes(r); + } + + RelationInfoQuery readRelationInfoQuery() throws DatabaseException { + int r = readResource(); + return qc.getOrCreateRelationInfoQuery(r); + } + + Statements readStatements() throws DatabaseException { + int r1 = readResource(); + int r2 = readResource(); + return qc.getOrCreateStatements(r1, r2); + } + + SuperRelations readSuperRelations() throws DatabaseException { + int r = readResource(); + return qc.getOrCreateSuperRelations(r); + } + + SuperTypes readSuperTypes() throws DatabaseException { + int r = readResource(); + return qc.getOrCreateSuperTypes(r); + } + + TypeHierarchy readTypeHierarchy() throws DatabaseException { + int r = readResource(); + return qc.getOrCreateTypeHierarchy(r); + } + + Types readTypes() throws DatabaseException { + int r = readResource(); + return qc.getOrCreateTypes(r); + } + + URIToResource readURIToResource() throws DatabaseException { + String s = readString(); + return qc.getOrCreateURIToResource(s); + } + + ValueQuery readValueQuery() throws DatabaseException { + int r = readResource(); + return qc.getOrCreateValueQuery(r); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryFactory.java new file mode 100644 index 000000000..c4b3f9f9a --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryFactory.java @@ -0,0 +1,8 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; + +public interface QueryFactory { + public CacheEntryBase read(QueryDeserializer deserializer) throws DatabaseException; + public T reference(QueryDeserializer deserializer) throws DatabaseException; +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryFactoryBase.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryFactoryBase.java new file mode 100644 index 000000000..a193ccec3 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryFactoryBase.java @@ -0,0 +1,25 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; + +abstract public class QueryFactoryBase implements QueryFactory { + + abstract protected CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException; + + public void readParents(QueryDeserializer deserializer, CacheEntryBase entry) throws DatabaseException { + int ps = deserializer.readLE4(); + for(int i=0;i getParents(QueryProcessor processor) { + public Collection getParents(QueryProcessor processor) { // TODO Auto-generated method stub return null; } @@ -227,7 +229,11 @@ abstract public class QueryIdentityHash extends THash { // TODO Auto-generated method stub return null; } - + + @Override + void pruneParentSet() { + } + }; /** diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryIdentityHashSet.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryIdentityHashSet.java index 3a7eb6182..ac2602fcb 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryIdentityHashSet.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryIdentityHashSet.java @@ -147,7 +147,25 @@ final public class QueryIdentityHashSet extends QueryIdentityHash implements Ite } } - + + final public void removeDiscardedReally() { + + tempDisableAutoCompaction(); + try { + + for(int i=0;i<_set.length;i++) { + CacheEntry entry = _set[i]; + if(entry != null && REMOVED != entry) { + if(entry.isDiscarded()) removeAt(i); + } + } + + } finally { + reenableAutoCompaction(false); + } + + } + /** * Creates an iterator over the values of the set. The iterator * supports element deletion. diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryListening.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryListening.java index dd410b4ce..e0b39d651 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryListening.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryListening.java @@ -14,15 +14,12 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.Semaphore; -import java.util.function.Consumer; import org.simantics.databoard.Bindings; import org.simantics.db.DevelopmentKeys; import org.simantics.db.debug.ListenerReport; import org.simantics.db.exception.DatabaseException; import org.simantics.db.impl.graph.ReadGraphImpl; -import org.simantics.db.impl.graph.WriteGraphImpl; import org.simantics.db.procedure.ListenerBase; import org.simantics.utils.Development; import org.simantics.utils.datastructures.Pair; @@ -34,11 +31,10 @@ import gnu.trove.set.hash.THashSet; public class QueryListening { - private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(QueryListening.class); + static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(QueryListening.class); private final QueryProcessor processor; private final Scheduler scheduler; - private final Consumer consumer; private final Map addedEntries = new HashMap<>(); private THashSet scheduledListeners = new THashSet(); @@ -46,210 +42,11 @@ public class QueryListening { final THashMap> listeners = new THashMap>(10, 0.75f); - private static class ThreadQueue extends ThreadLocal> { - - private final Map> allQueues = new HashMap<>(); - - private ArrayList> dispatchedQueues = new ArrayList<>(); - - @Override - protected synchronized ArrayList initialValue() { - ArrayList result = new ArrayList<>(); - allQueues.put(Thread.currentThread(), result); - return result; - } - - synchronized void sendToExecution() { - ArrayList rs = allQueues.remove(Thread.currentThread()); - dispatchedQueues.add(rs); - notify(); - } - - synchronized ArrayList> getDispatchedQueues() { - ArrayList> result = dispatchedQueues; - dispatchedQueues = new ArrayList<>(); - return result; - } - - } - - private static class Scheduler { - - private static final int BUFFER_SIZE = 100; - - private final QueryProcessor processor; - - private final ThreadQueue queues = new ThreadQueue(); - - /* - * Access to this field is synchronized using the monitor of 'queues' - * The method flush() shall be called by the single writing thread and the field has been nulled before the - * method can exit. Thus it is not possible for multiple instances of flush Semaphore to exist at the same time. - */ - private Semaphore flush = null; - - Scheduler(QueryProcessor processor) { - this.processor = processor; - } - - private boolean isTerminated() { - return processor.isDisposed(); - } - - Consumer newConsumer() { - return (task) -> { - - ArrayList l = queues.get(); - l.add(task); - if(l.size() == BUFFER_SIZE) { - queues.remove(); - queues.sendToExecution(); - } - - }; - } - - void start() { - - Thread thread = new Thread() { - - public void run() { - - synchronized(queues) { - while(!isTerminated()) { - try { - ArrayList> qs = queues.getDispatchedQueues(); - for(ArrayList queue : qs) { - for(Runnable r : queue) - r.run(); - } - if(flush != null) { - for(ArrayList queue : queues.allQueues.values()) { - for(Runnable r : queue) { - r.run(); - } - queue.clear(); - } - Semaphore s = flush; - flush = null; - s.release(); - } - queues.wait(1000); - } catch (InterruptedException e) { - LOGGER.error("Unexpected interrupt", e); - } - } - } - - }; - - }; - - thread.setName("QueryListening"); - thread.start(); - - } - - private Semaphore createFlush() { - synchronized(queues) { - flush = new Semaphore(0); - queues.notify(); - return flush; - } - } - - void flush() { - try { - createFlush().acquire(); - } catch (InterruptedException e) { - LOGGER.error("Unexpected interrupt", e); - } - } - - } - - private static class RegisterParentRunnable implements Runnable { - - private final CacheEntry parent; - private final CacheEntry child; - - public RegisterParentRunnable(CacheEntry parent, CacheEntry child) { - this.parent = parent; - this.child = child; - } - - @Override - public void run() { - child.addParent(parent); - if (Development.DEVELOPMENT) { - if(Development.getProperty(DevelopmentKeys.QUERYPROCESSOR_DEPENDENCIES, Bindings.BOOLEAN)) { - System.out.println(child + " -> " + parent); - } - } - } - - } - - private static class RegisterListenerRunnable implements Runnable { - - private final QueryListening queryListening; - private final ListenerBase base; - private final Object procedure; - private final CacheEntry parent; - private final CacheEntry entry; - - public RegisterListenerRunnable(QueryListening queryListening, ListenerBase base, Object procedure, CacheEntry parent, CacheEntry entry) { - this.queryListening = queryListening; - this.base = base; - this.procedure = procedure; - this.parent = parent; - this.entry = entry; - } - - @Override - public void run() { - - assert (entry != null); - assert (procedure != null); - - ArrayList list = queryListening.listeners.get(entry); - if (list == null) { - list = new ArrayList<>(1); - queryListening.listeners.put(entry, list); - } - - ListenerEntry result = new ListenerEntry(entry, base, procedure); - // Equals is here based on base - int currentIndex = list.indexOf(result); - // There was already a listener - if(currentIndex > -1) { - ListenerEntry current = list.get(currentIndex); - if(!current.base.isDisposed()) - return; - list.set(currentIndex, result); - } else { - list.add(result); - } - - if (Development.DEVELOPMENT) { - if(Development.getProperty(DevelopmentKeys.QUERYPROCESSOR_LISTENERS, Bindings.BOOLEAN)) { - new Exception().printStackTrace(); - System.err.println("addListener -> " + list.size() + " " + entry + " " + base + " " + procedure); - } - } - - queryListening.addedEntries.put(base, result); - - } - - - } QueryListening(QueryProcessor processor) { this.processor = processor; scheduler = new Scheduler(processor); - consumer = scheduler.newConsumer(); scheduler.start(); } @@ -260,7 +57,7 @@ public class QueryListening { void sync() { try { - scheduler.flush(); + scheduler.sync(); } catch (Throwable t) { LOGGER.error("Error while waiting for query dependency management", t); } @@ -276,7 +73,7 @@ public class QueryListening { if(parent != null) { try { if(!child.isImmutable(graph)) - consumer.accept(new RegisterParentRunnable(parent, child)); + scheduler.accept(new RegisterParentRunnable(parent, child)); } catch (DatabaseException e) { LOGGER.error("Error while registering query dependencies", e); } @@ -284,7 +81,7 @@ public class QueryListening { if(listener != null) if(!listener.isDisposed()) - consumer.accept(new RegisterListenerRunnable(this, listener, procedure, parent, child)); + scheduler.accept(new RegisterListenerRunnable(this, listener, procedure, parent, child)); } @@ -292,10 +89,7 @@ public class QueryListening { if(base == null) return; - consumer.accept(() -> { - ListenerEntry entry = addedEntries.get(base); - if(entry != null) entry.setLastKnown(result); - }); + scheduler.accept(new RegisterFirstKnownRunnable(addedEntries, base, result)); } @@ -413,7 +207,7 @@ public class QueryListening { } - public void fireListeners(WriteGraphImpl graph) { + public void fireListeners(ReadGraphImpl graph) { assert (!processor.updating); assert (!processor.cache.collecting); @@ -529,5 +323,102 @@ public class QueryListening { else return Collections.emptyList(); } - + + private static class RegisterParentRunnable implements Runnable { + + private final CacheEntry parent; + private final CacheEntry child; + + public RegisterParentRunnable(CacheEntry parent, CacheEntry child) { + this.parent = parent; + this.child = child; + } + + @Override + public void run() { + child.addParent(parent); + if (Development.DEVELOPMENT) { + if(Development.getProperty(DevelopmentKeys.QUERYPROCESSOR_DEPENDENCIES, Bindings.BOOLEAN)) { + System.out.println(child + " -> " + parent); + } + } + } + + } + + private static class RegisterListenerRunnable implements Runnable { + + private final QueryListening queryListening; + private final ListenerBase base; + private final Object procedure; + private final CacheEntry parent; + private final CacheEntry entry; + + public RegisterListenerRunnable(QueryListening queryListening, ListenerBase base, Object procedure, CacheEntry parent, CacheEntry entry) { + this.queryListening = queryListening; + this.base = base; + this.procedure = procedure; + this.parent = parent; + this.entry = entry; + } + + @Override + public void run() { + + assert (entry != null); + assert (procedure != null); + + ArrayList list = queryListening.listeners.get(entry); + if (list == null) { + list = new ArrayList<>(1); + queryListening.listeners.put(entry, list); + } + + ListenerEntry result = new ListenerEntry(entry, base, procedure); + // Equals is here based on base + int currentIndex = list.indexOf(result); + // There was already a listener + if(currentIndex > -1) { + ListenerEntry current = list.get(currentIndex); + if(!current.base.isDisposed()) + return; + list.set(currentIndex, result); + } else { + list.add(result); + } + + if (Development.DEVELOPMENT) { + if(Development.getProperty(DevelopmentKeys.QUERYPROCESSOR_LISTENERS, Bindings.BOOLEAN)) { + new Exception().printStackTrace(); + System.err.println("addListener -> " + list.size() + " " + entry + " " + base + " " + procedure); + } + } + + queryListening.addedEntries.put(base, result); + + } + + + } + + private static class RegisterFirstKnownRunnable implements Runnable { + + private final Map addedEntries; + private final ListenerBase base; + private final Object result; + + public RegisterFirstKnownRunnable(Map addedEntries, ListenerBase base, Object result) { + this.addedEntries = addedEntries; + this.base = base; + this.result = result; + } + + @Override + public void run() { + ListenerEntry entry = addedEntries.remove(base); + if(entry != null) entry.setLastKnown(result); + } + + } + } diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryProcessor.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryProcessor.java index a46bc0e8d..f61c661d1 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryProcessor.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryProcessor.java @@ -32,6 +32,7 @@ import java.util.concurrent.Semaphore; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; +import org.eclipse.core.runtime.Platform; import org.simantics.databoard.Bindings; import org.simantics.db.AsyncReadGraph; import org.simantics.db.DevelopmentKeys; @@ -42,6 +43,7 @@ import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.Statement; import org.simantics.db.VirtualGraph; +import org.simantics.db.common.ByteFileReader; import org.simantics.db.common.procedure.adapter.AsyncMultiProcedureAdapter; import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; @@ -68,9 +70,11 @@ import org.simantics.db.request.AsyncMultiRead; import org.simantics.db.request.ExternalRead; import org.simantics.db.request.MultiRead; import org.simantics.db.request.RequestFlags; +import org.simantics.db.service.Bytes; import org.simantics.layer0.Layer0; import org.simantics.utils.DataContainer; import org.simantics.utils.Development; +import org.simantics.utils.FileUtils; import org.simantics.utils.datastructures.Pair; import org.simantics.utils.datastructures.collections.CollectionUtils; import org.simantics.utils.datastructures.disposable.AbstractDisposable; @@ -1069,6 +1073,82 @@ final public class QueryProcessor extends AbstractDisposable implements ReadGrap } + public synchronized void save() throws IOException { + + long start = System.nanoTime(); + + Collection caches = allCaches(new CacheCollectionResult()).toCollection(); + Map> cachesByCluster = new HashMap<>(); + for(CacheEntryBase entry : caches) { + String clazz = entry.classId(); + if(clazz == null) + continue; + long cluster = entry.cluster(this); + List queries = cachesByCluster.get(cluster); + if(queries == null) { + queries = new ArrayList<>(); + cachesByCluster.put(cluster, queries); + } + queries.add(entry); + } + + File workspace = Platform.getLocation().toFile(); + File dir = new File(workspace, "queryData"); + FileUtils.deleteAll(dir); + + dir.mkdir(); + + for(Long cluster : cachesByCluster.keySet()) { + + List queries = cachesByCluster.get(cluster); + QuerySerializer serializer = new QuerySerializer(this); + int count = 0; + int pos = serializer.writeUnknownSize(); + for(CacheEntryBase entry : queries) { + String clazz = entry.classId(); + if(clazz == null) + continue; + try { + entry.serialize(serializer); + count++; + } catch (IllegalStateException e) { + System.err.println(e.getMessage()); + } + } + serializer.setUnknownSize(pos, count); + + System.err.println(serializer.bytes().length + " bytes for cluster " + cluster); + FileUtils.writeFile(new File(dir, "" + cluster + ".queryData"), serializer.bytes()); + + } + + long end = System.nanoTime(); + + System.err.println("saved queries in " + 1e-6*(end-start) + "ms."); + + } + + public void restore() throws IOException { + + long start = System.nanoTime(); + + File workspace = Platform.getLocation().toFile(); + File dir = new File(workspace, "queryData"); + dir.mkdir(); + + for(File f : FileUtils.listFilesByExtension(dir, "queryData")) { + byte[] bytes = FileUtils.readFile(f); + QueryDeserializer qd = new QueryDeserializer(this, bytes); + qd.readHeaders(); + qd.readQueries(); + } + + long end = System.nanoTime(); + + System.err.println("restored queries in " + 1e-6*(end-start) + "ms."); + + } + boolean removeQuery(CacheEntry entry) { // This entry has been removed before. No need to do anything here. @@ -1279,8 +1359,9 @@ final public class QueryProcessor extends AbstractDisposable implements ReadGrap entry.prepareRecompute(querySupport); ReadGraphImpl parentGraph = graph.forRecompute(entry); - + parentGraph.asyncBarrier.inc(); query.recompute(parentGraph); + parentGraph.asyncBarrier.dec(); if(entry.isExcepted()) return ListenerEntry.NO_VALUE; @@ -1759,6 +1840,12 @@ final public class QueryProcessor extends AbstractDisposable implements ReadGrap } return result; } + + public long cluster(int resource) { + if(resource <= 0) + return 0; + return querySupport.getClusterId(resource); + } public void assertDone() { } @@ -4053,6 +4140,10 @@ final public class QueryProcessor extends AbstractDisposable implements ReadGrap return L0; } + public Layer0 getL0() { + return L0; + } + public static ThreadLocal thread = new ThreadLocal() { protected Integer initialValue() { return -1; diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QuerySerializer.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QuerySerializer.java new file mode 100644 index 000000000..06b01407c --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QuerySerializer.java @@ -0,0 +1,136 @@ +package org.simantics.db.impl.query; + +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +import org.simantics.db.impl.ClusterTraitsBase; + +import gnu.trove.list.array.TByteArrayList; +import gnu.trove.map.hash.TLongIntHashMap; +import gnu.trove.procedure.TLongIntProcedure; + +public class QuerySerializer { + + private QueryProcessor processor; + private QuerySupport querySupport; + private TByteArrayList bytes = new TByteArrayList(); + private TLongIntHashMap clusterKeys = new TLongIntHashMap(); + private Map ids = new HashMap(); + + public QuerySerializer(QueryProcessor processor) { + this.processor = processor; + this.querySupport = processor.querySupport; + } + + public int writeUnknownSize() { + int pos = bytes.size(); + bytes.add((byte)0); + bytes.add((byte)0); + bytes.add((byte)0); + bytes.add((byte)0); + return pos; + } + + public void setUnknownSize(int pos, int value) { + bytes.set(pos, (byte) (value & 0xFF)); + bytes.set(pos+1, (byte) ((value >>> 8) & 0xFF)); + bytes.set(pos+2, (byte) ((value >>> 16) & 0xFF)); + bytes.set(pos+3, (byte) ((value >>> 24) & 0xFF)); + } + + public void serializeId(String classId) { + Integer id = ids.get(classId); + if(id == null) { + id = ids.size() + 1; + ids.put(classId, id); + } + writeLE(id); + } + + public void addResource(int r) { + if(r < 0) { + writeLE(r); + } else { + long clusterId = querySupport.getClusterId(r); + int clusterKey = clusterKeys.get(clusterId); + if(clusterKey == 0) { + clusterKey = clusterKeys.size() + 1; + clusterKeys.put(clusterId, clusterKey); + } + int i = ClusterTraitsBase.createResourceKeyNoThrow(clusterKey, ClusterTraitsBase.getResourceIndexFromResourceKeyNoThrow(r)); + writeLE(i); + } + } + + public void addString(String s) { + byte[] b = s.getBytes(); + writeLE(b.length); + bytes.add(b); + } + + public void add(byte b) { + bytes.add(b); + } + + public void add(byte[] bs) { + bytes.add(bs); + } + + public byte[] bytes() { + TByteArrayList header = new TByteArrayList(); + writeLE(header, ids.size()); + for(Entry entry : ids.entrySet()) { + String id = entry.getKey(); + writeLE(header, id.length()); + header.add(id.getBytes()); + writeLE(header, entry.getValue()); + } + + writeLE(header, clusterKeys.size()); + clusterKeys.forEachEntry(new TLongIntProcedure() { + + @Override + public boolean execute(long a, int b) { + writeLE(header, a); + writeLE(header, b); + return true; + } + + }); + + header.add(bytes.toArray()); + return header.toArray(); + } + + public void writeLE(int value) { + writeLE(bytes, value); + } + + public static void writeLE(TByteArrayList bytes, int value) { + bytes.add((byte) (value & 0xFF)); + bytes.add((byte) ((value >>> 8) & 0xFF)); + bytes.add((byte) ((value >>> 16) & 0xFF)); + bytes.add((byte) ((value >>> 24) & 0xFF)); + } + + public void writeLE(long value) { + writeLE(bytes, value); + } + + public static void writeLE(TByteArrayList bytes, long value) { + bytes.add((byte) (value & 0xFF)); + bytes.add((byte) ((value >>> 8) & 0xFF)); + bytes.add((byte) ((value >>> 16) & 0xFF)); + bytes.add((byte) ((value >>> 24) & 0xFF)); + bytes.add((byte) ((value >>> 32) & 0xFF)); + bytes.add((byte) ((value >>> 40) & 0xFF)); + bytes.add((byte) ((value >>> 48) & 0xFF)); + bytes.add((byte) ((value >>> 56) & 0xFF)); + } + + public QueryProcessor getQueryProcessor() { + return processor; + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QuerySupport.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QuerySupport.java index 3071c30c0..0a0a207fd 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QuerySupport.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QuerySupport.java @@ -13,17 +13,23 @@ package org.simantics.db.impl.query; import java.io.InputStream; +import org.simantics.db.ObjectResourceIdMap; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.VirtualGraph; import org.simantics.db.exception.DatabaseException; import org.simantics.db.exception.ResourceNotFoundException; +import org.simantics.db.impl.ClusterSupport; import org.simantics.db.impl.graph.ReadGraphImpl; public interface QuerySupport extends ResourceTranslator { Session getSession(); - + + ClusterSupport getClusterSupport(); + + ObjectResourceIdMap createChildMap(); + boolean isImmutable(int id); long getClusterId(int id); int getId(Resource resource); diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ReadEntry.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ReadEntry.java index 8f547d22b..4fb5ed996 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ReadEntry.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ReadEntry.java @@ -214,4 +214,9 @@ public final class ReadEntry extends CacheEntryBase> implem except(throwable); } + @Override + public String classId() { + return null; + } + } diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/RelationInfoQuery.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/RelationInfoQuery.java index cffd2984a..367e75f63 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/RelationInfoQuery.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/RelationInfoQuery.java @@ -100,4 +100,13 @@ public final class RelationInfoQuery extends UnaryQueryP { return RequestFlags.IMMEDIATE_UPDATE; } + @Override + public void serializeValue(QuerySerializer serializer) { + RelationInfo ri = getResult(); + serializer.addResource(ri.predicate); + serializer.add(ri.isFunctional ? (byte)1 : 0); + serializer.add(ri.isFinal ? (byte)1 : 0); + serializer.add(ri.isAsserted ? (byte)1 : 0); + } + } diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/RelationInfoQueryFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/RelationInfoQueryFactory.java new file mode 100644 index 000000000..05adb56a7 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/RelationInfoQueryFactory.java @@ -0,0 +1,26 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.RelationInfo; +import org.simantics.db.exception.DatabaseException; + +public class RelationInfoQueryFactory extends QueryFactoryBase { + + @Override + public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException { + RelationInfoQuery result = reference(deserializer); + int r = deserializer.readResource(); + int isFunctional = deserializer.readByte(); + int isFinal = deserializer.readByte(); + int isAsserted = deserializer.readByte(); + RelationInfo ri = new RelationInfo(r, isFunctional == 1, isFinal == 1, isAsserted == 1); + result.setResult(ri); + result.setReady(); + return result; + } + + @Override + public T reference(QueryDeserializer deserializer) throws DatabaseException { + return (T)deserializer.readRelationInfoQuery(); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/Scheduler.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/Scheduler.java new file mode 100644 index 000000000..2c9c47574 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/Scheduler.java @@ -0,0 +1,203 @@ +package org.simantics.db.impl.query; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.Semaphore; + +class Scheduler extends ThreadLocal { + + private final QueryProcessor processor; + + private static final int MAX_TASKLIST_SIZE = 1<<8; + + /* + * New TaskList objects shall be assigned this size. + * This shall grow exponentially upon task list creation to max size and shall reset to 1 when a write synchronizes the tasks. + * The intention is to make sure that upon frequent syncs the tasks shall be scheduled + */ + private int currentTaskListSize = 1; + + /* + * Anyone wishing to execute any tasks needs to hold this monitor + */ + private Object taskExecutionMonitor = new Object(); + + /* + * Anyone wishing to manipulate the list of dispatched tasks needs to hold this monitor + */ + private Object taskDispatchMonitor = new Object(); + + /* + * When a thread-specific TaskList becomes full it is added into this list for execution. + * The executor thread takes TaskLists from this list. + * The sync operation can also execute remaining tasks. + */ + private ArrayList dispatchedTaskLists; + + /* + * This replicates the ThreadLocal map of TaskList objects to enable listing of tasks active queues + */ + private final Map activeTaskLists = new HashMap<>(); + + /* + * This semaphore is incremented each time s task list gets dispatched. The execution thread waits for the semaphore. + */ + private final Semaphore taskDispatchNotifications = new Semaphore(0); + + Scheduler(QueryProcessor processor) { + this.processor = processor; + } + + /* + * This gets called by multiple query threads + */ + void accept(Runnable task) { + TaskList l = get(); + l.add(task); + if(l.shouldSchedule()) { + remove(); + sendToExecution(); + } + } + + /* + * A task list has reached full size and is moved into execution by the execution thread + */ + void sendToExecution() { + synchronized(activeTaskLists) { + // This is dispatched so it should not anymore be in list of active TaskList objects. + TaskList l = activeTaskLists.remove(Thread.currentThread()); + synchronized(taskDispatchMonitor) { + if(dispatchedTaskLists == null) + dispatchedTaskLists = new ArrayList(); + dispatchedTaskLists.add(l); + } + if(currentTaskListSize < MAX_TASKLIST_SIZE) + currentTaskListSize = currentTaskListSize<<1; + } + // Release the execution thread + taskDispatchNotifications.release(); + } + + /* + * Gets dispatched TaskList objects for execution. + * Returns null when there's nothing to execute (and thread shall go to sleep). + */ + ArrayList getDispatchedQueues() { + synchronized(taskDispatchMonitor) { + if(dispatchedTaskLists == null) + return null; + ArrayList result = dispatchedTaskLists; + dispatchedTaskLists = null; + return result; + } + } + + void start() { + + Thread thread = new Thread() { + + public void run() { + + // We execute tasks as long as the query processor is alive + while(!processor.isDisposed()) { + + try { + + // This is a mutex between this place and sync() + synchronized(taskExecutionMonitor) { + + // Execute busily while there is something to execute + while(true) { + + ArrayList qs = getDispatchedQueues(); + if(qs == null) { + // No tasks - go to sleep + break; + } + + // Execute everything we got + for(TaskList queue : qs) { + for(Runnable r : queue) { + r.run(); + } + } + + } + + } + + // sendToExecution shall release this + taskDispatchNotifications.acquire(); + + } catch (InterruptedException e) { + QueryListening.LOGGER.error("Unexpected interrupt", e); + } + + } + + }; + + }; + + thread.setName("QueryListening"); + thread.start(); + + } + + /* + * ThreadLocal calls this to create a TaskList. + * Called with first list per thread and also when accepting next task after sendToExecution. + */ + @Override + protected TaskList initialValue() { + TaskList result = new TaskList(currentTaskListSize); + synchronized(activeTaskLists) { + activeTaskLists.put(Thread.currentThread(), result); + } + return result; + } + + /* + * This makes sure that all tasks have been executed upon return. + * It takes the taskExecutionMonitor from the thread and executes possible dispatched work and + * also executes anything in active task lists. It resets the dispatch sizes of current and + * subsequently created task lists to 1. + */ + void sync() { + + // This is a mutex between this place and execution thread + synchronized(taskExecutionMonitor) { + + currentTaskListSize = 1; + + // Perform all dispatched work + ArrayList qs = getDispatchedQueues(); + if(qs != null) { + for(TaskList queue : qs) { + for(Runnable r : queue) { + r.run(); + } + } + } + + // Also perform any tasks in active queues. + // This assumes that all query threads that send new tasks are now parked and shall not interfere. + synchronized(activeTaskLists) { + for(TaskList queue : activeTaskLists.values()) { + // Run all tasks + for(Runnable r : queue) { + if(r != null) + r.run(); + } + // Remove the tasks from list and reset the max size to 1. + queue.reset(); + } + } + + } + + } + +} \ No newline at end of file diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/Statements.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/Statements.java index 6652f1b6b..218777413 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/Statements.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/Statements.java @@ -11,8 +11,6 @@ *******************************************************************************/ package org.simantics.db.impl.query; -import java.util.concurrent.atomic.AtomicBoolean; - import org.simantics.db.RelationInfo; import org.simantics.db.common.exception.DebugException; import org.simantics.db.exception.DatabaseException; @@ -24,93 +22,93 @@ import org.simantics.db.procedure.ListenerBase; import org.simantics.db.request.RequestFlags; public final class Statements extends CollectionBinaryQuery implements TripleIntProcedure { - + public Statements(final int r1, final int r2) { super(r1, r2); } - + final public static void queryEach(ReadGraphImpl graph, final int r1, final int r2, final QueryProcessor provider, final CacheEntry parent, final ListenerBase listener, final TripleIntProcedure procedure) throws DatabaseException { - - assert(r1 != 0); - assert(r2 != 0); - + + assert(r1 != 0); + assert(r2 != 0); + if(parent == null && listener == null) { - Statements.computeForEach(graph, r1, r2, null, procedure); - return; + Statements.computeForEach(graph, r1, r2, null, procedure); + return; } - + QueryCache.runnerStatements(graph, r1, r2, parent, listener, procedure); - + } - @Override - final public void removeEntry(QueryProcessor provider) { + @Override + final public void removeEntry(QueryProcessor provider) { provider.cache.remove(this); - } - + } + final static TripleIntProcedure NOPT = new TripleIntProcedure() { - @Override - public void exception(ReadGraphImpl graph, Throwable throwable) { - } + @Override + public void exception(ReadGraphImpl graph, Throwable throwable) { + } - @Override - public void execute(ReadGraphImpl graph, int s, int p, int o) { - } + @Override + public void execute(ReadGraphImpl graph, int s, int p, int o) { + } + + @Override + public void finished(ReadGraphImpl graph) { + } - @Override - public void finished(ReadGraphImpl graph) { - } - }; - + final static private IntArray getAssertionMap(ReadGraphImpl graph, final int r1, final int r2, final Statements entry) throws DatabaseException { - + class AssertionMapProc implements IntProcedure { - - boolean first = true; - - private IntArray result; - - public void addStatement(int s, int p, int o) { - - if(result.size() == 0) { - result.add(s); - result.add(p); - result.add(o); - } else { - for(int i = 0;i < result.sizeOrData ; i+=3) { - int existingP = result.data[i+1]; - if(p == existingP) { - int existingO = result.data[i+2]; - if(existingO == o) return; - } - } - result.add(s); - result.add(p); - result.add(o); - } - - } - + + boolean first = true; + + private IntArray result; + + public void addStatement(int s, int p, int o) { + + if(result.size() == 0) { + result.add(s); + result.add(p); + result.add(o); + } else { + for(int i = 0;i < result.sizeOrData ; i+=3) { + int existingP = result.data[i+1]; + if(p == existingP) { + int existingO = result.data[i+2]; + if(existingO == o) return; + } + } + result.add(s); + result.add(p); + result.add(o); + } + + } + @Override public void execute(ReadGraphImpl graph, int type) throws DatabaseException { if(result == null) { - result = QueryCache.resultAssertedStatements(graph, type, r2, entry, null); + result = QueryCache.resultAssertedStatements(graph, type, r2, entry, null); } else { - if (first) { - IntArray ia = result; - result = new IntArray(); - if(ia.data != null) { - for(int i = 0;i < ia.sizeOrData ; i+=3) addStatement(ia.data[i],ia.data[i+1],ia.data[i+2]); - } - first = false; - } - IntArray ia = QueryCache.resultAssertedStatements(graph, type, r2, entry, null); - if(ia.data != null) { - for(int i = 0;i < ia.sizeOrData ; i+=3) addStatement(ia.data[i],ia.data[i+1],ia.data[i+2]); - } + if (first) { + IntArray ia = result; + result = new IntArray(); + if(ia.data != null) { + for(int i = 0;i < ia.sizeOrData ; i+=3) addStatement(ia.data[i],ia.data[i+1],ia.data[i+2]); + } + first = false; + } + IntArray ia = QueryCache.resultAssertedStatements(graph, type, r2, entry, null); + if(ia.data != null) { + for(int i = 0;i < ia.sizeOrData ; i+=3) addStatement(ia.data[i],ia.data[i+1],ia.data[i+2]); + } } } @@ -118,322 +116,336 @@ public final class Statements extends CollectionBinaryQuery public void finished(ReadGraphImpl graph) { } - @Override - public void exception(ReadGraphImpl graph, Throwable throwable) { - } + @Override + public void exception(ReadGraphImpl graph, Throwable throwable) { + } } - + AssertionMapProc amp = new AssertionMapProc(); // This dependency could be cut QueryCache.runnerPrincipalTypes(graph, r1, entry, null, amp); - + return amp.result; - + } - + final static private void forSingleAssertion(ReadGraphImpl graph, final int r1, final int r2, final Statements parent, final TripleIntProcedure procedure) throws DatabaseException { - - IntArray map = getAssertionMap(graph, r1, r2, parent); - if(map == null) { - procedure.finished(graph); + + IntArray map = getAssertionMap(graph, r1, r2, parent); + if(map == null) { + procedure.finished(graph); return; - } - + } + int size = map.size(); if(size == 3) { - int s = map.data[0]; - int p = map.data[1]; - int o = map.data[2]; - - procedure.execute(graph, s,p,o); - procedure.finished(graph); + int s = map.data[0]; + int p = map.data[1]; + int o = map.data[2]; + + procedure.execute(graph, s,p,o); + procedure.finished(graph); } else if(size == 0) { - procedure.finished(graph); - + procedure.finished(graph); + } else { - int candidateS = map.data[0]; - int candidateP = map.data[1]; - int candidateO = map.data[2]; - - IntSet candidateIs = null; - try { - candidateIs = QueryCache.resultSuperTypes(graph, candidateS, parent, null); - } catch (DatabaseException e) { - procedure.exception(graph, e); - return; - } - - for(int i=3;i ignore next - - } else { - - IntSet nextIs = null; - try { - nextIs = QueryCache.resultSuperTypes(graph, nextS, parent, null); - } catch (DatabaseException e) { - procedure.exception(graph, e); - return; - } - - if(nextIs.contains(candidateS)) { - - // Candidate is a super type of next => next is the new candidate - - candidateS = nextS; - candidateP = nextP; - candidateO = nextO; - candidateIs = nextIs; - - } else { - // candidate and next are unrelated => error - ManyObjectsForFunctionalRelationException exception = new ManyObjectsForFunctionalRelationException("Functional relation has conflicting assertions.", r1); - procedure.exception(graph, exception); - return; - } - - } - - } - - } - + int candidateS = map.data[0]; + int candidateP = map.data[1]; + int candidateO = map.data[2]; + + IntSet candidateIs = null; + try { + candidateIs = QueryCache.resultSuperTypes(graph, candidateS, parent, null); + } catch (DatabaseException e) { + procedure.exception(graph, e); + return; + } + + for(int i=3;i ignore next + + } else { + + IntSet nextIs = null; + try { + nextIs = QueryCache.resultSuperTypes(graph, nextS, parent, null); + } catch (DatabaseException e) { + procedure.exception(graph, e); + return; + } + + if(nextIs.contains(candidateS)) { + + // Candidate is a super type of next => next is the new candidate + + candidateS = nextS; + candidateP = nextP; + candidateO = nextO; + candidateIs = nextIs; + + } else { + // candidate and next are unrelated => error + ManyObjectsForFunctionalRelationException exception = new ManyObjectsForFunctionalRelationException("Functional relation has conflicting assertions.", r1); + procedure.exception(graph, exception); + return; + } + + } + + } + + } + procedure.execute(graph, candidateS, candidateP, candidateO); procedure.finished(graph); - + } - + } - + final static InternalProcedure NOP = new InternalProcedure() { - @Override - public void execute(ReadGraphImpl graph, IntSet result) { - } + @Override + public void execute(ReadGraphImpl graph, IntSet result) { + } + + @Override + public void exception(ReadGraphImpl graph, Throwable throwable) { + } - @Override - public void exception(ReadGraphImpl graph, Throwable throwable) { - } - }; - - // Search for one statement - final static public void computeFunctionalIndex(ReadGraphImpl graph, final int r1, final int r2, final Statements parent, final RelationInfo ri, final TripleIntProcedure procedure) throws DatabaseException { - + + // Search for one statement + final static public void computeFunctionalIndex(ReadGraphImpl graph, final int r1, final int r2, final Statements parent, final RelationInfo ri, final TripleIntProcedure procedure) throws DatabaseException { + if(ri.isFinal) { - - int result = graph.processor.querySupport.getFunctionalObject(r1, r2); - if(result == 0) { + int result = graph.processor.querySupport.getFunctionalObject(r1, r2); - // Check for assertions - forSingleAssertion(graph, r1, r2, parent, procedure); + if(result == 0) { - } else if(result == -1) { + // Check for assertions + forSingleAssertion(graph, r1, r2, parent, procedure); - graph.processor.querySupport.getObjects(graph, r1, r2, new IntProcedure() { + } else if(result == -1) { + + graph.processor.querySupport.getObjects(graph, r1, r2, new IntProcedure() { + + @Override + public void execute(ReadGraphImpl graph, int i) throws DatabaseException { + procedure.execute(graph, r1, r2, i); + } - @Override - public void execute(ReadGraphImpl graph, int i) throws DatabaseException { - procedure.execute(graph, r1, r2, i); - } + @Override + public void exception(ReadGraphImpl graph, Throwable t) { + if(DebugException.DEBUG) new DebugException(t).printStackTrace(); + } - @Override - public void exception(ReadGraphImpl graph, Throwable t) { - if(DebugException.DEBUG) new DebugException(t).printStackTrace(); - } + @Override + public void finished(ReadGraphImpl graph) { + } - @Override - public void finished(ReadGraphImpl graph) { - } + }); - }); + // Check for assertions + forSingleAssertion(graph, r1, r2, parent, procedure); - // Check for assertions - forSingleAssertion(graph, r1, r2, parent, procedure); - - } else { + } else { - // If functional relation was found there is no need to check assertions + // If functional relation was found there is no need to check assertions procedure.execute(graph, r1, r2, result); procedure.finished(graph); - - } - + } + + } else { - - final AtomicBoolean found = new AtomicBoolean(false); - + // Note! The dependency is intentionally cut! IntSet direct = QueryCache.resultDirectPredicates(graph, r1, null, null); direct.forEach(graph, new SyncIntProcedure() { - + + /* + * 0 = not found + * 1 = found + * 2 = exception + */ + int found = 0; + @Override public void run(ReadGraphImpl graph) throws DatabaseException { - - if(found.get()) { - procedure.finished(graph); - } else { + + if(found == 1) { + + procedure.finished(graph); + + } else if(found == 0) { + // Check for assertions forSingleAssertion(graph, r1, r2, parent, procedure); + } - + } @Override public void execute(ReadGraphImpl graph, final int pred) throws DatabaseException { - - if(found.get()) return; + + if(found > 0) + return; if(pred == r2) { - - inc(); - + // Note! The dependency is intentionally cut! QueryCache.runnerDirectObjects(graph, r1, pred, null, null, new IntProcedure() { @Override public void execute(ReadGraphImpl graph, int i) throws DatabaseException { - - if(found.compareAndSet(false, true)) { + + if(found == 0) { + procedure.execute(graph, r1, pred, i); - } else { - ManyObjectsForFunctionalRelationException exception = new ManyObjectsForFunctionalRelationException("Functional relation has more than one statement.", r1); - procedure.exception(graph, exception); - } + found = 1; + + } else { + + ManyObjectsForFunctionalRelationException exception = new ManyObjectsForFunctionalRelationException("Functional relation has more than one statement.", r1); + procedure.exception(graph, exception); + found = 2; + + } } @Override public void finished(ReadGraphImpl graph) throws DatabaseException { - dec(graph); } - - @Override - public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { - procedure.exception(graph, t); - dec(graph); - } + + @Override + public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { + + procedure.exception(graph, t); + found = 2; + + } }); } else { - - inc(); - + QueryCache.runnerSuperRelations(graph, pred, parent, null, new InternalProcedure() { - + @Override public void execute(ReadGraphImpl graph, IntSet result) throws DatabaseException { - - if(found.get()) { - dec(graph); + + if(found > 0) return; - } if(result.contains(r2)) { - + inc(); - + // Note! The dependency is intentionally cut! QueryCache.runnerDirectObjects(graph, r1, pred, null, null, new IntProcedure() { - + @Override public void execute(ReadGraphImpl graph, int i) throws DatabaseException { - - if(found.compareAndSet(false, true)) { - procedure.execute(graph, r1, pred, i); - } else { - ManyObjectsForFunctionalRelationException exception = new ManyObjectsForFunctionalRelationException("Functional relation has more than one statement.", r1); - procedure.exception(graph, exception); - } - + + if(found == 0) { + + procedure.execute(graph, r1, pred, i); + found = 1; + + } else { + + ManyObjectsForFunctionalRelationException exception = new ManyObjectsForFunctionalRelationException("Functional relation has more than one statement (r1=" + r1 + ", r2=" + r2 + ").", r1); + procedure.exception(graph, exception); + found = 2; + + } + } - + @Override public void finished(ReadGraphImpl graph) throws DatabaseException { - dec(graph); } - - @Override - public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { - procedure.exception(graph, t); - dec(graph); - } + + @Override + public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { + procedure.exception(graph, t); + found = 2; + } }); - + } - - dec(graph); - + + } + + @Override + public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { + procedure.exception(graph, t); + found = 2; } - - @Override - public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { - procedure.exception(graph, t); - dec(graph); - } }); - + } - + } @Override public void finished(ReadGraphImpl graph) throws DatabaseException { dec(graph); } - + }); - + } - } - + } + final static private void forAssertions(ReadGraphImpl graph, final int r1, final int r2, final Statements parent, final TripleIntProcedure procedure) throws DatabaseException { - QueryCache.runnerPrincipalTypes(graph, r1, parent, null, new SyncIntProcedure() { - + QueryCache.runnerPrincipalTypes(graph, r1, parent, null, new SyncIntProcedure() { + @Override public void run(ReadGraphImpl graph) throws DatabaseException { procedure.finished(graph); } - + TripleIntProcedure proc = new TripleIntProcedureAdapter() { @Override public void execute(ReadGraphImpl graph, int s, int p, int o) throws DatabaseException { - procedure.execute(graph, s, p, o); + procedure.execute(graph, s, p, o); } @Override public void finished(ReadGraphImpl graph) throws DatabaseException { dec(graph); } - - @Override - public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { + + @Override + public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { dec(graph); - procedure.exception(graph, t); - } + procedure.exception(graph, t); + } }; @@ -442,57 +454,57 @@ public final class Statements extends CollectionBinaryQuery inc(); QueryCache.runnerAssertedStatements(graph, type, r2, parent, null, proc); } - + @Override public void finished(ReadGraphImpl graph) throws DatabaseException { dec(graph); } - + @Override public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { dec(graph); } - + }); - + } - final static public void computeNotFunctionalIndex(ReadGraphImpl graph, final int r1, final int r2, final Statements parent, final RelationInfo ri, final TripleIntProcedure procedure) throws DatabaseException { + final static public void computeNotFunctionalIndex(ReadGraphImpl graph, final int r1, final int r2, final Statements parent, final RelationInfo ri, final TripleIntProcedure procedure) throws DatabaseException { - if(ri.isFinal) { + if(ri.isFinal) { - graph.processor.querySupport.getObjects(graph, r1, r2, new IntProcedure() { + graph.processor.querySupport.getObjects(graph, r1, r2, new IntProcedure() { - @Override - public void execute(ReadGraphImpl graph, int i) throws DatabaseException { - procedure.execute(graph, r1, r2, i); - } + @Override + public void execute(ReadGraphImpl graph, int i) throws DatabaseException { + procedure.execute(graph, r1, r2, i); + } - @Override - public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { - if(DebugException.DEBUG) new DebugException(t).printStackTrace(); - procedure.exception(graph, t); - } + @Override + public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { + if(DebugException.DEBUG) new DebugException(t).printStackTrace(); + procedure.exception(graph, t); + } - @Override - public void finished(ReadGraphImpl graph) { - } + @Override + public void finished(ReadGraphImpl graph) { + } - }); + }); - if(ri.isAsserted) { - forAssertions(graph, r1, r2, parent, procedure); - } else { - procedure.finished(graph); - } + if(ri.isAsserted) { + forAssertions(graph, r1, r2, parent, procedure); + } else { + procedure.finished(graph); + } } else { // Note! The dependency is intentionally cut! IntSet direct = QueryCache.resultDirectPredicates(graph, r1, null, null); direct.forEach(graph, new SyncIntProcedure() { - + @Override public void run(ReadGraphImpl graph) throws DatabaseException { forAssertions(graph, r1, r2, parent, procedure); @@ -502,36 +514,30 @@ public final class Statements extends CollectionBinaryQuery public void execute(ReadGraphImpl graph, final int pred2) throws DatabaseException { if(pred2 == r2) { - - inc(); - + // Note! The dependency is intentionally cut! QueryCache.runnerDirectObjects(graph, r1, pred2, null, null, new IntProcedure() { @Override public void execute(ReadGraphImpl graph, int i) throws DatabaseException { - procedure.execute(graph, r1, pred2, i); + procedure.execute(graph, r1, pred2, i); } @Override public void finished(ReadGraphImpl graph) throws DatabaseException { - dec(graph); } - - @Override - public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { - procedure.exception(graph, t); - dec(graph); - } + + @Override + public void exception(ReadGraphImpl graph, Throwable t) throws DatabaseException { + procedure.exception(graph, t); + } }); } else { - -// inc(); try { - + IntSet result = QueryCache.resultSuperRelations(graph, pred2, parent, null); if(result.contains(r2)) { @@ -560,30 +566,30 @@ public final class Statements extends CollectionBinaryQuery }); } - + } catch (Throwable e) { procedure.exception(graph, e); } } - + } @Override public void finished(ReadGraphImpl graph) throws DatabaseException { dec(graph); } - + }); - + } - + } - + public static void computeForEach(ReadGraphImpl graph, final int r1, final int r2, final Statements entry, final TripleIntProcedure procedure_) throws DatabaseException { - + TripleIntProcedure procedure = entry != null ? entry : procedure_; - + RelationInfo ri = QueryCache.resultRelationInfoQuery(graph, r2, entry, null); graph.ensureLoaded(r1, r2); if(ri.isFunctional) { @@ -593,16 +599,16 @@ public final class Statements extends CollectionBinaryQuery } if(entry != null) entry.performFromCache(graph, procedure_); - + } - + @Override public String toString() { - return "Statements[" + r1() + " - " + r2() + "]"; + return "Statements[" + r1() + " - " + r2() + "]"; } final private void finish(ReadGraphImpl graph, TripleIntProcedure procedure) throws DatabaseException { - + assert(assertPending()); synchronized(this) { @@ -614,95 +620,95 @@ public final class Statements extends CollectionBinaryQuery final IntArray value = (IntArray)getResult(); for(int i=0;i>>32); } - + final static public int r2(long id) { return (int)id; } - + final public void addOrSetFunctional(int s, long po) { - - addOrSetFunctional(s, r1(po), r2(po)); - + + addOrSetFunctional(s, r1(po), r2(po)); + } final public void addOrSetFunctional(int s, int p, int o) { - - assert(assertPending()); - - IntArray value = (IntArray)getResult(); + + assert(assertPending()); + + IntArray value = (IntArray)getResult(); value.add(s); value.add(p); value.add(o); - + } - + @Override public Object performFromCache(ReadGraphImpl graph, final TripleIntProcedure procedure) throws DatabaseException { - assert(isReady()); + assert(isReady()); final IntArray value = (IntArray)getResult(); - if(handleException(graph, procedure)) return value; - + if(handleException(graph, procedure)) return value; + for(int i=0;i public void exception(ReadGraphImpl graph, Throwable throwable) throws DatabaseException { except(throwable); } - + } diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/StatementsFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/StatementsFactory.java new file mode 100644 index 000000000..7639235d6 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/StatementsFactory.java @@ -0,0 +1,21 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; + +public class StatementsFactory extends QueryFactoryBase { + + @Override + public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException { + Statements result = reference(deserializer); + IntArray ia = IntArray.deserialize(deserializer); + result.setResult(ia); + result.setReady(); + return result; + } + + @Override + public T reference(QueryDeserializer deserializer) throws DatabaseException { + return (T)deserializer.readStatements(); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/SuperRelations.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/SuperRelations.java index 1f540062e..5c6e8e439 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/SuperRelations.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/SuperRelations.java @@ -21,7 +21,7 @@ import org.simantics.db.impl.procedure.InternalProcedure; import gnu.trove.procedure.TIntProcedure; import gnu.trove.set.hash.TIntHashSet; -public final class SuperRelations extends UnaryQueryP { +public final class SuperRelations extends UnaryQueryPIntSet { SuperRelations(final int resource) { super(resource); diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/SuperRelationsFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/SuperRelationsFactory.java new file mode 100644 index 000000000..9011b4606 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/SuperRelationsFactory.java @@ -0,0 +1,21 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; + +public class SuperRelationsFactory extends QueryFactoryBase { + + @Override + public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException { + SuperRelations result = reference(deserializer); + IntSet ia = IntSet.deserialize(deserializer); + result.setResult(ia); + result.setReady(); + return result; + } + + @Override + public T reference(QueryDeserializer deserializer) throws DatabaseException { + return (T)deserializer.readSuperRelations(); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/SuperTypes.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/SuperTypes.java index a02fda462..f3dc03e14 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/SuperTypes.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/SuperTypes.java @@ -17,7 +17,7 @@ import org.simantics.db.impl.procedure.InternalProcedure; import gnu.trove.procedure.TIntProcedure; -public final class SuperTypes extends UnaryQueryP { +public final class SuperTypes extends UnaryQueryPIntSet { SuperTypes(int resource) { super(resource); diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/SuperTypesFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/SuperTypesFactory.java new file mode 100644 index 000000000..edb82ef83 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/SuperTypesFactory.java @@ -0,0 +1,21 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; + +public class SuperTypesFactory extends QueryFactoryBase { + + @Override + public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException { + SuperTypes result = reference(deserializer); + IntSet ia = IntSet.deserialize(deserializer); + result.setResult(ia); + result.setReady(); + return result; + } + + @Override + public T reference(QueryDeserializer deserializer) throws DatabaseException { + return (T)deserializer.readSuperTypes(); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/TaskList.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/TaskList.java new file mode 100644 index 000000000..7734bae77 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/TaskList.java @@ -0,0 +1,24 @@ +package org.simantics.db.impl.query; + +import java.util.ArrayList; + +class TaskList extends ArrayList { + + private static final long serialVersionUID = -8047504882681478972L; + + private int maxSize; + + TaskList(int maxSize) { + this.maxSize = maxSize; + } + + boolean shouldSchedule() { + return size() == maxSize; + } + + void reset() { + clear(); + maxSize = 1; + } + +} \ No newline at end of file diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/TypeHierarchy.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/TypeHierarchy.java index 5c2be0c64..323bbd42d 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/TypeHierarchy.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/TypeHierarchy.java @@ -18,7 +18,7 @@ import org.simantics.db.procedure.ListenerBase; import gnu.trove.procedure.TIntProcedure; -public final class TypeHierarchy extends UnaryQueryP { +public final class TypeHierarchy extends UnaryQueryPIntSet { TypeHierarchy(int resource) { super(resource); diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/TypeHierarchyFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/TypeHierarchyFactory.java new file mode 100644 index 000000000..d8120b7f2 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/TypeHierarchyFactory.java @@ -0,0 +1,21 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; + +public class TypeHierarchyFactory extends QueryFactoryBase { + + @Override + public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException { + TypeHierarchy result = reference(deserializer); + IntSet ia = IntSet.deserialize(deserializer); + result.setResult(ia); + result.setReady(); + return result; + } + + @Override + public T reference(QueryDeserializer deserializer) throws DatabaseException { + return (T)deserializer.readTypeHierarchy(); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/Types.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/Types.java index a9fe36bc6..bb0d11a24 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/Types.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/Types.java @@ -19,7 +19,7 @@ import org.simantics.db.impl.procedure.InternalProcedure; import gnu.trove.procedure.TIntProcedure; -public final class Types extends UnaryQueryP { +public final class Types extends UnaryQueryPIntSet { Types(int resource) { super(resource); diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/TypesFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/TypesFactory.java new file mode 100644 index 000000000..014b0eecd --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/TypesFactory.java @@ -0,0 +1,21 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; + +public class TypesFactory extends QueryFactoryBase { + + @Override + public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException { + Types result = reference(deserializer); + IntSet ia = IntSet.deserialize(deserializer); + result.setResult(ia); + result.setReady(); + return result; + } + + @Override + public T reference(QueryDeserializer deserializer) throws DatabaseException { + return (T)deserializer.readTypes(); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/URIToResource.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/URIToResource.java index ec7ebeed7..9dae343e3 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/URIToResource.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/URIToResource.java @@ -144,4 +144,20 @@ public class URIToResource extends StringQuery> imple except(throwable); } + @Override + public long cluster(QueryProcessor processor) { + return 0; + } + + @Override + public void serializeKey(QuerySerializer serializer) { + serializer.addString(id); + } + + @Override + public void serializeValue(QuerySerializer serializer) { + Integer value = getResult(); + serializer.addResource(value); + } + } diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/URIToResourceFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/URIToResourceFactory.java new file mode 100644 index 000000000..ca82ff647 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/URIToResourceFactory.java @@ -0,0 +1,21 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; + +public class URIToResourceFactory extends QueryFactoryBase { + + @Override + public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException { + URIToResource result = reference(deserializer); + int value = deserializer.readResource(); + result.setResult(value); + result.setReady(); + return result; + } + + @Override + public T reference(QueryDeserializer deserializer) throws DatabaseException { + return (T)deserializer.readURIToResource(); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/UnaryQuery.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/UnaryQuery.java index fd6cd7d87..fe24846aa 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/UnaryQuery.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/UnaryQuery.java @@ -15,6 +15,8 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.impl.graph.ReadGraphImpl; import org.simantics.db.request.RequestFlags; +import gnu.trove.list.array.TByteArrayList; + public abstract class UnaryQuery extends CacheEntryBase implements Query { final public int id; @@ -68,4 +70,14 @@ public abstract class UnaryQuery extends CacheEntryBase im return graph.processor.isImmutable(id); } + @Override + public long cluster(QueryProcessor processor) { + return processor.cluster(id); + } + + @Override + public void serializeKey(QuerySerializer serializer) { + serializer.addResource(id); + } + } diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/UnaryQueryPIntSet.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/UnaryQueryPIntSet.java new file mode 100644 index 000000000..cf824790a --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/UnaryQueryPIntSet.java @@ -0,0 +1,15 @@ +package org.simantics.db.impl.query; + +abstract public class UnaryQueryPIntSet extends UnaryQueryP { + + public UnaryQueryPIntSet(int r) { + super(r); + } + + @Override + public void serializeValue(QuerySerializer serializer) { + IntSet is = getResult(); + is.serialize(serializer); + } + +} diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ValueQuery.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ValueQuery.java index ad4017f9c..f04df9f68 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ValueQuery.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ValueQuery.java @@ -45,6 +45,17 @@ public final class ValueQuery extends UnaryQueryP { return value; } + + @Override + public void serializeValue(QuerySerializer serializer) { + byte[] result = getResult(); + if(result == null) { + serializer.writeLE(-1); + } else { + serializer.writeLE(result.length); + serializer.add(result); + } + } @Override public String toString() { diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ValueQueryFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ValueQueryFactory.java new file mode 100644 index 000000000..4a746fda1 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ValueQueryFactory.java @@ -0,0 +1,21 @@ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; + +public class ValueQueryFactory extends QueryFactoryBase { + + @Override + public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException { + ValueQuery result = reference(deserializer); + byte[] bytes = deserializer.readByteArray(); + result.setResult(bytes); + result.setReady(); + return result; + } + + @Override + public T reference(QueryDeserializer deserializer) throws DatabaseException { + return (T)deserializer.readValueQuery(); + } + +} diff --git a/bundles/org.simantics.db.indexing/.classpath b/bundles/org.simantics.db.indexing/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.db.indexing/.classpath +++ b/bundles/org.simantics.db.indexing/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.db.indexing/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.db.indexing/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.db.indexing/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.db.indexing/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.db.indexing/META-INF/MANIFEST.MF b/bundles/org.simantics.db.indexing/META-INF/MANIFEST.MF index 501876664..0655ab922 100644 --- a/bundles/org.simantics.db.indexing/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.db.indexing/META-INF/MANIFEST.MF @@ -10,8 +10,8 @@ Require-Bundle: org.eclipse.core.runtime, org.apache.lucene4.queryparser;bundle-version="4.9.0", org.apache.lucene4.analyzers-common;bundle-version="4.9.0", org.simantics.db.services;bundle-version="0.8.0", - org.slf4j.api;bundle-version="1.7.25" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 + org.slf4j.api +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.db.indexing Bundle-Activator: org.simantics.db.indexing.Activator Bundle-ActivationPolicy: lazy diff --git a/bundles/org.simantics.db.layer0/.classpath b/bundles/org.simantics.db.layer0/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.db.layer0/.classpath +++ b/bundles/org.simantics.db.layer0/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.db.layer0/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.db.layer0/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.db.layer0/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.db.layer0/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.db.layer0/META-INF/MANIFEST.MF b/bundles/org.simantics.db.layer0/META-INF/MANIFEST.MF index 28801e278..17fc2ed8c 100644 --- a/bundles/org.simantics.db.layer0/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.db.layer0/META-INF/MANIFEST.MF @@ -3,13 +3,12 @@ Bundle-ManifestVersion: 2 Bundle-Name: Layer0 Database Utils Bundle-SymbolicName: org.simantics.db.layer0;singleton:=true Bundle-Version: 1.1.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: gnu.trove3;bundle-version="3.0.3", org.eclipse.core.runtime;bundle-version="3.5.0", org.simantics.databoard;bundle-version="0.6.2";visibility:=reexport, org.simantics.db.services;bundle-version="1.1.0";visibility:=reexport, org.simantics.db.management;bundle-version="1.1.0", - org.apache.log4j;bundle-version="1.2.15", org.apache.commons.io;bundle-version="1.4.0", org.simantics.layer0;bundle-version="1.0.0";visibility:=reexport, org.simantics.graph.db;bundle-version="1.1.5";visibility:=reexport, diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/ContextualRelatedValue.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/ContextualRelatedValue.java index 517ce761e..6ad6315b9 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/ContextualRelatedValue.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/ContextualRelatedValue.java @@ -27,41 +27,43 @@ import org.simantics.scl.runtime.function.FunctionImpl3; */ public abstract class ContextualRelatedValue implements ConverterComputationalValue { - @SuppressWarnings("unchecked") - @Override - public T getValue(ReadGraph graph, Resource resource) throws DatabaseException { - return (T) new FunctionImpl3() { - @Override - public Object apply(ReadGraph graph, Resource converter, Object context) { - SCLContext sclContext = SCLContext.getCurrent(); - Object oldGraph = sclContext.get("graph"); - try { - if (context instanceof Variable) { - Variable variable = (Variable)context; - try { - Function1 fn = getFunction(graph, variable.getParent(graph).getRepresents(graph), variable.getRepresents(graph), variable.getPredicateResource(graph)); - sclContext.put("graph", graph); - return fn.apply(variable); - } catch (DatabaseException e) { - throw new RuntimeDatabaseException(e); - } - } if (context instanceof Resource) { - Resource resource = (Resource)context; - try { - // Here converter is the object and context is the subject - Function1 fn = getFunction(graph, resource, converter, null); - return fn.apply(resource); - } catch (DatabaseException e) { - throw new RuntimeDatabaseException(e); - } - } else { - throw new IllegalStateException("Unknown context " + context); + private final FunctionImpl3 function = new FunctionImpl3() { + @Override + public Object apply(ReadGraph graph, Resource converter, Object context) { + SCLContext sclContext = SCLContext.getCurrent(); + Object oldGraph = sclContext.get("graph"); + try { + if (context instanceof Variable) { + Variable variable = (Variable)context; + try { + Function1 fn = getFunction(graph, variable.getParent(graph).getRepresents(graph), variable.getRepresents(graph), variable.getPredicateResource(graph)); + sclContext.put("graph", graph); + return fn.apply(variable); + } catch (DatabaseException e) { + throw new RuntimeDatabaseException(e); + } + } if (context instanceof Resource) { + Resource resource = (Resource)context; + try { + // Here converter is the object and context is the subject + Function1 fn = getFunction(graph, resource, converter, null); + return fn.apply(resource); + } catch (DatabaseException e) { + throw new RuntimeDatabaseException(e); } - } finally { - sclContext.put("graph", oldGraph); + } else { + throw new IllegalStateException("Unknown context " + context); } + } finally { + sclContext.put("graph", oldGraph); } - }; + } + }; + + @SuppressWarnings("unchecked") + @Override + public T getValue(ReadGraph graph, Resource resource) throws DatabaseException { + return (T) function; } } diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/function/All.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/function/All.java index 4e775e08a..671810d8e 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/function/All.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/function/All.java @@ -36,7 +36,6 @@ import org.simantics.db.common.uri.UnescapedChildMapOfResource; import org.simantics.db.common.utils.CommonDBUtils; import org.simantics.db.common.utils.Functions; import org.simantics.db.common.utils.ListUtils; -import org.simantics.db.common.utils.Logger; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.common.utils.NearestOwnerFinder; import org.simantics.db.common.validation.L0Validations; @@ -92,15 +91,19 @@ import org.simantics.simulator.variable.exceptions.NodeManagerException; import org.simantics.utils.Development; import org.simantics.utils.datastructures.Pair; import org.simantics.utils.strings.StringInputValidator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import gnu.trove.map.hash.THashMap; import gnu.trove.set.hash.THashSet; public class All { - public static Object standardGetValue1(ReadGraph graph, Variable context) throws DatabaseException { + private static final Logger LOGGER = LoggerFactory.getLogger(All.class); - StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; + public static Object standardGetValue1(ReadGraph graph, Variable context) throws DatabaseException { + + StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; // First from node if(variable.node != null) { @@ -108,59 +111,61 @@ public class All { if(Variables.PENDING_NODE_VALUE == value) throw new PendingVariableException(""); return value.getValue(); } - - try { + + try { if(variable.property.hasEnumerationRange) { - Resource object = variable.getRepresents(graph); - if(graph.sync(new IsEnumeratedValue(object))) { - Layer0 L0 = Layer0.getInstance(graph); - if(graph.isInstanceOf(object, L0.Literal)) { - return graph.getValue(object); - } else { - String label = graph.getPossibleRelatedValue2(variable.getRepresents(graph), L0.HasLabel, Bindings.STRING); - if(label == null) label = graph.getPossibleRelatedValue(variable.getRepresents(graph), L0.HasName, Bindings.STRING); - if(label == null) label = ""; - return label; - } - } + Resource object = variable.getRepresents(graph); + if(graph.sync(new IsEnumeratedValue(object))) { + Layer0 L0 = Layer0.getInstance(graph); + if(graph.isInstanceOf(object, L0.Literal)) { + return graph.getValue(object); + } else { + String label = graph.getPossibleRelatedValue2(variable.getRepresents(graph), L0.HasLabel, Bindings.STRING); + if(label == null) label = graph.getPossibleRelatedValue(variable.getRepresents(graph), L0.HasName, Bindings.STRING); + if(label == null) label = ""; + return label; + } + } } - + if (variable.isAsserted()) { - if (variable.parentResource != null) { - Map> assertions = graph.syncRequest( - new UnescapedAssertedPropertyMapOfResource(variable.parentResource), - TransientCacheAsyncListener.instance()); - - // NOTE: This optimization assumes the property - // variable's representation is the asserted object. - Resource object = variable.getPossibleRepresents(graph); - if (object != null) { - return graph.getValue2(object, variable); - } else { - for (Pair assertion : assertions.values()) { - if (assertion.first.predicate.equals(variable.property.predicate)) { - return graph.getValue2(assertion.second, variable); - } - } - } - } + if (variable.parentResource != null) { + Map> assertions = graph.syncRequest( + new UnescapedAssertedPropertyMapOfResource(variable.parentResource), + TransientCacheAsyncListener.instance()); + + // NOTE: This optimization assumes the property + // variable's representation is the asserted object. + Resource object = variable.getPossibleRepresents(graph); + if (object != null) { + return graph.getValue2(object, variable); + } else { + for (Pair assertion : assertions.values()) { + if (assertion.first.predicate.equals(variable.getPossiblePredicateResource(graph))) { + return graph.getValue2(assertion.second, variable); + } + } + } + } } - - return graph.getValue2(variable.getRepresents(graph), variable); - - } catch (NoSingleResultException e) { - throw new MissingVariableValueException(variable.getPossibleURI(graph), e); - } catch (DoesNotContainValueException e) { - throw new MissingVariableValueException(variable.getPossibleURI(graph), e); - } catch (DatabaseException e) { - throw new MissingVariableValueException(variable.getPossibleURI(graph), e); - } - - } - - public static Object standardGetValue2(ReadGraph graph, Variable context, Binding binding) throws DatabaseException { - StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; + + return graph.getValue2(variable.getRepresents(graph), variable); + + } catch (PendingVariableException e) { + throw e; + } catch (NoSingleResultException e) { + throw new MissingVariableValueException(variable.getPossibleURI(graph), e); + } catch (DoesNotContainValueException e) { + throw new MissingVariableValueException(variable.getPossibleURI(graph), e); + } catch (DatabaseException e) { + throw new MissingVariableValueException(variable.getPossibleURI(graph), e); + } + + } + + public static Object standardGetValue2(ReadGraph graph, Variable context, Binding binding) throws DatabaseException { + StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; // First from node if(variable.node != null) { @@ -173,61 +178,61 @@ public class All { throw new AdaptionException("Could not get value for " + context.getURI(graph), e); } } - - try { - - if(variable.property.hasEnumerationRange) { - Resource object = variable.getRepresents(graph); - if(graph.sync(new IsEnumeratedValue(object))) { - Layer0 L0 = Layer0.getInstance(graph); - if(graph.isInstanceOf(object, L0.Literal)) { - return graph.getValue(object, binding); - } else { - return graph.getRelatedValue2(variable.getRepresents(graph), L0.HasLabel, binding); - } - } + + try { + + if(variable.property.hasEnumerationRange) { + Resource object = variable.getRepresents(graph); + if(graph.sync(new IsEnumeratedValue(object))) { + Layer0 L0 = Layer0.getInstance(graph); + if(graph.isInstanceOf(object, L0.Literal)) { + return graph.getValue(object, binding); + } else { + return graph.getRelatedValue2(variable.getRepresents(graph), L0.HasLabel, binding); + } + } } - - if (variable.isAsserted()) { - if (variable.parentResource != null) { - Map> assertions = graph.syncRequest( - new UnescapedAssertedPropertyMapOfResource(variable.parentResource), - TransientCacheAsyncListener.instance()); - - // NOTE: This optimization assumes the property - // variable's representation is the asserted object. - Resource object = variable.getPossibleRepresents(graph); - if (object != null) { - return graph.getValue2(object, variable, binding); - } else { - for (Pair assertion : assertions.values()) { - if (assertion.first.predicate.equals(variable.property.predicate)) { - return graph.getValue2(assertion.second, variable, binding); - } - } - } - } - } - - return graph.getValue2(variable.getRepresents(graph), context, binding); - - } catch (NoSingleResultException e) { - throw new MissingVariableValueException(variable.getPossibleURI(graph)); - } catch (DoesNotContainValueException e) { - throw new MissingVariableValueException(variable.getPossibleURI(graph)); - } catch (DatabaseException e) { - throw new MissingVariableValueException(variable.getPossibleURI(graph), e); - } - - } - - public static void standardSetValue2(WriteGraph graph, Variable context, final Object value) throws DatabaseException { - - if(context instanceof StandardGraphPropertyVariable) { - - final StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; - - // First from node + + if (variable.isAsserted()) { + if (variable.parentResource != null) { + Map> assertions = graph.syncRequest( + new UnescapedAssertedPropertyMapOfResource(variable.parentResource), + TransientCacheAsyncListener.instance()); + + // NOTE: This optimization assumes the property + // variable's representation is the asserted object. + Resource object = variable.getPossibleRepresents(graph); + if (object != null) { + return graph.getValue2(object, variable, binding); + } else { + for (Pair assertion : assertions.values()) { + if (assertion.first.predicate.equals(variable.getPossiblePredicateResource(graph))) { + return graph.getValue2(assertion.second, variable, binding); + } + } + } + } + } + + return graph.getValue2(variable.getRepresents(graph), context, binding); + + } catch (NoSingleResultException e) { + throw new MissingVariableValueException(variable.getPossibleURI(graph)); + } catch (DoesNotContainValueException e) { + throw new MissingVariableValueException(variable.getPossibleURI(graph)); + } catch (DatabaseException e) { + throw new MissingVariableValueException(variable.getPossibleURI(graph), e); + } + + } + + public static void standardSetValue2(WriteGraph graph, Variable context, final Object value) throws DatabaseException { + + if(context instanceof StandardGraphPropertyVariable) { + + final StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; + + // First from node if(variable.node != null) { final Binding binding = Layer0Utils.getDefaultBinding(graph, variable); @@ -243,8 +248,8 @@ public class All { } catch (NodeManagerException e) { throw new RuntimeException(e); } catch (BindingException e) { - throw new RuntimeException(e); - } + throw new RuntimeException(e); + } } }); } catch(RuntimeException e) { @@ -262,31 +267,31 @@ public class All { return; } - - } - - Function4 modifier = context.getPossiblePropertyValue(graph, Variables.INPUT_MODIFIER); - if(modifier == null) modifier = VariableUtils.defaultInputModifier; - try { - modifier.apply(graph, context, value, Bindings.getBinding(value.getClass())); - } catch (BindingConstructionException e) { - throw new org.simantics.db.exception.BindingException("",e); - } - } + } + + Function4 modifier = context.getPossiblePropertyValue(graph, Variables.INPUT_MODIFIER); + if(modifier == null) modifier = VariableUtils.defaultInputModifier; + try { + modifier.apply(graph, context, value, Bindings.getBinding(value.getClass())); + } catch (BindingConstructionException e) { + throw new org.simantics.db.exception.BindingException("",e); + } + + } - public static void standardSetValue3(final WriteGraph graph, Variable context, final Object value, final Binding binding) throws DatabaseException { + public static void standardSetValue3(final WriteGraph graph, Variable context, final Object value, final Binding binding) throws DatabaseException { // First from node if(context instanceof StandardGraphPropertyVariable) { final StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; - + // First from node if(variable.node != null) { - + try { - + variable.node.support.manager.getRealm().syncExec(new Runnable() { @Override @@ -297,42 +302,42 @@ public class All { ExternalSetValue ext = new ExternalSetValue(variable.node.support.manager, variable.node.node, oldValue, value, binding); graph.getService(UndoRedoSupport.class).addExternalOperation(graph, ext); } catch (NodeManagerException | BindingException e) { - Logger.defaultLogError(e); + LOGGER.error("Error setting value", e); } } - + }); - + return; - + } catch (InterruptedException e) { throw new DatabaseException(e); } - + } - + } - - Function4 modifier = context.getPossiblePropertyValue(graph, Variables.INPUT_MODIFIER); - if(modifier == null) modifier = VariableUtils.defaultInputModifier; - modifier.apply(graph, context, value, binding); - - } - - public static Datatype getDatatypeFromValue(ReadGraph graph, Variable context) throws DatabaseException { - if (context instanceof AbstractVariable) { - Binding defaultBinding = ((AbstractVariable)context).getPossibleDefaultBinding(graph); - if (defaultBinding != null) - return defaultBinding.type(); - } - - Variant value = context.getVariantValue(graph); - if (value.getBinding() == null) - throw new DatabaseException("No value binding for " + context.getURI(graph)); - - return value.getBinding().type(); - } + + Function4 modifier = context.getPossiblePropertyValue(graph, Variables.INPUT_MODIFIER); + if(modifier == null) modifier = VariableUtils.defaultInputModifier; + modifier.apply(graph, context, value, binding); + + } + + public static Datatype getDatatypeFromValue(ReadGraph graph, Variable context) throws DatabaseException { + if (context instanceof AbstractVariable) { + Binding defaultBinding = ((AbstractVariable)context).getPossibleDefaultBinding(graph); + if (defaultBinding != null) + return defaultBinding.type(); + } + + Variant value = context.getVariantValue(graph); + if (value.getBinding() == null) + throw new DatabaseException("No value binding for " + context.getURI(graph)); + + return value.getBinding().type(); + } @SuppressWarnings("rawtypes") private static class DatatypeGetter implements VariableNodeReadRunnable { @@ -360,25 +365,25 @@ public class All { } public static Datatype standardGetDatatype(ReadGraph graph, Variable context) throws DatabaseException { - if (context instanceof AbstractVariable) { - final AbstractVariable variable = (AbstractVariable)context; - if (variable.node != null) { - try { - DatatypeGetter request = new DatatypeGetter(variable.node); - - variable.node.support.manager.getRealm().syncExec(request); - - if (request.exception != null) - throw new DatabaseException(request.exception); - - return request.type; - } catch (InterruptedException e) { - } - } - } - - return getDatatypeFromValue(graph, context); - } + if (context instanceof AbstractVariable) { + final AbstractVariable variable = (AbstractVariable)context; + if (variable.node != null) { + try { + DatatypeGetter request = new DatatypeGetter(variable.node); + + variable.node.support.manager.getRealm().syncExec(request); + + if (request.exception != null) + throw new DatabaseException(request.exception); + + return request.type; + } catch (InterruptedException e) { + } + } + } + + return getDatatypeFromValue(graph, context); + } // @SCLValue(type = "ValueAccessor") // public static ValueAccessor standardValueAccessor = new ValueAccessor() { @@ -409,54 +414,54 @@ public class All { // } // // }; - - @SCLValue(type = "ValueAccessor") - public static ValueAccessor standardValueAccessor = new ValueAccessor() { - - @Override - public Object getValue(ReadGraph graph, Variable context) throws DatabaseException { - ValueAccessor accessor = getPossibleValueValueAccessor(graph, context); - if(accessor != null) return accessor.getValue(graph, context); - else - return standardGetValue1(graph, context); - } - - @Override - public Object getValue(ReadGraph graph, Variable context, Binding binding) throws DatabaseException { - ValueAccessor accessor = getPossibleValueValueAccessor(graph, context); - if(accessor != null) return accessor.getValue(graph, context, binding); - else - return standardGetValue2(graph, context, binding); - } - - @Override - public void setValue(WriteGraph graph, Variable context, Object value) throws DatabaseException { - ValueAccessor accessor = getPossibleValueValueAccessor(graph, context); - if(accessor != null) accessor.setValue(graph, context, value); - else - standardSetValue2(graph, context, value); - } - - @Override - public void setValue(WriteGraph graph, Variable context, Object value, Binding binding) throws DatabaseException { - ValueAccessor accessor = getPossibleValueValueAccessor(graph, context); - if(accessor != null) accessor.setValue(graph, context, value, binding); - else - standardSetValue3(graph, context, value, binding); - } - - @Override - public Datatype getDatatype(ReadGraph graph, Variable context) - throws DatabaseException { - ValueAccessor accessor = getPossibleValueValueAccessor(graph, context); - if(accessor != null) return accessor.getDatatype(graph, context); - else - return standardGetDatatype(graph, context); - } - - }; - - public static Variable getStandardChildDomainPropertyVariable(ReadGraph graph, Variable context, String name) throws DatabaseException { + + @SCLValue(type = "ValueAccessor") + public static ValueAccessor standardValueAccessor = new ValueAccessor() { + + @Override + public Object getValue(ReadGraph graph, Variable context) throws DatabaseException { + ValueAccessor accessor = getPossibleValueValueAccessor(graph, context); + if(accessor != null) return accessor.getValue(graph, context); + else + return standardGetValue1(graph, context); + } + + @Override + public Object getValue(ReadGraph graph, Variable context, Binding binding) throws DatabaseException { + ValueAccessor accessor = getPossibleValueValueAccessor(graph, context); + if(accessor != null) return accessor.getValue(graph, context, binding); + else + return standardGetValue2(graph, context, binding); + } + + @Override + public void setValue(WriteGraph graph, Variable context, Object value) throws DatabaseException { + ValueAccessor accessor = getPossibleValueValueAccessor(graph, context); + if(accessor != null) accessor.setValue(graph, context, value); + else + standardSetValue2(graph, context, value); + } + + @Override + public void setValue(WriteGraph graph, Variable context, Object value, Binding binding) throws DatabaseException { + ValueAccessor accessor = getPossibleValueValueAccessor(graph, context); + if(accessor != null) accessor.setValue(graph, context, value, binding); + else + standardSetValue3(graph, context, value, binding); + } + + @Override + public Datatype getDatatype(ReadGraph graph, Variable context) + throws DatabaseException { + ValueAccessor accessor = getPossibleValueValueAccessor(graph, context); + if(accessor != null) return accessor.getDatatype(graph, context); + else + return standardGetDatatype(graph, context); + } + + }; + + public static Variable getStandardChildDomainPropertyVariable(ReadGraph graph, Variable context, String name) throws DatabaseException { StandardGraphChildVariable variable = (StandardGraphChildVariable)context; PropertyInfo graphProperty = getPossiblePropertyInfoFromContext(graph, variable, variable.resource, name); return getStandardChildDomainPropertyVariable(graph, context, graphProperty, name); @@ -471,7 +476,7 @@ public class All { return null; } - public static Variable getStandardChildDomainPropertyVariable(ReadGraph graph, Variable context, PropertyInfo graphProperty, String name) throws DatabaseException { + public static Variable getStandardChildDomainPropertyVariable(ReadGraph graph, Variable context, PropertyInfo graphProperty, String name) throws DatabaseException { StandardGraphChildVariable variable = (StandardGraphChildVariable)context; Object propertyNode = getPossibleNodeProperty(graph, variable, name, true); if(graphProperty != null && graphProperty.builder != null) @@ -511,41 +516,41 @@ public class All { } public static Map getStandardChildDomainPropertyVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { - // Get properties with null identification + // Get properties with null identification return getStandardChildDomainPropertyVariables(graph, context, null, map); } public static Map getStandardChildDomainPropertyVariables(ReadGraph graph, Variable context, String classification, Map map) throws DatabaseException { - + StandardGraphChildVariable variable = (StandardGraphChildVariable)context; - + Collection nodeProperties = getPossibleNodeProperties(graph, variable); if(!nodeProperties.isEmpty()) { // Get variables for properties read from the graph Map graphProperties = collectPropertyInfosFromContext(graph, variable, variable.resource); - + Set used = new THashSet(nodeProperties.size()); - + map = ensureVariableMap(map, graphProperties.size() + nodeProperties.size()); - + // Process NodeManager property nodes for(Object nodeProperty : nodeProperties) { - String name = getNodeName(variable, nodeProperty); + String name = getNodeName(variable, nodeProperty); used.add(name); - + PropertyInfo graphProperty = graphProperties.get(name); if(graphProperty != null && graphProperty.builder != null) { if (classification != null && !graphProperty.hasClassification(classification)) continue; - + // Combine with identically named graph property map.put(name, buildPropertyVariable(graph, variable, variable.resource, graphProperty, nodeProperty)); continue; } - + map.put(name, createStandardGraphPropertyVariable(graph, variable, nodeProperty)); } - + // Process graph properties for(PropertyInfo info : graphProperties.values()) { String name = info.name; @@ -556,249 +561,249 @@ public class All { } } return map; - + } else { - if(variable.resource == null) return map; + if(variable.resource == null) return map; + + // Only graph properties + Collection predicates = graph.getPredicates(variable.resource); + if(predicates.isEmpty()) return map; + + map = ensureVariableMap(map, predicates.size()); - // Only graph properties - Collection predicates = graph.getPredicates(variable.resource); - if(predicates.isEmpty()) return map; - - map = ensureVariableMap(map, predicates.size()); - // Process graph properties for(Resource predicate : predicates) { - - PropertyInfo info = //graph.isImmutable(predicate) ? - graph.syncRequest(new PropertyInfoRequest(predicate), TransientCacheAsyncListener.instance());// : - //graph.syncRequest(new PropertyInfoRequest(predicate)); - if(!info.isHasProperty) continue; - + PropertyInfo info = //graph.isImmutable(predicate) ? + graph.syncRequest(new PropertyInfoRequest(predicate), TransientCacheAsyncListener.instance());// : + //graph.syncRequest(new PropertyInfoRequest(predicate)); + + if(!info.isHasProperty) continue; + if (classification != null && !info.hasClassification(classification)) continue; if (info.builder != null) { map.put(info.name, buildPropertyVariable(graph, variable, variable.resource, info, null)); } - + } - + return map; - + } - - } - + + } + @SCLValue(type = "VariableMap") - public static VariableMap standardChildDomainProperties = new VariableMapImpl() { - - @Override - public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException { - return getStandardChildDomainPropertyVariable(graph, context, name); - } - - @Override - public Map getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { - return getStandardChildDomainPropertyVariables(graph, context, map); - } - - }; - + public static VariableMap standardChildDomainProperties = new VariableMapImpl() { + + @Override + public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException { + return getStandardChildDomainPropertyVariable(graph, context, name); + } + + @Override + public Map getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { + return getStandardChildDomainPropertyVariables(graph, context, map); + } + + }; + @SCLValue(type = "VariableMap") - public static VariableMap methodsPropertyDomainProperties = new VariableMapImpl() { - - @Override - public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException { - Variable parent = context.getParent(graph); - Resource container = parent.getPossibleRepresents(graph); - if(container == null) - return null; - Map methods = graph.syncRequest(new UnescapedMethodMapOfResource(container)); - Resource predicate = methods.get(name); - if(predicate != null) { - Layer0 L0 = Layer0.getInstance(graph); - PropertyInfo info = graph.syncRequest(new PropertyInfoRequest(L0.Entity_method)); - Resource value = graph.getSingleObject(container, predicate); - return new StandardGraphPropertyVariable(context, null, container, info, value); - } - return null; - } - - @Override - public Map getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { - Variable parent = context.getParent(graph); - Resource container = parent.getPossibleRepresents(graph); - if(container == null) - return Collections.emptyMap(); - Map methods = graph.syncRequest(new UnescapedMethodMapOfResource(container)); - for(Map.Entry entry : methods.entrySet()) { - String name = entry.getKey(); - Resource predicate = entry.getValue(); - Layer0 L0 = Layer0.getInstance(graph); - PropertyInfo info = graph.syncRequest(new PropertyInfoRequest(L0.Entity_method)); - Resource value = graph.getSingleObject(container, predicate); - if(map == null) map = new HashMap<>(); - map.put(name, new StandardGraphPropertyVariable(context, null, container, info, value)); - } - return map; - } - - }; - - public static Variable getStandardPropertyDomainPropertyVariableFromValue(ReadGraph graph, Variable context, String name) throws DatabaseException { - - if(context instanceof StandardGraphPropertyVariable) { - StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; - Resource literal = variable.getPossibleRepresents(graph); - Object propertyNode = getPossibleNodeProperty(graph, variable, name, false); - - if(literal != null) { - Variable result = getPossiblePropertyFromContext(graph, variable, literal, name, propertyNode); - if(result != null) return result; - } - - Variable result = getPossibleSubliteralPropertyFromContext(graph, variable, name); - if(result != null) return result; - result = getPossiblePropertyFromContext(graph, variable, variable.property.predicate, name, propertyNode); - if (result != null) return result; - - // Get possible property from NodeManager - if (propertyNode != null) - return createStandardGraphPropertyVariable(graph, variable, propertyNode); - return null; - } else if (context instanceof StandardGraphChildVariable) { - return standardChildDomainProperties.getVariable(graph, context, name); - } else { - throw new DatabaseException("Unknown variable implementation " + context.getClass().getCanonicalName()); - } - - } - - public static Map getStandardPropertyDomainPropertyVariablesFromValue(ReadGraph graph, Variable context, Map map) throws DatabaseException { - - if(context instanceof StandardGraphPropertyVariable) { - StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; - map = collectPropertiesFromContext(graph, variable, variable.property.predicate, map); - if (variable.parentResource != null) { - Resource literal = graph.getPossibleObject(variable.parentResource, variable.property.predicate); - if(literal != null) map=collectPropertiesFromContext(graph, variable, literal, map); - map=collectSubliteralProperties(graph, variable, map); - } - - // Get properties from VariableNode - map = getStandardNodePropertyVariables(graph, context, map); - return map; - } else if (context instanceof StandardGraphChildVariable) { - return standardChildDomainProperties.getVariables(graph, context, map); - } else { - throw new DatabaseException("Unknown variable implementation " + context.getClass().getCanonicalName()); - } - - } - - public static Map getStandardPropertyDomainPropertyVariablesFromValue(ReadGraph graph, Variable context, String classification, Map map) throws DatabaseException { - - if(context instanceof StandardGraphPropertyVariable) { - StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; - map = collectPropertiesFromContext(graph, variable, variable.property.predicate, classification, map); - if (variable.parentResource != null) { - Resource literal = graph.getPossibleObject(variable.parentResource, variable.property.predicate); - if(literal != null) map=collectPropertiesFromContext(graph, variable, literal, classification, map); - } - - // Get properties from VariableNode - map = getStandardNodePropertyVariables(graph, context, map); - return map; - } else if (context instanceof StandardGraphChildVariable) { - return standardChildDomainProperties.getVariables(graph, context, map); - } else { - throw new DatabaseException("Unknown variable implementation " + context.getClass().getCanonicalName()); - } - - } - + public static VariableMap methodsPropertyDomainProperties = new VariableMapImpl() { + + @Override + public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException { + Variable parent = context.getParent(graph); + Resource container = parent.getPossibleRepresents(graph); + if(container == null) + return null; + Map methods = graph.syncRequest(new UnescapedMethodMapOfResource(container)); + Resource predicate = methods.get(name); + if(predicate != null) { + Layer0 L0 = Layer0.getInstance(graph); + PropertyInfo info = graph.syncRequest(new PropertyInfoRequest(L0.Entity_method)); + Resource value = graph.getSingleObject(container, predicate); + return new StandardGraphPropertyVariable(context, null, container, info, value); + } + return null; + } + + @Override + public Map getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { + Variable parent = context.getParent(graph); + Resource container = parent.getPossibleRepresents(graph); + if(container == null) + return Collections.emptyMap(); + Map methods = graph.syncRequest(new UnescapedMethodMapOfResource(container)); + for(Map.Entry entry : methods.entrySet()) { + String name = entry.getKey(); + Resource predicate = entry.getValue(); + Layer0 L0 = Layer0.getInstance(graph); + PropertyInfo info = graph.syncRequest(new PropertyInfoRequest(L0.Entity_method)); + Resource value = graph.getSingleObject(container, predicate); + if(map == null) map = new HashMap<>(); + map.put(name, new StandardGraphPropertyVariable(context, null, container, info, value)); + } + return map; + } + + }; + + public static Variable getStandardPropertyDomainPropertyVariableFromValue(ReadGraph graph, Variable context, String name) throws DatabaseException { + + if(context instanceof StandardGraphPropertyVariable) { + StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; + Resource literal = variable.getPossibleRepresents(graph); + Object propertyNode = getPossibleNodeProperty(graph, variable, name, false); + + if(literal != null) { + Variable result = getPossiblePropertyFromContext(graph, variable, literal, name, propertyNode); + if(result != null) return result; + } + + Variable result = getPossibleSubliteralPropertyFromContext(graph, variable, name); + if(result != null) return result; + result = getPossiblePropertyFromContext(graph, variable, variable.property.predicate, name, propertyNode); + if (result != null) return result; + + // Get possible property from NodeManager + if (propertyNode != null) + return createStandardGraphPropertyVariable(graph, variable, propertyNode); + return null; + } else if (context instanceof StandardGraphChildVariable) { + return standardChildDomainProperties.getVariable(graph, context, name); + } else { + throw new DatabaseException("Unknown variable implementation " + context.getClass().getCanonicalName()); + } + + } + + public static Map getStandardPropertyDomainPropertyVariablesFromValue(ReadGraph graph, Variable context, Map map) throws DatabaseException { + + if(context instanceof StandardGraphPropertyVariable) { + StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; + map = collectPropertiesFromContext(graph, variable, variable.property.predicate, map); + if (variable.parentResource != null) { + Resource literal = graph.getPossibleObject(variable.parentResource, variable.property.predicate); + if(literal != null) map=collectPropertiesFromContext(graph, variable, literal, map); + map=collectSubliteralProperties(graph, variable, map); + } + + // Get properties from VariableNode + map = getStandardNodePropertyVariables(graph, context, map); + return map; + } else if (context instanceof StandardGraphChildVariable) { + return standardChildDomainProperties.getVariables(graph, context, map); + } else { + throw new DatabaseException("Unknown variable implementation " + context.getClass().getCanonicalName()); + } + + } + + public static Map getStandardPropertyDomainPropertyVariablesFromValue(ReadGraph graph, Variable context, String classification, Map map) throws DatabaseException { + + if(context instanceof StandardGraphPropertyVariable) { + StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; + map = collectPropertiesFromContext(graph, variable, variable.property.predicate, classification, map); + if (variable.parentResource != null) { + Resource literal = graph.getPossibleObject(variable.parentResource, variable.property.predicate); + if(literal != null) map=collectPropertiesFromContext(graph, variable, literal, classification, map); + } + + // Get properties from VariableNode + map = getStandardNodePropertyVariables(graph, context, map); + return map; + } else if (context instanceof StandardGraphChildVariable) { + return standardChildDomainProperties.getVariables(graph, context, map); + } else { + throw new DatabaseException("Unknown variable implementation " + context.getClass().getCanonicalName()); + } + + } + @SCLValue(type = "VariableMap") - public static VariableMap standardPropertyDomainProperties = new VariableMapImpl() { - - VariableMap getValueVariableMap(ReadGraph graph, Variable context) throws DatabaseException { - Resource represents = context.getPossibleRepresents(graph); - if(represents == null) return null; - - VariableMap map = graph.isImmutable(represents) ? - graph.syncRequest(new PropertyVariableMapRequest(represents), TransientCacheListener.instance()) : - (VariableMap)graph.getPossibleRelatedValue2(represents, Layer0.getInstance(graph).domainProperties, represents); - - if(map == standardPropertyDomainProperties) return null; - else return map; - - } - - @Override - public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException { - VariableMap valueMap = getValueVariableMap(graph, context); - if(valueMap != null) return valueMap.getVariable(graph, context, name); - return getStandardPropertyDomainPropertyVariableFromValue(graph, context, name); - } - - @Override - public Map getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { - VariableMap valueMap = getValueVariableMap(graph, context); - if(valueMap != null) return valueMap.getVariables(graph, context, map); - else return getStandardPropertyDomainPropertyVariablesFromValue(graph, context, map); - } - - @Override - public Map getVariables(ReadGraph graph, Variable context, String classification, Map map) throws DatabaseException { - VariableMap valueMap = getValueVariableMap(graph, context); - if(valueMap != null) return valueMap.getVariables(graph, context, classification, map); - else return getStandardPropertyDomainPropertyVariablesFromValue(graph, context, classification, map); - } - - }; + public static VariableMap standardPropertyDomainProperties = new VariableMapImpl() { + + VariableMap getValueVariableMap(ReadGraph graph, Variable context) throws DatabaseException { + Resource represents = context.getPossibleRepresents(graph); + if(represents == null) return null; + + VariableMap map = graph.isImmutable(represents) ? + graph.syncRequest(new PropertyVariableMapRequest(represents), TransientCacheListener.instance()) : + (VariableMap)graph.getPossibleRelatedValue2(represents, Layer0.getInstance(graph).domainProperties, represents); + + if(map == standardPropertyDomainProperties) return null; + else return map; + + } + + @Override + public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException { + VariableMap valueMap = getValueVariableMap(graph, context); + if(valueMap != null) return valueMap.getVariable(graph, context, name); + return getStandardPropertyDomainPropertyVariableFromValue(graph, context, name); + } + + @Override + public Map getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { + VariableMap valueMap = getValueVariableMap(graph, context); + if(valueMap != null) return valueMap.getVariables(graph, context, map); + else return getStandardPropertyDomainPropertyVariablesFromValue(graph, context, map); + } + + @Override + public Map getVariables(ReadGraph graph, Variable context, String classification, Map map) throws DatabaseException { + VariableMap valueMap = getValueVariableMap(graph, context); + if(valueMap != null) return valueMap.getVariables(graph, context, classification, map); + else return getStandardPropertyDomainPropertyVariablesFromValue(graph, context, classification, map); + } + + }; public static Resource getPossibleGraphChild(ReadGraph graph, Variable variable, String name) throws DatabaseException { - Resource resource = variable.getPossibleRepresents(graph); + Resource resource = variable.getPossibleRepresents(graph); if(resource == null) return null; Map graphChildren = graph.syncRequest(new UnescapedChildMapOfResource(resource)); return graphChildren.get(name); } public static Map getPossibleGraphChildren(ReadGraph graph, Variable variable) throws DatabaseException { - Resource resource = variable.getPossibleRepresents(graph); + Resource resource = variable.getPossibleRepresents(graph); if(resource == null) return Collections.emptyMap(); return graph.syncRequest(new UnescapedChildMapOfResource(resource)); } public static Object getPossibleNodeChild(ReadGraph graph, Variable variable, String name) throws DatabaseException { - if (!(variable instanceof AbstractVariable)) return null; - VariableNode node = ((AbstractVariable)variable).node; + if (!(variable instanceof AbstractVariable)) return null; + VariableNode node = ((AbstractVariable)variable).node; if(node == null) return null; NodeStructure structure = Variables.requestNodeStructure(graph, node); if(Variables.PENDING_NODE_STRUCTURE == structure) throw new PendingVariableException(""); return structure.children.get(name); - } - + } + public static Collection getPossibleNodeChildren(ReadGraph graph, Variable variable) throws DatabaseException { - if (!(variable instanceof AbstractVariable)) return null; - VariableNode node = ((AbstractVariable)variable).node; + if (!(variable instanceof AbstractVariable)) return null; + VariableNode node = ((AbstractVariable)variable).node; if(node == null) return Collections.emptyList(); NodeStructure structure = Variables.requestNodeStructure(graph, node); if(Variables.PENDING_NODE_STRUCTURE == structure) throw new PendingVariableException(""); return structure.children.values(); } - + public static Object getPossibleNodeProperty(ReadGraph graph, Variable variable, String name, boolean throwPending) throws DatabaseException { - if (!(variable instanceof AbstractVariable)) return null; - VariableNode node = ((AbstractVariable)variable).node; + if (!(variable instanceof AbstractVariable)) return null; + VariableNode node = ((AbstractVariable)variable).node; if(node == null) return null; NodeStructure structure = Variables.requestNodeStructure(graph, node); if(throwPending && Variables.PENDING_NODE_STRUCTURE == structure) throw new PendingVariableException(""); return structure.properties.get(name); } - + public static Collection getPossibleNodeProperties(ReadGraph graph, Variable variable) throws DatabaseException { - if (!(variable instanceof AbstractVariable)) return null; - VariableNode node = ((AbstractVariable)variable).node; + if (!(variable instanceof AbstractVariable)) return null; + VariableNode node = ((AbstractVariable)variable).node; if(node == null) return Collections.emptyList(); NodeStructure structure = Variables.requestNodeStructure(graph, node); if(Variables.PENDING_NODE_STRUCTURE == structure) throw new PendingVariableException(""); @@ -813,24 +818,24 @@ public class All { @Deprecated public static Variable getStandardChildDomainChildVariable(ReadGraph graph, Variable context, String name) throws DatabaseException { - return StandardChildDomainChildren.getStandardChildDomainChildVariable(graph, context, name); + return StandardChildDomainChildren.getStandardChildDomainChildVariable(graph, context, name); } @Deprecated public static Variable getStandardChildDomainChildVariable(ReadGraph graph, Variable context, Resource graphChild, String name) throws DatabaseException { - return StandardChildDomainChildren.getStandardChildDomainChildVariable(graph, context, graphChild, name); + return StandardChildDomainChildren.getStandardChildDomainChildVariable(graph, context, graphChild, name); } - + @Deprecated public static Map getStandardChildDomainChildVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { - return StandardChildDomainChildren.getStandardChildDomainChildVariables(graph, context, map); + return StandardChildDomainChildren.getStandardChildDomainChildVariables(graph, context, map); } @Deprecated public static Map getStandardChildDomainChildVariables(ReadGraph graph, Variable context, Map graphChildren, Map map) throws DatabaseException { - return StandardChildDomainChildren.getStandardChildDomainChildVariables(graph, context, graphChildren, map); + return StandardChildDomainChildren.getStandardChildDomainChildVariables(graph, context, graphChildren, map); } - + /** * Get a map of child Variables from a node manager-based Variable, combined with the existing variables in #map. * @param graph The read graph. @@ -840,18 +845,18 @@ public class All { * @throws DatabaseException */ public static Map getStandardNodeChildVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { - AbstractVariable variable = (AbstractVariable)context; - if (variable.node == null) return map; - + AbstractVariable variable = (AbstractVariable)context; + if (variable.node == null) return map; + Collection nodeChildren = getPossibleNodeChildren(graph, variable); if (nodeChildren.isEmpty()) return map; - + map = ensureVariableMap(map, nodeChildren.size()); for(Object nodeChild : nodeChildren) { String name = getNodeName(variable, nodeChild); if (!map.containsKey(name)) - map.put(name, createStandardGraphChildVariable(variable, nodeChild)); + map.put(name, createStandardGraphChildVariable(variable, nodeChild)); } return map; @@ -866,368 +871,371 @@ public class All { * @throws DatabaseException */ public static Map getStandardNodePropertyVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { - AbstractVariable variable = (AbstractVariable)context; - if (variable.node == null) return map; - + AbstractVariable variable = (AbstractVariable)context; + if (variable.node == null) return map; + Collection nodeProperties = getPossibleNodeProperties(graph, variable); if (nodeProperties.isEmpty()) return map; - + map = ensureVariableMap(map, nodeProperties.size()); for(Object nodeProperty : nodeProperties) { String name = getNodeName(variable, nodeProperty); if (!map.containsKey(name)) { - map.put(name, createStandardGraphPropertyVariable(graph, variable, nodeProperty)); + map.put(name, createStandardGraphPropertyVariable(graph, variable, nodeProperty)); } } return map; } - @SCLValue(type = "VariableMap") - public static VariableMap standardChildDomainChildren = new VariableMapImpl() { + @SCLValue(type = "VariableMap") + public static VariableMap standardChildDomainChildren = new VariableMapImpl() { - @Override - public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException { - return StandardChildDomainChildren.getStandardChildDomainChildVariable(graph, context, name); - } + @Override + public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException { + return StandardChildDomainChildren.getStandardChildDomainChildVariable(graph, context, name); + } + + @Override + public Map getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { + return StandardChildDomainChildren.getStandardChildDomainChildVariables(graph, context, map); + } - @Override - public Map getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { - return StandardChildDomainChildren.getStandardChildDomainChildVariables(graph, context, map); - } - - }; + }; @SCLValue(type = "VariableMap") - public static VariableMap standardPropertyDomainChildren = new VariableMapImpl() { - - /** - * Get a possible non-standard VariableMap defined in the graph. - * @param graph The graph - * @param context The context node - * @return A non-standard VariableMap instance for the context node, - * or null, if not defined or defined as this instance. - * @throws DatabaseException - */ - VariableMap getValueVariableMap(ReadGraph graph, Variable context) throws DatabaseException { - Resource represents = context.getPossibleRepresents(graph); - if(represents == null) return null; - VariableMap map = graph.syncRequest(new ChildVariableMapRequest(represents)); - if(map == standardPropertyDomainChildren) return null; - else return map; - } - - @Override - public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException { - // Delegate call to a non-standard variable map? - VariableMap valueMap = getValueVariableMap(graph, context); - if(valueMap != null) return valueMap.getVariable(graph, context, name); - - if(context instanceof StandardGraphPropertyVariable) { - StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; - Datatype dt = variable.getDatatype(graph); - if (dt instanceof ArrayType) { - ChildReference ref = getPossibleIndexReference(name); - if (ref != null) - return new SubliteralPropertyVariableDeprecated(variable, ref); - } - - // Check for a child node provided by the NodeManager - if (variable.node != null) { - Object childNode = getPossibleNodeChild(graph, variable, name); - if (childNode != null) - return createStandardGraphChildVariable(variable, childNode); - } - return standardChildDomainChildren.getVariable(graph, context, name); - } else if (context instanceof StandardGraphChildVariable) { - return standardChildDomainChildren.getVariable(graph, context, name); - } else { - throw new DatabaseException("Unknown variable implementation " + context.getClass().getCanonicalName()); - } - } - - @Override - public Map getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { - // Delegate call to a non-standard variable map? - VariableMap valueMap = getValueVariableMap(graph, context); - if(valueMap != null) return valueMap.getVariables(graph, context, map); - - if(context instanceof StandardGraphPropertyVariable) { - // Get child variables provided by the NodeManager - Map result = getStandardNodeChildVariables(graph, context, map); - return standardChildDomainChildren.getVariables(graph, context, result); - } else if (context instanceof StandardGraphChildVariable) { - return standardChildDomainChildren.getVariables(graph, context, map); - } else { - throw new DatabaseException("Unknown variable implementation " + context.getClass().getCanonicalName()); - } - } - - }; - - protected static ChildReference getPossibleIndexReference(String name) { - if (name.startsWith("i-")) { - try { - int index = Integer.parseInt(name.substring(2)); - return new IndexReference(index); - } catch (NumberFormatException e) {} - } - return null; - } - - protected static ValueAccessor getPossiblePropertyValueAccessor(ReadGraph graph, StandardGraphPropertyVariable variable) throws DatabaseException { - if(variable.property == null) return null; - return variable.property.valueAccessor; + public static VariableMap standardPropertyDomainChildren = new VariableMapImpl() { + + /** + * Get a possible non-standard VariableMap defined in the graph. + * @param graph The graph + * @param context The context node + * @return A non-standard VariableMap instance for the context node, + * or null, if not defined or defined as this instance. + * @throws DatabaseException + */ + VariableMap getValueVariableMap(ReadGraph graph, Variable context) throws DatabaseException { + Resource represents = context.getPossibleRepresents(graph); + if(represents == null) return null; + VariableMap map = graph.syncRequest(new ChildVariableMapRequest(represents)); + if(map == standardPropertyDomainChildren) return null; + else return map; + } + + @Override + public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException { + // Delegate call to a non-standard variable map? + VariableMap valueMap = getValueVariableMap(graph, context); + if(valueMap != null) return valueMap.getVariable(graph, context, name); + + if(context instanceof StandardGraphPropertyVariable) { + StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; + Datatype dt = variable.getDatatype(graph); + if (dt instanceof ArrayType) { + ChildReference ref = getPossibleIndexReference(name); + if (ref != null) + return new SubliteralPropertyVariableDeprecated(variable, ref); + } + + // Check for a child node provided by the NodeManager + if (variable.node != null) { + Object childNode = getPossibleNodeChild(graph, variable, name); + if (childNode != null) + return createStandardGraphChildVariable(variable, childNode); + } + return standardChildDomainChildren.getVariable(graph, context, name); + } else if (context instanceof StandardGraphChildVariable) { + return standardChildDomainChildren.getVariable(graph, context, name); + } else { + throw new DatabaseException("Unknown variable implementation " + context.getClass().getCanonicalName()); + } + } + + @Override + public Map getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { + // Delegate call to a non-standard variable map? + VariableMap valueMap = getValueVariableMap(graph, context); + if(valueMap != null) return valueMap.getVariables(graph, context, map); + + if(context instanceof StandardGraphPropertyVariable) { + // Get child variables provided by the NodeManager + Map result = getStandardNodeChildVariables(graph, context, map); + return standardChildDomainChildren.getVariables(graph, context, result); + } else if (context instanceof StandardGraphChildVariable) { + return standardChildDomainChildren.getVariables(graph, context, map); + } else { + throw new DatabaseException("Unknown variable implementation " + context.getClass().getCanonicalName()); + } + } + + }; + + protected static ChildReference getPossibleIndexReference(String name) { + if (name.startsWith("i-")) { + try { + int index = Integer.parseInt(name.substring(2)); + return new IndexReference(index); + } catch (NumberFormatException e) {} + } + return null; + } + + protected static ValueAccessor getPossiblePropertyValueAccessor(ReadGraph graph, StandardGraphPropertyVariable variable) throws DatabaseException { + if(variable.property == null) return null; + return variable.property.valueAccessor; // return graph.syncRequest(new PropertyValueAccessorRequest(variable.property), TransientCacheAsyncListener.instance()); // return graph.syncRequest(new PossibleRelatedValueImplied2(variable.property, Layer0.getInstance(graph).valueAccessor)); - } - - public static ValueAccessor getPossibleValueValueAccessor(ReadGraph graph, Variable variable) throws DatabaseException { - Resource value = variable.getPossibleRepresents(graph); - if(value == null) return null; - //return graph.syncRequest(new PropertyValueAccessorRequest(value)); - return graph.syncRequest(new PossibleRelatedValueImplied2(value, Layer0.getInstance(graph).valueAccessor)); - } - - public static PropertyInfo getPossiblePropertyInfoFromContext(ReadGraph graph, Variable variable, Resource context, String name) throws DatabaseException { - if(context == null) return null; - Map predicates = graph.syncRequest(new UnescapedPropertyMapOfResource(context), TransientCacheListener.instance()); - return predicates.get(name); - } + } + + public static ValueAccessor getPossibleValueValueAccessor(ReadGraph graph, Variable variable) throws DatabaseException { + Resource value = variable.getPossibleRepresents(graph); + if(value == null) return null; + //return graph.syncRequest(new PropertyValueAccessorRequest(value)); + return graph.syncRequest(new PossibleRelatedValueImplied2(value, Layer0.getInstance(graph).valueAccessor)); + } + + public static PropertyInfo getPossiblePropertyInfoFromContext(ReadGraph graph, Variable variable, Resource context, String name) throws DatabaseException { + if(context == null) return null; + Map predicates = graph.syncRequest(new UnescapedPropertyMapOfResource(context), TransientCacheListener.instance()); + return predicates.get(name); + } public static Variable getPossiblePropertyFromContext(ReadGraph graph, Variable variable, Resource context, String name, Object propertyNode) throws DatabaseException { PropertyInfo info = getPossiblePropertyInfoFromContext(graph, variable, context, name); if(info == null || info.builder == null) return null; return buildPropertyVariable(graph, variable, context, info, propertyNode); } - + public static Variable getPossibleSubliteralPropertyFromContext(ReadGraph graph, StandardGraphPropertyVariable variable, String name) throws DatabaseException { - - Resource predicate = variable.property.predicate; - if(predicate == null) return null; - PropertyInfo info = getPropertyInfo(graph, predicate); - Pair p = info.subliteralPredicates.get(name); - if(p == null) return null; - - return new SubliteralPropertyVariable(graph, variable, p.first, p.second); - + Resource predicate = variable.property.predicate; + if(predicate == null) return null; + + PropertyInfo info = getPropertyInfo(graph, predicate); + Pair p = info.subliteralPredicates.get(name); + if(p == null) return null; + + return new SubliteralPropertyVariable(graph, variable, p.first, p.second); + } public static Map collectPropertyInfosFromContext(ReadGraph graph, Variable variable, Resource context) throws DatabaseException { if(context == null) return Collections.emptyMap(); - return graph.isImmutable(context) ? - graph.syncRequest(new UnescapedPropertyMapOfResource(context), TransientCacheAsyncListener.>instance()) : - graph.syncRequest(new UnescapedPropertyMapOfResource(context)); - } - - public static Map collectPropertiesFromContext(ReadGraph graph, Variable variable, Resource context, Map map) throws DatabaseException { - - Map properties = graph.isImmutable(context) ? - graph.syncRequest(new UnescapedPropertyMapOfResource(context), TransientCacheAsyncListener.>instance()) : - graph.syncRequest(new UnescapedPropertyMapOfResource(context)); - - if(properties.isEmpty()) return map; - - map = ensureVariableMap(map, properties.size()); - - for(PropertyInfo info : properties.values()) { - String name = info.name; - if (info.builder != null) { - Variable v = info.builder.buildProperty(graph, variable, null, context, info.predicate); - map.put(name, v); - } - } - - return map; - - } - - public static Map collectSubliteralProperties(ReadGraph graph, StandardGraphPropertyVariable variable, Map map) throws DatabaseException { - - Resource predicate = variable.property.predicate; - if(predicate == null) return map; - - PropertyInfo info = getPropertyInfo(graph, predicate); - if(info.subliteralPredicates.isEmpty()) return map; - - map = ensureVariableMap(map, info.subliteralPredicates.size()); - - for(Map.Entry> entry : info.subliteralPredicates.entrySet()) { - String key = entry.getKey(); - Pair p = entry.getValue(); - if(map == null) map = new THashMap(); - map.put(key, new SubliteralPropertyVariable(graph, variable, p.first, p.second)); - } - - return map; - - } - - public static Map collectPropertiesFromContext(ReadGraph graph, Variable variable, Resource context, String classification, Map map) throws DatabaseException { - - if(graph.isImmutable(context)) { - - Map properties = graph.syncRequest(new UnescapedPropertyMapOfResource(context), TransientCacheAsyncListener.>instance()); - for(PropertyInfo info : properties.values()) { - - if(info.classifications.contains(classification) && info.builder != null) { - String name = info.name; - Variable v = info.builder.buildProperty(graph, variable, null, context, info.predicate); - if(map == null) map = new THashMap(); - map.put(name, v); - } - - } - - } else { - - Collection predicates = graph.getPredicates(context); - - if(predicates.isEmpty()) return map; - - map = ensureVariableMap(map, predicates.size()); - - for(Resource predicate : predicates) { - - PropertyInfo info = graph.isImmutable(predicate) ? - graph.syncRequest(new PropertyInfoRequest(predicate), TransientCacheAsyncListener.instance()) : - graph.syncRequest(new PropertyInfoRequest(predicate)); - - if(!info.isHasProperty) continue; - - if(info.classifications.contains(classification) && info.builder != null) { - String name = info.name; - Variable v = info.builder.buildProperty(graph, variable, null, context, info.predicate); - if(map == null) map = new THashMap(); - map.put(name, v); - } - - } - - } - - return map; - - } - + return graph.isImmutable(context) ? + graph.syncRequest(new UnescapedPropertyMapOfResource(context), TransientCacheAsyncListener.>instance()) : + graph.syncRequest(new UnescapedPropertyMapOfResource(context)); + } + + public static Map collectPropertiesFromContext(ReadGraph graph, Variable variable, Resource context, Map map) throws DatabaseException { + + Map properties = graph.isImmutable(context) ? + graph.syncRequest(new UnescapedPropertyMapOfResource(context), TransientCacheAsyncListener.>instance()) : + graph.syncRequest(new UnescapedPropertyMapOfResource(context)); + + if(properties.isEmpty()) return map; + + map = ensureVariableMap(map, properties.size()); + + for(PropertyInfo info : properties.values()) { + String name = info.name; + if (info.builder != null) { + Variable v = info.builder.buildProperty(graph, variable, null, context, info.predicate); + map.put(name, v); + } + } + + return map; + + } + + public static Map collectSubliteralProperties(ReadGraph graph, StandardGraphPropertyVariable variable, Map map) throws DatabaseException { + + Resource predicate = variable.property.predicate; + if(predicate == null) return map; + + PropertyInfo info = getPropertyInfo(graph, predicate); + if(info.subliteralPredicates.isEmpty()) return map; + + map = ensureVariableMap(map, info.subliteralPredicates.size()); + + for(Map.Entry> entry : info.subliteralPredicates.entrySet()) { + String key = entry.getKey(); + Pair p = entry.getValue(); + if(map == null) map = new THashMap(); + map.put(key, new SubliteralPropertyVariable(graph, variable, p.first, p.second)); + } + + return map; + + } + + public static Map collectPropertiesFromContext(ReadGraph graph, Variable variable, Resource context, String classification, Map map) throws DatabaseException { + + if(graph.isImmutable(context)) { + + Map properties = graph.syncRequest(new UnescapedPropertyMapOfResource(context), TransientCacheAsyncListener.>instance()); + for(PropertyInfo info : properties.values()) { + + if(info.classifications.contains(classification) && info.builder != null) { + String name = info.name; + Variable v = info.builder.buildProperty(graph, variable, null, context, info.predicate); + if(map == null) map = new THashMap(); + map.put(name, v); + } + + } + + } else { + + Collection predicates = graph.getPredicates(context); + + if(predicates.isEmpty()) return map; + + map = ensureVariableMap(map, predicates.size()); + + for(Resource predicate : predicates) { + + PropertyInfo info = graph.isImmutable(predicate) ? + graph.syncRequest(new PropertyInfoRequest(predicate), TransientCacheAsyncListener.instance()) : + graph.syncRequest(new PropertyInfoRequest(predicate)); + + if(!info.isHasProperty) continue; + + if(info.classifications.contains(classification) && info.builder != null) { + String name = info.name; + Variable v = info.builder.buildProperty(graph, variable, null, context, info.predicate); + if(map == null) map = new THashMap(); + map.put(name, v); + } + + } + + } + + return map; + + } + @SCLValue(type = "ReadGraph -> Resource -> a -> String") public static String entityLabel(ReadGraph graph, Resource resource, Object context) throws DatabaseException { - if(context instanceof Resource) { - return NameUtils.getSafeLabel(graph, ((Resource)context)); - } else if (context instanceof Variable) { - Variable parent = ((Variable)context).getParent(graph); - Resource represents = parent.getRepresents(graph); - return NameUtils.getSafeLabel(graph, represents); - } else { - throw new DatabaseException("Unknown context " + context); - } + if(context instanceof Resource) { + return NameUtils.getSafeLabel(graph, ((Resource)context)); + } else if (context instanceof Variable) { + Variable parent = ((Variable)context).getParent(graph); + Resource represents = parent.getRepresents(graph); + return NameUtils.getSafeLabel(graph, represents); + } else { + throw new DatabaseException("Unknown context " + context); + } } @SCLValue(type = "ReadGraph -> Resource -> a -> b") public static Object listResources(ReadGraph graph, Resource resource, Object context) throws DatabaseException { - return ListUtils.toList(graph, resource); + return ListUtils.toList(graph, resource); } @SCLValue(type = "ReadGraph -> Resource -> Variable -> [String]") public static List standardClassifications(ReadGraph graph, Resource resource, Variable context) throws DatabaseException { - ArrayList result = new ArrayList(); - Resource predicate = context.getParent(graph).getPossiblePredicateResource(graph); - if(predicate != null) { - for(Resource type : graph.getTypes(predicate)) { - String uri = graph.getPossibleURI(type); - if(uri != null) result.add(uri); - } - } - return result; + ArrayList result = new ArrayList(); + Resource predicate = context.getParent(graph).getPossiblePredicateResource(graph); + if(predicate != null) { + for(Resource type : graph.getTypes(predicate)) { + String uri = graph.getPossibleURI(type); + if(uri != null) result.add(uri); + } + } + return result; } @SCLValue(type = "ReadGraph -> Resource -> a -> Boolean") public static Boolean standardValidValue(ReadGraph graph, Resource resource, Object context) throws DatabaseException { - return Boolean.TRUE; + return Boolean.TRUE; } @SCLValue(type = "ReadGraph -> Resource -> a -> StringInputValidator") public static StringInputValidator standardValidator(ReadGraph graph, Resource resource, Object context) throws DatabaseException { - return StringInputValidator.PASS; + return StringInputValidator.PASS; } @SCLValue(type = "ReadGraph -> Resource -> a -> Boolean") public static Boolean standardRequiredValue(ReadGraph graph, Resource resource, Object context) throws DatabaseException { - return Boolean.FALSE; + return Boolean.FALSE; } @SCLValue(type = "ReadGraph -> Resource -> Variable -> Boolean") public static Boolean standardDefaultValue(ReadGraph graph, Resource resource, Variable context) throws DatabaseException { - Variable property = context.getParent(graph); - if(property instanceof StandardGraphPropertyVariable) { - StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)property; - if (variable.parentResource != null) { - Statement stm = graph.getPossibleStatement(variable.parentResource, variable.property.predicate); - return stm != null && stm.isAsserted(variable.parentResource); - } - } - return Boolean.FALSE; + Variable property = context.getParent(graph); + if(property instanceof StandardGraphPropertyVariable) { + StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)property; + if (variable.parentResource != null) { + Resource predicate = variable.getPossiblePredicateResource(graph); + if (predicate != null) { + Statement stm = graph.getPossibleStatement(variable.parentResource, predicate); + return stm != null && stm.isAsserted(variable.parentResource); + } + } + } + return Boolean.FALSE; } @SCLValue(type = "ReadGraph -> Resource -> a -> Boolean") public static Boolean standardReadOnlyValue(ReadGraph graph, Resource resource, Object context) throws DatabaseException { - return Boolean.FALSE; + return Boolean.FALSE; } @SCLValue(type = "ReadGraph -> Resource -> a -> b") public static Object resourceAsValue(ReadGraph graph, Resource resource, Object context) throws DatabaseException { - return resource; + return resource; } - + @SCLValue(type = "ReadGraph -> Resource -> a -> b") public static Object functionApplication(ReadGraph graph, Resource resource, Object context) throws DatabaseException { - return Functions.exec(graph, resource, graph, resource, context); + return Functions.exec(graph, resource, graph, resource, context); } @SCLValue(type = "ReadGraph -> Resource -> a -> b") public static Object computeExpression(ReadGraph graph, Resource converter, Object context) throws DatabaseException { - if(context instanceof Variable) { + if(context instanceof Variable) { return CompileValueRequest.compileAndEvaluate(graph, (Variable)context); - } if (context instanceof Resource) { + } if (context instanceof Resource) { return CompileResourceValueRequest.compileAndEvaluate(graph, (Resource)converter); - } else { - throw new IllegalStateException("Unknown context " + context); - } + } else { + throw new IllegalStateException("Unknown context " + context); + } } @SCLValue(type = "ReadGraph -> Resource -> a -> b") public static Object composedPropertyValue(ReadGraph graph, Resource converter, Object context) throws DatabaseException { - if(context instanceof Variable) { - return new StandardComposedProperty(); - } if (context instanceof Resource) { - return new StandardComposedProperty(); - } else { - throw new IllegalStateException("Unknown context " + context); - } - } - + if(context instanceof Variable) { + return new StandardComposedProperty(); + } if (context instanceof Resource) { + return new StandardComposedProperty(); + } else { + throw new IllegalStateException("Unknown context " + context); + } + } + @SCLValue(type = "ReadGraph -> Resource -> a -> b") public static Object numberInputValidator(ReadGraph graph, Resource resource, Object context) throws DatabaseException { - + class Validator extends FunctionImpl1 { private final Datatype datatype; - + public Validator(Datatype datatype) { this.datatype = datatype; } - + @Override public String apply(String input) { - + if(datatype == null) return null; - + try { if(datatype instanceof NumberType) { - + Number number = (Number)PrimitiveValueParser.parse(input, datatype); NumberType nt = (NumberType)datatype; Range r = nt.getRange(); @@ -1236,129 +1244,130 @@ public class All { } } return null; - + } catch (NumberFormatException e) { return "Not a valid floating-point number"; } catch (IllegalArgumentException e) { return "Not a valid floating-point number"; } - + } - + } if(context instanceof Variable) { - + Variable variable = (Variable)context; Variable property = variable.getParent(graph); Datatype datatype = property.getPossibleDatatype(graph); return new Validator(datatype); - + } else if (context instanceof Resource) { Layer0 L0 = Layer0.getInstance(graph); Resource literal = (Resource)context; Datatype datatype = graph.getRelatedValue(literal, L0.HasDataType, Bindings.getBindingUnchecked(Datatype.class)); return new Validator(datatype); - + } else { - + return new Validator(null); - + } - + } - + @SCLValue(type = "ReadGraph -> Resource -> a -> b") public static Object booleanInputValidator(ReadGraph graph, Resource resource, Object context) throws DatabaseException { - + return new FunctionImpl1() { @Override public String apply(String input) { - - String lower = input.toLowerCase(); - if("true".equals(lower) || "false".equals(lower)) return null; - return "Not a valid boolean: " + input; - + String lower = input.toLowerCase(); + if("true".equals(lower) || "false".equals(lower)) return null; + + return "Not a valid boolean: " + input; + } - + }; - + } @SCLValue(type = "ReadGraph -> Resource -> Variable -> Resource") public static Resource hasStandardResource(ReadGraph graph, Resource resource, Variable context) throws DatabaseException { - Variable parent = context.getParent(graph); - if(parent instanceof StandardGraphChildVariable) { - StandardGraphChildVariable variable = (StandardGraphChildVariable)parent; - return variable.resource; - } - return null; + Variable parent = context.getParent(graph); + if(parent instanceof StandardGraphChildVariable) { + StandardGraphChildVariable variable = (StandardGraphChildVariable)parent; + return variable.resource; + } + return null; } @SCLValue(type = "ReadGraph -> Resource -> Variable -> a") - public static Object valueWithoutBinding(ReadGraph graph, Resource converter, Variable context) throws DatabaseException { - - StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; - - if(graph.sync(new IsEnumeratedValue(variable.getRepresents(graph)))) { - Layer0 L0 = Layer0.getInstance(graph); - return graph.getRelatedValue2(variable.getRepresents(graph), L0.HasLabel); - } - - if (variable.parentResource == null) - throw new InvalidVariableException("Variable is not represented by any resource (URI=" + variable.getPossibleURI(graph) + ")."); - - try { - return graph.getRelatedValue2(variable.parentResource, variable.property.predicate, variable); - } catch (NoSingleResultException e) { - throw new MissingVariableValueException(variable.getPossibleURI(graph), e); - } catch (DoesNotContainValueException e) { - throw new MissingVariableValueException(variable.getPossibleURI(graph), e); - } - - } + public static Object valueWithoutBinding(ReadGraph graph, Resource converter, Variable context) throws DatabaseException { + + StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; + + if(graph.sync(new IsEnumeratedValue(variable.getRepresents(graph)))) { + Layer0 L0 = Layer0.getInstance(graph); + return graph.getRelatedValue2(variable.getRepresents(graph), L0.HasLabel); + } + + if (variable.parentResource == null) + throw new InvalidVariableException("Variable is not represented by any resource (URI=" + variable.getPossibleURI(graph) + ")."); + + try { + return graph.getRelatedValue2(variable.parentResource, variable.getPredicateResource(graph), variable); + } catch (NoSingleResultException e) { + throw new MissingVariableValueException(variable.getPossibleURI(graph), e); + } catch (DoesNotContainValueException e) { + throw new MissingVariableValueException(variable.getPossibleURI(graph), e); + } + + } @SCLValue(type = "ReadGraph -> Variable -> Binding -> a") - public static Object valueWithBinding(ReadGraph graph, Variable context, Binding binding) throws DatabaseException { - - StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; - - if(graph.sync(new IsEnumeratedValue(variable.getRepresents(graph)))) { - Layer0 L0 = Layer0.getInstance(graph); - return graph.getRelatedValue2(variable.getRepresents(graph), L0.HasLabel, binding); - } - - if (variable.parentResource == null) - throw new MissingVariableException("Variable is not represented by any resource (URI=" + variable.getPossibleURI(graph) + ").", context.getPossibleRepresents(graph)); - - try { - return graph.getRelatedValue2(variable.parentResource, variable.property.predicate, variable); - } catch (NoSingleResultException e) { - throw new MissingVariableValueException(variable.getPossibleURI(graph), e); - } catch (DoesNotContainValueException e) { - throw new MissingVariableValueException(variable.getPossibleURI(graph), e); - } - - } + public static Object valueWithBinding(ReadGraph graph, Variable context, Binding binding) throws DatabaseException { + + StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context; + + if(graph.sync(new IsEnumeratedValue(variable.getRepresents(graph)))) { + Layer0 L0 = Layer0.getInstance(graph); + return graph.getRelatedValue2(variable.getRepresents(graph), L0.HasLabel, binding); + } + + if (variable.parentResource == null) + throw new MissingVariableException("Variable is not represented by any resource (URI=" + variable.getPossibleURI(graph) + ").", context.getPossibleRepresents(graph)); + + + try { + return graph.getRelatedValue2(variable.parentResource, variable.getPredicateResource(graph), variable); + } catch (NoSingleResultException e) { + throw new MissingVariableValueException(variable.getPossibleURI(graph), e); + } catch (DoesNotContainValueException e) { + throw new MissingVariableValueException(variable.getPossibleURI(graph), e); + } + + } @SCLValue(type = "WriteGraph -> Variable -> a -> Binding -> b") - public static Object valueSetterWithBinding(WriteGraph graph, Variable variable, Object value, Binding binding) throws DatabaseException { - - Function4 modifier = variable.getPossiblePropertyValue(graph, Variables.INPUT_MODIFIER); - if(modifier == null) modifier = VariableUtils.defaultInputModifier; - modifier.apply(graph, variable, value, binding); - return null; - - } - + public static Object valueSetterWithBinding(WriteGraph graph, Variable variable, Object value, Binding binding) throws DatabaseException { + + Function4 modifier = variable.getPossiblePropertyValue(graph, Variables.INPUT_MODIFIER); + if(modifier == null) modifier = VariableUtils.defaultInputModifier; + modifier.apply(graph, variable, value, binding); + return null; + + } + static class L0Issue extends StandardIssue { - + private final String description; - + public L0Issue(String description, Resource type, Resource ... contexts) { super(type, contexts); this.description = description; @@ -1373,63 +1382,63 @@ public class All { graph.addLiteral(issue, L0.HasDescription, L0.HasDescription_Inverse, description, Bindings.STRING); return issue; } - - } - - private static List reportInconsistency(ReadGraph graph, Resource subject, String description, List issues) throws DatabaseException { - if(issues == null) issues = new ArrayList(); - System.err.println("Change set validation reports the following issue: " + NameUtils.getSafeName(graph, subject, true) + ": " + description); - IssueResource IR = IssueResource.getInstance(graph); - issues.add(new L0Issue(description, IR.Issue, subject)); - return issues; - } - + + } + + private static List reportInconsistency(ReadGraph graph, Resource subject, String description, List issues) throws DatabaseException { + if(issues == null) issues = new ArrayList(); + System.err.println("Change set validation reports the following issue: " + NameUtils.getSafeName(graph, subject, true) + ": " + description); + IssueResource IR = IssueResource.getInstance(graph); + issues.add(new L0Issue(description, IR.Issue, subject)); + return issues; + } + @SCLValue(type = "ReadGraph -> Resource -> [Issue]") public static List relationValidator(ReadGraph graph, Resource resource) throws DatabaseException { - Layer0 L0 = Layer0.getInstance(graph); - - List issues = null; - - for(Statement stm : graph.getStatements(resource, L0.IsWeaklyRelatedTo)) { - Resource predicate = stm.getPredicate(); - Resource object = stm.getObject(); - if(!isRelation(graph, L0, predicate)) { - issues = reportInconsistency(graph, resource, "The predicate of a statement must be a relation: " + NameUtils.toString(graph, stm), issues); - } - if(graph.isInstanceOf(predicate, L0.FunctionalRelation)) { - if(graph.getObjects(resource, predicate).size() > 1) - issues = reportInconsistency(graph, resource, - "Relation " + - NameUtils.getSafeName(graph, predicate) - + " is functional.", issues); - } - { - Collection domain = graph.getObjects(predicate, L0.HasDomain); - if (!isInstanceOfAny(graph, resource, domain, true)) { - StringBuilder sb = new StringBuilder() - .append("The domain of ") - .append(NameUtils.getSafeName(graph, predicate)) - .append(" relation is "); - orString(graph, sb, domain).append("."); - issues = reportInconsistency(graph, resource, sb.toString(), issues); - } - } - { - Collection range = graph.getObjects(predicate, L0.HasRange); - if (!isInstanceOfAny(graph, object, range, true) && !graph.isInstanceOf(object, L0.SCLValue)) { - StringBuilder sb = new StringBuilder() - .append("The range of ") - .append(NameUtils.getSafeName(graph, predicate)) - .append(" relation is "); - orString(graph, sb, range).append(" but current object is ") - .append(NameUtils.getSafeName(graph, object)).append("."); - issues = reportInconsistency(graph, resource, sb.toString(), issues); - } - } - } - - return issues != null ? issues : Collections.emptyList(); + Layer0 L0 = Layer0.getInstance(graph); + + List issues = null; + + for(Statement stm : graph.getStatements(resource, L0.IsWeaklyRelatedTo)) { + Resource predicate = stm.getPredicate(); + Resource object = stm.getObject(); + if(!isRelation(graph, L0, predicate)) { + issues = reportInconsistency(graph, resource, "The predicate of a statement must be a relation: " + NameUtils.toString(graph, stm), issues); + } + if(graph.isInstanceOf(predicate, L0.FunctionalRelation)) { + if(graph.getObjects(resource, predicate).size() > 1) + issues = reportInconsistency(graph, resource, + "Relation " + + NameUtils.getSafeName(graph, predicate) + + " is functional.", issues); + } + { + Collection domain = graph.getObjects(predicate, L0.HasDomain); + if (!isInstanceOfAny(graph, resource, domain, true)) { + StringBuilder sb = new StringBuilder() + .append("The domain of ") + .append(NameUtils.getSafeName(graph, predicate)) + .append(" relation is "); + orString(graph, sb, domain).append("."); + issues = reportInconsistency(graph, resource, sb.toString(), issues); + } + } + { + Collection range = graph.getObjects(predicate, L0.HasRange); + if (!isInstanceOfAny(graph, object, range, true) && !graph.isInstanceOf(object, L0.SCLValue)) { + StringBuilder sb = new StringBuilder() + .append("The range of ") + .append(NameUtils.getSafeName(graph, predicate)) + .append(" relation is "); + orString(graph, sb, range).append(" but current object is ") + .append(NameUtils.getSafeName(graph, object)).append("."); + issues = reportInconsistency(graph, resource, sb.toString(), issues); + } + } + } + + return issues != null ? issues : Collections.emptyList(); } @@ -1439,197 +1448,197 @@ public class All { List issues = null; Layer0 L0 = Layer0.getInstance(graph); - for(Statement stm : graph.getStatements(resource, L0.HasProperty)) { - Resource subject = stm.getSubject(); - Resource predicate = stm.getPredicate(); - String error = L0Validations.checkValueType(graph, subject, predicate); - if(error != null) issues = reportInconsistency(graph, subject, error, issues); - } - + for(Statement stm : graph.getStatements(resource, L0.HasProperty)) { + Resource subject = stm.getSubject(); + Resource predicate = stm.getPredicate(); + String error = L0Validations.checkValueType(graph, subject, predicate); + if(error != null) issues = reportInconsistency(graph, subject, error, issues); + } + return issues != null ? issues : Collections.emptyList(); } - - + + @SCLValue(type = "ReadGraph -> Resource -> [Issue]") public static List valueValidator(ReadGraph graph, Resource resource) throws DatabaseException { List issues = null; Layer0 L0 = Layer0.getInstance(graph); - if(graph.hasValue(resource)) { - if(!graph.isInstanceOf(resource, L0.Literal)) { - issues = reportInconsistency(graph, resource, - "Resource has a value but it is not a literal.", issues); - } - else { - // TODO check that the value is valid for the data type - } - } - else { - if(graph.isInstanceOf(resource, L0.Literal)) { - issues = reportInconsistency(graph, resource, - "Resource is a literal but it does not have a value.", issues); - } - } - + if(graph.hasValue(resource)) { + if(!graph.isInstanceOf(resource, L0.Literal)) { + issues = reportInconsistency(graph, resource, + "Resource has a value but it is not a literal.", issues); + } + else { + // TODO check that the value is valid for the data type + } + } + else { + if(graph.isInstanceOf(resource, L0.Literal)) { + issues = reportInconsistency(graph, resource, + "Resource is a literal but it does not have a value.", issues); + } + } + return issues != null ? issues : Collections.emptyList(); - + } - + @SCLValue(type = "ReadGraph -> Resource -> [Issue]") public static List uriValidator(ReadGraph graph, Resource resource) throws DatabaseException { - + List issues = null; Layer0 L0 = Layer0.getInstance(graph); Resource parent = graph.getPossibleObject(resource, L0.PartOf); - if(parent != null) { - String parentURI = graph.syncRequest(new PossibleURI(parent)); - if(parentURI != null) { - String name = graph.getPossibleRelatedValue(resource, L0.HasName); - if(name == null) { - issues = reportInconsistency(graph, resource, "Resource has a parent with URI but has no valid HasName.", issues); - } - } - } + if(parent != null) { + String parentURI = graph.syncRequest(new PossibleURI(parent)); + if(parentURI != null) { + String name = graph.getPossibleRelatedValue(resource, L0.HasName); + if(name == null) { + issues = reportInconsistency(graph, resource, "Resource has a parent with URI but has no valid HasName.", issues); + } + } + } return issues != null ? issues : Collections.emptyList(); - + } - + private static Resource getPossibleNearestClusterSet(ReadGraph graph, Resource base, Resource resource) throws DatabaseException { ClusteringSupport cs = graph.getService(ClusteringSupport.class); if(cs.isClusterSet(resource) && !base.equals(resource)) return resource; - + Resource nearest = NearestOwnerFinder.getNearestOwner(graph, resource); if(nearest == null) return null; - + return getPossibleNearestClusterSet(graph, base, nearest); } private static boolean quirks(ReadGraph graph, Resource resource) throws DatabaseException { - if(!resource.isPersistent()) return true; - if(graph.isImmutable(resource)) return true; - if(resource.getResourceId() < 0x2000) return true; + if(!resource.isPersistent()) return true; + if(graph.isImmutable(resource)) return true; + if(resource.getResourceId() < 0x2000) return true; + + return false; - return false; - } - + @SCLValue(type = "ReadGraph -> Resource -> [Issue]") public static List clusterValidator(ReadGraph graph, Resource resource) throws DatabaseException { - if(!Development.DEVELOPMENT) return Collections.emptyList(); - - if(quirks(graph, resource)) return Collections.emptyList(); - + if(!Development.DEVELOPMENT) return Collections.emptyList(); + + if(quirks(graph, resource)) return Collections.emptyList(); + List issues = null; ClusteringSupport cs = graph.getService(ClusteringSupport.class); Resource set = cs.getClusterSetOfCluster(resource); - + if(set == null) return reportInconsistency(graph, resource, "Resource cluster is not part of any cluster set", issues); - + Resource nearestSet = getPossibleNearestClusterSet(graph, resource, resource); if(nearestSet == null) { - // This means that there is no owner since RootLibrary is a cluster set - return Collections.emptyList(); + // This means that there is no owner since RootLibrary is a cluster set + return Collections.emptyList(); } - + if(!set.equals(nearestSet)) return reportInconsistency(graph, resource, "The cluster set of a resource is not the nearest owner set", issues); return Collections.emptyList(); - + } private static boolean isInstanceOfAny(ReadGraph graph, Resource r, Collection types, boolean ifEmpty) throws DatabaseException { - if (types.isEmpty()) - return ifEmpty; - for (Resource type : types) { - if (graph.isInstanceOf(r, type)) { - return true; - } - } - return false; - } - - private static StringBuilder orString(ReadGraph graph, StringBuilder sb, Collection rs) throws DatabaseException { - sb.append("("); - boolean first = true; - for (Resource r : rs) { - if (!first) - sb.append(" | "); - first = false; - sb.append(NameUtils.getSafeName(graph, r)); - } - sb.append(")"); - return sb; - } + if (types.isEmpty()) + return ifEmpty; + for (Resource type : types) { + if (graph.isInstanceOf(r, type)) { + return true; + } + } + return false; + } + + private static StringBuilder orString(ReadGraph graph, StringBuilder sb, Collection rs) throws DatabaseException { + sb.append("("); + boolean first = true; + for (Resource r : rs) { + if (!first) + sb.append(" | "); + first = false; + sb.append(NameUtils.getSafeName(graph, r)); + } + sb.append(")"); + return sb; + } public static boolean isRelation(ReadGraph g, Layer0 l0, Resource relation) throws DatabaseException { - return g.hasStatement(relation, l0.SubrelationOf) || relation == l0.IsWeaklyRelatedTo; - } - - public static boolean isType(ReadGraph g, Layer0 l0, Resource type) throws DatabaseException { - return g.hasStatement(type, l0.Inherits) || type == l0.Entity; - } - + return g.hasStatement(relation, l0.SubrelationOf) || relation == l0.IsWeaklyRelatedTo; + } + + public static boolean isType(ReadGraph g, Layer0 l0, Resource type) throws DatabaseException { + return g.hasStatement(type, l0.Inherits) || type == l0.Entity; + } + public static Variable buildChildVariable(ReadGraph graph, Variable context, Resource graphChild, Object nodeChild) throws DatabaseException { VariableBuilder builder = graph.adapt(graphChild, VariableBuilder.class); - return builder.buildChild(graph, context, build(((AbstractVariable)context).node, nodeChild), graphChild); - } - - private static Variable buildPropertyVariable(ReadGraph graph, Variable variable, Resource parentResource, PropertyInfo graphProperty, Object propertyNode) throws DatabaseException { - VariableNode node = variable instanceof AbstractVariable ? build(((AbstractVariable)variable).node, propertyNode) : null; - return graphProperty.builder.buildProperty(graph, variable, node, parentResource, graphProperty.predicate); - } - - static StandardGraphChildVariable createStandardGraphChildVariable( - AbstractVariable parent, Object child) { - return new StandardGraphChildVariable(parent, build(parent.node, child), null); - } - - private static StandardGraphPropertyVariable createStandardGraphPropertyVariable( - ReadGraph graph, AbstractVariable variable, Object nodeProperty) throws DatabaseException { + return builder.buildChild(graph, context, build(((AbstractVariable)context).node, nodeChild), graphChild); + } + + private static Variable buildPropertyVariable(ReadGraph graph, Variable variable, Resource parentResource, PropertyInfo graphProperty, Object propertyNode) throws DatabaseException { + VariableNode node = variable instanceof AbstractVariable ? build(((AbstractVariable)variable).node, propertyNode) : null; + return graphProperty.builder.buildProperty(graph, variable, node, parentResource, graphProperty.predicate); + } + + static StandardGraphChildVariable createStandardGraphChildVariable( + AbstractVariable parent, Object child) { + return new StandardGraphChildVariable(parent, build(parent.node, child), null); + } + + private static StandardGraphPropertyVariable createStandardGraphPropertyVariable( + ReadGraph graph, AbstractVariable variable, Object nodeProperty) throws DatabaseException { Resource propertyResource = getPossiblePropertyResource(graph, variable, nodeProperty); return new StandardGraphPropertyVariable(graph, variable, build(variable.node, nodeProperty), null, propertyResource); - } - - static Map ensureVariableMap( - Map map, int size) { - if(map == null) map = new THashMap(size); - return map; - } - - private static PropertyInfo getPropertyInfo(ReadGraph graph, Resource predicate) throws DatabaseException { - return graph.syncRequest(new PropertyInfoRequest(predicate)); - } - - @SuppressWarnings("unchecked") - static String getNodeName(AbstractVariable parent, Object child) { - return parent.node.support.manager.getName(child); - } - - @SuppressWarnings("unchecked") - private static Object getNodeValue(final AbstractVariable variable, final Binding binding) throws NodeManagerException, BindingException { - return variable.node.support.manager.getValue(variable.node.node, binding); - } - - @SuppressWarnings("unchecked") - private static void setNodeValue(final AbstractVariable variable, final Object value, final Binding binding) throws NodeManagerException, BindingException { - variable.node.support.manager.setValue(variable.node.node, value, binding); - } - - @SuppressWarnings("unchecked") - private static String getPossiblePropertyURI(AbstractVariable parent, Object node) { - return parent.node.support.manager.getPropertyURI(parent.node.node, node); - } - + } + + static Map ensureVariableMap( + Map map, int size) { + if(map == null) map = new THashMap(size); + return map; + } + + private static PropertyInfo getPropertyInfo(ReadGraph graph, Resource predicate) throws DatabaseException { + return graph.syncRequest(new PropertyInfoRequest(predicate)); + } + + @SuppressWarnings("unchecked") + static String getNodeName(AbstractVariable parent, Object child) { + return parent.node.support.manager.getName(child); + } + + @SuppressWarnings("unchecked") + private static Object getNodeValue(final AbstractVariable variable, final Binding binding) throws NodeManagerException, BindingException { + return variable.node.support.manager.getValue(variable.node.node, binding); + } + + @SuppressWarnings("unchecked") + private static void setNodeValue(final AbstractVariable variable, final Object value, final Binding binding) throws NodeManagerException, BindingException { + variable.node.support.manager.setValue(variable.node.node, value, binding); + } + + @SuppressWarnings("unchecked") + private static String getPossiblePropertyURI(AbstractVariable parent, Object node) { + return parent.node.support.manager.getPropertyURI(parent.node.node, node); + } + @SCLValue(type = "ReadGraph -> Resource -> Variable -> a") public static Object defaultInstantiateUnder(ReadGraph graph, Resource converter, Variable context) throws DatabaseException { diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/Dependencies.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/Dependencies.java index 0aa36390b..83837a960 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/Dependencies.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/Dependencies.java @@ -13,13 +13,14 @@ package org.simantics.db.layer0.genericrelation; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; -import org.simantics.db.common.utils.Logger; +import org.simantics.db.common.request.UniqueRead; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.GenericRelationIndex; import org.simantics.db.service.QueryControl; import org.simantics.operation.Layer0X; import org.simantics.scl.runtime.function.FunctionImpl4; import org.simantics.scl.runtime.function.UnsaturatedFunction2; +import org.slf4j.LoggerFactory; /** * dependencies: @@ -30,6 +31,8 @@ import org.simantics.scl.runtime.function.UnsaturatedFunction2; */ public class Dependencies extends FunctionImpl4 { + private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(Dependencies.class); + public static final String FIELD_MODEL = "Model"; public static final String FIELD_PARENT = "Parent"; public static final String FIELD_RESOURCE = "Resource"; @@ -71,10 +74,15 @@ public class Dependencies extends FunctionImpl4() { + @Override + public Object perform(ReadGraph graph) throws DatabaseException { + return index.query(graph, query, getBindingPattern(), new Object[] { model }, maxResults); + } + }); } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("Error while performing index query", e); return null; } } diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/DependencyResources.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/DependencyResources.java index 1702af0f3..a2059a6ad 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/DependencyResources.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/DependencyResources.java @@ -13,13 +13,14 @@ package org.simantics.db.layer0.genericrelation; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; -import org.simantics.db.common.utils.Logger; +import org.simantics.db.common.request.UniqueRead; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.GenericRelationIndex; import org.simantics.db.service.QueryControl; import org.simantics.operation.Layer0X; import org.simantics.scl.runtime.function.FunctionImpl4; import org.simantics.scl.runtime.function.UnsaturatedFunction2; +import org.slf4j.LoggerFactory; /** * dependencyResources: @@ -30,6 +31,8 @@ import org.simantics.scl.runtime.function.UnsaturatedFunction2; */ public class DependencyResources extends FunctionImpl4 { + private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(DependencyResources.class); + protected Resource getIndexRelation(ReadGraph graph) { return Layer0X.getInstance(graph).DependenciesRelation; } @@ -61,10 +64,15 @@ public class DependencyResources extends FunctionImpl4() { + @Override + public Object perform(ReadGraph graph) throws DatabaseException { + return index.queryResources(graph, query, getBindingPattern(), new Object[] { model }, maxResults); + } + }); } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("Error while performing index query", e); return null; } } diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/AbstractExpressionCompilationRequest.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/AbstractExpressionCompilationRequest.java index 1bcd91877..16f88a340 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/AbstractExpressionCompilationRequest.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/AbstractExpressionCompilationRequest.java @@ -179,7 +179,6 @@ implements Read> { b2.append('\n'); } SCLDatabaseException exception = new SCLDatabaseException(b.toString()+b2.toString(), b2.toString(), e.getErrors()); - LOGGER.info(exception.getMessage(), exception); throw exception; } catch(Throwable e) { // Should not happen! diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/HierarchyMultiMap.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/HierarchyMultiMap.java index a4ac87b50..b12d5ad2b 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/HierarchyMultiMap.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/HierarchyMultiMap.java @@ -37,7 +37,28 @@ public abstract class HierarchyMultiMap { bs.add(b); cache = null; } - + + /** + * Appends the contents of the specified map to this map. + * + * @param from the map to append contents from + */ + public void append(HierarchyMultiMap from) { + from.appendTo(this); + } + + /** + * Appends the contents of this map to the specified map. + * + * @param to the map to append to + */ + public void appendTo(HierarchyMultiMap to) { + map.forEachEntry((a, bl) -> { + bl.forEach(b -> to.put(a, b)); + return true; + }); + } + /** * Gets the values stored into the map for the key {@code a} or * its superelements. diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Layer0Utils.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Layer0Utils.java index 830f7a6bb..ad8676f81 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Layer0Utils.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Layer0Utils.java @@ -1202,6 +1202,10 @@ public class Layer0Utils { } + public static boolean isMarkedReadOnly(ReadGraph graph, Resource r) throws DatabaseException { + return Boolean.TRUE.equals( graph.getPossibleRelatedValue(r, graph.l0().readOnly, Bindings.BOOLEAN) ); + } + private static TransferableGraph1 makeTG(ReadGraph graph, Resource r) throws DatabaseException { SimanticsClipboardImpl cp = new SimanticsClipboardImpl(); diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/SessionGarbageCollection.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/SessionGarbageCollection.java index c168e2286..c48ec3630 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/SessionGarbageCollection.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/SessionGarbageCollection.java @@ -76,7 +76,18 @@ public class SessionGarbageCollection { QueryControl qc = graph.getService(QueryControl.class); ClusterControl cc = graph.getService(ClusterControl.class); _monitor.beginTask("Collect clusters", IProgressMonitor.UNKNOWN); - cc.gc(graph, clusterTarget); + //cc.gc(graph, clusterTarget); + if(clusterTarget == -1) { + int used = cc.used(); + //System.err.println("session gc, cluster use = " + used); + int baseline = 32*(1<<20); + if(used > baseline) { + int dynamicTarget = (int)(0.95 * (used-baseline)) + baseline; + cc.gc(graph, dynamicTarget); + } + } else { + cc.gc(graph, clusterTarget); + } _monitor.beginTask("Collect queries", IProgressMonitor.UNKNOWN); qc.gc(graph, allowedTimeInMs); } diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/NoPredicateResourceException.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/NoPredicateResourceException.java new file mode 100644 index 000000000..a1b74638f --- /dev/null +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/NoPredicateResourceException.java @@ -0,0 +1,34 @@ +package org.simantics.db.layer0.variable; + +import org.simantics.db.Resource; +import org.simantics.db.exception.AssumptionException; + +public class NoPredicateResourceException extends AssumptionException { + + private static final long serialVersionUID = -374051341908276908L; + + public NoPredicateResourceException(Throwable cause) { + super(cause); + } + + public NoPredicateResourceException(String message, Throwable cause, Resource... rs) { + super(message, cause, rs); + } + + public NoPredicateResourceException(String message, Resource... resources) { + super(message, resources); + } + + public NoPredicateResourceException(String message, Throwable cause) { + super(message, cause); + } + + public NoPredicateResourceException(String message, int... args) { + super(message, args); + } + + public NoPredicateResourceException(String message) { + super(message); + } + +} diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/NodeStructureRequest.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/NodeStructureRequest.java index 5d21ca56b..707fdbd0e 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/NodeStructureRequest.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/NodeStructureRequest.java @@ -7,174 +7,177 @@ import java.util.Map; import org.simantics.databoard.util.ObjectUtils; import org.simantics.db.ReadGraph; import org.simantics.db.common.request.ParametrizedPrimitiveRead; -import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.variable.Variables.NodeStructure; import org.simantics.db.procedure.Listener; import org.simantics.simulator.variable.exceptions.NodeManagerException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import gnu.trove.map.hash.THashMap; @SuppressWarnings("rawtypes") class NodeStructureRequest extends ParametrizedPrimitiveRead implements VariableNodeReadRunnable { - private Listener listener = null; - private NodeStructure value = Variables.PENDING_NODE_STRUCTURE; - private boolean wasRun = false; - - static class Probe implements Runnable { - - private VariableNode node; - public NodeStructure result; - - public Probe(VariableNode node) { - this.node = node; - } - - @SuppressWarnings("unchecked") - @Override - public void run() { - try { - result = NodeStructureRequest.get(node); - node.support.structureCache.put(node.node, result, 1000000000L); - } catch (NodeManagerException e) { - e.printStackTrace(); - } - } - - } - - public NodeStructureRequest(VariableNode node) { - super(node); - } - - @SuppressWarnings("unchecked") - @Override - public void register(ReadGraph graph, final Listener procedure) { - - if(procedure.isDisposed()) { - - // We are not listening - NodeStructure result = (NodeStructure)parameter.support.structureCache.get(parameter.node); - - if(result != null) { - // Return cached value immediately - procedure.execute(result); - } else { - NodeStructureRequest.Probe probe = new Probe(parameter); - parameter.support.manager.getRealm().asyncExec(probe); - if(probe.result != null) { - procedure.execute(probe.result); - } else { - procedure.execute(Variables.PENDING_NODE_STRUCTURE); - } - } - - return; - - } - - // We need to listen - listener = procedure; - // Register listening - parameter.support.manager.addNodeListener(parameter.node, this); - synchronized(this) { - if(wasRun) { - procedure.execute(value); - } else { - NodeStructure result = (NodeStructure)parameter.support.structureCache.get(parameter.node); - if(result != null) { - procedure.execute(result); - } else { - procedure.execute(Variables.PENDING_NODE_STRUCTURE); - } - } - } - - } - - static class NodeListener implements VariableNodeReadRunnable { - - private VariableNode node; - private NodeStructureRequest request; - - public NodeListener(VariableNode node, NodeStructureRequest request) { - this.node = node; - this.request = request; - } - - @SuppressWarnings("unchecked") - @Override - public void run() { - node.support.manager.addNodeListener(node.node, request); - } - - } - - @SuppressWarnings("unchecked") - @Override - public void unregistered() { - parameter.support.manager.removeNodeListener(parameter.node, this); - parameter.support.structureCache.removeListening(parameter.node); - listener = null; - } - - @SuppressWarnings("unchecked") - public static NodeStructure get(VariableNode parameter) throws NodeManagerException { - List children = parameter.support.manager.getChildren(parameter.node); - List properties = parameter.support.manager.getProperties(parameter.node); - Map childMap = Collections.emptyMap(); - Map propertyMap = childMap; - if(!children.isEmpty()) { - childMap = new THashMap<>(children.size()); - for(Object o : children) { - String name = parameter.support.manager.getName(o); - childMap.put(name, o); - } - } - if(!properties.isEmpty()) { - propertyMap = new THashMap<>(properties.size()); - for(Object o : properties) { - String name = parameter.support.manager.getName(o); - propertyMap.put(name, o); - } - } - return new NodeStructure(childMap, propertyMap); - } - - @SuppressWarnings("unchecked") - @Override - public synchronized void run() { - try { - // Cache this value with infinite cache time since we are listening - NodeStructure newValue = get(parameter); - if (wasRun && ObjectUtils.objectEquals(value, newValue)) { - //System.out.println("CACHE VALUE MATCH (" + newValue + ") for " + node.node); - return; - } - value = newValue; - parameter.support.structureCache.put(parameter.node, value); - } catch (Throwable e) { - // Must catch everything to prevent DB client from getting stuck. - Logger.defaultLogError(e); - // Invoke the exception method of the listener - Listener listener = this.listener; - if (listener != null) listener.exception(new DatabaseException("External data access error", e)); - wasRun = true; - return; - } - - // Must always invoke an existing listener, regardless of earlier errors. - Listener listener = this.listener; - if (listener != null) { - listener.execute(value); - } - wasRun = true; - } - - @Override - public String toString() { - return "NodeStructureRequest.run @ " + System.identityHashCode(this); - } + private static final Logger LOGGER = LoggerFactory.getLogger(NodeStructureRequest.class); + + private Listener listener = null; + private NodeStructure value = Variables.PENDING_NODE_STRUCTURE; + private boolean wasRun = false; + + static class Probe implements Runnable { + + private VariableNode node; + public NodeStructure result; + + public Probe(VariableNode node) { + this.node = node; + } + + @SuppressWarnings("unchecked") + @Override + public void run() { + try { + result = NodeStructureRequest.get(node); + node.support.structureCache.put(node.node, result, 1000000000L); + } catch (NodeManagerException e) { + e.printStackTrace(); + } + } + + } + + public NodeStructureRequest(VariableNode node) { + super(node); + } + + @SuppressWarnings("unchecked") + @Override + public void register(ReadGraph graph, final Listener procedure) { + + if(procedure.isDisposed()) { + + // We are not listening + NodeStructure result = (NodeStructure)parameter.support.structureCache.get(parameter.node); + + if(result != null) { + // Return cached value immediately + procedure.execute(result); + } else { + NodeStructureRequest.Probe probe = new Probe(parameter); + parameter.support.manager.getRealm().asyncExec(probe); + if(probe.result != null) { + procedure.execute(probe.result); + } else { + procedure.execute(Variables.PENDING_NODE_STRUCTURE); + } + } + + return; + + } + + // We need to listen + listener = procedure; + // Register listening + parameter.support.manager.addNodeListener(parameter.node, this); + synchronized(this) { + if(!wasRun) { + NodeStructure result = (NodeStructure)parameter.support.structureCache.get(parameter.node); + if(result != null) { + procedure.execute(result); + } else { + procedure.execute(Variables.PENDING_NODE_STRUCTURE); + } + } + } + + } + + static class NodeListener implements VariableNodeReadRunnable { + + private VariableNode node; + private NodeStructureRequest request; + + public NodeListener(VariableNode node, NodeStructureRequest request) { + this.node = node; + this.request = request; + } + + @SuppressWarnings("unchecked") + @Override + public void run() { + node.support.manager.addNodeListener(node.node, request); + } + + } + + @SuppressWarnings("unchecked") + @Override + public void unregistered() { + parameter.support.manager.removeNodeListener(parameter.node, this); + parameter.support.structureCache.removeListening(parameter.node); + listener = null; + } + + @SuppressWarnings("unchecked") + public static NodeStructure get(VariableNode parameter) throws NodeManagerException { + List children = parameter.support.manager.getChildren(parameter.node); + List properties = parameter.support.manager.getProperties(parameter.node); + Map childMap = Collections.emptyMap(); + Map propertyMap = childMap; + if(!children.isEmpty()) { + childMap = new THashMap<>(children.size()); + for(Object o : children) { + String name = parameter.support.manager.getName(o); + childMap.put(name, o); + } + } + if(!properties.isEmpty()) { + propertyMap = new THashMap<>(properties.size()); + for(Object o : properties) { + String name = parameter.support.manager.getName(o); + propertyMap.put(name, o); + } + } + return new NodeStructure(childMap, propertyMap); + } + + @SuppressWarnings("unchecked") + @Override + public synchronized void run() { + try { + // Cache this value with infinite cache time since we are listening + NodeStructure newValue = get(parameter); + if (wasRun && ObjectUtils.objectEquals(value, newValue)) { + //System.out.println("CACHE VALUE MATCH (" + newValue + ") for " + node.node); + return; + } + value = newValue; + parameter.support.structureCache.put(parameter.node, value); + } catch (Throwable e) { + // Must catch everything to prevent DB client from getting stuck. + LOGGER.error("Error while computing node structure", e); + // Invoke the exception method of the listener + Listener listener = this.listener; + if (listener != null) { + listener.exception(new DatabaseException("External data access error", e)); + wasRun = true; + } + return; + } + + // Must always invoke an existing listener, regardless of earlier errors. + Listener listener = this.listener; + if (listener != null) { + listener.execute(value); + wasRun = true; + } + } + + @Override + public String toString() { + return "NodeStructureRequest.run @ " + System.identityHashCode(this); + } } \ No newline at end of file diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/NodeValueRequest.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/NodeValueRequest.java index 2bd089d1e..b44f16b30 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/NodeValueRequest.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/NodeValueRequest.java @@ -6,44 +6,48 @@ import org.simantics.databoard.binding.mutable.Variant; import org.simantics.databoard.util.ObjectUtils; import org.simantics.db.ReadGraph; import org.simantics.db.common.request.ParametrizedPrimitiveRead; -import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; import org.simantics.db.procedure.Listener; +import org.simantics.simulator.variable.NodeManager; import org.simantics.simulator.variable.exceptions.NodeIsNotValidAnymoreException; import org.simantics.simulator.variable.exceptions.NodeManagerException; import org.simantics.utils.datastructures.Pair; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @SuppressWarnings("rawtypes") class NodeValueRequest extends ParametrizedPrimitiveRead, Variant> implements VariableNodeReadRunnable { + private static final Logger LOGGER = LoggerFactory.getLogger(NodeValueRequest.class); + private Listener listener = null; private Variant value = Variables.PENDING_NODE_VALUE; private boolean wasRun = false; static class Probe implements Runnable { - private Pair parameter; - public Variant result; - - public Probe(Pair parameter) { - this.parameter = parameter; - } - - @SuppressWarnings("unchecked") - @Override - public void run() { - try { - result = NodeValueRequest.get(parameter); - parameter.first.support.valueCache.put(parameter.first.node, result, 1000000000L); - } catch (NodeManagerException e) { - e.printStackTrace(); - } catch (BindingException e) { - e.printStackTrace(); - } - } - + private Pair parameter; + public Variant result; + + public Probe(Pair parameter) { + this.parameter = parameter; + } + + @SuppressWarnings("unchecked") + @Override + public void run() { + try { + result = NodeValueRequest.get(parameter); + parameter.first.support.valueCache.put(parameter.first.node, result, 1000000000L); + } catch (NodeManagerException e) { + e.printStackTrace(); + } catch (BindingException e) { + e.printStackTrace(); + } + } + } - + public NodeValueRequest(VariableNode node) { super(Pair.make(node, null)); } @@ -55,18 +59,18 @@ class NodeValueRequest extends ParametrizedPrimitiveRead procedure) { - - VariableNode node = parameter.first; + + VariableNode node = parameter.first; if(procedure.isDisposed()) { - - // We are not listening - Variant result = (Variant)node.support.valueCache.get(node.node); - if(result != null) { - // Return cached value immediately - procedure.execute(result); - } else { + // We are not listening + Variant result = (Variant)node.support.valueCache.get(node.node); + + if(result != null) { + // Return cached value immediately + procedure.execute(result); + } else { // // listener = procedure; @@ -87,37 +91,35 @@ class NodeValueRequest extends ParametrizedPrimitiveRead parameter) throws NodeManagerException, BindingException { - VariableNode node = parameter.first; - Binding binding = parameter.second; - - if (binding != null) { - Object raw = node.support.manager.getValue(node.node, binding); - if(raw == null) return null; - else return new Variant(binding, raw); - } else { - return node.support.manager.getValue(node.node); - } - + VariableNode node = parameter.first; + Binding binding = parameter.second; + + if (binding != null) { + Object raw = node.support.manager.getValue(node.node, binding); + if(raw == null) + return null; + else if(NodeManager.PENDING_NODE_VALUE == raw) + return NodeManager.PENDING_NODE_VALUE; + else return new Variant(binding, raw); + } else { + return node.support.manager.getValue(node.node); + } + } - + @SuppressWarnings("unchecked") @Override public synchronized void run() { - - VariableNode node = parameter.first; - + + VariableNode node = parameter.first; + try { - Variant newValue = get(parameter); + Variant newValue = get(parameter); if (wasRun && ObjectUtils.objectEquals(value, newValue)) { //System.out.println("CACHE VALUE MATCH (" + newValue + ") for " + node.node); return; @@ -209,11 +214,13 @@ class NodeValueRequest extends ParametrizedPrimitiveRead listener = this.listener; - if (listener != null) listener.exception(new DatabaseException("External data access error", e)); - wasRun = true; + if (listener != null) { + listener.exception(new DatabaseException("External data access error", e)); + wasRun = true; + } return; } // Must always invoke an existing listener, regardless of earlier errors. @@ -221,8 +228,8 @@ class NodeValueRequest extends ParametrizedPrimitiveReadgetProperty(DevelopmentKeys.L0_VALIDATION, Bindings.BOOLEAN)) { - String error = L0Validations.checkValueType(graph, parentResource, property.predicate); - if(error != null) { - LOGGER.error(error); - throw new ValidationException(error); + if (property.predicate != null) { + String error = L0Validations.checkValueType(graph, parentResource, property.predicate); + if(error != null) { + LOGGER.error(error); + throw new ValidationException(error); + } } } } @@ -145,10 +152,12 @@ public class StandardGraphPropertyVariable extends AbstractPropertyVariable { if(Development.DEVELOPMENT) { if(Development.getProperty(DevelopmentKeys.L0_VALIDATION, Bindings.BOOLEAN)) { - String error = L0Validations.checkValueType(graph, parentResource, property.predicate); - if(error != null) { - LOGGER.error(error); - throw new ValidationException(error); + if (property.predicate != null) { + String error = L0Validations.checkValueType(graph, parentResource, property.predicate); + if(error != null) { + LOGGER.error(error); + throw new ValidationException(error); + } } } } @@ -183,10 +192,12 @@ public class StandardGraphPropertyVariable extends AbstractPropertyVariable { if(Development.DEVELOPMENT) { if(Development.getProperty(DevelopmentKeys.L0_VALIDATION, Bindings.BOOLEAN)) { - String error = L0Validations.checkValueType(graph, parentResource, property.predicate); - if(error != null) { - LOGGER.error(error); - throw new ValidationException(error); + if (property.predicate != null) { + String error = L0Validations.checkValueType(graph, parentResource, property.predicate); + if(error != null) { + LOGGER.error(error); + throw new ValidationException(error); + } } } } @@ -200,10 +211,12 @@ public class StandardGraphPropertyVariable extends AbstractPropertyVariable { if(Development.DEVELOPMENT) { if(Development.getProperty(DevelopmentKeys.L0_VALIDATION, Bindings.BOOLEAN)) { - String error = L0Validations.checkValueType(graph, parentResource, property.predicate); - if(error != null) { - LOGGER.error(error); - throw new ValidationException(error); + if (property.predicate != null) { + String error = L0Validations.checkValueType(graph, parentResource, property.predicate); + if(error != null) { + LOGGER.error(error); + throw new ValidationException(error); + } } } } @@ -324,11 +337,15 @@ public class StandardGraphPropertyVariable extends AbstractPropertyVariable { @Override public Variable getPredicate(ReadGraph graph) throws DatabaseException { + if (property.predicate == null) + throw new MissingVariableException("No predicate for property " + getName(graph)); return Variables.getVariable(graph, graph.getURI(property.predicate)); } @Override public Resource getPredicateResource(ReadGraph graph) throws DatabaseException { + if (property.predicate == null) + throw new NoPredicateResourceException("No predicate for property " + getName(graph)); return property.predicate; } diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/Variables.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/Variables.java index 341a496a4..218a268a4 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/Variables.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/Variables.java @@ -32,7 +32,6 @@ import org.simantics.db.WriteGraph; import org.simantics.db.common.request.PossibleIndexRoot; import org.simantics.db.common.request.TernaryRead; import org.simantics.db.common.utils.CommonDBUtils; -import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.exception.InvalidVariableException; import org.simantics.db.layer0.exception.MissingVariableException; @@ -53,14 +52,19 @@ import org.simantics.scl.runtime.function.Function1; import org.simantics.scl.runtime.function.Function2; import org.simantics.scl.runtime.function.Function3; import org.simantics.simulation.ontology.SimulationResource; +import org.simantics.simulator.variable.NodeManager; import org.simantics.simulator.variable.exceptions.NodeManagerException; import org.simantics.utils.datastructures.Pair; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import gnu.trove.map.hash.TObjectIntHashMap; final public class Variables { - public static final Variant PENDING_NODE_VALUE = new Variant(); + private static final Logger LOGGER = LoggerFactory.getLogger(Variables.class); + + public static final Variant PENDING_NODE_VALUE = NodeManager.PENDING_NODE_VALUE; public static final NodeStructure PENDING_NODE_STRUCTURE = new NodeStructure(Collections.emptyMap(), Collections.emptyMap()) { public boolean equals(Object object) { @@ -154,8 +158,8 @@ final public class Variables { @Deprecated public final static String[] builtins = { - TYPE, RESOURCE, URI - //, SERIALISED + TYPE, RESOURCE, URI + //, SERIALISED }; public static Variable getPossibleVariable(ReadGraph graph, Resource resource) throws DatabaseException { @@ -309,15 +313,15 @@ final public class Variables { public static Variable getRootVariable(ReadGraph graph) throws DatabaseException { return graph.adapt(graph.getRootLibrary(), Variable.class); } - + public static Resource getPossibleIndexRoot(ReadGraph graph, Variable variable) throws DatabaseException { - return graph.syncRequest(new PossibleVariableIndexRoot(variable)); + return graph.syncRequest(new PossibleVariableIndexRoot(variable)); } - + public static Resource getIndexRoot(ReadGraph graph, Variable variable) throws DatabaseException { - return graph.syncRequest(new VariableIndexRoot(variable)); + return graph.syncRequest(new VariableIndexRoot(variable)); } - + public static Resource getModel(ReadGraph graph, Variable variable) throws DatabaseException { String URI = variable.getURI(graph); return VariablesImpl.getFirst(graph, SimulationResource.getInstance(graph).Model, URI, 8); @@ -382,7 +386,7 @@ final public class Variables { Variable context = getConfigurationContext(graph, resource); return context.browse(graph, RVI); } - + public static Variable getConfigurationVariable(ReadGraph graph, Variable variable) throws DatabaseException { Variable context = getConfigurationContext(graph, variable); RVI rvi = variable.getRVI(graph); @@ -546,12 +550,12 @@ final public class Variables { } public static Variable toPossibleConfigurationVariable(ReadGraph graph, Variable variable) throws DatabaseException { - + Resource represents = variable.getPossibleRepresents(graph); if(represents == null) return null; Resource config = getPossibleConfigurationContextResource(graph, represents); if(config == null) return null; - return switchPossibleContext(graph, variable, config); + return switchPossibleContext(graph, variable, config); } @@ -641,25 +645,26 @@ final public class Variables { } public static Variant requestNodeValue(ReadGraph graph, VariableNode node, final Binding binding) throws DatabaseException { - Variant value = graph.syncRequest(new NodeValueRequest(node, binding)); - if(PENDING_NODE_VALUE == value && graph.getSynchronous()) { - // In this case a PENDING value was previously cached but now the value needs to be obtained for real. - - ValueGetter getter = new ValueGetter(node, binding); - try { - node.support.manager.getRealm().syncExec(getter); - } catch (InterruptedException e) { - Logger.defaultLogError(e); - } - - if (getter.exception != null) - throw new MissingVariableValueException("No value for node " + node, getter.exception); - - return getter.result; - } + Variant value = graph.syncRequest(new NodeValueRequest(node, binding)); + if(PENDING_NODE_VALUE == value && graph.getSynchronous()) { + // In this case a PENDING value was previously cached but now the value needs to be obtained for real. + + ValueGetter getter = new ValueGetter(node, binding); + try { + node.support.manager.getRealm().syncExec(getter); + } catch (InterruptedException e) { + LOGGER.error("Error while getting node value", e); + throw new InvalidVariableException("External data access error " + String.valueOf(node), e); + } + + if (getter.exception != null) + throw new MissingVariableValueException("No value for node " + node, getter.exception); + + return getter.result; + } return value; } - + public static class NodeStructure { // Immutable but wrapped with Collections.unmodifiableMap as an optimization public final Map children; @@ -699,51 +704,51 @@ final public class Variables { NodeStructure value = graph.syncRequest(new NodeStructureRequest(node)); if (value == null) throw new InvalidVariableException("External data access error " + String.valueOf(node)); - if(PENDING_NODE_STRUCTURE == value && graph.getSynchronous()) { - // In this case a PENDING value was previously cached but now the value needs to be obtained for real. - - StructureGetter getter = new StructureGetter(node); - try { - node.support.manager.getRealm().syncExec(getter); - } catch (InterruptedException e) { - Logger.defaultLogError(e); - throw new InvalidVariableException("External data access error " + String.valueOf(node), e); - } - - if (getter.exception != null) - throw new InvalidVariableException("External data access error " + String.valueOf(node), getter.exception); - if (getter.result == null) - throw new InvalidVariableException("External data access error " + String.valueOf(node)); - - return getter.result; - - } + if(PENDING_NODE_STRUCTURE == value && graph.getSynchronous()) { + // In this case a PENDING value was previously cached but now the value needs to be obtained for real. + + StructureGetter getter = new StructureGetter(node); + try { + node.support.manager.getRealm().syncExec(getter); + } catch (InterruptedException e) { + LOGGER.error("Error while getting node structure", e); + throw new InvalidVariableException("External data access error " + String.valueOf(node), e); + } + + if (getter.exception != null) + throw new InvalidVariableException("External data access error " + String.valueOf(node), getter.exception); + if (getter.result == null) + throw new InvalidVariableException("External data access error " + String.valueOf(node)); + + return getter.result; + + } return value; } - + public static String getPossibleUnit(ReadGraph graph, Variable variable) throws DatabaseException { - - try { - - Resource predicate = variable.getPossiblePredicateResource(graph); - if(predicate != null) { - PropertyInfo info = graph.syncRequest(new PropertyInfoRequest(predicate)); - if(info.definedUnit != null) return info.definedUnit; - } - - Variant variant = variable.getVariantValue(graph); - Binding binding = variant.getBinding(); - if(binding == null) return null; - Datatype dt = binding.type(); - if(!(dt instanceof NumberType)) return null; - NumberType nt = (NumberType)dt; - return nt.getUnit(); - - } catch (DatabaseException e) { - return null; - } - + + try { + + Resource predicate = variable.getPossiblePredicateResource(graph); + if(predicate != null) { + PropertyInfo info = graph.syncRequest(new PropertyInfoRequest(predicate)); + if(info.definedUnit != null) return info.definedUnit; + } + + Variant variant = variable.getVariantValue(graph); + Binding binding = variant.getBinding(); + if(binding == null) return null; + Datatype dt = binding.type(); + if(!(dt instanceof NumberType)) return null; + NumberType nt = (NumberType)dt; + return nt.getUnit(); + + } catch (DatabaseException e) { + return null; + } + } /** @@ -790,8 +795,10 @@ final public class Variables { result = new Variant(binding, n.support.manager.getValue(n.node, binding)); else result = n.support.manager.getValue(n.node); + } catch (NodeManagerException e) { + exception = e; } catch (Exception e) { - Logger.defaultLogError(e); + LOGGER.error("Error while getting node value", e); exception = e; } } @@ -814,10 +821,9 @@ final public class Variables { try { result = NodeStructureRequest.get(n); } catch (NodeManagerException e) { - Logger.defaultLogError(e); exception = e; } - } + } }; @@ -825,12 +831,12 @@ final public class Variables { Variable v = Variables.getPossibleVariable(graph, entity); return v != null ? v.getPossibleProperty(graph, property) : null; } - - public static ValueAccessor createValueAccessor(Function1 getValue1, Function2 getValue2, - Function2 setValue2, Function3 setValue3, - Function1 getDatatype) { - return new SCLValueAccessor(getValue1, getValue2, setValue2, setValue3, getDatatype); - } + + public static ValueAccessor createValueAccessor(Function1 getValue1, Function2 getValue2, + Function2 setValue2, Function3 setValue3, + Function1 getDatatype) { + return new SCLValueAccessor(getValue1, getValue2, setValue2, setValue3, getDatatype); + } public static void setRVIProperty(WriteGraph graph, Variable variable, RVI rvi) throws DatabaseException { Layer0 L0 = Layer0.getInstance(graph); diff --git a/bundles/org.simantics.db.management/.classpath b/bundles/org.simantics.db.management/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.db.management/.classpath +++ b/bundles/org.simantics.db.management/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.db.management/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.db.management/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.db.management/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.db.management/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.db.management/META-INF/MANIFEST.MF b/bundles/org.simantics.db.management/META-INF/MANIFEST.MF index 75fdb8b6f..4794e15f1 100644 --- a/bundles/org.simantics.db.management/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.db.management/META-INF/MANIFEST.MF @@ -11,6 +11,6 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.5.0", Bundle-ActivationPolicy: lazy Export-Package: org.simantics.db.management, org.simantics.db.management.discovery -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.simantics.db.management diff --git a/bundles/org.simantics.db.procore/.classpath b/bundles/org.simantics.db.procore/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.db.procore/.classpath +++ b/bundles/org.simantics.db.procore/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.db.procore/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.db.procore/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.db.procore/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.db.procore/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.db.procore/META-INF/MANIFEST.MF b/bundles/org.simantics.db.procore/META-INF/MANIFEST.MF index bf25b3db2..ac40619df 100644 --- a/bundles/org.simantics.db.procore/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.db.procore/META-INF/MANIFEST.MF @@ -4,8 +4,7 @@ Bundle-Name: ProCore Database Access Bundle-SymbolicName: org.simantics.db.procore Bundle-Version: 1.2.1.qualifier Bundle-Vendor: VTT Technical Research Centre of Finland -Require-Bundle: org.apache.log4j;visibility:=reexport, - org.simantics.db;bundle-version="0.8.0";visibility:=reexport, +Require-Bundle: org.simantics.db;bundle-version="0.8.0";visibility:=reexport, org.simantics.db.common;bundle-version="0.8.0";visibility:=reexport, gnu.trove3;bundle-version="3.0.0", org.simantics.db.impl;bundle-version="0.8.0", @@ -24,6 +23,6 @@ Import-Package: org.eclipse.core.runtime, org.simantics.db.server, org.simantics.fastlz, org.simantics.graph.db -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Service-Component: OSGI-INF/org.simantics.db.procore.ProCoreDriver.xml, OSGI-INF/org.simantics.db.procore.internal.ProCoreDriverVirtual.xml Automatic-Module-Name: org.simantics.db.procore diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterTable.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterTable.java index 200e9e3c1..efb644acd 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterTable.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterTable.java @@ -526,10 +526,11 @@ public final class ClusterTable implements IClusterTable { ArrayList toRelease = new ArrayList(); for (CollectorCluster cluster : support.getResidentClusters()) { - target -= support.getClusterSize(cluster); - if (target > 0) { - toRelease.add(cluster); - } else { + toRelease.add(cluster); + long clusterSize = support.getClusterSize(cluster); + //System.err.println("release cluster with " + (clusterSize/1024) + " kiB - " + cluster); + target -= clusterSize; + if (target <= 0) { break; } } diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/DebugSupportImpl.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/DebugSupportImpl.java index 3b05bcba6..ca5eb0825 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/DebugSupportImpl.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/DebugSupportImpl.java @@ -45,6 +45,7 @@ import org.simantics.scl.runtime.function.FunctionImpl2; import org.simantics.scl.runtime.function.FunctionImpl3; import org.simantics.utils.Development; import org.simantics.utils.FileUtils; +import org.slf4j.LoggerFactory; import gnu.trove.map.hash.TIntIntHashMap; import gnu.trove.procedure.TIntIntProcedure; @@ -53,6 +54,8 @@ import gnu.trove.set.hash.TIntHashSet; public class DebugSupportImpl implements DebugSupport { + private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(DebugSupportImpl.class); + final private Map> getCommands = new HashMap>(); final private Map> listCommands = new HashMap>(); final private Map> execCommands = new HashMap>(); @@ -106,6 +109,21 @@ public class DebugSupportImpl implements DebugSupport { }); + listCommands.put("queryData", new FunctionImpl3() { + + @Override + public String apply(WriteGraph graph, File file, String args) { + try { + getSession(graph).queryProvider2.save(); + return "Saved queries"; + } catch (IOException e) { + LOGGER.error("Error while saving queries", e); + return e.getMessage(); + } + } + + }); + listCommands.put("queryActivity", new FunctionImpl3() { @Override diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ObjectResourceMap.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ObjectResourceMap.java index 8b26442d8..02daf860e 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ObjectResourceMap.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ObjectResourceMap.java @@ -214,5 +214,5 @@ final class ObjectResourceMap implements Map, ObjectResourceIdMa public int getId(T t) { return backend.get(t); } - + } \ No newline at end of file diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/QueryControlImpl.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/QueryControlImpl.java index 237e8b50b..f5e55deaa 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/QueryControlImpl.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/QueryControlImpl.java @@ -13,11 +13,16 @@ import org.simantics.db.impl.graph.ReadGraphImpl; import org.simantics.db.procedure.AsyncContextMultiProcedure; import org.simantics.db.procedure.AsyncMultiProcedure; import org.simantics.db.request.ExternalRead; +import org.simantics.db.request.Read; import org.simantics.db.service.QueryControl; import org.simantics.utils.DataContainer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class QueryControlImpl implements QueryControl { - + + private static final Logger LOGGER = LoggerFactory.getLogger(QueryControlImpl.class); + final private SessionImplSocket session; QueryControlImpl(SessionImplSocket session) { @@ -47,7 +52,7 @@ public class QueryControlImpl implements QueryControl { }); } catch (DatabaseException e) { - e.printStackTrace(); + LOGGER.error("query flush failed", e); } return result.get(); } @@ -78,7 +83,7 @@ public class QueryControlImpl implements QueryControl { } }); } catch (DatabaseException e) { - e.printStackTrace(); + LOGGER.error("query gc failed", e); } } @@ -141,6 +146,17 @@ public class QueryControlImpl implements QueryControl { ReadGraphImpl impl = (ReadGraphImpl)graph; return impl.withParent(null, null, false); } + + @Override + public T syncRequestIndependent(ReadGraph graph, Read request) throws DatabaseException { + ReadGraphImpl independent = ((ReadGraphImpl)graph).withParent(null, null, false); + independent.asyncBarrier.inc(); + try { + return independent.syncRequest(request); + } finally { + independent.asyncBarrier.dec(); + } + } @Override public boolean hasParentRequest(ReadGraph graph) { diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/QuerySupportImpl.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/QuerySupportImpl.java index eea97e2e0..0febcea1b 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/QuerySupportImpl.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/QuerySupportImpl.java @@ -5,6 +5,7 @@ import java.io.InputStream; import java.util.Collection; import java.util.function.Consumer; +import org.simantics.db.ObjectResourceIdMap; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.Statement; @@ -83,7 +84,17 @@ public class QuerySupportImpl implements QuerySupport { public ResourceSupport getSupport() { return resourceSupport; } - + + @Override + public ClusterSupport getClusterSupport() { + return clusterSupport; + } + + @Override + public ObjectResourceIdMap createChildMap() { + return new ObjectResourceMap(session); + } + @Override public Statement getStatement(int s, int p, int o) { return getStatement(null, s, p, o); diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplDb.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplDb.java index 92c5e9dda..2b7f2da33 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplDb.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplDb.java @@ -18,7 +18,6 @@ import org.simantics.db.SessionManager; import org.simantics.db.SessionReference; import org.simantics.db.VirtualGraph; import org.simantics.db.authentication.UserAuthenticationAgent; -import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; import org.simantics.db.exception.InvalidAuthenticationException; import org.simantics.db.exception.InvalidUserException; @@ -30,9 +29,13 @@ import org.simantics.db.impl.graph.WriteSupport; import org.simantics.db.impl.query.QueryProcessor; import org.simantics.db.impl.query.QuerySupport; import org.simantics.db.service.ServerInformation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; final public class SessionImplDb extends SessionImplSocket { + private static final Logger LOGGER = LoggerFactory.getLogger(SessionImplDb.class); + /** * Cached ServerInformation structure fetched from the server at connection * time. It should never change during a single session and therefore it @@ -58,7 +61,7 @@ final public class SessionImplDb extends SessionImplSocket { try { newId = cluster.createResource(clusterTranslator); } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("createResource failed", e); return null; } return new ResourceImpl(resourceSupport, newId); @@ -90,6 +93,9 @@ final public class SessionImplDb extends SessionImplSocket { serviceLocator.registerService(QuerySupport.class, querySupport); queryProvider2 = new QueryProcessor(getAmountOfQueryThreads(), querySupport, sessionThreads); + + if("true".equals(System.getProperty("org.simantics.db.persistQueries"))) + queryProvider2.restore(); writeSupport = new WriteSupportImpl(this); serviceLocator.registerService(WriteSupport.class, writeSupport); @@ -114,8 +120,7 @@ final public class SessionImplDb extends SessionImplSocket { // clusterTable.dispose(); clusterTable = null; // throw e; } catch (Throwable e) { - e.printStackTrace(); - Logger.defaultLogError("Unhandled error. See exception for details.", e); + LOGGER.error("Unhandled error. See exception for details.", e); graphSession = null; clusterTable.dispose(); clusterTable = null; throw new Exception(e); diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplSocket.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplSocket.java index 22d0f3165..29c70445b 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplSocket.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplSocket.java @@ -328,7 +328,7 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule try { getClusterTable().refresh(csid, this, clusterUID); } catch (Throwable t) { - Logger.defaultLogError("Refesh failed.", t); + LOGGER.error("refresh({}, {}) failed", thread, csid, t); } } @@ -461,17 +461,17 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule }); assert (null != writer); -// writer.state.barrier.inc(); + writer.asyncBarrier.inc(); try { request.perform(writer); assert (null != writer); } catch (Throwable t) { if (!(t instanceof CancelTransactionException)) - Logger.defaultLogError("Write transaction caused an unexpected error, see exception.", t); + LOGGER.error("Write transaction caused an unexpected error, see exception.", t); writeState.except(t); } finally { -// writer.state.barrier.dec(); + writer.asyncBarrier.dec(); // writer.waitAsync(request); } @@ -482,7 +482,7 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule // Log it first, just to be safe that the error is always logged. if (!(e instanceof CancelTransactionException)) - Logger.defaultLogError("Write transaction caused an unexpected error, see exception.", e); + LOGGER.error("Write transaction caused an unexpected error, see exception.", e); // writeState.getGraph().state.barrier.dec(); // writeState.getGraph().waitAsync(request); @@ -571,52 +571,21 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule VirtualGraph vg = getProvider(request.getProvider()); WriteGraphImpl writer = WriteGraphImpl.create(getQueryProvider2(), writeSupport, vg); - try { - WriteState writeStateT = new WriteState(writer, request, notify, procedure); - writeState = writeStateT; + WriteState writeStateT = new WriteState(writer, request, notify, procedure); + writeState = writeStateT; + assert (null != writer); - assert (null != writer); -// writer.state.barrier.inc(); + try { + writer.asyncBarrier.inc(); writeStateT.setResult(request.perform(writer)); assert (null != writer); - -// writer.state.barrier.dec(); -// writer.waitAsync(null); - } catch (Throwable e) { - -// writer.state.barrier.dec(); -// writer.waitAsync(null); - writeState.except(e); - -// state.stopWriteTransaction(clusterStream); -// -// } catch (Throwable e) { -// // Log it first, just to be safe that the error is always logged. -// Logger.defaultLogError("Write transaction caused an unexpected error, see exception.", e); -// -// try { -// // Callback is client code, we have to be prepared for it to throw unexpected exceptions. -// // All we can do here is to log those, can't really pass them anywhere. -// if (procedure != null) { -// if(e instanceof DatabaseException) procedure.exception((DatabaseException)e); -// else procedure.exception(new DatabaseException(e)); -// } -// } catch (Throwable e2) { -// Logger.defaultLogError("Write request callback caused an unexpected error, see exception.", e2); -// } -// -// clientChanges = new ClientChangesImpl(SessionImplSocket.this); -// -// state.stopWriteTransaction(clusterStream); - } finally { + writer.asyncBarrier.dec(); fireSessionVariableChange(SessionVariables.QUEUED_WRITES); } -// if(notify != null) notify.release(); - task.finish(); } @@ -657,7 +626,7 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule if (t instanceof DatabaseException) callback.accept((DatabaseException) t); else callback.accept(new DatabaseException(t)); } else - Logger.defaultLogError("Unhandled exception", t); + LOGGER.error("Unhandled exception", t); } }; @@ -1355,7 +1324,7 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule callback.exception(new DatabaseException(e)); state.stopWriteTransaction(clusterStream); - Logger.defaultLogError("Write transaction caused an unexpected error, see exception.", e); + LOGGER.error("Write transaction caused an unexpected error, see exception.", e); } finally { @@ -1561,7 +1530,7 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule if(throwable != null) { throwable.set(th); } else { - Logger.defaultLogError("Unhandled exception", th); + LOGGER.error("Unhandled exception", th); } } @@ -1574,7 +1543,7 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule if(throwable != null) { throwable.set(t); } else { - Logger.defaultLogError("Unhandled exception", t); + LOGGER.error("Unhandled exception", t); } try { @@ -1586,7 +1555,7 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule if(throwable != null) { throwable.set(t2); } else { - Logger.defaultLogError("Unhandled exception", t2); + LOGGER.error("Unhandled exception", t2); } } @@ -1626,6 +1595,7 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule ITask task = ThreadLogger.task(request); final ReadGraphImpl newGraph = ReadGraphImpl.create(getQueryProvider2()); + newGraph.asyncBarrier.inc(); try { @@ -1663,6 +1633,8 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule } finally { + newGraph.asyncBarrier.dec(); + fireSessionVariableChange(SessionVariables.QUEUED_READS); } @@ -2479,6 +2451,7 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule return; WriteGraphImpl reactionGraph = WriteGraphImpl.create(graph.processor, writeSupport, null); + reactionGraph.asyncBarrier.inc(); try { @@ -2493,6 +2466,8 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule } finally { + reactionGraph.asyncBarrier.dec(); + } } catch (Throwable t) { @@ -2536,39 +2511,41 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule */ @SuppressWarnings("unchecked") @Override - public synchronized T peekService(Class api) { - - if(serviceKey1 == api) { - return (T)service1; - } else if (serviceKey2 == api) { - // Promote this key - Object result = service2; - service2 = service1; - serviceKey2 = serviceKey1; - service1 = result; - serviceKey1 = api; - return (T)result; - } + public T peekService(Class api) { + if (Layer0.class == api) + return (T) L0; - if (Layer0.class == api) - return (T) L0; - if (ServerInformation.class == api) - return (T) getCachedServerInformation(); - else if (WriteGraphImpl.class == api) - return (T) writeState.getGraph(); - else if (ClusterBuilder.class == api) - return (T)new ClusterBuilderImpl(this, (WriteOnlySupport)writeState.getGraph().writeSupport); - else if (ClusterBuilderFactory.class == api) - return (T)new ClusterBuilderFactoryImpl(this); + synchronized (this) { + if (serviceKey1 == api) { + return (T) service1; + } + if (serviceKey2 == api) { + // Promote this key + Object result = service2; + service2 = service1; + serviceKey2 = serviceKey1; + service1 = result; + serviceKey1 = api; + return (T)result; + } - service2 = service1; - serviceKey2 = serviceKey1; + if (ServerInformation.class == api) + return (T) getCachedServerInformation(); + else if (WriteGraphImpl.class == api) + return (T) writeState.getGraph(); + else if (ClusterBuilder.class == api) + return (T)new ClusterBuilderImpl(this, (WriteOnlySupport)writeState.getGraph().writeSupport); + else if (ClusterBuilderFactory.class == api) + return (T)new ClusterBuilderFactoryImpl(this); - service1 = serviceLocator.peekService(api); - serviceKey1 = api; + service2 = service1; + serviceKey2 = serviceKey1; - return (T)service1; + service1 = serviceLocator.peekService(api); + serviceKey1 = api; + return (T)service1; + } } /* @@ -2615,9 +2592,9 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule try { h.valuesChanged(ctx); } catch (Exception e) { - Logger.defaultLogError("monitor handler notification produced the following exception", e); + LOGGER.error("monitor handler notification produced the following exception", e); } catch (LinkageError e) { - Logger.defaultLogError("monitor handler notification produced a linkage error", e); + LOGGER.error("monitor handler notification produced a linkage error", e); } } } @@ -3604,4 +3581,10 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule state.setCombine(false); } + @SuppressWarnings("unchecked") + @Override + public T l0() { + return (T) L0; + } + } diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplVirtual.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplVirtual.java index 50184528e..d90f2c3a5 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplVirtual.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplVirtual.java @@ -16,7 +16,6 @@ import java.io.IOException; import org.simantics.db.ServerI; import org.simantics.db.VirtualGraph; import org.simantics.db.authentication.UserAuthenticationAgent; -import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; import org.simantics.db.exception.InvalidAuthenticationException; import org.simantics.db.exception.InvalidUserException; @@ -24,6 +23,8 @@ import org.simantics.db.impl.ResourceImpl; import org.simantics.db.impl.VirtualGraphImpl; import org.simantics.db.impl.query.QueryProcessor; import org.simantics.db.service.ServerInformation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import fi.vtt.simantics.procore.BackdoorAuthenticator; import fi.vtt.simantics.procore.ProCoreServerReference; @@ -31,6 +32,9 @@ import fi.vtt.simantics.procore.ProCoreSessionReference; import fi.vtt.simantics.procore.SessionManagerSource; public class SessionImplVirtual extends SessionImplSocket { + + private static final Logger LOGGER = LoggerFactory.getLogger(SessionImplVirtual.class); + protected VirtualGraphImpl virtualGraphImpl; public SessionImplVirtual(UserAuthenticationAgent authAgent) throws DatabaseException { @@ -75,12 +79,11 @@ public class SessionImplVirtual extends SessionImplSocket { } catch (InvalidUserException e) { throw e; } catch (IOException e) { - Logger.defaultLogError("I/O error. See exception for details.", e); + LOGGER.error("I/O error. See exception for details.", e); graphSession = null; throw new DatabaseException(e); } catch (Throwable e) { - e.printStackTrace(); - Logger.defaultLogError("Unhandled error. See exception for details.", e); + LOGGER.error("Unhandled error. See exception for details.", e); graphSession = null; throw new DatabaseException(e); } @@ -108,7 +111,7 @@ public class SessionImplVirtual extends SessionImplSocket { try { return gs.getServerInformation(); } catch (DatabaseException e) { - Logger.defaultLogError("Failed to get server info.", e); + LOGGER.error("Failed to get server info.", e); return null; } } diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/State.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/State.java index 4c6e77b1a..1e468f2c3 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/State.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/State.java @@ -24,6 +24,7 @@ import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; import org.simantics.db.exception.InternalException; import org.simantics.db.exception.RuntimeDatabaseException; +import org.simantics.db.impl.graph.ReadGraphImpl; import org.simantics.db.impl.graph.WriteGraphImpl; import org.simantics.db.impl.query.QueryProcessor; import org.simantics.db.request.WriteOnly; @@ -340,7 +341,10 @@ class State { // start = System.nanoTime(); queryProvider.propagateChangesInQueryCache(graph); - queryProvider.listening.fireListeners(graph); + ReadGraphImpl listenerGraph = graph.forRecompute(null); + listenerGraph.asyncBarrier.inc(); + queryProvider.listening.fireListeners(listenerGraph); + listenerGraph.asyncBarrier.dec(); // duration = System.nanoTime() - start; // System.out.println("performScheduledUpdates " + 1e-9*duration + "s. "); diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/WriteSupportImpl.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/WriteSupportImpl.java index ea4319ace..247df4645 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/WriteSupportImpl.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/WriteSupportImpl.java @@ -8,7 +8,6 @@ import org.simantics.db.VirtualGraph; import org.simantics.db.WriteGraph; import org.simantics.db.common.MetadataUtils; import org.simantics.db.common.exception.DebugException; -import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; import org.simantics.db.exception.ImmutableException; import org.simantics.db.exception.ServiceException; @@ -28,9 +27,13 @@ import org.simantics.db.request.WriteOnly; import org.simantics.db.request.WriteResult; import org.simantics.db.request.WriteTraits; import org.simantics.db.service.ByteReader; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class WriteSupportImpl implements WriteSupport { + private static final Logger LOGGER = LoggerFactory.getLogger(WriteSupportImpl.class); + final private SessionImplSocket session; final private QueryProcessor queryProcessor; final private State state; @@ -122,7 +125,7 @@ public class WriteSupportImpl implements WriteSupport { try { addSetValue(((ResourceImpl) resource).id, value, value.length); } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("writeOnly setValue({}, {}, byte[{}]) failed", provider, resource, value.length, e); } } } else { @@ -134,7 +137,7 @@ public class WriteSupportImpl implements WriteSupport { try { addSetValue(((ResourceImpl) resource).id, value, value.length); } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("setValue({}, {}, byte[{}]) failed", provider, resource, value.length, e); } } queryProcessor.releaseWrite(session.writeState.getGraph()); @@ -199,7 +202,7 @@ public class WriteSupportImpl implements WriteSupport { try { cluster.removeValue(key, session.clusterTranslator); } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("denyValue({}, {}) failed", provider, resource, e); return; } queryProcessor.updateValue(key); @@ -460,7 +463,7 @@ public class WriteSupportImpl implements WriteSupport { if (null != c && c != cluster) session.clusterTable.replaceCluster(c); } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("claimImpl({}, {}, {}) failed", subject, predicate, object, e); throw new RuntimeException(e); } queryProcessor.updateStatements(subject, predicate); @@ -480,7 +483,7 @@ public class WriteSupportImpl implements WriteSupport { if (null != c && c != cluster) session.clusterTable.replaceCluster(c); } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("claimImpl2({}, {}, {}) failed", subject, predicate, object, e); } if (cluster.isWriteOnly()) return; @@ -504,7 +507,7 @@ public class WriteSupportImpl implements WriteSupport { try { cluster.denyRelation(subject, predicate, object, session.clusterTranslator); } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("removeStatement({}, {}, {}) failed", subject, predicate, object, e); return false; } queryProcessor.updateStatements(subject, predicate); diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/XSupportImpl.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/XSupportImpl.java index 058706686..7a9be0480 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/XSupportImpl.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/XSupportImpl.java @@ -1,5 +1,7 @@ package fi.vtt.simantics.procore.internal; +import java.io.IOException; + import org.simantics.db.Database; import org.simantics.db.Resource; import org.simantics.db.Session; @@ -175,5 +177,14 @@ public class XSupportImpl implements XSupport { ClusterImpl clusterImpl = session.clusterTable.getClusterByClusterUIDOrMakeProxy(clusterUID); return clusterImpl.isLoaded(); } - + + @Override + public void saveQueries() throws DatabaseException { + try { + session.queryProvider2.save(); + } catch (IOException e) { + throw new DatabaseException(e); + } + } + } diff --git a/bundles/org.simantics.db.server/.classpath b/bundles/org.simantics.db.server/.classpath index b862a296d..e801ebfb4 100644 --- a/bundles/org.simantics.db.server/.classpath +++ b/bundles/org.simantics.db.server/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/bundles/org.simantics.db.server/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.db.server/.settings/org.eclipse.jdt.core.prefs index 295926d96..7adc0fb9a 100644 --- a/bundles/org.simantics.db.server/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.db.server/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.db.server/META-INF/MANIFEST.MF b/bundles/org.simantics.db.server/META-INF/MANIFEST.MF index dceca2ea8..bd2c64b31 100644 --- a/bundles/org.simantics.db.server/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.db.server/META-INF/MANIFEST.MF @@ -7,12 +7,10 @@ Bundle-Activator: org.simantics.db.server.internal.Activator Bundle-Vendor: VTT Technical Research Centre of Finland Export-Package: org.simantics.db.server, org.simantics.db.server.internal -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Import-Package: gnu.trove.impl.hash, gnu.trove.iterator, gnu.trove.map.hash, - org.apache.log4j, - org.apache.log4j.spi, org.eclipse.core.runtime, org.osgi.framework;version="1.3.0", org.simantics.db, diff --git a/bundles/org.simantics.db.services/.classpath b/bundles/org.simantics.db.services/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.db.services/.classpath +++ b/bundles/org.simantics.db.services/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.db.services/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.db.services/.settings/org.eclipse.jdt.core.prefs index 3a2153707..7adc0fb9a 100644 --- a/bundles/org.simantics.db.services/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.db.services/.settings/org.eclipse.jdt.core.prefs @@ -1,11 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.db.services/META-INF/MANIFEST.MF b/bundles/org.simantics.db.services/META-INF/MANIFEST.MF index bb78bf41e..099d1dca2 100644 --- a/bundles/org.simantics.db.services/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.db.services/META-INF/MANIFEST.MF @@ -7,7 +7,7 @@ Bundle-Vendor: VTT Technical Research Centre of Finland Require-Bundle: org.eclipse.core.runtime, gnu.trove3, org.simantics.layer0x.ontology;bundle-version="1.0.0", - org.slf4j.api;bundle-version="1.7.25", + org.slf4j.api, org.simantics.utils;bundle-version="1.1.0", org.simantics.db;bundle-version="1.1.0", org.simantics.scl.reflection, @@ -19,5 +19,5 @@ Export-Package: org.simantics.db.services, Bundle-ClassPath: . Bundle-ActivationPolicy: lazy Bundle-Activator: org.simantics.db.services.internal.Activator -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.simantics.db.services diff --git a/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/AdapterRegistry2.java b/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/AdapterRegistry2.java index fe9bab552..e9b59023f 100644 --- a/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/AdapterRegistry2.java +++ b/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/AdapterRegistry2.java @@ -34,7 +34,6 @@ import org.simantics.db.Session; import org.simantics.db.adaption.Adapter; import org.simantics.db.adaption.AdapterInstaller; import org.simantics.db.adaption.AdaptionService; -import org.simantics.db.common.request.ReadRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.request.Read; import org.simantics.db.services.adaption.reflection.AdaptingDynamicAdapter2; @@ -96,15 +95,12 @@ public class AdapterRegistry2 { } private static void handleException(Exception e, String fileName) { - System.err.println("At " + fileName); - e.printStackTrace(); + LOGGER.error("At {}", fileName, e); } private void handleException(Exception e, AdapterInstaller installer) { String desc = installerSources.get(installer); - if (desc != null) - System.err.println("At " + desc); - e.printStackTrace(); + LOGGER.error("At {}, installer {}", desc, installer, e); } private void handleAdaptersDocument(Loader b, Document doc, String fileName) { @@ -228,7 +224,6 @@ public class AdapterRegistry2 { }, fileName); } catch (Exception e) { - e.printStackTrace(); handleException(e, fileName); } } @@ -242,9 +237,9 @@ public class AdapterRegistry2 { NamedNodeMap attr = n.getAttributes(); IDynamicAdapter2 da = null; if(n.getNodeName().equals("this")) - da = new ThisResource2(); + da = ThisResource2.INSTANCE; else if(n.getNodeName().equals("graph")) - da = new GraphObject2(); + da = GraphObject2.INSTANCE; else if(n.getNodeName().equals("bundle")) { String bundleId = null; Node fc = n.getFirstChild(); diff --git a/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/GraphObject2.java b/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/GraphObject2.java index e8f171b8c..8a2db578f 100644 --- a/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/GraphObject2.java +++ b/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/GraphObject2.java @@ -15,6 +15,8 @@ import org.simantics.db.ReadGraph; public class GraphObject2 implements IDynamicAdapter2 { + public static final IDynamicAdapter2 INSTANCE = new GraphObject2(); + @Override public Class getType() { return ReadGraph.class; diff --git a/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/ThisResource2.java b/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/ThisResource2.java index 24001ee0a..bacf3adee 100644 --- a/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/ThisResource2.java +++ b/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/ThisResource2.java @@ -16,6 +16,8 @@ import org.simantics.db.ReadGraph; public class ThisResource2 implements IDynamicAdapter2 { + public static IDynamicAdapter2 INSTANCE = new ThisResource2(); + @Override public Class getType() { return Resource.class; diff --git a/bundles/org.simantics.db.testing/.classpath b/bundles/org.simantics.db.testing/.classpath index d280a5aa3..e56d60296 100644 --- a/bundles/org.simantics.db.testing/.classpath +++ b/bundles/org.simantics.db.testing/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.db.testing/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.db.testing/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.db.testing/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.db.testing/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.db.testing/META-INF/MANIFEST.MF b/bundles/org.simantics.db.testing/META-INF/MANIFEST.MF index 960ccf009..03b2c8cd3 100644 --- a/bundles/org.simantics.db.testing/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.db.testing/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: DB Testing Support Bundle-SymbolicName: org.simantics.db.testing Bundle-Version: 1.0.0.qualifier Bundle-Vendor: Semantum Oy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.db.layer0;bundle-version="1.1.0", org.simantics.graph.db;bundle-version="1.1.5";visibility:=reexport, org.simantics.project;bundle-version="1.0.1";visibility:=reexport, @@ -19,7 +19,7 @@ Require-Bundle: org.simantics.db.layer0;bundle-version="1.1.0", org.junit;bundle-version="4.12.0", org.simantics.db.server, org.apache.commons.math3, - org.slf4j.api;bundle-version="1.7.25" + org.slf4j.api Export-Package: org.simantics.db.testing.annotation, org.simantics.db.testing.base, org.simantics.db.testing.cases, diff --git a/bundles/org.simantics.db/.classpath b/bundles/org.simantics.db/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.db/.classpath +++ b/bundles/org.simantics.db/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.db/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.db/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.db/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.db/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.db/META-INF/MANIFEST.MF b/bundles/org.simantics.db/META-INF/MANIFEST.MF index 34c12e8cc..9762e369b 100644 --- a/bundles/org.simantics.db/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.db/META-INF/MANIFEST.MF @@ -21,7 +21,7 @@ Require-Bundle: org.simantics.utils.datastructures;bundle-version="1.0.0";visibi org.simantics.scl.runtime;bundle-version="0.1.4", org.eclipse.osgi, org.eclipse.core.runtime -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-Activator: org.simantics.db.internal.Activator Bundle-ActivationPolicy: lazy Automatic-Module-Name: org.simantics.db diff --git a/bundles/org.simantics.db/src/org/simantics/db/RelationInfo.java b/bundles/org.simantics.db/src/org/simantics/db/RelationInfo.java index fb4c4820a..168816ed9 100644 --- a/bundles/org.simantics.db/src/org/simantics/db/RelationInfo.java +++ b/bundles/org.simantics.db/src/org/simantics/db/RelationInfo.java @@ -11,8 +11,6 @@ *******************************************************************************/ package org.simantics.db; - - final public class RelationInfo { public static final RelationInfo[] NONE = new RelationInfo[0]; @@ -27,7 +25,7 @@ final public class RelationInfo { this.isFinal = isFinal; this.isAsserted = isAsserted; } - + @Override public String toString() { return "RelationInfo[predicate=" + predicate + ", isFunctional=" + isFunctional + ", isFinal=" + isFinal + ", isAsserted=" + isAsserted + "]"; diff --git a/bundles/org.simantics.db/src/org/simantics/db/RequestProcessor.java b/bundles/org.simantics.db/src/org/simantics/db/RequestProcessor.java index 5e818cb99..924ccffb0 100644 --- a/bundles/org.simantics.db/src/org/simantics/db/RequestProcessor.java +++ b/bundles/org.simantics.db/src/org/simantics/db/RequestProcessor.java @@ -62,7 +62,7 @@ import org.simantics.db.request.WriteInterface; * @see MergingGraphRequestProcessor * @see AsyncRequestProcessor */ -public interface RequestProcessor extends RequestProcessorSpecific, ServiceLocator { +public interface RequestProcessor extends RequestProcessorSpecific, ServiceLocator, ResourceLocator { Resource getRootLibrary(); diff --git a/bundles/org.simantics.db/src/org/simantics/db/ResourceLocator.java b/bundles/org.simantics.db/src/org/simantics/db/ResourceLocator.java new file mode 100644 index 000000000..8a8b0fa48 --- /dev/null +++ b/bundles/org.simantics.db/src/org/simantics/db/ResourceLocator.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2020 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Semantum Oy - initial API and implementation + *******************************************************************************/ +package org.simantics.db; + +/** + * @author Tuukka Lehtonen + * @since 1.43.0 + */ +public interface ResourceLocator { + + /** + * Layer0 is an integral part of Simantics database modelling and for performance + * reasons deserves simplest possible access to its resource class. + * + * @return returns the internally cached + * org.simantics.layer0.Layer0 instance + */ + public T l0(); + +} diff --git a/bundles/org.simantics.db/src/org/simantics/db/service/QueryControl.java b/bundles/org.simantics.db/src/org/simantics/db/service/QueryControl.java index 3da3c5aa3..a8c728643 100644 --- a/bundles/org.simantics.db/src/org/simantics/db/service/QueryControl.java +++ b/bundles/org.simantics.db/src/org/simantics/db/service/QueryControl.java @@ -17,9 +17,11 @@ import org.simantics.db.AsyncReadGraph; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; +import org.simantics.db.exception.DatabaseException; import org.simantics.db.procedure.AsyncContextMultiProcedure; import org.simantics.db.procedure.AsyncMultiProcedure; import org.simantics.db.request.ExternalRead; +import org.simantics.db.request.Read; /** @@ -87,12 +89,25 @@ public interface QueryControl { * performed with the specified ReadGraph. DB listeners are therefore not * triggered by anything that is performed with the returned ReadGraph. * + * @Deprecated In favor of syncRequestIndependent * @param graph read transaction handle to clone for listener-independent * use * @return read transaction handle that is independent of the requests * performed with the parameter */ ReadGraph getIndependentGraph(ReadGraph graph); + + /** + * Performs the given request without accumulating query dependencies. + * DB listeners are therefore not triggered by anything that is performed within the request. + * + * @param graph read transaction handle to clone for listener-independent + * use + * @param request the request to perform + * @return the result of the request evaluation + */ + T syncRequestIndependent(ReadGraph graph, Read request) throws DatabaseException; + boolean hasParentRequest(ReadGraph graph); } diff --git a/bundles/org.simantics.db/src/org/simantics/db/service/XSupport.java b/bundles/org.simantics.db/src/org/simantics/db/service/XSupport.java index cf9e96e78..bab69074e 100644 --- a/bundles/org.simantics.db/src/org/simantics/db/service/XSupport.java +++ b/bundles/org.simantics.db/src/org/simantics/db/service/XSupport.java @@ -162,5 +162,7 @@ public interface XSupport { public boolean rolledback(); public boolean isClusterLoaded(ClusterUID clusterUID) throws DatabaseException; - + + public void saveQueries() throws DatabaseException; + } diff --git a/bundles/org.simantics.debug.browser.ui/.classpath b/bundles/org.simantics.debug.browser.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.debug.browser.ui/.classpath +++ b/bundles/org.simantics.debug.browser.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.debug.browser.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.debug.browser.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.debug.browser.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.debug.browser.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.debug.browser.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.debug.browser.ui/META-INF/MANIFEST.MF index f377235cb..4e4424aec 100644 --- a/bundles/org.simantics.debug.browser.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.debug.browser.ui/META-INF/MANIFEST.MF @@ -13,7 +13,7 @@ Require-Bundle: org.eclipse.ui, org.simantics.utils.ui;bundle-version="1.1.0", org.simantics.db;bundle-version="1.1.0", org.simantics.db.layer0;bundle-version="1.1.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Bundle-Vendor: Association for Decentralized Information Management in Industry THTH ry Import-Package: org.eclipse.core.expressions, diff --git a/bundles/org.simantics.debug.browser/.classpath b/bundles/org.simantics.debug.browser/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.debug.browser/.classpath +++ b/bundles/org.simantics.debug.browser/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.debug.browser/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.debug.browser/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.debug.browser/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.debug.browser/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.debug.browser/META-INF/MANIFEST.MF b/bundles/org.simantics.debug.browser/META-INF/MANIFEST.MF index 398b4bce1..3dc219fb5 100644 --- a/bundles/org.simantics.debug.browser/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.debug.browser/META-INF/MANIFEST.MF @@ -6,17 +6,16 @@ Bundle-Version: 1.0.0.qualifier Bundle-Activator: org.simantics.debug.browser.internal.Activator Require-Bundle: org.simantics;bundle-version="1.0.0", gnu.trove3;bundle-version="3.0.3", - org.eclipse.jetty.server, - org.eclipse.jetty.servlet, - org.eclipse.jetty.http;bundle-version="9.2.13", - org.eclipse.jetty.util;bundle-version="9.2.13" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 + org.eclipse.jetty.server;bundle-version="9.4.24", + org.eclipse.jetty.servlet;bundle-version="9.4.24", + org.eclipse.jetty.http;bundle-version="9.4.24", + org.eclipse.jetty.util;bundle-version="9.4.24", + javax.servlet-api;bundle-version="3.1.0" +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.debug.browser.content, org.simantics.debug.browser.internal;x-friends:="org.simantics.debug.browser.ui", org.simantics.debug.browser.sections, org.simantics.debug.browser.utils -Import-Package: javax.servlet;version="2.5.0", - javax.servlet.http;version="2.5.0" Bundle-Vendor: Association for Decentralized Information Management in Industry THTH ry Automatic-Module-Name: org.simantics.debug.browser diff --git a/bundles/org.simantics.debug.graphical/.classpath b/bundles/org.simantics.debug.graphical/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.debug.graphical/.classpath +++ b/bundles/org.simantics.debug.graphical/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.debug.graphical/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.debug.graphical/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.debug.graphical/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.debug.graphical/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.debug.graphical/META-INF/MANIFEST.MF b/bundles/org.simantics.debug.graphical/META-INF/MANIFEST.MF index b50e13d63..f43bcaec4 100644 --- a/bundles/org.simantics.debug.graphical/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.debug.graphical/META-INF/MANIFEST.MF @@ -3,12 +3,12 @@ Bundle-ManifestVersion: 2 Bundle-Name: Graphical Bundle-SymbolicName: org.simantics.debug.graphical;singleton:=true Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.db;bundle-version="1.1.0", org.eclipse.core.runtime;bundle-version="3.6.0", org.eclipse.ui;bundle-version="3.6.0", org.simantics.ui;bundle-version="1.0.0", com.fasterxml.jackson.core.jackson-core;bundle-version="2.8.8", - org.slf4j.api;bundle-version="1.7.25", + org.slf4j.api, com.fasterxml.jackson.core.jackson-databind;bundle-version="2.8.8" Automatic-Module-Name: org.simantics.debug.graphical diff --git a/bundles/org.simantics.debug.graphical/scl/Simantics/GraphicalDebugger.scl b/bundles/org.simantics.debug.graphical/scl/Simantics/GraphicalDebugger.scl index 7a23274c4..0542beb1d 100644 --- a/bundles/org.simantics.debug.graphical/scl/Simantics/GraphicalDebugger.scl +++ b/bundles/org.simantics.debug.graphical/scl/Simantics/GraphicalDebugger.scl @@ -1,6 +1,6 @@ import "Simantics/DB" -importJava "org.simantics.debug.graphical.DebuggerCanvas" where +importJava "org.simantics.debug.graphical.DebuggerCanvasProxy" where data GraphDebugger setStatementFilter :: GraphDebugger -> (Statement -> Boolean) -> () diff --git a/bundles/org.simantics.debug.graphical/src/org/simantics/debug/graphical/DebuggerCanvasProxy.java b/bundles/org.simantics.debug.graphical/src/org/simantics/debug/graphical/DebuggerCanvasProxy.java new file mode 100644 index 000000000..bf7a73887 --- /dev/null +++ b/bundles/org.simantics.debug.graphical/src/org/simantics/debug/graphical/DebuggerCanvasProxy.java @@ -0,0 +1,32 @@ +package org.simantics.debug.graphical; + +import org.simantics.db.Resource; +import org.simantics.scl.runtime.function.Function; + +/** + * Simantics/GraphicalDebugger SCL API to avoid undesired AWT + * toolkit initialization. + * + * @author Tuukka Lehtonen + */ +public class DebuggerCanvasProxy { + + DebuggerCanvas canvas; + + public void setStatementFilter(@SuppressWarnings("rawtypes") Function statementFilter) { + canvas.setStatementFilter(statementFilter); + } + + public void removeStatementFilter() { + canvas.removeStatementFilter(); + } + + public void addResource(Resource resource) { + canvas.addResource(resource); + } + + public DebuggerCanvasProxy(DebuggerCanvas canvas) { + this.canvas = canvas; + } + +} diff --git a/bundles/org.simantics.debug.graphical/src/org/simantics/debug/graphical/GraphicalDebugger.java b/bundles/org.simantics.debug.graphical/src/org/simantics/debug/graphical/GraphicalDebugger.java index 9091a27f9..81844e4ae 100644 --- a/bundles/org.simantics.debug.graphical/src/org/simantics/debug/graphical/GraphicalDebugger.java +++ b/bundles/org.simantics.debug.graphical/src/org/simantics/debug/graphical/GraphicalDebugger.java @@ -11,7 +11,7 @@ import javax.swing.JFrame; public class GraphicalDebugger { - public static DebuggerCanvas newGraphDebugger() { + public static DebuggerCanvasProxy newGraphDebugger() { final JFrame frame = new JFrame(); frame.setTitle("Graph debugger"); Toolkit tk = Toolkit.getDefaultToolkit(); @@ -53,7 +53,7 @@ public class GraphicalDebugger { }); frame.setVisible(true); - return canvas; + return new DebuggerCanvasProxy(canvas); } } diff --git a/bundles/org.simantics.debug.ui/.classpath b/bundles/org.simantics.debug.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.debug.ui/.classpath +++ b/bundles/org.simantics.debug.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.debug.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.debug.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.debug.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.debug.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.debug.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.debug.ui/META-INF/MANIFEST.MF index 4996a07e9..397d3febe 100644 --- a/bundles/org.simantics.debug.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.debug.ui/META-INF/MANIFEST.MF @@ -23,6 +23,6 @@ Require-Bundle: org.eclipse.core.runtime, org.simantics.modeling.ontology, org.slf4j.api Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.debug.ui Automatic-Module-Name: org.simantics.debug.ui diff --git a/bundles/org.simantics.desktop.product/.classpath b/bundles/org.simantics.desktop.product/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.desktop.product/.classpath +++ b/bundles/org.simantics.desktop.product/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.desktop.product/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.desktop.product/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.desktop.product/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.desktop.product/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.desktop.product/META-INF/MANIFEST.MF b/bundles/org.simantics.desktop.product/META-INF/MANIFEST.MF index 0d0294896..0da4b9a48 100644 --- a/bundles/org.simantics.desktop.product/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.desktop.product/META-INF/MANIFEST.MF @@ -4,5 +4,5 @@ Bundle-Name: Simantics Desktop Product Bundle-SymbolicName: org.simantics.desktop.product;singleton:=true Bundle-Version: 1.0.0.qualifier Bundle-Vendor: Semantum Oy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.simantics.desktop.product diff --git a/bundles/org.simantics.desktop.product/splash.svg b/bundles/org.simantics.desktop.product/splash.svg index b984365f4..2b4ec84d2 100644 --- a/bundles/org.simantics.desktop.product/splash.svg +++ b/bundles/org.simantics.desktop.product/splash.svg @@ -401,7 +401,7 @@ id="tspan6235" x="4.0821486" y="291.79337" - style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.6444446px;font-family:'Cascadia Code';-inkscape-font-specification:'Cascadia Code, Normal';fill:#ffffff;fill-opacity:1;stroke-width:0.26458335px;text-anchor:start;text-align:start;writing-mode:lr;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;">1.43.0 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.6444446px;font-family:'Cascadia Code';-inkscape-font-specification:'Cascadia Code, Normal';fill:#ffffff;fill-opacity:1;stroke-width:0.26458335px;text-anchor:start;text-align:start;writing-mode:lr;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;">1.44.0 DESKTOP diff --git a/bundles/org.simantics.desktop.ui.ontology/.classpath b/bundles/org.simantics.desktop.ui.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.desktop.ui.ontology/.classpath +++ b/bundles/org.simantics.desktop.ui.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.desktop.ui.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.desktop.ui.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.desktop.ui.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.desktop.ui.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.desktop.ui.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.desktop.ui.ontology/META-INF/MANIFEST.MF index 08fbbb32b..8024dbe0a 100644 --- a/bundles/org.simantics.desktop.ui.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.desktop.ui.ontology/META-INF/MANIFEST.MF @@ -9,5 +9,5 @@ Require-Bundle: org.simantics.layer0, org.simantics.silk.ontology;bundle-version="1.1.0", org.simantics.viewpoint.ontology;bundle-version="1.2.0", org.simantics.modeling.ontology;bundle-version="1.2.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.simantics.desktop.ui.ontology diff --git a/bundles/org.simantics.desktop.ui/.classpath b/bundles/org.simantics.desktop.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.desktop.ui/.classpath +++ b/bundles/org.simantics.desktop.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.desktop.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.desktop.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.desktop.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.desktop.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.desktop.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.desktop.ui/META-INF/MANIFEST.MF index 1c2b3846c..05b72e740 100644 --- a/bundles/org.simantics.desktop.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.desktop.ui/META-INF/MANIFEST.MF @@ -15,7 +15,8 @@ Require-Bundle: org.simantics.workbench;bundle-version="1.5.1", org.simantics.spreadsheet.graph, org.simantics.spreadsheet;bundle-version="1.1.0", org.eclipse.ui.intro;bundle-version="3.5.100", - org.eclipse.ui.intro.quicklinks;bundle-version="1.0.100" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 + org.eclipse.ui.intro.quicklinks;bundle-version="1.0.100", + org.simantics.views.swt;bundle-version="1.0.0" +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Automatic-Module-Name: org.simantics.desktop.ui diff --git a/bundles/org.simantics.diagram.connection/.classpath b/bundles/org.simantics.diagram.connection/.classpath index 8a3b30d04..6248f62f7 100644 --- a/bundles/org.simantics.diagram.connection/.classpath +++ b/bundles/org.simantics.diagram.connection/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.diagram.connection/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.diagram.connection/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.diagram.connection/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.diagram.connection/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.diagram.connection/META-INF/MANIFEST.MF b/bundles/org.simantics.diagram.connection/META-INF/MANIFEST.MF index bd0ead3ec..824febec4 100644 --- a/bundles/org.simantics.diagram.connection/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.diagram.connection/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Diagram connections Bundle-SymbolicName: org.simantics.diagram.connection Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: gnu.trove3;bundle-version="3.0.0", org.junit;bundle-version="4.12.0";resolution:=optional Export-Package: org.simantics.diagram.connection, diff --git a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteGraph.java b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteGraph.java index fe9371766..6357e537a 100644 --- a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteGraph.java +++ b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteGraph.java @@ -277,6 +277,12 @@ public class RouteGraph implements Serializable { transientLines.clear(); } + protected void removeRouteTerminalsFromRouteLines() { + for(RouteLine line : lines) { + line.removeRouteTerminals(); + } + } + /** * Rotates given terminal clockwise by given amount * (also negative numbers are allowed). @@ -311,6 +317,7 @@ public class RouteGraph implements Serializable { public void update() { needsUpdate = false; removeTransientRouteLines(); + removeRouteTerminalsFromRouteLines(); //print(); diff --git a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteLine.java b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteLine.java index a6a4f22d2..225c4abfe 100644 --- a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteLine.java +++ b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteLine.java @@ -113,10 +113,17 @@ public class RouteLine implements RouteNode, Serializable { out.print(" HOR"); else out.print(" VER"); + if (hidden) + out.print(" HIDDEN"); + out.print(" @ " + position); for(RoutePoint point : points) { out.print(" ("+point.x+","+point.y+")"); } out.print(" (data=" + data + ")"); + if (nextTransient != null) + out.print(" (next transient line=" + nextTransient.getData() + ")"); + if (terminal != null) + out.print(" (terminal=" + terminal.getData() + ")"); out.println(); } @@ -188,6 +195,10 @@ public class RouteLine implements RouteNode, Serializable { return lines; } + public void removeRouteTerminals() { + points.removeIf(p -> p instanceof RouteTerminal); + } + public RouteTerminal getTerminal() { return terminal; } diff --git a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteTerminal.java b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteTerminal.java index dd660d4aa..3d6bd182f 100644 --- a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteTerminal.java +++ b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteTerminal.java @@ -164,18 +164,31 @@ public class RouteTerminal extends RoutePoint implements RouteNode, Serializable boolean routeLineDoesNotIntersectTerminal; double linePosition = line.position; if(line.isHorizontal) { + if (linePosition == y) { + // direct route to terminal + line.addPoint(this); + return; + } lineDir = linePosition < y ? 3 : 1; routeLineDoesNotIntersectTerminal = linePosition <= minY || linePosition >= maxY || boundingBoxesIntersect /* we ignore intersection in this case */; } else { + if (linePosition == x) { + // direct route to terminal + line.addPoint(this); + return; + } lineDir = linePosition < x ? 2 : 0; routeLineDoesNotIntersectTerminal = linePosition <= minX || linePosition >= maxX || boundingBoxesIntersect /* we ignore intersection in this case */; } // We can route the connection directly to the right direction - if(routeLineDoesNotIntersectTerminal && + if((routeLineDoesNotIntersectTerminal || + (line.isHorizontal && (x == minX || x == maxX)) || // already on the top/bottom edge + (!line.isHorizontal && (y == minY || y == maxY)) // already on the left/right edge + ) && Directions.isAllowed(allowedDirections, lineDir)) { RouteLine line0 = createLine0(lineDir); new RouteLink(line0, line); diff --git a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/SimpleConnectionUtility.java b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/SimpleConnectionUtility.java index 0628573d0..f36417b48 100644 --- a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/SimpleConnectionUtility.java +++ b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/SimpleConnectionUtility.java @@ -145,7 +145,7 @@ public class SimpleConnectionUtility { return MORE_BENDS_BBS_DONT_INTERSECT; } - private static int simpleConnectionCaseRouteToBounds(RouteTerminal a, + public static int simpleConnectionCaseRouteToBounds(RouteTerminal a, RouteTerminal b) { double aX = 0.5*(a.getMinX() + a.getMaxX()); double aY = 0.5*(a.getMinY() + a.getMaxY()); diff --git a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/AggregateConnectionStyle.java b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/AggregateConnectionStyle.java new file mode 100644 index 000000000..7bf76246f --- /dev/null +++ b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/AggregateConnectionStyle.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2020 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Semantum Oy - initial API and implementation + *******************************************************************************/ +package org.simantics.diagram.connection.rendering; + +import java.awt.Graphics2D; +import java.awt.geom.Path2D; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +public class AggregateConnectionStyle implements ConnectionStyle, Serializable{ + + private static final long serialVersionUID = 5888959070127628457L; + private List styles = new ArrayList<>(); + + public void addStyle(ConnectionStyle style) { + styles.add(style); + } + + @Override + public void drawBranchPoint(Graphics2D g, double x, double y) { + for (ConnectionStyle style : styles) { + style.drawBranchPoint(g, x, y); + } + } + + @Override + public void drawLine(Graphics2D g, double x1, double y1, double x2, double y2, boolean isTransient) { + for (ConnectionStyle style : styles) { + style.drawLine(g, x1, y1, x2, y2, isTransient); + } + } + + @Override + public void drawPath(Graphics2D g, Path2D path, boolean isTransient) { + for (ConnectionStyle style : styles) { + style.drawPath(g, path, isTransient); + } + } + + @Override + public void drawDegeneratedLine(Graphics2D g, double x, double y, boolean isHorizontal, boolean isTransient) { + for (ConnectionStyle style : styles) { + style.drawDegeneratedLine(g, x, y, isHorizontal, isTransient); + } + } + + @Override + public double getDegeneratedLineLength() { + double max = 0; + for (ConnectionStyle style : styles) { + max = Math.max(max, style.getDegeneratedLineLength()); + } + return max; + } + +} diff --git a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/BasicConnectionStyle.java b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/BasicConnectionStyle.java index b2895fb34..94de76bb4 100644 --- a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/BasicConnectionStyle.java +++ b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/BasicConnectionStyle.java @@ -17,9 +17,11 @@ import java.awt.RenderingHints; import java.awt.Stroke; import java.awt.geom.AffineTransform; import java.awt.geom.Ellipse2D; +import java.awt.geom.FlatteningPathIterator; import java.awt.geom.Line2D; import java.awt.geom.Path2D; import java.awt.geom.PathIterator; +import java.awt.geom.Point2D; import java.io.Serializable; /** @@ -37,12 +39,13 @@ public class BasicConnectionStyle implements ConnectionStyle, Serializable { final Stroke routeLineStroke; final double degenerateLineLength; final double rounding; + final double offset; transient Line2D line = new Line2D.Double(); transient Ellipse2D ellipse = new Ellipse2D.Double(); public BasicConnectionStyle(Color lineColor, Color branchPointColor, double branchPointRadius, Stroke lineStroke, Stroke routeLineStroke, double degenerateLineLength, - double rounding) { + double rounding, double offset) { this.lineColor = lineColor; this.branchPointColor = branchPointColor; this.branchPointRadius = branchPointRadius; @@ -50,10 +53,16 @@ public class BasicConnectionStyle implements ConnectionStyle, Serializable { this.routeLineStroke = routeLineStroke; this.degenerateLineLength = degenerateLineLength; this.rounding = rounding; + this.offset = offset; + } + + public BasicConnectionStyle(Color lineColor, Color branchPointColor, double branchPointRadius, Stroke lineStroke, Stroke routeLineStroke, double degenerateLineLength, + double rounding) { + this(lineColor, branchPointColor, branchPointRadius, lineStroke, routeLineStroke, degenerateLineLength, rounding, 0.0); } public BasicConnectionStyle(Color lineColor, Color branchPointColor, double branchPointRadius, Stroke lineStroke, Stroke routeLineStroke, double degenerateLineLength) { - this(lineColor, branchPointColor, branchPointRadius, lineStroke, routeLineStroke, degenerateLineLength, 0.0); + this(lineColor, branchPointColor, branchPointRadius, lineStroke, routeLineStroke, degenerateLineLength, 0.0, 0.0); } public Color getLineColor() { @@ -101,11 +110,101 @@ public class BasicConnectionStyle implements ConnectionStyle, Serializable { if(rounding > 0.0) { Object oldRenderingHint = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g.draw(round(path)); + path = round(path); + if (offset != 0) { + path = offsetPath(path, offset); + } + g.draw(path); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldRenderingHint); } - else + else { + if (offset != 0) { + path = offsetPath(path, offset); + } g.draw(path); + } + } + + private static Point2D getNormal(Point2D dir) { + return new Point2D.Double(-dir.getY(), dir.getX()); + } + + private static Point2D normalize(Point2D v) { + double d = Math.sqrt(v.getX() * v.getX() + v.getY() * v.getY()); + v.setLocation(v.getX() / d, v.getY() / d); + return v; + } + + private static Path2D offsetPath(Path2D path, double offset) { + Path2D result = new Path2D.Double(); + PathIterator iter = new FlatteningPathIterator(path.getPathIterator(null), 0.05, 10); + + double c[] = new double[6]; + double initialX = 0; + double initialY = 0; + boolean first = true; + Point2D prevDir = null; + Point2D prevPos = null; + + while (!iter.isDone()) { + int i = iter.currentSegment(c); + switch (i) { + case PathIterator.SEG_MOVETO: + if (first) { + initialX = c[0]; + initialY = c[1]; + first = false; + } + if (prevDir != null) { + Point2D N = normalize(getNormal(prevDir)); + result.lineTo(prevPos.getX() + N.getX() * offset , prevPos.getY() + N.getY() * offset); + } + prevPos = new Point2D.Double(c[0], c[1]); + prevDir = null; + break; + case PathIterator.SEG_LINETO: + case PathIterator.SEG_CLOSE: + if (i == PathIterator.SEG_CLOSE) { + c[0] = initialX; + c[1] = initialY; + } + Point2D currentDir = new Point2D.Double(c[0] - prevPos.getX(), c[1] - prevPos.getY()); + if (currentDir.getX() == 0.0 && currentDir.getY() == 0) break; + + if (prevDir == null) { + Point2D N = normalize(getNormal(currentDir)); + result.moveTo(prevPos.getX() + N.getX() * offset, prevPos.getY() + N.getY() * offset); + prevPos = new Point2D.Double(c[0], c[i]); + prevDir = currentDir; + } else { + Point2D N1 = normalize(getNormal(prevDir)); + Point2D N2 = normalize(getNormal(currentDir)); + Point2D N = normalize(new Point2D.Double(N1.getX() + N2.getX(), N1.getY() + N2.getY())); + double dot = N1.getX() * N.getX() + N1.getY() * N.getY(); + + if (!Double.isFinite(dot) || Math.abs(dot) < 0.1) { + result.lineTo(prevPos.getX() + (N1.getX() + N1.getY()) * offset, prevPos.getY() + (N1.getY() - N1.getX()) * offset); + result.lineTo(prevPos.getX() + (N2.getX() + N1.getY()) * offset, prevPos.getY() + (N2.getY() - N1.getX()) * offset); + prevPos = new Point2D.Double(c[0], c[i]); + prevDir = currentDir; + } else { + double Nx = N.getX() * offset / dot; + double Ny = N.getY() * offset / dot; + result.lineTo(prevPos.getX() + Nx, prevPos.getY() + Ny); + prevPos = new Point2D.Double(c[0], c[i]); + prevDir = currentDir; + } + } + + break; + } + iter.next(); + } + if (prevDir != null) { + Point2D N = normalize(getNormal(prevDir)); + result.lineTo(prevPos.getX() + N.getX() * offset , prevPos.getY() + N.getY() * offset); + } + return result; } private Path2D round(Path2D path) { @@ -126,16 +225,18 @@ public class BasicConnectionStyle implements ConnectionStyle, Serializable { double dy1 = curY-oldY; double dx2 = curX-newX; double dy2 = curY-newY; - double maxRadius = 0.5 * Math.min(Math.sqrt(dx1*dx1 + dy1*dy1), Math.sqrt(dx2*dx2 + dy2*dy2)); + double r1 = Math.sqrt(dx1*dx1 + dy1*dy1); + double r2 = Math.sqrt(dx2*dx2 + dy2*dy2); + double maxRadius = 0.5 * Math.min(r1, r2); double radius = Math.min(rounding, maxRadius); - newPath.lineTo(curX + radius*Math.signum(oldX-curX), curY + radius*Math.signum(oldY-curY)); + double dx1Normalized = r1 > 0 ? dx1 / r1 : 0; + double dy1Normalized = r1 > 0 ? dy1 / r1 : 0; + double dx2Normalized = r2 > 0 ? dx2 / r2 : 0; + double dy2Normalized = r2 > 0 ? dy2 / r2 : 0; + newPath.lineTo(curX - radius*dx1Normalized, curY - radius*dy1Normalized); newPath.curveTo(curX, curY, curX, curY, - curX + radius*Math.signum(newX-curX), curY + radius*Math.signum(newY-curY)); - - //newPath.lineTo(curX + round*Math.signum(oldX-curX), curY + round*Math.signum(oldY-curY)); - //newPath.lineTo(curX + round*Math.signum(newX-curX), curY + round*Math.signum(newY-curY)); - //newPath.lineTo(curX, curY); + curX - radius*dx2Normalized, curY - radius*dy2Normalized); } else ++state; @@ -216,6 +317,8 @@ public class BasicConnectionStyle implements ConnectionStyle, Serializable { result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + ((lineColor == null) ? 0 : lineColor.hashCode()); result = prime * result + ((lineStroke == null) ? 0 : lineStroke.hashCode()); + temp = Double.doubleToLongBits(rounding); + result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + ((routeLineStroke == null) ? 0 : routeLineStroke.hashCode()); return result; } @@ -248,6 +351,8 @@ public class BasicConnectionStyle implements ConnectionStyle, Serializable { return false; } else if (!lineStroke.equals(other.lineStroke)) return false; + if (Double.doubleToLongBits(rounding) != Double.doubleToLongBits(other.rounding)) + return false; if (routeLineStroke == null) { if (other.routeLineStroke != null) return false; @@ -260,4 +365,7 @@ public class BasicConnectionStyle implements ConnectionStyle, Serializable { return rounding; } + public double getOffset() { + return offset; + } } diff --git a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/ConnectionCrossings.java b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/ConnectionCrossings.java new file mode 100644 index 000000000..3ccb492b6 --- /dev/null +++ b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/ConnectionCrossings.java @@ -0,0 +1,214 @@ +/******************************************************************************* + * Copyright (c) 2020 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Semantum Oy - initial API and implementation + *******************************************************************************/ +package org.simantics.diagram.connection.rendering; + +import java.awt.geom.Arc2D; +import java.awt.geom.Path2D; +import java.awt.geom.PathIterator; +import java.awt.geom.Point2D; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class ConnectionCrossings implements PathModifier { + public enum Type { + NONE, + GAP, + ARC, + SQUARE + } + + private List segments = new ArrayList<>(); + private double width; + private Type type; + + public void setWidth(double gapWidth) { + this.width = gapWidth; + } + + public double getWidth() { + return width; + } + + public void setType(Type type) { + this.type = type; + } + + public Type getType() { + return type; + } + + static class Segment { + public double x1, y1, x2, y2; + + public Segment(double x1, double y1, double x2, double y2) { + this.x1 = x1; + this.y1 = y1; + this.x2 = x2; + this.y2 = y2; + } + }; + + public void reset() { + segments.clear(); + } + + static Double lineLineIntersection(Segment l1, Segment l2) { + double epsilon = 0.001; + + double d = (l1.x1 - l1.x2) * (l2.y1 - l2.y2) - (l1.y1 - l1.y2) * (l2.x1 - l2.x2); + if (d == 0.0) return null; + double s = ((l1.x1 - l2.x1) * (l2.y1 - l2.y2) - (l1.y1 - l2.y1) * (l2.x1 - l2.x2)) / d; + if ((s > epsilon) && (s < 1 - epsilon)) { + double t = -((l1.x1 - l1.x2) * (l1.y1 - l2.y1) - (l1.y1 - l1.y2) * (l1.x1 - l2.x1)) / d; + if ((t > epsilon) && (t < 1 - epsilon)) { + return t; + } + } + return null; + } + + public Path2D modify(Path2D path) { + Path2D.Double path2 = new Path2D.Double(); + PathIterator iter = path.getPathIterator(null); + + while (!iter.isDone()) { + + double c[] = new double[6]; + int i = iter.currentSegment(c); + switch (i) { + case PathIterator.SEG_MOVETO: + path2.moveTo(c[0], c[1]); + break; + case PathIterator.SEG_LINETO: + Segment l = new Segment(path2.getCurrentPoint().getX(), path2.getCurrentPoint().getY(), c[0], c[1]); + + List gaps = new ArrayList<>(); + for (Segment old : segments) { + Double t = lineLineIntersection(old, l); + if (t != null) { + gaps.add(t); + } + } + + if (gaps.isEmpty()) { + path2.lineTo(c[0], c[1]); + } else { + Collections.sort(gaps); + double dx = l.x2 - l.x1; + double dy = l.y2 - l.y1; + + double pos = 0.0; + double len = Math.sqrt(dx*dx + dy*dy); + + boolean finish = true; + Point2D prevGapEnd = null; + for (Double gapCenter : gaps) { + double pos2 = gapCenter - width / 2 / len; + double pos3 = gapCenter + width / 2 / len; + if (pos2 > pos) { + handleGap(path2, prevGapEnd); + prevGapEnd = null; + path2.lineTo(l.x1 + pos2 * dx, l.y1 + pos2 * dy); + } + if (pos3 < 1.0) { + double x = l.x1 + pos3 * dx; + double y = l.y1 + pos3 * dy; + prevGapEnd = new Point2D.Double(x, y); + } else { + finish = false; + } + pos = pos3; + } + + if (finish) { + handleGap(path2, prevGapEnd); + path2.lineTo(l.x2, l.y2); + } else { + prevGapEnd = new Point2D.Double(l.x2, l.y2); + handleGap(path2, prevGapEnd); + } + } + segments.add(l); + + break; + case PathIterator.SEG_QUADTO: + // TODO: implement gaps + path2.quadTo(c[0], c[1], c[2], c[3]); + break; + case PathIterator.SEG_CUBICTO: + // TODO: implement gaps + path2.curveTo(c[0], c[1], c[2], c[3], c[4], c[5]); + break; + case PathIterator.SEG_CLOSE: + // TODO: implement gaps + path2.closePath(); + break; + default: + throw new RuntimeException("Unexpected segment type " + i); + } + iter.next(); + } + return path2; + } + + private void handleGap(Path2D path, Point2D prevGapEnd) { + if (prevGapEnd != null) { + switch (type) { + case ARC: + arcTo(path, prevGapEnd.getX(), prevGapEnd.getY()); + break; + case SQUARE: + squareTo(path, prevGapEnd.getX(), prevGapEnd.getY(), width); + break; + case GAP: + path.moveTo(prevGapEnd.getX(), prevGapEnd.getY()); + break; + case NONE: + break; + } + } + } + + private static void arcTo(Path2D path, double x2, double y2) { + Arc2D arc = new Arc2D.Double(); + double x1 = path.getCurrentPoint().getX(); + double y1 = path.getCurrentPoint().getY(); + double dx = x2 - x1; + double dy = y2 - y1; + double r = Math.sqrt(dx * dx + dy * dy) / 2; + double angle = Math.atan2(dx, dy) * 180 / Math.PI + 90; + double span = (angle > 225 || angle < 45) ? 180 : -180; + arc.setArcByCenter((x1 + x2) / 2, (y1 + y2) / 2, r, angle, span, Arc2D.OPEN); + path.append(arc, true); + } + + private static void squareTo(Path2D path, double x2, double y2, double width) { + double x1 = path.getCurrentPoint().getX(); + double y1 = path.getCurrentPoint().getY(); + double dx = x2 - x1; + double dy = y2 - y1; + double l = Math.sqrt(dx * dx + dy* dy); + if (l > 0) { + double nx = -dy / l; + double ny = dx / l; + if (nx - ny < 0) { + nx = -nx; + ny = -ny; + } + path.lineTo(x1 + nx * width / 2, y1 + ny * width / 2); + path.lineTo(x2 + nx * width / 2, y2 + ny * width / 2); + path.lineTo(x2, y2); + } + } + +} diff --git a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/ConnectionRenderingHints.java b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/ConnectionRenderingHints.java new file mode 100644 index 000000000..a78bec04b --- /dev/null +++ b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/ConnectionRenderingHints.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2020 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Semantum Oy - initial API and implementation + *******************************************************************************/ +package org.simantics.diagram.connection.rendering; + +import java.awt.RenderingHints.Key; + +public final class ConnectionRenderingHints { + + public static final Key KEY_PATH_MODIFIER = new Key(0) { + @Override + public boolean isCompatibleValue(Object val) { + return val == null || val instanceof PathModifier; + } + }; +} \ No newline at end of file diff --git a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/PathModifier.java b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/PathModifier.java new file mode 100644 index 000000000..50d771a40 --- /dev/null +++ b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/PathModifier.java @@ -0,0 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2020 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Semantum Oy - initial API and implementation + *******************************************************************************/ +package org.simantics.diagram.connection.rendering; + +import java.awt.geom.Path2D; + +public interface PathModifier { + public Path2D modify(Path2D source); +} diff --git a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/StyledRouteGraphRenderer.java b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/StyledRouteGraphRenderer.java index dd9473042..fa1447469 100644 --- a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/StyledRouteGraphRenderer.java +++ b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/StyledRouteGraphRenderer.java @@ -62,6 +62,10 @@ public class StyledRouteGraphRenderer implements IRouteGraphRenderer, Serializab path.reset(); rg.getPath2D(path); + PathModifier pm = (PathModifier) g.getRenderingHint(ConnectionRenderingHints.KEY_PATH_MODIFIER); + if (pm != null) { + path = pm.modify(path); + } style.drawPath(g, path, false); branchPoints.clear(); diff --git a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/segments/Segment.java b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/segments/Segment.java index b283cb4ed..4e4280c0a 100644 --- a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/segments/Segment.java +++ b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/segments/Segment.java @@ -28,4 +28,9 @@ public class Segment { public boolean isDegenerated() { return p1.getX() == p2.getX() && p1.getY() == p2.getY(); } + + @Override + public String toString() { + return String.format("(%f, %f) (%f, %f)", p1.getX(), p1.getY(), p2.getX(), p2.getY()); + } } diff --git a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/splitting/SplittedRouteGraph.java b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/splitting/SplittedRouteGraph.java index ae79dc019..8f7f71a29 100644 --- a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/splitting/SplittedRouteGraph.java +++ b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/splitting/SplittedRouteGraph.java @@ -1,13 +1,17 @@ package org.simantics.diagram.connection.splitting; -import gnu.trove.set.hash.THashSet; - +import java.awt.geom.Line2D; import java.awt.geom.Point2D; +import java.util.ArrayList; import org.simantics.diagram.connection.RouteGraph; import org.simantics.diagram.connection.RouteLine; import org.simantics.diagram.connection.RouteNode; +import org.simantics.diagram.connection.RoutePoint; import org.simantics.diagram.connection.RouteTerminal; +import org.simantics.diagram.connection.segments.Segment; + +import gnu.trove.set.hash.THashSet; public class SplittedRouteGraph { public final RouteLine splitLine; @@ -91,7 +95,75 @@ public class SplittedRouteGraph { } } - /** + public static final class PickResult { + /** + * The connection route line nearest to {@link #pickPoint}. + */ + public final RouteLine nearestLine; + /** + * Original pick point in canvas coordinates. + */ + public final Point2D pickPoint; + /** + * Intersection point in canvas coordinates of {@link #nearestLine} and + * perpendicular line from {@link #pickPoint} to {@link #nearestLine}. + */ + public final Point2D intersectionPoint; + + public PickResult(RouteLine nearestLine, Point2D pickPoint, Point2D intersectionPoint) { + this.nearestLine = nearestLine; + this.pickPoint = pickPoint; + this.intersectionPoint = intersectionPoint; + } + } + + public static PickResult pickNearestLine(RouteGraph rg, double x, double y) { + Segment nearestSegment = null; + RouteLine nearestLine = null; + + ArrayList segments = new ArrayList<>(); + double minDistanceSq = Double.MAX_VALUE; + for (RouteLine line : rg.getAllLines()) { + segments.clear(); + line.collectSegments(segments); + for (Segment segment : segments) { + RoutePoint p1 = segment.p1; + RoutePoint p2 = segment.p2; + double distanceSq = Line2D.ptSegDistSq(p1.getX(), p1.getY(), p2.getX(), p2.getY(), x, y); + if (distanceSq < minDistanceSq) { + minDistanceSq = distanceSq; + nearestSegment = segment; + nearestLine = line; + } + } + } + + if (nearestSegment == null) + return null; + + RoutePoint p1 = nearestSegment.p1; + RoutePoint p2 = nearestSegment.p2; + Point2D p = pointToLineIntersection(p1.getX(), p1.getY(), p2.getX(), p2.getY(), x, y); + return new PickResult(nearestLine, new Point2D.Double(x, y), p); + } + + private static Point2D pointToLineIntersection(double x1, double y1, double x2, double y2, double px, double py) { + double d = Math.pow(x2 - x1, 2.0) + Math.pow(y2 - y1, 2.0); + if (d == 0) { + return new Point2D.Double(x1, y1); + } else { + double u = ((px - x1) * (x2 - x1) + (py - y1) * (y2 - y1)) / d; + if (u > 1.0) { + return new Point2D.Double(x2, y2); + } else if (u <= 0.0) { + return new Point2D.Double(x1, y1); + } else { + return new Point2D.Double(x2 * u + x1 * (1.0-u), (y2 * u + y1 * (1.0- u))); + } + } + } + + /** * @param point * @param line * @return the specified point instance snapped to the specified line diff --git a/bundles/org.simantics.diagram.ontology/.classpath b/bundles/org.simantics.diagram.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.diagram.ontology/.classpath +++ b/bundles/org.simantics.diagram.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.diagram.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.diagram.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.diagram.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.diagram.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.diagram.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.diagram.ontology/META-INF/MANIFEST.MF index 9e9456843..a36b26e83 100644 --- a/bundles/org.simantics.diagram.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.diagram.ontology/META-INF/MANIFEST.MF @@ -15,7 +15,7 @@ Require-Bundle: org.simantics.layer0, org.simantics.scenegraph.ontology;bundle-version="1.0.0", org.simantics.selectionview.ontology;bundle-version="1.1.0", org.simantics.datatypes.ontology;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.diagram.stubs Bundle-Vendor: VTT Technical Research Centre of Finland Automatic-Module-Name: org.simantics.diagram.ontology diff --git a/bundles/org.simantics.diagram.ontology/graph/Diagram.pgraph b/bundles/org.simantics.diagram.ontology/graph/Diagram.pgraph index b26bfc698..a38de5bc9 100644 --- a/bundles/org.simantics.diagram.ontology/graph/Diagram.pgraph +++ b/bundles/org.simantics.diagram.ontology/graph/Diagram.pgraph @@ -68,6 +68,9 @@ DIA.IOTableRename -- DIA.Diagram.IOTableRenaming --> DIA.IOTableRename DIA.ProfileEntryContribution.HasEntry --> DIA.ProfileEntry - + diff --git a/bundles/org.simantics.diagram.profile/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.diagram.profile/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.diagram.profile/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.diagram.profile/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.diagram.profile/META-INF/MANIFEST.MF b/bundles/org.simantics.diagram.profile/META-INF/MANIFEST.MF index 3d5910b94..60816536a 100644 --- a/bundles/org.simantics.diagram.profile/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.diagram.profile/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Diagram Visualization Profiles Support Bundle-SymbolicName: org.simantics.diagram.profile;singleton:=true Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.browsing.ui.swt;bundle-version="1.1.0", org.simantics.diagram.ontology;bundle-version="1.1.1", org.simantics.diagram;bundle-version="1.1.1", @@ -14,7 +14,8 @@ Require-Bundle: org.simantics.browsing.ui.swt;bundle-version="1.1.0", org.simantics.views.swt;bundle-version="1.0.0", org.simantics.views.swt.client;bundle-version="1.0.0", org.simantics.views.ontology;bundle-version="1.0.0", - org.simantics.selectionview;bundle-version="1.0.0" + org.simantics.selectionview;bundle-version="1.0.0", + org.slf4j.api Import-Package: org.simantics.views Bundle-Vendor: Semantum Oy Export-Package: org.simantics.diagram.profile.request diff --git a/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ActiveRuntimeDiagramInputSource.java b/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ActiveRuntimeDiagramInputSource.java index fb07993ac..be0b062ad 100644 --- a/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ActiveRuntimeDiagramInputSource.java +++ b/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ActiveRuntimeDiagramInputSource.java @@ -37,6 +37,7 @@ import org.simantics.db.common.request.UniqueRead; import org.simantics.db.exception.DatabaseException; import org.simantics.db.management.ISessionContext; import org.simantics.db.procedure.Procedure; +import org.simantics.diagram.runtime.RuntimeDiagramManager; import org.simantics.diagram.stubs.DiagramResource; import org.simantics.utils.ObjectUtils; import org.simantics.utils.ui.SWTUtils; @@ -170,7 +171,12 @@ public class ActiveRuntimeDiagramInputSource implements WorkbenchSessionContextI } protected void editorActivated(IEditorPart part) { - Resource resource = part.getAdapter(Resource.class); + RuntimeDiagramManager rdm = part.getAdapter(RuntimeDiagramManager.class); + Resource resource = null; + if (rdm != null) + resource = rdm.getRuntimeDiagram(); + if (resource == null) + resource = part.getAdapter(Resource.class); lastInputResource = resource; if (ownerIsVisible) { testAndChangeInput(resource); diff --git a/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/CreateGroupAction.java b/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/CreateGroupAction.java index 58cd82b0e..cbe77333f 100644 --- a/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/CreateGroupAction.java +++ b/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/CreateGroupAction.java @@ -7,13 +7,16 @@ import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; -import org.simantics.diagram.Logger; import org.simantics.diagram.stubs.DiagramResource; import org.simantics.layer0.Layer0; import org.simantics.operation.Layer0X; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class CreateGroupAction extends ModelledActionImpl { + private static final Logger LOGGER = LoggerFactory.getLogger(CreateGroupAction.class); + public CreateGroupAction(Resource configuration) { super(configuration); } @@ -49,9 +52,7 @@ public class CreateGroupAction extends ModelledActionImpl { }); } catch (DatabaseException e) { - - Logger.defaultLogError(e); - + LOGGER.error("CreateGroupAction failed", e); } } diff --git a/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/CreateProfileAction.java b/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/CreateProfileAction.java index 656159abf..c0fdb11e3 100644 --- a/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/CreateProfileAction.java +++ b/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/CreateProfileAction.java @@ -8,12 +8,15 @@ import org.simantics.db.common.request.WriteRequest; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.common.utils.OrderedSetUtils; import org.simantics.db.exception.DatabaseException; -import org.simantics.diagram.Logger; import org.simantics.diagram.stubs.DiagramResource; import org.simantics.layer0.Layer0; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class CreateProfileAction extends ModelledActionImpl { + private static final Logger LOGGER = LoggerFactory.getLogger(CreateProfileAction.class); + public CreateProfileAction(Resource configuration) { super(configuration); } @@ -51,9 +54,7 @@ public class CreateProfileAction extends ModelledActionImpl { }); } catch (DatabaseException e) { - - Logger.defaultLogError(e); - + LOGGER.error("CreateProfileAction failed", e); } } diff --git a/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/CreateStyleAction.java b/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/CreateStyleAction.java index de0734156..6cda70f2d 100644 --- a/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/CreateStyleAction.java +++ b/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/CreateStyleAction.java @@ -7,13 +7,16 @@ import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; -import org.simantics.diagram.Logger; import org.simantics.diagram.stubs.DiagramResource; import org.simantics.layer0.Layer0; import org.simantics.operation.Layer0X; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class CreateStyleAction extends ModelledActionImpl { + private static final Logger LOGGER = LoggerFactory.getLogger(CreateStyleAction.class); + public CreateStyleAction(Resource configuration) { super(configuration); } @@ -49,9 +52,7 @@ public class CreateStyleAction extends ModelledActionImpl { }); } catch (DatabaseException e) { - - Logger.defaultLogError(e); - + LOGGER.error("CreateStyleAction failed", e); } } diff --git a/bundles/org.simantics.diagram.svg/.classpath b/bundles/org.simantics.diagram.svg/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.diagram.svg/.classpath +++ b/bundles/org.simantics.diagram.svg/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.diagram.svg/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.diagram.svg/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.diagram.svg/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.diagram.svg/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.diagram.svg/META-INF/MANIFEST.MF b/bundles/org.simantics.diagram.svg/META-INF/MANIFEST.MF index 0a4be8445..df874ebe0 100644 --- a/bundles/org.simantics.diagram.svg/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.diagram.svg/META-INF/MANIFEST.MF @@ -13,8 +13,8 @@ Require-Bundle: org.eclipse.ui, org.simantics.db.management;bundle-version="1.1.0", org.simantics.structural.ontology;bundle-version="1.2.0", org.simantics.structural2;bundle-version="1.1.1", - org.apache.batik;bundle-version="1.8.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 + org.apache.batik;bundle-version="1.12.0" +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.diagram.svg.export Automatic-Module-Name: org.simantics.diagram.svg diff --git a/bundles/org.simantics.diagram/.classpath b/bundles/org.simantics.diagram/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.diagram/.classpath +++ b/bundles/org.simantics.diagram/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.diagram/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.diagram/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.diagram/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.diagram/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.diagram/META-INF/MANIFEST.MF b/bundles/org.simantics.diagram/META-INF/MANIFEST.MF index 6ca327d19..92e4d84ae 100644 --- a/bundles/org.simantics.diagram/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.diagram/META-INF/MANIFEST.MF @@ -18,7 +18,6 @@ Require-Bundle: org.simantics.utils.thread.swt, org.simantics.diagram.ontology;bundle-version="1.0.0";visibility:=reexport, org.simantics.structural.ontology;bundle-version="1.0.0", org.simantics.layer0.utils;bundle-version="[1.0.0,2.0.0)", - org.apache.log4j;bundle-version="1.2.15", org.simantics.threadlog;bundle-version="1.0.0";resolution:=optional, org.simantics.graph;bundle-version="1.1.5", org.simantics.graph.db;bundle-version="1.1.5", @@ -45,7 +44,7 @@ Require-Bundle: org.simantics.utils.thread.swt, org.eclipse.e4.ui.services, org.eclipse.e4.core.contexts, org.eclipse.e4.ui.workbench, - org.slf4j.api;bundle-version="1.7.20", + org.slf4j.api, org.simantics.browsing.ui Export-Package: org.simantics.diagram, org.simantics.diagram.adapter, @@ -77,5 +76,5 @@ Import-Package: org.simantics.simulation.experiment, Bundle-ActivationPolicy: lazy Bundle-Activator: org.simantics.diagram.internal.Activator Bundle-Vendor: VTT Technical Research Center of Finland -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.simantics.diagram diff --git a/bundles/org.simantics.diagram/plugin.xml b/bundles/org.simantics.diagram/plugin.xml index ef8a32516..b6a591201 100644 --- a/bundles/org.simantics.diagram/plugin.xml +++ b/bundles/org.simantics.diagram/plugin.xml @@ -360,6 +360,13 @@ + + + + + diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/LogManager.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/LogManager.java deleted file mode 100644 index a4e1eab87..000000000 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/LogManager.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.diagram; - -import java.util.Properties; - -import org.apache.log4j.Hierarchy; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; -import org.apache.log4j.PropertyConfigurator; -import org.apache.log4j.spi.LoggerFactory; -import org.apache.log4j.spi.RootLogger; - -/** - * This class encapsulates a Log4J Hierarchy and centralizes all Logger access. - */ -public class LogManager { - - private Hierarchy hierarchy; - - /** - * Creates a new LogManager. Saves the log and state location. - * Creates a new Hierarchy and add a new EventListener to it. - * Configure the hierarchy with the properties passed. Add this object to - * the list of active log managers. - * - * @param properties log configuration properties - */ - public LogManager(Properties properties) { - this.hierarchy = new Hierarchy(new RootLogger(Level.DEBUG)); - new PropertyConfigurator().doConfigure(properties, this.hierarchy); - } - - /** - * Checks if this PluginLogManager is disabled for this level. - * - * @param level level value - * @return boolean true if it is disabled - */ - public boolean isDisabled(int level) { - return this.hierarchy.isDisabled(level); - } - - /** - * Enable logging for logging requests with level l or higher. By default - * all levels are enabled. - * - * @param level level object - */ - public void setThreshold(Level level) { - this.hierarchy.setThreshold(level); - } - - /** - * The string version of setThreshold(Level level) - * - * @param level level string - */ - public void setThreshold(String level) { - this.hierarchy.setThreshold(level); - } - - /** - * Get the repository-wide threshold. - * - * @return Level - */ - public Level getThreshold() { - return this.hierarchy.getThreshold(); - } - - /** - * Returns a new logger instance named as the first parameter using the - * default factory. If a logger of that name already exists, then it will be - * returned. Otherwise, a new logger will be instantiated and then linked - * with its existing ancestors as well as children. - * - * @param clazz the class to get the logger for - * @return Logger - */ - public Logger getLogger(Class clazz) { - return this.hierarchy.getLogger(clazz.getName()); - } - - /** - * Returns a new logger instance named as the first parameter using the - * default factory. If a logger of that name already exists, then it will be - * returned. Otherwise, a new logger will be instantiated and then linked - * with its existing ancestors as well as children. - * - * @param name logger name - * @return Logger - */ - public Logger getLogger(String name) { - return this.hierarchy.getLogger(name); - } - - /** - * The same as getLogger(String name) but using a factory instance instead - * of a default factory. - * - * @param name logger name - * @param factory factory instance - * @return Logger - */ - public Logger getLogger(String name, LoggerFactory factory) { - return this.hierarchy.getLogger(name, factory); - } - - /** - * Returns the root of this hierarchy. - * - * @return Logger - */ - public Logger getRootLogger() { - return this.hierarchy.getRootLogger(); - } - - /** - * Checks if this logger exists. - * - * @return Logger - */ - public Logger exists(String name) { - return this.hierarchy.exists(name); - } - - /** - * Disposes the logger hierarchy - */ - public void shutdown() { - this.hierarchy.shutdown(); - } - - /** - * Resets configuration values to its defaults. - */ - public void resetConfiguration() { - this.hierarchy.resetConfiguration(); - } - -} \ No newline at end of file diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/Logger.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/Logger.java deleted file mode 100644 index ad93cb85b..000000000 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/Logger.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.diagram; - -import java.util.Properties; - -public class Logger { - public static final boolean ECHO = false; - public static final Properties defaultProperties = new Properties(); - static { - defaultProperties.put("log4j.rootCategory", "ERROR, default"); - defaultProperties.put("log4j.appender.default", "org.apache.log4j.FileAppender"); - defaultProperties.put("log4j.appender.default.File", "diagram.log"); - defaultProperties.put("log4j.appender.default.append", "false"); - defaultProperties.put("log4j.appender.default.layout", "org.apache.log4j.PatternLayout"); - defaultProperties.put("log4j.appender.default.layout.ConversionPattern", "%-6r [%15.15t] %-5p %30.30c - %m%n"); - } - private static LogManager defaultLogManager = new LogManager(defaultProperties); - private static final Logger defaultErrorLogger = new Logger(LogManager.class); - private org.apache.log4j.Logger logger; - Logger(Class clazz) { - logger = defaultLogManager.getLogger(clazz); - } - - /** - * Log a trace event. - * - * @param message message of the trace - * @param exception the exception, or null - */ - public void logTrace(String message, Throwable exception) { - // Errors are much more useful with a stack trace! - if (exception == null) { - exception = new RuntimeException(); - } - logger.trace(message, exception); - } - - /** - * Log an info event. - * - * @param message message of the info - * @param exception the exception, or null - */ - public void logInfo(String message, Throwable exception) { - // Errors are much more useful with a stack trace! - if (exception == null) { - exception = new RuntimeException(); - } - logger.info(message, exception); - } - - /** - * Log an error event. - * - * @param message message of the error - * @param exception the exception, or null - */ - public void logError(String message, Throwable exception) { - // Errors are much more useful with a stack trace! - if (exception == null) { - exception = new RuntimeException(); - } - logger.error(message, exception); - } - - public static Logger getDefault() { - return defaultErrorLogger; - } - - public static LogManager getDefaultLogManager() { - return defaultLogManager; - } - public static void defaultLogError(Throwable exception) { - getDefault().logError(exception.getLocalizedMessage(), exception); - if(ECHO) exception.printStackTrace(); - } - public static void defaultLogError(String message) { - getDefault().logError(message, null); - if(ECHO) - System.err.println(message); - } - public static void defaultLogError(String message, Throwable exception) { - getDefault().logError(message, exception); - if(ECHO) - System.err.println(message); - } - public static void defaultLogInfo(String message) { - getDefault().logInfo(message, null); - if(ECHO) - System.err.println(message); - } - public static void defaultLogTrace(String message) { - getDefault().logTrace(message, null); - if(ECHO) - System.err.println(message); - } -} diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/GroupStyleProfileEntry.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/GroupStyleProfileEntry.java index bdc3af02c..f38d1971b 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/GroupStyleProfileEntry.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/GroupStyleProfileEntry.java @@ -44,6 +44,7 @@ public class GroupStyleProfileEntry implements ProfileEntry { else this.priority = 0; GroupStyleProfileEntry.this.style = graph.adapt(style, Style.class); + GroupStyleProfileEntry.this.style.setPriority(this.priority); GroupStyleProfileEntry.this.group = graph.adapt(group, Group.class); } diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/RouteGraphConnectionClassFactory.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/RouteGraphConnectionClassFactory.java index a3d907482..4e15608a6 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/RouteGraphConnectionClassFactory.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/RouteGraphConnectionClassFactory.java @@ -100,7 +100,7 @@ public class RouteGraphConnectionClassFactory extends SyncElementFactory { RouteGraph rg = RouteGraphUtils.load(graph, diagramRuntime, connection, canvas, diagram, element, modelingRules, backendConnections); // Load connection line style. - ConnectionStyle style = RouteGraphUtils.readConnectionStyle(graph, modelingRules, connection, STR); + ConnectionStyle style = RouteGraphUtils.readConnectionStyle(graph, modelingRules, connection, STR, DIA); StyledRouteGraphRenderer renderer = RouteGraphUtils.getRenderer(graph, style); // Finish element load diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/RouteGraphUtils.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/RouteGraphUtils.java index d6a59a0cb..3ff98cd0b 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/RouteGraphUtils.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/RouteGraphUtils.java @@ -20,6 +20,7 @@ import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; import java.util.Collection; import java.util.Collections; +import java.util.List; import java.util.Map; import java.util.Set; @@ -31,6 +32,7 @@ import org.simantics.db.Statement; import org.simantics.db.common.procedure.adapter.TransientCacheListener; import org.simantics.db.common.request.ResourceRead2; import org.simantics.db.common.request.UnaryRead; +import org.simantics.db.common.utils.ListUtils; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; import org.simantics.diagram.connection.ConnectionVisuals; @@ -39,6 +41,7 @@ import org.simantics.diagram.connection.RouteLine; import org.simantics.diagram.connection.RouteNode; import org.simantics.diagram.connection.RouteTerminal; import org.simantics.diagram.connection.RouteTerminalPosition; +import org.simantics.diagram.connection.rendering.AggregateConnectionStyle; import org.simantics.diagram.connection.rendering.BasicConnectionStyle; import org.simantics.diagram.connection.rendering.ConnectionStyle; import org.simantics.diagram.connection.rendering.ExampleConnectionStyle; @@ -65,8 +68,8 @@ import org.simantics.g2d.element.ElementUtils; import org.simantics.g2d.element.IElement; import org.simantics.g2d.element.handler.EdgeVisuals.EdgeEnd; import org.simantics.g2d.element.handler.TerminalLayout; -import org.simantics.g2d.elementclass.RouteGraphConnectionClass; import org.simantics.g2d.elementclass.FlagClass.Type; +import org.simantics.g2d.elementclass.RouteGraphConnectionClass; import org.simantics.layer0.Layer0; import org.simantics.scenegraph.g2d.nodes.connection.RouteGraphChangeEvent; import org.simantics.scenegraph.utils.GeometryUtils; @@ -543,13 +546,30 @@ public class RouteGraphUtils { * @return * @throws DatabaseException */ - protected static ConnectionStyle readConnectionStyle(ReadGraph graph, IModelingRules modelingRules, Resource connection, StructuralResource2 STR) throws DatabaseException { + protected static ConnectionStyle readConnectionStyle(ReadGraph graph, IModelingRules modelingRules, Resource connection, StructuralResource2 STR, DiagramResource DIA) throws DatabaseException { + Resource connectionStyle = graph.getPossibleObject(connection, DIA.HasConnectionStyle); Resource connectionType = null; - if (modelingRules != null) - connectionType = modelingRules.getConnectionType(graph, connection); - if (connectionType == null) - connectionType = graph.getPossibleObject(connection, STR.HasConnectionType); - return connectionType != null ? readConnectionStyleFromConnectionType(graph, connectionType) : DEFAULT_CONNECTION_STYLE; + if (connectionStyle == null) { + if (modelingRules != null) + connectionType = modelingRules.getConnectionType(graph, connection); + if (connectionType == null) + connectionType = graph.getPossibleObject(connection, STR.HasConnectionType); + connectionStyle = graph.getPossibleObject(connectionType, DIA.HasConnectionStyle); + } + if (connectionStyle != null) { + List lineStyles = ListUtils.toList(graph, connectionStyle); + if (lineStyles.size() != 1) { + AggregateConnectionStyle aggregate = new AggregateConnectionStyle(); + for (Resource connectionLine : ListUtils.toList(graph, connectionStyle)) { + aggregate.addStyle(readConnectionStyleFromConnectionType(graph, connectionLine)); + } + return aggregate; + } else { + return readConnectionStyleFromConnectionType(graph, lineStyles.get(0)); + } + } else { + return connectionType != null ? readConnectionStyleFromConnectionType(graph, connectionType) : DEFAULT_CONNECTION_STYLE; + } } protected static ConnectionStyle readConnectionStyleFromConnectionType(ReadGraph graph, Resource connectionType) throws DatabaseException { @@ -589,6 +609,7 @@ public class RouteGraphUtils { lineStroke = new BasicStroke(0.1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10, null, 0); Stroke routeLineStroke = GeometryUtils.scaleStrokeWidth(lineStroke, 2); double rounding = cv.rounding == null ? 0.0 : cv.rounding; + double offset = cv.offset == null ? 0.0 : cv.offset; return new BasicConnectionStyle( lineColor, @@ -597,7 +618,8 @@ public class RouteGraphUtils { lineStroke, routeLineStroke, degenerateLineLength, - rounding); + rounding, + offset); } public static void scheduleSynchronize(Session session, Resource connection, RouteGraphChangeEvent event) { diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/connection/ConnectionVisuals.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/connection/ConnectionVisuals.java index 802881e16..e7a31692b 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/connection/ConnectionVisuals.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/connection/ConnectionVisuals.java @@ -27,12 +27,17 @@ public class ConnectionVisuals { public final Stroke stroke; public final Double branchPointRadius; public final Double rounding; + public final Double offset; public ConnectionVisuals(float[] color, StrokeType strokeType, Stroke stroke, Double rounding) { this(color, strokeType, stroke, null, rounding); } public ConnectionVisuals(float[] color, StrokeType strokeType, Stroke stroke, Double branchPointRadius, Double rounding) { + this(color, strokeType, stroke, null, rounding, null); + } + + public ConnectionVisuals(float[] color, StrokeType strokeType, Stroke stroke, Double branchPointRadius, Double rounding, Double offset) { if (color != null && color.length < 3) throw new IllegalArgumentException("colors must have at least 3 components (rgb), got " + color.length); this.color = color; @@ -40,6 +45,7 @@ public class ConnectionVisuals { this.stroke = stroke; this.branchPointRadius = branchPointRadius; this.rounding = rounding; + this.offset = offset; } public Color toColor() { @@ -57,6 +63,7 @@ public class ConnectionVisuals { result = prime * result + ((branchPointRadius == null) ? 0 : branchPointRadius.hashCode()); result = prime * result + Arrays.hashCode(color); result = prime * result + ((rounding == null) ? 0 : rounding.hashCode()); + result = prime * result + ((offset == null) ? 0 : offset.hashCode()); result = prime * result + ((stroke == null) ? 0 : stroke.hashCode()); result = prime * result + ((strokeType == null) ? 0 : strokeType.hashCode()); return result; @@ -83,6 +90,11 @@ public class ConnectionVisuals { return false; } else if (!rounding.equals(other.rounding)) return false; + if (offset == null) { + if (other.offset != null) + return false; + } else if (!offset.equals(other.offset)) + return false; if (stroke == null) { if (other.stroke != null) return false; diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java index 2991d234c..bf1bf563b 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java @@ -403,13 +403,14 @@ public class TextNode extends G2DNode implements IDynamicSelectionPainterNode, L if (hasState(STATE_EDITING)) return; - this.text = new String(text != null ? text : ""); + this.text = text; this.font = font; this.color = color; this.scale = scale; this.scaleRecip = 1.0 / scale; this.caret = 0; this.selectionTail = 0; + resetCaches(); } @@ -469,8 +470,8 @@ public class TextNode extends G2DNode implements IDynamicSelectionPainterNode, L // no value => value if(this.text == null && text != null) NodeUtil.decreasePending(this); - this.text = text != null ? text : ""; - caret = Math.min(caret, this.text.length()); + this.text = text; + caret = text != null ? Math.min(caret, text.length()) : 0; selectionTail = caret; resetCaches(); @@ -1437,6 +1438,9 @@ public class TextNode extends G2DNode implements IDynamicSelectionPainterNode, L y += line.layout.getDescent() + line.layout.getLeading() + line.layout.getAscent(); Rectangle2D bbox = line.layout.getLogicalHighlightShape(0, lineText.length()).getBounds2D(); + // HighlightShape is not large enough, if font is italic. + Rectangle2D bbox2 = line.layout.getBounds(); + bbox.add(bbox2); bbox.setFrame(bbox.getX(), bbox.getY() + line.drawPosY, bbox.getWidth(), bbox.getHeight()); line.bbox = bbox; } diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/export/ExportDiagramPdf.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/export/ExportDiagramPdf.java index 23cb9f970..25e72d984 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/export/ExportDiagramPdf.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/export/ExportDiagramPdf.java @@ -183,8 +183,14 @@ public class ExportDiagramPdf implements ExportClass { ThreadUtils.syncExec(workerThread, new Runnable() { @Override public void run() { - try { + try { cctx.getDefaultHintContext().setHint(Hints.KEY_PAGE_DESC, _marginaaliViiva); + if (!fitDiagramContentsToPageMargins) { + // Prevent PDF printing from drawing page borders if the + // print area is fitted directly to the page size. + // This avoids unwanted black half-visible edges. + cctx.getDefaultHintContext().setHint(Hints.KEY_DISPLAY_PAGE, false); + } String bottomLabel = diagramName; if ( drawingTemplate != null && activeProfileEntries.contains(TMPL.DrawingTemplate) ) bottomLabel = null; diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/flag/FlagUtil.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/flag/FlagUtil.java index d38a301da..e53f4b636 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/flag/FlagUtil.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/flag/FlagUtil.java @@ -176,6 +176,17 @@ public final class FlagUtil { * @throws DatabaseException */ public static Resource join(WriteGraph g, Resource flag, Resource otherFlag) throws DatabaseException { + return join(g, flag, otherFlag, true); + } + + /** + * @param g + * @param flag + * @param otherFlag + * @return the created DIA.ConnectionJoin instance + * @throws DatabaseException + */ + public static Resource join(WriteGraph g, Resource flag, Resource otherFlag, boolean activateDiagramMapping) throws DatabaseException { DiagramResource DIA = DiagramResource.getInstance(g); StructuralResource2 STR = StructuralResource2.getInstance(g); Resource connectionJoin = g.newResource(); @@ -184,14 +195,24 @@ public final class FlagUtil { g.claim(connectionJoin, DIA.JoinsFlag, flag); g.claim(connectionJoin, DIA.JoinsFlag, otherFlag); - IActivationManager manager = g.getService(IActivationManager.class); - for(Resource diagram : OrderedSetUtils.getSubjects(g, flag)) - manager.activateOnce(g, diagram); - for(Resource diagram : OrderedSetUtils.getSubjects(g, otherFlag)) - manager.activateOnce(g, diagram); + if (activateDiagramMapping) { + activateMappingForParentDiagramsOf(g, flag, otherFlag); + } + return connectionJoin; } + public static void activateMappingForParentDiagramsOf(WriteGraph graph, Resource... elements) throws DatabaseException { + IActivationManager manager = graph.getService(IActivationManager.class); + Set diagrams = new HashSet<>(elements.length); + for (Resource e : elements) { + diagrams.addAll(OrderedSetUtils.getSubjects(graph, e)); + } + for (Resource diagram : diagrams) { + manager.activateOnce(graph, diagram); + } + } + public static void disconnectFlag(WriteGraph graph, Resource flag) throws DatabaseException { // Remove any :ConnectionJoin's this flag is joined by // if there's less than two flags joined by the join. @@ -531,5 +552,4 @@ public final class FlagUtil { return flags; } - -} +} \ No newline at end of file diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/flag/RouteGraphConnectionSplitter.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/flag/RouteGraphConnectionSplitter.java index 3f1076b5d..5c85a9944 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/flag/RouteGraphConnectionSplitter.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/flag/RouteGraphConnectionSplitter.java @@ -1,11 +1,10 @@ package org.simantics.diagram.flag; -import gnu.trove.map.hash.TObjectIntHashMap; - import java.awt.geom.AffineTransform; import java.awt.geom.Point2D; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import org.simantics.databoard.Bindings; import org.simantics.db.ReadGraph; @@ -24,9 +23,11 @@ import org.simantics.diagram.connection.RouteNode; import org.simantics.diagram.connection.RoutePoint; import org.simantics.diagram.connection.RouteTerminal; import org.simantics.diagram.connection.splitting.SplittedRouteGraph; +import org.simantics.diagram.connection.splitting.SplittedRouteGraph.PickResult; import org.simantics.diagram.content.ConnectionUtil; import org.simantics.diagram.stubs.DiagramResource; import org.simantics.diagram.synchronization.graph.AddElement; +import org.simantics.diagram.synchronization.graph.BasicResources; import org.simantics.diagram.synchronization.graph.DiagramGraphUtil; import org.simantics.diagram.synchronization.graph.RouteGraphModification; import org.simantics.g2d.elementclass.FlagClass; @@ -34,6 +35,8 @@ import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; import org.simantics.structural.stubs.StructuralResource2; +import gnu.trove.map.hash.TObjectIntHashMap; + /** * A class that handles splitting a route graph connection in two with diagram * local flags. @@ -87,34 +90,33 @@ public class RouteGraphConnectionSplitter { RouteGraphModification modis = new RouteGraphModification(ss, rg); TObjectIntHashMap idMap = modis.getIdMap(); + if (DEBUG) { + System.out.println("Split canvas position: " + splitCanvasPos); + rg.print(); + } + // Find the edge to disconnect in the graph. // Bisect the nearest route line. - RouteLine line = SplittedRouteGraph.findNearestLine(rg, splitCanvasPos); - if (DEBUG) - rg.print(); - if (line == null) + PickResult picked = SplittedRouteGraph.pickNearestLine(rg, splitCanvasPos.getX(), splitCanvasPos.getY()); + if (picked == null) return; + + RouteLine line = picked.nearestLine; + if (DEBUG) { + System.out.println("picked nearest line:"); line.print(System.out); for (RoutePoint rp : line.getPoints()) System.out.println("RP: " + rp.getX() + ", " + rp.getY()); } // Get exact intersection point on the line - double isectX = splitCanvasPos.getX(); - double isectY = splitCanvasPos.getY(); - SplittedRouteGraph srg; - if (line.isHorizontal()) { - isectY = line.getPosition(); - srg = rg.splitGraph(line, isectX); - } - else { - isectX = line.getPosition(); - srg = rg.splitGraph(line, isectY); - } + double isectX = picked.intersectionPoint.getX(); + double isectY = picked.intersectionPoint.getY(); + SplittedRouteGraph srg = rg.splitGraph(line, line.isHorizontal() ? isectX : isectY); if (DEBUG) System.out.println(srg); - + // Disconnect if(rg.isSimpleConnection()) { RouteNode na = srg.terminals1.iterator().next(); @@ -141,44 +143,106 @@ public class RouteGraphConnectionSplitter { idMap.get(srg.splitLine) )); } - - ArrayList interfaceNodes1Resources = new ArrayList(srg.interfaceNodes1.size()); - for(RouteNode n : srg.interfaceNodes1) - interfaceNodes1Resources.add(ss.getResource((Long)n.getData())); - ArrayList interfaceNodes2Resources = new ArrayList(srg.interfaceNodes2.size()); - for(RouteNode n : srg.interfaceNodes2) - interfaceNodes2Resources.add(ss.getResource((Long)n.getData())); - - ArrayList lines2Resources = new ArrayList(srg.lines2.size()); - for(RouteLine n : srg.lines2) - lines2Resources.add(ss.getResource((Long)n.getData())); - - ArrayList terminals1Resources = new ArrayList(srg.terminals1.size()); - for(RouteTerminal n : srg.terminals1) - terminals1Resources.add(ss.getResource((Long)n.getData())); - ArrayList terminals2Resources = new ArrayList(srg.terminals2.size()); - for(RouteTerminal n : srg.terminals2) - terminals2Resources.add(ss.getResource((Long)n.getData())); + ArrayList terminals1Resources = toResources(srg.terminals1); + ArrayList terminals2Resources = toResources(srg.terminals2); + + boolean mustFlip = analyzePartInputs(graph, terminals1Resources, terminals2Resources); + + ArrayList interfaceNodes1 = toResources(mustFlip ? srg.interfaceNodes2 : srg.interfaceNodes1); + ArrayList interfaceNodes2 = toResources(mustFlip ? srg.interfaceNodes1 : srg.interfaceNodes2); + + ArrayList lines2 = toResources(mustFlip ? srg.lines1 : srg.lines2); + ArrayList terminals1 = mustFlip ? terminals2Resources : terminals1Resources; + ArrayList terminals2 = mustFlip ? terminals1Resources : terminals2Resources; + doSplit(graph, connection, - interfaceNodes1Resources, - interfaceNodes2Resources, - lines2Resources, - terminals1Resources, - terminals2Resources, + interfaceNodes1, + interfaceNodes2, + lines2, + terminals1, + terminals2, line.isHorizontal(), + mustFlip, isectX, isectY); modis.addModi(new RouteGraphModification.Split( - modis.toIds(interfaceNodes1Resources), - modis.toIds(interfaceNodes2Resources), - modis.toIds(lines2Resources), - modis.toIds(terminals1Resources), - modis.toIds(terminals2Resources), + modis.toIds(interfaceNodes1), + modis.toIds(interfaceNodes2), + modis.toIds(lines2), + modis.toIds(terminals1), + modis.toIds(terminals2), line.isHorizontal(), + mustFlip, isectX, isectY )); - } - + + private ArrayList toResources(Collection nodes) throws DatabaseException { + ArrayList result = new ArrayList<>(nodes.size()); + for (RouteNode n : nodes) + result.add(ss.getResource((Long)n.getData())); + return result; + } + + /** + * @param graph + * @param terminals1 + * @param terminals2 + * @return true if inputs need to be flipped, i.e. if terminals2 + * contains the output terminals and terminals1 doesn't. + * @throws DatabaseException + */ + private boolean analyzePartInputs(ReadGraph graph, List terminals1, List terminals2) throws DatabaseException { + @SuppressWarnings("unused") + int inputs1 = 0, outputs1 = 0; + for(Resource connector : terminals1) { + if(graph.hasStatement(connector, DIA.IsHeadConnectorOf)) + ++inputs1; + else + ++outputs1; + } + @SuppressWarnings("unused") + int inputs2 = 0, outputs2 = 0; + for(Resource connector : terminals2) { + if(graph.hasStatement(connector, DIA.IsHeadConnectorOf)) + ++inputs2; + else + ++outputs2; + } + + boolean mustFlip = outputs1 == 0; + + if (DEBUG) { + System.out.println("inputs1: " + inputs1); + System.out.println("outputs1: " + outputs1); + System.out.println("inputs2: " + inputs2); + System.out.println("outputs2: " + outputs2); + System.out.println("=> type1: " + (mustFlip ? FlagClass.Type.In : FlagClass.Type.Out)); + System.out.println("=> type2: " + (mustFlip ? FlagClass.Type.Out : FlagClass.Type.In)); + System.out.println("=> must flip route graph parts to split: " + mustFlip); + } + + return mustFlip; + } + + private static String routeNodeDebugInfo(ReadGraph graph, Resource c) throws DatabaseException { + BasicResources BR = BasicResources.getInstance(graph); + String ctr = NameUtils.getSafeName(graph, c, true); + for (Resource e : graph.getObjects(c, BR.STR.Connects)) { + ctr += " --> " + NameUtils.getSafeName(graph, e); + } + for (Resource e : graph.getObjects(c, BR.DIA.AreConnected)) { + ctr += " <-> " + NameUtils.getSafeName(graph, e); + } + return ctr; + } + + /** + * Internal routine that is only public because + * {@link RouteGraphModification#runUpdates(WriteGraph)} needs to invoke it. + * + * Assumes that #1 parameters will stay with the existing connection and #2 + * parameters will go to the newly created connection. + */ public void doSplit(WriteGraph graph, Resource connection, ArrayList interfaceNodes1Resources, @@ -186,22 +250,28 @@ public class RouteGraphConnectionSplitter { ArrayList lines2Resources, ArrayList terminals1Resources, ArrayList terminals2Resources, - boolean isHorizontal, + boolean isHorizontal, + boolean invertFlagRotation, double isectX, double isectY) throws DatabaseException { + // 1 = output, 2 = input + FlagClass.Type + type1 = FlagClass.Type.Out, + type2 = FlagClass.Type.In; + if (DEBUG) { System.out.println("doSplit:"); System.out.println(NameUtils.getSafeName(graph, connection, true)); for (Resource i : interfaceNodes1Resources) - System.out.println("i1: " + NameUtils.getSafeName(graph, i, true)); + System.out.println("i1: " + routeNodeDebugInfo(graph, i)); for (Resource i : interfaceNodes2Resources) - System.out.println("i2: " + NameUtils.getSafeName(graph, i, true)); + System.out.println("i2: " + routeNodeDebugInfo(graph, i)); for (Resource l : lines2Resources) - System.out.println("l2r: " + NameUtils.getSafeName(graph, l, true)); + System.out.println("l2r: " + routeNodeDebugInfo(graph, l)); for (Resource t : terminals1Resources) - System.out.println("t1: " + NameUtils.getSafeName(graph, t, true)); + System.out.println("t1: " + routeNodeDebugInfo(graph, t)); for (Resource t : terminals2Resources) - System.out.println("t2: " + NameUtils.getSafeName(graph, t, true)); + System.out.println("t2: " + routeNodeDebugInfo(graph, t)); System.out.println("is horizontal: " + isHorizontal); System.out.println("@(x,y): " + isectX + ", " + isectY); } @@ -209,15 +279,39 @@ public class RouteGraphConnectionSplitter { ConnectionUtil cu = new ConnectionUtil(graph); Resource diagram = OrderedSetUtils.getSingleOwnerList(graph, connection, DIA.Diagram); - Resource connectionType = graph.getSingleType(connection, DIA.Connection); + Resource diagramConnectionType = graph.getSingleType(connection, DIA.Connection); Resource hasConnectionType = graph.getPossibleObject(connection, STR.HasConnectionType); - Resource newConnection = cu.newConnection(diagram, connectionType); + Resource newConnection = cu.newConnection(diagram, diagramConnectionType); if (hasConnectionType != null) graph.claim(newConnection, STR.HasConnectionType, null, hasConnectionType); // Give running name to connection increment the counter attached to the diagram. AddElement.claimFreshElementName(graph, diagram, newConnection); + String commonLabel = DiagramFlagPreferences + .getActiveFlagLabelingScheme(graph) + .generateLabel(graph, diagram); + + Point2D pos1, pos2; + double theta; + double flagDist = 3.0; + if(isHorizontal) { + theta = 0.0; + pos1 = new Point2D.Double(isectX-flagDist, isectY); + pos2 = new Point2D.Double(isectX+flagDist, isectY); + } else { + theta = Math.PI*0.5; + pos1 = new Point2D.Double(isectX, isectY-flagDist); + pos2 = new Point2D.Double(isectX, isectY+flagDist); + } + + if (invertFlagRotation) { + theta += Math.PI; + Point2D p = pos1; + pos1 = pos2; + pos2 = p; + } + // WORKAROUND for mapping problems: // If any terminal of the split connection contains a flag, make sure their STR.Joins relations are all removed // to give mapping a chance to fix them properly. @@ -237,97 +331,31 @@ public class RouteGraphConnectionSplitter { graph.claim(rn, predicate, newConnection); } - // 1 = output, 2 = input - FlagClass.Type type1, type2; - - FlagLabelingScheme scheme = DiagramFlagPreferences.getActiveFlagLabelingScheme(graph); - String commonLabel = scheme.generateLabel(graph, diagram); - // Create flags and connect both disconnected ends to them. - Point2D pos1, pos2; - double theta; - double flagDist = 3.0; - if(isHorizontal) { - theta = 0.0; - pos1 = new Point2D.Double(isectX-flagDist, isectY); - pos2 = new Point2D.Double(isectX+flagDist, isectY); - } - else { - theta = Math.PI*0.5; - pos1 = new Point2D.Double(isectX, isectY-flagDist); - pos2 = new Point2D.Double(isectX, isectY+flagDist); - } - - // Chooses flag directions - { - @SuppressWarnings("unused") - int inputs1 = 0, outputs1 = 0; - for(Resource connector : terminals1Resources) { - if(graph.hasStatement(connector, DIA.IsHeadConnectorOf)) - ++inputs1; - else - ++outputs1; - } - @SuppressWarnings("unused") - int inputs2 = 0, outputs2 = 0; - for(Resource connector : terminals2Resources) { - if(graph.hasStatement(connector, DIA.IsHeadConnectorOf)) - ++inputs2; - else - ++outputs2; - } - - if(outputs1 == 0) { - type1 = FlagClass.Type.In; - type2 = FlagClass.Type.Out; - theta += Math.PI; - } - else { - type1 = FlagClass.Type.Out; - type2 = FlagClass.Type.In; - } - if (DEBUG) { - System.out.println("inputs1: " + inputs1); - System.out.println("outputs1: " + outputs1); - System.out.println("=> type1: " + type1); - System.out.println("inputs2: " + inputs2); - System.out.println("outputs2: " + outputs2); - System.out.println("=> type2: " + type2); - } - } Resource flag1 = createFlag(graph, diagram, getFlagTransform(pos1, theta), type1, commonLabel); Resource flag2 = createFlag(graph, diagram, getFlagTransform(pos2, theta), type2, commonLabel); + if (DEBUG) { + System.out.println("LABEL FOR NEW FLAGS: " + commonLabel); System.out.println("FLAG1: " + NameUtils.getSafeName(graph, flag1, true)); System.out.println("FLAG2: " + NameUtils.getSafeName(graph, flag2, true)); } -// System.out.println("conn1: " + NameUtils.getSafeLabel(graph, type1 == FlagClass.Type.In ? DIA.HasPlainConnector : DIA.HasArrowConnector)); -// System.out.println("conn2: " + NameUtils.getSafeLabel(graph, type2 == FlagClass.Type.In ? DIA.HasPlainConnector : DIA.HasArrowConnector)); - Resource flagConnector1 = cu.newConnector(connection, - type1 == FlagClass.Type.In ? DIA.HasPlainConnector : DIA.HasArrowConnector); - Resource flagConnector2 = cu.newConnector(newConnection, - type2 == FlagClass.Type.In ? DIA.HasPlainConnector : DIA.HasArrowConnector); + Resource flagConnector1 = cu.newConnector(connection, DIA.HasArrowConnector); + Resource flagConnector2 = cu.newConnector(newConnection, DIA.HasPlainConnector); graph.claim(flag1, DIA.Flag_ConnectionPoint, flagConnector1); graph.claim(flag2, DIA.Flag_ConnectionPoint, flagConnector2); double position = isHorizontal ? isectY : isectX; - connectFlag(graph, isHorizontal, position, connection, flagConnector1, - interfaceNodes1Resources); - connectFlag(graph, isHorizontal, position, newConnection, flagConnector2, - interfaceNodes2Resources); - - FlagUtil.join(graph, flag1, flag2); - - // Move mapping relations to new connection if necessary - if(type1 == FlagClass.Type.In) { - moveStatements(graph, connection, newConnection, MOD.ElementToComponent); - moveStatements(graph, connection, newConnection, MOD.DiagramConnectionToConnection); - moveStatements(graph, connection, newConnection, MOD.DiagramConnectionToConnectionSpecial); - FlagUtil.fixBindsStatements(graph, graph.getPossibleObject(newConnection, MOD.DiagramConnectionToConnection)); - } - else - FlagUtil.fixBindsStatements(graph, graph.getPossibleObject(connection, MOD.DiagramConnectionToConnection)); + connectFlag(graph, isHorizontal, position, connection, flagConnector1, interfaceNodes1Resources); + connectFlag(graph, isHorizontal, position, newConnection, flagConnector2, interfaceNodes2Resources); + + // Join the flags without activatingn diagram mapping at this point + FlagUtil.join(graph, flag1, flag2, false); + FlagUtil.fixBindsStatements(graph, graph.getPossibleObject(connection, MOD.DiagramConnectionToConnection)); + + // Finally ensure that all the diagrams related to the operation are mapped properly in one go + FlagUtil.activateMappingForParentDiagramsOf(graph, flag1, flag2); } /** @@ -370,15 +398,6 @@ public class RouteGraphConnectionSplitter { } } - private static void moveStatements(WriteGraph graph, Resource from, Resource to, Resource relation) throws DatabaseException { - if(from.equals(to)) - return; - for(Statement stat : graph.getStatements(from, relation)) - if(stat.getSubject().equals(from)) - graph.claim(to, stat.getPredicate(), stat.getObject()); - graph.deny(from, relation); - } - private void connectFlag(WriteGraph graph, boolean isHorizontal, double position, Resource connection, Resource flagConnector, Collection interfaceNodes) throws DatabaseException { if(interfaceNodes.size() > 1) { @@ -421,6 +440,7 @@ public class RouteGraphConnectionSplitter { } public static void splitConnection(WriteGraph graph, Resource connection, double x, double y) throws DatabaseException { + // TODO: provide a proper runtimeDiagram parameter to load to support also connections attached to flags attached to diagram template flag tables RouteGraph rg = RouteGraphUtils.load(graph, null, connection); new RouteGraphConnectionSplitter(graph).split(graph, connection, rg, new Point2D.Double(x, y)); } diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/function/All.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/function/All.java index 6cd4c542f..5bb793f7d 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/function/All.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/function/All.java @@ -95,6 +95,8 @@ public class All { Resource flag = context.element; Resource runtimeDiagram = context.runtime; + if (runtimeDiagram == null) + return flagTransformImpl(graph, converter, context); Resource diagram = graph.getPossibleObject(runtimeDiagram, DIA.RuntimeDiagram_HasConfiguration); if (diagram == null) diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/CopyPasteHandler.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/CopyPasteHandler.java index 52217c3cf..de10603d3 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/CopyPasteHandler.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/CopyPasteHandler.java @@ -44,7 +44,6 @@ import org.simantics.db.layer0.util.SimanticsKeys; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; import org.simantics.db.request.Read; -import org.simantics.diagram.Logger; import org.simantics.diagram.content.Change; import org.simantics.diagram.content.ConnectionUtil; import org.simantics.diagram.content.DiagramContentChanges; @@ -114,6 +113,8 @@ import org.simantics.utils.threads.SWTThread; import org.simantics.utils.threads.ThreadUtils; import org.simantics.utils.ui.ErrorLogger; import org.simantics.utils.ui.SWTUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * CopyPasteHandler is a canvas handler for Commands.CUT, Commands.COPY and @@ -141,6 +142,8 @@ import org.simantics.utils.ui.SWTUtils; */ public class CopyPasteHandler extends AbstractDiagramParticipant { + private static final Logger LOGGER = LoggerFactory.getLogger(CopyPasteHandler.class); + public static final Key KEY_CUT_SELECTION_FRAME_COLOR = new KeyOf(Color.class, "CUT_SELECTION_FRAME_COLOR"); public static final Key KEY_CUT_SELECTION_CONTENT_COLOR = new KeyOf(Color.class, "CUT_SELECTION_CONTENT_COLOR"); public static final Key KEY_COPIED_SELECTION_FRAME_COLOR = new KeyOf(Color.class, "COPY_SELECTION_FRAME_COLOR"); @@ -1294,7 +1297,7 @@ public class CopyPasteHandler extends AbstractDiagramParticipant { }); } } catch (DatabaseException e1) { - Logger.defaultLogError(e1); + LOGGER.error("Monitor paste failed", e1); } } return true; diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/MouseScaleMode.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/MouseScaleMode.java index 539e28461..32df540ee 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/MouseScaleMode.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/MouseScaleMode.java @@ -315,8 +315,8 @@ public class MouseScaleMode extends AbstractMode { System.out.println("Lp: " + p); localAt.setTransform( - localAt.getScaleX(), localAt.getShearX(), - localAt.getShearY(), localAt.getScaleY(), + localAt.getScaleX(), localAt.getShearY(), + localAt.getShearX(), localAt.getScaleY(), p.getX(), p.getY()); if (DEBUG) diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/e4/CopyPasteHandler.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/e4/CopyPasteHandler.java index 761494127..7f709c709 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/e4/CopyPasteHandler.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/e4/CopyPasteHandler.java @@ -44,7 +44,6 @@ import org.simantics.db.layer0.util.SimanticsKeys; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; import org.simantics.db.request.Read; -import org.simantics.diagram.Logger; import org.simantics.diagram.content.Change; import org.simantics.diagram.content.ConnectionUtil; import org.simantics.diagram.content.DiagramContentChanges; @@ -125,6 +124,8 @@ import org.simantics.utils.threads.SWTThread; import org.simantics.utils.threads.ThreadUtils; import org.simantics.utils.ui.ErrorLogger; import org.simantics.utils.ui.SWTUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * CopyPasteHandler is a canvas handler for Commands.CUT, Commands.COPY and @@ -152,6 +153,8 @@ import org.simantics.utils.ui.SWTUtils; */ public class CopyPasteHandler extends AbstractDiagramParticipant { + private static final Logger LOGGER = LoggerFactory.getLogger(CopyPasteHandler.class); + public static final Key KEY_CUT_SELECTION_FRAME_COLOR = new KeyOf(Color.class, "CUT_SELECTION_FRAME_COLOR"); public static final Key KEY_CUT_SELECTION_CONTENT_COLOR = new KeyOf(Color.class, "CUT_SELECTION_CONTENT_COLOR"); public static final Key KEY_COPIED_SELECTION_FRAME_COLOR = new KeyOf(Color.class, "COPY_SELECTION_FRAME_COLOR"); @@ -1291,7 +1294,7 @@ public class CopyPasteHandler extends AbstractDiagramParticipant { }); } } catch (DatabaseException e1) { - Logger.defaultLogError(e1); + LOGGER.error("Monitor paste failed", e1); } } return true; diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/ConnectionCrossingsParticipant.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/ConnectionCrossingsParticipant.java new file mode 100644 index 000000000..c02f68de6 --- /dev/null +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/ConnectionCrossingsParticipant.java @@ -0,0 +1,136 @@ +/******************************************************************************* + * Copyright (c) 2020 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Semantum Oy - initial API and implementation + *******************************************************************************/ +package org.simantics.diagram.participant; + +import org.simantics.Simantics; +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.common.request.UnaryRead; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.procedure.Listener; +import org.simantics.diagram.connection.rendering.ConnectionCrossings; +import org.simantics.diagram.stubs.DiagramResource; +import org.simantics.g2d.canvas.ICanvasContext; +import org.simantics.g2d.canvas.SGDesignation; +import org.simantics.g2d.canvas.impl.SGNodeReflection.SGCleanup; +import org.simantics.g2d.canvas.impl.SGNodeReflection.SGInit; +import org.simantics.g2d.diagram.participant.AbstractDiagramParticipant; +import org.simantics.scenegraph.g2d.G2DParentNode; +import org.simantics.scenegraph.g2d.nodes.ConnectionCrossingsNode; +import org.simantics.utils.datastructures.Pair; +import org.simantics.utils.ui.ErrorLogger; + +public class ConnectionCrossingsParticipant extends AbstractDiagramParticipant { + public static final String CONNECTION_CROSSINGS_NODE_KEY = "connection-crossings"; + + private ConnectionCrossingsNode ccNode; + private final ConnectionCrossings crossings = new ConnectionCrossings(); + private ConnectionCrossingStyleListener listener; + private Resource diagram; + + public ConnectionCrossingsParticipant(Resource diagram) { + this.diagram = diagram; + } + public ConnectionCrossingsParticipant(double width, ConnectionCrossings.Type type) { + crossings.setWidth(width); + crossings.setType(type); + } + + @SGInit(designation = SGDesignation.CONTROL) + public void initSG(G2DParentNode parent) { + ccNode = parent.addNode(CONNECTION_CROSSINGS_NODE_KEY, ConnectionCrossingsNode.class); + ccNode.setCrossings(crossings); + ccNode.setZIndex(Integer.MIN_VALUE / 4); + } + + @SGCleanup + public void cleanupSG() { + if (ccNode != null) { + ccNode.remove(); + ccNode = null; + } + } + + @Override + public void addedToContext(ICanvasContext ctx) { + super.addedToContext(ctx); + + if (diagram != null) { + listener = new ConnectionCrossingStyleListener(ctx); + Simantics.getSession().async(new UnaryRead>(diagram){ + + @Override + public Pair perform(ReadGraph graph) throws DatabaseException { + DiagramResource DIA = DiagramResource.getInstance(graph); + Double gap = graph.getPossibleRelatedValue(diagram, DIA.ConnectionCrossingStyle_Width); + Resource typeRes = graph.getPossibleObject(diagram, DIA.ConnectionCrossingStyle_HasType); + ConnectionCrossings.Type type; + if (DIA.ConnectionCrossingStyle_Type_Gap.equals(typeRes)) { + type = ConnectionCrossings.Type.GAP; + } else if (DIA.ConnectionCrossingStyle_Type_Arc.equals(typeRes)) { + type = ConnectionCrossings.Type.ARC; + } else if (DIA.ConnectionCrossingStyle_Type_Square.equals(typeRes)) { + type = ConnectionCrossings.Type.SQUARE; + } else { + type = ConnectionCrossings.Type.NONE; + } + return new Pair<>(gap, type); + } + + }, listener); + } + } + + @Override + public void removedFromContext(ICanvasContext ctx) { + if (listener != null) { + listener.dispose(); + listener = null; + } + super.removedFromContext(ctx); + } + + class ConnectionCrossingStyleListener implements Listener> { + ICanvasContext context; + public ConnectionCrossingStyleListener(ICanvasContext context) { + this.context = context; + } + @Override + public void execute(final Pair result) { + context.getThreadAccess().asyncExec(new Runnable() { + @Override + public void run() { + ICanvasContext ctx = context; + if (ctx == null) + return; + if (ctx.isDisposed()) + return; + crossings.setWidth(result.first != null ? result.first : 0.0); + crossings.setType(result.second); + ccNode.repaint(); + } + }); + } + public void dispose() { + context = null; + } + @Override + public boolean isDisposed() { + return context == null || context.isDisposed(); + } + @Override + public void exception(Throwable t) { + ErrorLogger.defaultLogError(t); + } + } + +} diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/CopyAsSVGParticipant.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/CopyAsSVGParticipant.java new file mode 100644 index 000000000..b91c2bb7a --- /dev/null +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/CopyAsSVGParticipant.java @@ -0,0 +1,175 @@ +/******************************************************************************* + * Copyright (c) 2007 VTT Technical Research Centre of Finland and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.diagram.participant; + +import java.awt.Font; +import java.awt.RenderingHints; +import java.awt.geom.Rectangle2D; +import java.io.StringWriter; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.batik.dom.GenericDOMImplementation; +import org.apache.batik.svggen.SVGGeneratorContext; +import org.apache.batik.svggen.SVGGeneratorContext.GraphicContextDefaults; +import org.apache.batik.svggen.SVGGraphics2D; +import org.apache.batik.svggen.SVGGraphics2DIOException; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.widgets.Display; +import org.simantics.diagram.elements.TextNode; +import org.simantics.g2d.canvas.ICanvasContext; +import org.simantics.g2d.canvas.impl.DependencyReflection.Dependency; +import org.simantics.g2d.diagram.participant.AbstractDiagramParticipant; +import org.simantics.g2d.diagram.participant.Selection; +import org.simantics.g2d.element.ElementHints; +import org.simantics.g2d.element.ElementUtils; +import org.simantics.g2d.element.IElement; +import org.simantics.scenegraph.INode; +import org.simantics.scenegraph.g2d.G2DNode; +import org.simantics.scenegraph.g2d.G2DSceneGraph; +import org.simantics.scenegraph.g2d.events.EventHandlerReflection.EventHandler; +import org.simantics.scenegraph.g2d.events.command.CommandEvent; +import org.simantics.scenegraph.g2d.events.command.Commands; +import org.simantics.scenegraph.g2d.nodes.LinkNode; +import org.simantics.scenegraph.g2d.nodes.SelectionNode; +import org.simantics.scenegraph.g2d.nodes.SingleElementNode; +import org.simantics.scenegraph.g2d.nodes.connection.RouteGraphNode; +import org.simantics.scenegraph.utils.NodeMapper; +import org.simantics.scenegraph.utils.NodeUtil; +import org.simantics.utils.ui.ErrorLogger; +import org.w3c.dom.DOMImplementation; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +public class CopyAsSVGParticipant extends AbstractDiagramParticipant { + + @Dependency + protected Selection sel; + + @EventHandler(priority = 0) + public boolean handleCommand(CommandEvent e) { + if (e.command.equals(Commands.COPY_AS_SVG)) { + Set ss = sel.getSelection(0); + copyAsSVG(getContext(), ss); + return true; + } + return false; + } + + private static void copyAsSVG(ICanvasContext canvasContext, Set elements) { + G2DSceneGraph sg = canvasContext.getSceneGraph(); + NodeMapper clipboardNodeMapper = new NodeMapper(); + List selectionRenderingDisabledNodes = new ArrayList(); + SingleElementNode clipboardNode = sg.addNode("svg-clipboard-temp", SingleElementNode.class); + + try { + for (IElement e : elements) { + INode node = e.getHint(ElementHints.KEY_SG_NODE); + if (node != null) { + // Don't render selection. Selection rendering could be a global rendering hint that is adhered by nodes! + for(RouteGraphNode n : NodeUtil.collectNodes(node, RouteGraphNode.class)) { + n.setIgnoreSelection(true); + selectionRenderingDisabledNodes.add(n); + } + for(SelectionNode n : NodeUtil.collectNodes(node, SelectionNode.class)) { + n.setIgnore(true); + selectionRenderingDisabledNodes.add(n); + } + for(TextNode n : NodeUtil.collectNodes(node, TextNode.class)) { + n.setShowSelection(false); + selectionRenderingDisabledNodes.add(n); + } + + String nodeId = clipboardNodeMapper.add(node); + LinkNode delegate = clipboardNode.addNode(ElementUtils.generateNodeId(e), LinkNode.class); + delegate.setDelegateId( nodeId ); + } + } + + DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation(); + + String svgNS = "http://www.w3.org/2000/svg"; + Document document = domImpl.createDocument(svgNS, "svg", null); + + GraphicContextDefaults gcDefaults = new GraphicContextDefaults(); + SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(document); + Map hintMap = new HashMap(); + + hintMap.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); + hintMap.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + hintMap.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + hintMap.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); + hintMap.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); + + gcDefaults.setRenderingHints(new RenderingHints(hintMap)); + gcDefaults.setFont(Font.decode(null)); + ctx.setGraphicContextDefaults(gcDefaults); + + SVGGraphics2D svgG2D = new SVGGraphics2D(ctx, false); + + StringWriter writer = new StringWriter(); + + // Track connection crossings manually since we will render only the clipboard node. + sg.getNode(ConnectionCrossingsParticipant.CONNECTION_CROSSINGS_NODE_KEY).render(svgG2D); + clipboardNode.render(svgG2D); + + Element root = svgG2D.getRoot(); + + Rectangle2D bounds = clipboardNode.getBoundsInLocal(true); + if (bounds != null) { + root.setAttributeNS(null, "viewBox", bounds.getMinX() + " " + bounds.getMinY() + " " + bounds.getWidth() + " " + bounds.getHeight()); + root.setAttributeNS(null, "height", Double.toString(bounds.getHeight())); + root.setAttributeNS(null, "width", Double.toString(bounds.getWidth())); + } + + try { + svgG2D.stream(root, writer, false, false); + } catch (SVGGraphics2DIOException e1) { + ErrorLogger.defaultLogError("Failed to copy the diagram selection as SVG." , e1); + } + + byte[] svgContent = writer.toString().getBytes(StandardCharsets.UTF_8); + + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + Clipboard cb = new Clipboard(Display.getCurrent()); + cb.setContents(new byte[][] {svgContent}, + new Transfer[] { + SVGTransfer.getInstance() + } + ); + } + }); + + } finally { + clipboardNode.removeNodes(); + clipboardNodeMapper.clear(); + clipboardNode.remove(); + + // Restore the selection rendering state for changed nodes. + for (G2DNode n : selectionRenderingDisabledNodes) { + if (n instanceof RouteGraphNode) { + ((RouteGraphNode) n).setIgnoreSelection(false); + } else if (n instanceof SelectionNode) { + ((SelectionNode)n).setIgnore(false); + } else if (n instanceof TextNode) { + ((TextNode)n).setShowSelection(true); + } + } + } + } +} diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/PopulateSelectionDropParticipant.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/PopulateSelectionDropParticipant.java index 3e1140a07..0731bd90d 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/PopulateSelectionDropParticipant.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/PopulateSelectionDropParticipant.java @@ -24,10 +24,8 @@ import java.util.List; import org.eclipse.jface.viewers.IStructuredSelection; import org.simantics.db.Session; import org.simantics.db.exception.DatabaseException; -import org.simantics.diagram.Logger; import org.simantics.diagram.adapter.GraphToDiagramSynchronizer; import org.simantics.g2d.diagram.DiagramHints; -import org.simantics.g2d.diagram.DiagramMutator; import org.simantics.g2d.diagram.DiagramUtils; import org.simantics.g2d.diagram.IDiagram; import org.simantics.g2d.diagram.participant.AbstractDiagramParticipant; @@ -42,11 +40,14 @@ import org.simantics.g2d.element.IElement; import org.simantics.scenegraph.g2d.snap.ISnapAdvisor; import org.simantics.ui.dnd.LocalObjectTransfer; import org.simantics.ui.dnd.LocalObjectTransferable; -import org.simantics.utils.datastructures.Callback; import org.simantics.utils.logging.TimeLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; abstract public class PopulateSelectionDropParticipant extends AbstractDiagramParticipant implements IDropTargetParticipant { + private static final Logger LOGGER = LoggerFactory.getLogger(PopulateSelectionDropParticipant.class); + public abstract List getElements(Session session, IStructuredSelection selection) throws DatabaseException; protected GraphToDiagramSynchronizer synchronizer; @@ -96,12 +97,8 @@ abstract public class PopulateSelectionDropParticipant extends AbstractDiagramPa } - } catch (UnsupportedFlavorException e) { - Logger.defaultLogError(e); - } catch (IOException e) { - Logger.defaultLogError(e); - } catch (DatabaseException e) { - Logger.defaultLogError(e); + } catch (DatabaseException | IOException | UnsupportedFlavorException e) { + LOGGER.error("Unexpected failure", e); } } diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/SVGTransfer.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/SVGTransfer.java new file mode 100644 index 000000000..539e22e3d --- /dev/null +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/SVGTransfer.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2020 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Semantum Oy - initial API and implementation + *******************************************************************************/ +package org.simantics.diagram.participant; + +import java.nio.charset.StandardCharsets; + +import org.eclipse.swt.dnd.ByteArrayTransfer; + +public class SVGTransfer extends ByteArrayTransfer { + private static SVGTransfer instance = new SVGTransfer(); + private static final String TYPE_NAME = "image/svg+xml"; + private static final int TYPE_ID = registerType(TYPE_NAME); + + public static byte[] formatContent(String svg) { + return svg.getBytes(StandardCharsets.UTF_8); + } + + public static SVGTransfer getInstance () { + return instance; + } + + @Override + protected int[] getTypeIds(){ + return new int[] {TYPE_ID}; + } + + @Override + protected String[] getTypeNames(){ + return new String[] {TYPE_NAME}; + } +} \ No newline at end of file diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/IconButtonStyleBase.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/IconButtonStyleBase.java index f4c9470bd..4055e8d4a 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/IconButtonStyleBase.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/IconButtonStyleBase.java @@ -18,7 +18,15 @@ public abstract class IconButtonStyleBase extends St abstract protected String getNodePrefix(); abstract protected Class getNodeClass(); - + + public IconButtonStyleBase(Object identity) { + super(identity); + } + + public IconButtonStyleBase() { + super(); + } + private AffineTransform translateAndScaleIfNeeded(AffineTransform tr, Vec2d offset, boolean relativeTransform) { if(relativeTransform) { if(!offset.isZero()) { diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/Updater.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/Updater.java index 44ec7618e..2e79ef216 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/Updater.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/Updater.java @@ -60,11 +60,11 @@ class Updater implements Runnable { } public void register(INode node) { - // We use ths size of this map to determine whether updates are needed, this is done in AWT thread + // We use the size of this map to determine whether updates are needed, this is done in AWT thread synchronized(requesters) { if(requesters.size() == 0) { if(state.compareAndSet(false, true)) { - ThreadUtils.getNonBlockingWorkExecutor().scheduleAtFixedRate(this, 0, 500, TimeUnit.MILLISECONDS); + ThreadUtils.getNonBlockingWorkExecutor().scheduleWithFixedDelay(this, 0, 500, TimeUnit.MILLISECONDS); } } ICanvasContext context = DiagramNodeUtil.getPossibleCanvasContext((G2DNode)node); diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/query/ConnectionVisualsRequest.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/query/ConnectionVisualsRequest.java index 73e3615ce..619e913f0 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/query/ConnectionVisualsRequest.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/query/ConnectionVisualsRequest.java @@ -54,8 +54,9 @@ public class ConnectionVisualsRequest extends ResourceRead { Stroke stroke = G2DUtils.getStroke(g, g.getPossibleObject(structuralConnectionType, g2d.HasStroke)); Double branchPointRadius = g.getPossibleRelatedValue(structuralConnectionType, g2d.HasBranchPointRadius, Bindings.DOUBLE); Double rounding = g.getPossibleRelatedValue(structuralConnectionType, g2d.HasRounding, Bindings.DOUBLE); + Double offset = g.getPossibleRelatedValue(structuralConnectionType, g2d.HasOffset, Bindings.DOUBLE); - return new ConnectionVisuals(color, strokeType, stroke, branchPointRadius, rounding); + return new ConnectionVisuals(color, strokeType, stroke, branchPointRadius, rounding, offset); } StrokeType toStrokeType(Resource strokeType) { diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/runtime/RuntimeVariable.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/runtime/RuntimeVariable.java index 994370670..e7d411f85 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/runtime/RuntimeVariable.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/runtime/RuntimeVariable.java @@ -65,6 +65,8 @@ class RuntimeVariable extends TernaryRead 0) json.append(","); - Object r = res[i]; - if(r instanceof IdentifiedObject) { - Object id = ((IdentifiedObject) r).getId(); - if(id instanceof IAdaptable) { - Object resource = ((IAdaptable) id).getAdapter(Resource.class); - if(resource != null) { - long rid = ((Resource)resource).getResourceId(); - json.append(Long.toString(rid)); - pos++; - } - } - } + if(pos > 0) json.append(","); + Object r = res[i]; + if(r instanceof IAdaptable) { + Resource resource = ((IAdaptable) r).getAdapter(Resource.class); + if(resource != null) { + long rid = resource.getResourceId(); + json.append(Long.toString(rid)); + pos++; + } + } } json.append("] }"); - StringSelection text = new StringSelection(json.toString()); - PlaintextTransfer plainText = new PlaintextTransfer(json.toString()); + String jsonText = json.toString(); + StringSelection text = new StringSelection(jsonText); + PlaintextTransfer plainText = new PlaintextTransfer(jsonText); return new MultiTransferable(local, text, plainText); diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/CopyAdvisorUtil.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/CopyAdvisorUtil.java index ab28463e8..bbf9a8e5b 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/CopyAdvisorUtil.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/CopyAdvisorUtil.java @@ -11,8 +11,6 @@ *******************************************************************************/ package org.simantics.diagram.synchronization.graph; -import gnu.trove.map.hash.THashMap; - import java.util.Map; import java.util.Set; import java.util.function.BiFunction; @@ -46,6 +44,10 @@ import org.simantics.diagram.synchronization.SynchronizationHints; import org.simantics.graph.db.TransferableGraphs; import org.simantics.graph.representation.TransferableGraph1; import org.simantics.layer0.Layer0; +import org.simantics.utils.datastructures.BinaryFunction; + +import gnu.trove.map.hash.THashMap; +import gnu.trove.set.hash.THashSet; /** * This class contains utility methods for the basic cut/copy operations @@ -82,6 +84,15 @@ public class CopyAdvisorUtil { public static final boolean DEBUG_COPY = DebugPolicy.DEBUG_COPY_PASTE; + private static class Statement4 { + public final Statement stm; + public final Resource inverse; + public Statement4(Statement stm, Resource inverse) { + this.stm = stm; + this.inverse = inverse; + } + } + /** * @param context a synchronization context instance, such as * {@link GraphToDiagramSynchronizer} @@ -364,8 +375,10 @@ public class CopyAdvisorUtil { * @throws DatabaseException */ public static Resource copy2(WriteGraph graph, Resource source, - BiFunction advisor) throws DatabaseException { - return copy2(graph, source, 0, advisor, new THashMap()); + BiFunction advisor) + throws DatabaseException + { + return copy2(graph, source, advisor, new THashMap<>()); } /** @@ -380,13 +393,52 @@ public class CopyAdvisorUtil { * @throws DatabaseException */ public static Resource copy2(WriteGraph graph, Resource source, - BiFunction advisor, Map copyMap) - throws DatabaseException { - return copy2(graph, source, 0, advisor, copyMap); + BiFunction advisor, + Map copyMap) + throws DatabaseException + { + Set pendingStatements = new THashSet<>(); + Resource result = copy2(graph, source, 0, advisor, copyMap, pendingStatements); + postProcessStatements(graph, copyMap, pendingStatements); + return result; + } + + /** + * Post-process pending statement + * + * Rule: If both the subject and object of a pending source statement have + * been copied, then the pending statement should also be copied. + */ + private static void postProcessStatements( + WriteGraph graph, + Map copyMap, + Set pendingStatements) + throws DatabaseException + { + if (pendingStatements.isEmpty()) + return; + + if (DEBUG_COPY) + System.out.println("post processing " + pendingStatements.size() + " pending statements"); + for (Statement4 srcStm : pendingStatements) { + // At this point, it is certain that srcStm subject has been copied + // but test it anyway. + Resource subjectCopy = (Resource) copyMap.get(srcStm.stm.getSubject()); + Resource objectCopy = (Resource) copyMap.get(srcStm.stm.getObject()); + if (subjectCopy == null || objectCopy == null) { + if (DEBUG_COPY) + System.out.println("skipping pending statement: " + NameUtils.toString(graph, srcStm.stm)); + continue; + } + if (DEBUG_COPY) + System.out.println("copying pending statement: " + NameUtils.toString(graph, srcStm.stm)); + graph.claim(subjectCopy, srcStm.stm.getPredicate(), srcStm.inverse, objectCopy); + } } private static Resource copy2(final WriteGraph graph, final Resource source, final int level, - BiFunction advisor, Map copyMap) + BiFunction advisor, Map copyMap, + Set pendingSourceStatements) throws DatabaseException { if (DEBUG_COPY) System.out.println("[" + level + "] CopyAdvisorUtil.copy(" + NameUtils.getSafeName(graph, source) + ", advisor=" + advisor + ")"); @@ -497,12 +549,18 @@ public class CopyAdvisorUtil { if (DEBUG_COPY) System.out.println("[" + level + "]\t\tcopy whole object"); - Resource clone = copy2(graph, obj, level + 1, advisor, copyMap); + Resource clone = copy2(graph, obj, level + 1, advisor, copyMap, pendingSourceStatements); graph.claim(copy, relation, inverse, clone); } } else { - if (DEBUG_COPY) - System.out.println("[" + level + "]\t\tskipping statement"); + if (graph.isSubrelationOf(relation, L0.IsRelatedTo)) { + if (DEBUG_COPY) + System.out.println("[" + level + "]\t\tmarking statement as pending for post-processing"); + pendingSourceStatements.add(new Statement4(stm, inverse)); + } else { + if (DEBUG_COPY) + System.out.println("[" + level + "]\t\tskipping weak statement"); + } } } } diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/ElementReorder.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/ElementReorder.java index b0146cc21..e0d757417 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/ElementReorder.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/ElementReorder.java @@ -55,9 +55,7 @@ public class ElementReorder extends ModificationAdapter { List graphOrder = OrderedSetUtils.toList(g, l); Set graphContents = new HashSet(graphOrder); - List diagramOrder = new ArrayList(order.size()); - Map diagramOrderIndex = new HashMap(order.size()); - int i = 0; + List newGraphOrder = new ArrayList<>(); for (IElement e : order) { Object obj = ElementUtils.getObject(e); if (obj instanceof Resource) { @@ -66,41 +64,22 @@ public class ElementReorder extends ModificationAdapter { // This prevents errors in situations where #order contains // elements that no longer exist in the diagram. if (graphContents.contains(r)) { - diagramOrder.add(r); - diagramOrderIndex.put(r, Integer.valueOf(i)); - ++i; + newGraphOrder.add(r); } } } - // Reorder the backend list according to diagramOrder - i = 0; - for (Resource r : graphOrder) { - Integer di = diagramOrderIndex.get(r); - if (di != null) { - int targetIndex = di; - int graphIndex = i++; - if (graphIndex != targetIndex) { - // Check if the predecessor of r is already correct. - // If it is, we don't have to do anything for r. - Resource graphPrev = OrderedSetUtils.prev(g, l, r); - Resource after = null; - if (targetIndex == 0) { - after = l; - if (l.equals(graphPrev)) - continue; - } else { - after = diagramOrder.get(targetIndex - 1); - if (after.equals(graphPrev)) - continue; - } - - // r needs to be repositioned. - OrderedSetUtils.remove(g, l, r); - OrderedSetUtils.addAfter(g, l, after, r); + // Safety measure for possible missing elements + if (graphOrder.size() != newGraphOrder.size()) { + Set added = new HashSet(newGraphOrder); + for (Resource r : graphOrder) { + if (!added.contains(r)) { + newGraphOrder.add(r); } } } + + OrderedSetUtils.reorder(g, l, newGraphOrder); } } diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/RouteGraphModification.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/RouteGraphModification.java index a15b99bc4..41f4c00e6 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/RouteGraphModification.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/RouteGraphModification.java @@ -162,12 +162,14 @@ public class RouteGraphModification { int[] lines2; int[] terminals1; int[] terminals2; - boolean isHorizontal; + boolean isHorizontal; + boolean invertFlagRotation; double isectX; double isectY; public Split(int[] interface1, int[] interface2, int[] lines2, int[] terminals1, int[] terminals2, boolean isHorizontal, + boolean invertFlagRotation, double isectX, double isectY) { this.interface1 = interface1; this.interface2 = interface2; @@ -175,6 +177,7 @@ public class RouteGraphModification { this.terminals1 = terminals1; this.terminals2 = terminals2; this.isHorizontal = isHorizontal; + this.invertFlagRotation = invertFlagRotation; this.isectX = isectX; this.isectY = isectY; } @@ -188,6 +191,7 @@ public class RouteGraphModification { this.terminals1 = readInts(it); this.terminals2 = readInts(it); this.isHorizontal = Boolean.parseBoolean(it.next()); + this.invertFlagRotation = Boolean.parseBoolean(it.next()); this.isectX = Double.parseDouble(it.next()); this.isectY = Double.parseDouble(it.next()); } @@ -208,6 +212,8 @@ public class RouteGraphModification { b.append("$"); b.append(isHorizontal); b.append("$"); + b.append(invertFlagRotation); + b.append("$"); b.append(isectX); b.append("$"); b.append(isectY); @@ -531,6 +537,7 @@ public class RouteGraphModification { toResources(modi.terminals1), toResources(modi.terminals2), modi.isHorizontal, + modi.invertFlagRotation, modi.isectX, modi.isectY ); diff --git a/bundles/org.simantics.document.base.ontology/.classpath b/bundles/org.simantics.document.base.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.document.base.ontology/.classpath +++ b/bundles/org.simantics.document.base.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.document.base.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.document.base.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.document.base.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.document.base.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.document.base.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.document.base.ontology/META-INF/MANIFEST.MF index deb99608f..9ec3dc50f 100644 --- a/bundles/org.simantics.document.base.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.document.base.ontology/META-INF/MANIFEST.MF @@ -16,6 +16,6 @@ Require-Bundle: org.simantics.layer0, org.simantics.views.ontology;bundle-version="1.1.0", org.simantics.user.ontology;bundle-version="1.0.0", org.simantics.simulation.ontology;bundle-version="1.1.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.document.base.ontology Automatic-Module-Name: org.simantics.document.base.ontology diff --git a/bundles/org.simantics.document.linking.ontology/.classpath b/bundles/org.simantics.document.linking.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.document.linking.ontology/.classpath +++ b/bundles/org.simantics.document.linking.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.document.linking.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.document.linking.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.document.linking.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.document.linking.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.document.linking.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.document.linking.ontology/META-INF/MANIFEST.MF index 8cc4ad04e..e34909c19 100644 --- a/bundles/org.simantics.document.linking.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.document.linking.ontology/META-INF/MANIFEST.MF @@ -11,6 +11,6 @@ Require-Bundle: org.eclipse.core.runtime, org.simantics.image2.ontology;bundle-version="1.2.0", org.simantics.silk.ontology;bundle-version="1.1.0", org.simantics.workbench.ontology;bundle-version="1.2.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.document.linking.ontology Automatic-Module-Name: org.simantics.document.linking.ontology diff --git a/bundles/org.simantics.document.linking.ui/.classpath b/bundles/org.simantics.document.linking.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.document.linking.ui/.classpath +++ b/bundles/org.simantics.document.linking.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.document.linking.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.document.linking.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.document.linking.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.document.linking.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.document.linking.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.document.linking.ui/META-INF/MANIFEST.MF index a7dc90092..56bdc60bd 100644 --- a/bundles/org.simantics.document.linking.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.document.linking.ui/META-INF/MANIFEST.MF @@ -26,7 +26,7 @@ Require-Bundle: org.eclipse.ui, org.simantics.editors;bundle-version="1.0.0", org.simantics.scl.osgi;bundle-version="1.0.4", org.simantics.objmap2;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.document.linking.actions, org.simantics.document.linking.report, diff --git a/bundles/org.simantics.document.ontology/.classpath b/bundles/org.simantics.document.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.document.ontology/.classpath +++ b/bundles/org.simantics.document.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.document.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.document.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.document.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.document.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.document.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.document.ontology/META-INF/MANIFEST.MF index a0083d3a6..f28e12378 100644 --- a/bundles/org.simantics.document.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.document.ontology/META-INF/MANIFEST.MF @@ -11,6 +11,6 @@ Require-Bundle: org.simantics.layer0, org.simantics.selectionview.ontology;bundle-version="1.1.0", org.simantics.graphfile.ontology;bundle-version="0.1.0", org.simantics.action.ontology;bundle-version="1.1.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.document Automatic-Module-Name: org.simantics.document.ontology diff --git a/bundles/org.simantics.document.server.io/.classpath b/bundles/org.simantics.document.server.io/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.document.server.io/.classpath +++ b/bundles/org.simantics.document.server.io/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.document.server.io/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.document.server.io/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.document.server.io/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.document.server.io/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.document.server.io/META-INF/MANIFEST.MF b/bundles/org.simantics.document.server.io/META-INF/MANIFEST.MF index 0acaf4695..1434cb1b8 100644 --- a/bundles/org.simantics.document.server.io/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.document.server.io/META-INF/MANIFEST.MF @@ -6,7 +6,7 @@ Bundle-Version: 1.0.0.qualifier Bundle-Activator: org.simantics.document.server.io.Activator Bundle-Vendor: Semantum Oy Require-Bundle: org.eclipse.core.runtime -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.document.server.io Automatic-Module-Name: org.simantics.document.server.io diff --git a/bundles/org.simantics.document.server/.classpath b/bundles/org.simantics.document.server/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.document.server/.classpath +++ b/bundles/org.simantics.document.server/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.document.server/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.document.server/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.document.server/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.document.server/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.document.server/META-INF/MANIFEST.MF b/bundles/org.simantics.document.server/META-INF/MANIFEST.MF index 2881621c6..677d6d411 100644 --- a/bundles/org.simantics.document.server/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.document.server/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Document Server Bundle-SymbolicName: org.simantics.document.server;singleton:=true Bundle-Version: 1.0.0.qualifier Bundle-Vendor: Semantum Oy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics;bundle-version="1.0.0", org.simantics.structural2;bundle-version="1.1.1", diff --git a/bundles/org.simantics.document.server/src/org/simantics/document/server/Functions.java b/bundles/org.simantics.document.server/src/org/simantics/document/server/Functions.java index d5a727ffa..8dea97ad1 100644 --- a/bundles/org.simantics.document.server/src/org/simantics/document/server/Functions.java +++ b/bundles/org.simantics.document.server/src/org/simantics/document/server/Functions.java @@ -164,8 +164,8 @@ public class Functions { StandardAssertedGraphPropertyVariable ass = (StandardAssertedGraphPropertyVariable)property; if("dataDefinitions".equals(ass.property.name) || "commands".equals(ass.property.name) || "pollingFunction".equals(ass.property.name)) { storePropertyValueAndExceptions(graph, parent, ass.property.name, property, map); + continue; } - continue; } Resource predicate = property.getPossiblePredicateResource(graph); if(predicate != null) { @@ -297,8 +297,8 @@ public class Functions { StandardAssertedGraphPropertyVariable ass = (StandardAssertedGraphPropertyVariable)property; if("dataDefinitions".equals(ass.property.name) || "commands".equals(ass.property.name) || "pollingFunction".equals(ass.property.name)) { result.add(ass.property.name); + continue; } - continue; } Resource predicate = property.getPossiblePredicateResource(graph); if(predicate != null) { diff --git a/bundles/org.simantics.document.server/src/org/simantics/document/server/request/DocumentRequest.java b/bundles/org.simantics.document.server/src/org/simantics/document/server/request/DocumentRequest.java index 8acc2f0d1..5b76cd344 100644 --- a/bundles/org.simantics.document.server/src/org/simantics/document/server/request/DocumentRequest.java +++ b/bundles/org.simantics.document.server/src/org/simantics/document/server/request/DocumentRequest.java @@ -1,6 +1,7 @@ package org.simantics.document.server.request; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; @@ -10,7 +11,7 @@ import java.util.Set; import org.simantics.db.AsyncReadGraph; import org.simantics.db.ReadGraph; import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener; -import org.simantics.db.common.request.AsyncReadRequest; +import org.simantics.db.common.request.UnaryAsyncRead; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.request.VariableRead; import org.simantics.db.layer0.variable.Variable; @@ -28,49 +29,55 @@ public class DocumentRequest extends VariableRead> { super(var); } - @Override - public List perform(ReadGraph graph) throws DatabaseException { - - long s = System.nanoTime(); - - Set nodes = graph.syncRequest(new NodesRequest(variable), TransientCacheAsyncListener.>instance()); - HashSet rs = new HashSet(); // result - if(nodes.isEmpty()) { - return Collections.emptyList(); - } + static class CollectNodesRequest extends UnaryAsyncRead, Collection> { - if(PROFILE) { - long dura = System.nanoTime()-s; - System.err.println("DocumentRequest1 " + System.identityHashCode(this) + " in " + 1e-6*dura + "ms. " + variable.getURI(graph)); + public CollectNodesRequest(Collection nodes) { + super(nodes); } - graph.syncRequest(new AsyncReadRequest() { + @Override + public void perform(AsyncReadGraph graph, AsyncProcedure> procedure) { + HashSet rs = new HashSet(); // result - @Override - public void run(AsyncReadGraph graph) throws DatabaseException { + for(Variable node : parameter) { + graph.asyncRequest(new NodeRequest(node), new AsyncProcedure () { - for(Variable node : nodes) { - graph.asyncRequest(new NodeRequest(node), new AsyncProcedure () { - - @Override - public void execute(AsyncReadGraph graph, JSONObject result) { - synchronized (rs) { - rs.add(result); - } + @Override + public void execute(AsyncReadGraph graph, JSONObject result) { + synchronized(rs) { + rs.add(result); } + } - @Override - public void exception(AsyncReadGraph graph, Throwable throwable) { - } + @Override + public void exception(AsyncReadGraph graph, Throwable throwable) { + } + + }); - }); - - } - } - - }); + procedure.execute(graph, rs); + + } + + } + + @Override + public List perform(ReadGraph graph) throws DatabaseException { + + long s = System.nanoTime(); + + Set nodes = graph.syncRequest(new NodesRequest(variable), TransientCacheAsyncListener.>instance()); + if(nodes.isEmpty()) { + return Collections.emptyList(); + } + + if(PROFILE) { + long dura = System.nanoTime()-s; + System.err.println("DocumentRequest1 " + System.identityHashCode(this) + " in " + 1e-6*dura + "ms. " + variable.getURI(graph)); + } + Collection rs = graph.syncRequest(new CollectNodesRequest(nodes)); if(PROFILE) { long dura = System.nanoTime()-s; diff --git a/bundles/org.simantics.document.server/src/org/simantics/document/server/request/HandleEventRequest.java b/bundles/org.simantics.document.server/src/org/simantics/document/server/request/HandleEventRequest.java index 606b361b6..4c611a9aa 100644 --- a/bundles/org.simantics.document.server/src/org/simantics/document/server/request/HandleEventRequest.java +++ b/bundles/org.simantics.document.server/src/org/simantics/document/server/request/HandleEventRequest.java @@ -1,19 +1,17 @@ package org.simantics.document.server.request; import org.simantics.db.ReadGraph; +import org.simantics.db.common.request.UnaryRead; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; -import org.simantics.db.request.Read; import org.simantics.document.server.handler.AbstractEventHandler; import org.simantics.structural.stubs.StructuralResource2; -public class HandleEventRequest implements Read { - - final String id; +public class HandleEventRequest extends UnaryRead { public HandleEventRequest(String id) { - this.id = id; + super(id); } @Override @@ -21,7 +19,7 @@ public class HandleEventRequest implements Read { StructuralResource2.getInstance(graph); - Variable variable = Variables.getPossibleVariable(graph, id); + Variable variable = Variables.getPossibleVariable(graph, parameter); if(variable == null) return null; // System.err.println("EVENT " + variable.getURI(graph)); @@ -29,7 +27,7 @@ public class HandleEventRequest implements Read { if(handler instanceof AbstractEventHandler) return (AbstractEventHandler) handler; else - throw new DatabaseException("Handler for " + id + " is not instance of AbstractEventHandler (it is instance of " + (handler != null ? handler.getClass() : null) + ")"); + throw new DatabaseException("Handler for " + parameter + " is not instance of AbstractEventHandler (it is instance of " + (handler != null ? handler.getClass() : null) + ")"); } } \ No newline at end of file diff --git a/bundles/org.simantics.document.server/src/org/simantics/document/server/request/NodesRequest.java b/bundles/org.simantics.document.server/src/org/simantics/document/server/request/NodesRequest.java index 99526368e..133264e29 100644 --- a/bundles/org.simantics.document.server/src/org/simantics/document/server/request/NodesRequest.java +++ b/bundles/org.simantics.document.server/src/org/simantics/document/server/request/NodesRequest.java @@ -2,11 +2,12 @@ package org.simantics.document.server.request; import java.util.Collection; import java.util.Collections; +import java.util.HashSet; import java.util.Set; import org.simantics.db.AsyncReadGraph; import org.simantics.db.ReadGraph; -import org.simantics.db.common.request.AsyncReadRequest; +import org.simantics.db.common.request.UnaryAsyncRead; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.request.VariableChildren; import org.simantics.db.layer0.request.VariableRead; @@ -16,52 +17,57 @@ import org.simantics.structural.stubs.StructuralResource2; import org.simantics.utils.threads.logger.ITask; import org.simantics.utils.threads.logger.ThreadLogger; -import gnu.trove.set.hash.THashSet; - public class NodesRequest extends VariableRead> { public NodesRequest(Variable var) { super(var); } - @Override - public Set perform(ReadGraph graph) throws DatabaseException { + static class CollectNodesRequest2 extends UnaryAsyncRead, Set> { - ITask task = DocumentRequest.PROFILE ? ThreadLogger.task(this) : null; + public CollectNodesRequest2(Collection nodes) { + super(nodes); + } - StructuralResource2.getInstance(graph); - if(variable == null) - return Collections.emptySet(); + @Override + public void perform(AsyncReadGraph graph, AsyncProcedure> procedure) { + HashSet rs = new HashSet(); // result - Set nodes = new THashSet(); + for(Variable node : parameter) { + graph.asyncRequest(new NodesRequest2(node), new AsyncProcedure> () { - Collection children = graph.syncRequest(new VariableChildren(variable)); + @Override + public void execute(AsyncReadGraph graph, Set result) { + synchronized(rs) { + rs.addAll(result); + } + } - graph.syncRequest(new AsyncReadRequest() { + @Override + public void exception(AsyncReadGraph graph, Throwable throwable) { + } - @Override - public void run(AsyncReadGraph graph) throws DatabaseException { + }); - for(Variable child : children) { - graph.asyncRequest(new NodesRequest2(child), new AsyncProcedure>() { + } + procedure.execute(graph, rs); - @Override - public void execute(AsyncReadGraph graph, Set result) { - synchronized(nodes) { - nodes.addAll(result); - } - } + } - @Override - public void exception(AsyncReadGraph graph, Throwable throwable) { - } - - }); - } + } - } + @Override + public Set perform(ReadGraph graph) throws DatabaseException { + + ITask task = DocumentRequest.PROFILE ? ThreadLogger.task(this) : null; + + StructuralResource2.getInstance(graph); + if(variable == null) + return Collections.emptySet(); + + Collection children = graph.syncRequest(new VariableChildren(variable)); - }); + Set nodes = graph.syncRequest(new CollectNodesRequest2(children)); if(DocumentRequest.PROFILE) task.finish(); diff --git a/bundles/org.simantics.document.swt.core/.classpath b/bundles/org.simantics.document.swt.core/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.document.swt.core/.classpath +++ b/bundles/org.simantics.document.swt.core/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.document.swt.core/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.document.swt.core/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.document.swt.core/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.document.swt.core/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.document.swt.core/META-INF/MANIFEST.MF b/bundles/org.simantics.document.swt.core/META-INF/MANIFEST.MF index 7e9a61d04..c65f2054a 100644 --- a/bundles/org.simantics.document.swt.core/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.document.swt.core/META-INF/MANIFEST.MF @@ -18,7 +18,7 @@ Require-Bundle: org.eclipse.core.runtime, org.simantics.scl.db;bundle-version="0.1.3", org.simantics.scl.ui;bundle-version="0.5.0", org.eclipse.jface.text;bundle-version="3.7.1" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.document.swt.core, org.simantics.document.swt.core.base, diff --git a/bundles/org.simantics.document.swt.ontology/.classpath b/bundles/org.simantics.document.swt.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.document.swt.ontology/.classpath +++ b/bundles/org.simantics.document.swt.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.document.swt.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.document.swt.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.document.swt.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.document.swt.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.document.swt.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.document.swt.ontology/META-INF/MANIFEST.MF index b5edfb470..1258ad659 100644 --- a/bundles/org.simantics.document.swt.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.document.swt.ontology/META-INF/MANIFEST.MF @@ -9,6 +9,6 @@ Require-Bundle: org.simantics.layer0, org.simantics.datatypes.ontology;bundle-version="1.0.0", org.simantics.structural.ontology;bundle-version="1.2.0", org.simantics.document.base.ontology;bundle-version="1.1.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.document.swt.ontology Automatic-Module-Name: org.simantics.document.swt.ontology diff --git a/bundles/org.simantics.document.ui.ontology/.classpath b/bundles/org.simantics.document.ui.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.document.ui.ontology/.classpath +++ b/bundles/org.simantics.document.ui.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.document.ui.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.document.ui.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.document.ui.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.document.ui.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.document.ui.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.document.ui.ontology/META-INF/MANIFEST.MF index 8a09d9e4b..553b2b570 100644 --- a/bundles/org.simantics.document.ui.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.document.ui.ontology/META-INF/MANIFEST.MF @@ -18,6 +18,6 @@ Require-Bundle: org.simantics.layer0, org.simantics.simulation.ontology;bundle-version="1.0.0", org.simantics.selectionview.ui.ontology;bundle-version="1.1.0", org.simantics.workbench.ontology;bundle-version="1.2.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.document.ui Automatic-Module-Name: org.simantics.document.ui.ontology diff --git a/bundles/org.simantics.document.ui/.classpath b/bundles/org.simantics.document.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.document.ui/.classpath +++ b/bundles/org.simantics.document.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.document.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.document.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.document.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.document.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.document.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.document.ui/META-INF/MANIFEST.MF index b226c5aac..799395372 100644 --- a/bundles/org.simantics.document.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.document.ui/META-INF/MANIFEST.MF @@ -28,8 +28,8 @@ Require-Bundle: org.eclipse.ui, org.simantics.annotation.ui;bundle-version="1.0.0", org.eclipse.ui.editors;bundle-version="3.9.0", org.eclipse.jface.text, - org.slf4j.api;bundle-version="1.7.2" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 + org.slf4j.api +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.document.ui, org.simantics.document.ui.actions, diff --git a/bundles/org.simantics.document/.classpath b/bundles/org.simantics.document/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.document/.classpath +++ b/bundles/org.simantics.document/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.document/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.document/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.document/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.document/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.document/META-INF/MANIFEST.MF b/bundles/org.simantics.document/META-INF/MANIFEST.MF index 865f7dffe..5e2adc62d 100644 --- a/bundles/org.simantics.document/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.document/META-INF/MANIFEST.MF @@ -5,7 +5,7 @@ Bundle-SymbolicName: org.simantics.document;singleton:=true Bundle-Version: 1.0.0.qualifier Bundle-Vendor: Semantum Oy Bundle-Activator: org.simantics.document.Activator -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics;bundle-version="1.0.0", org.simantics.scenegraph.loader;bundle-version="1.0.0", org.simantics.views;bundle-version="1.1.0", diff --git a/bundles/org.simantics.dublincore.ontology/.classpath b/bundles/org.simantics.dublincore.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.dublincore.ontology/.classpath +++ b/bundles/org.simantics.dublincore.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.dublincore.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.dublincore.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.dublincore.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.dublincore.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.dublincore.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.dublincore.ontology/META-INF/MANIFEST.MF index 4578ba2e1..c521b5f91 100644 --- a/bundles/org.simantics.dublincore.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.dublincore.ontology/META-INF/MANIFEST.MF @@ -4,6 +4,6 @@ Bundle-Name: http://www.simantics.org/DublinCore Bundle-SymbolicName: org.simantics.dublincore.ontology Bundle-Version: 1.1.0.qualifier Require-Bundle: org.simantics.layer0 -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.layer0 Automatic-Module-Name: org.simantics.dublincore.ontology diff --git a/bundles/org.simantics.editors.win32/.classpath b/bundles/org.simantics.editors.win32/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.editors.win32/.classpath +++ b/bundles/org.simantics.editors.win32/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.editors.win32/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.editors.win32/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.editors.win32/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.editors.win32/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.editors.win32/META-INF/MANIFEST.MF b/bundles/org.simantics.editors.win32/META-INF/MANIFEST.MF index 25aba8548..bf68d4a97 100644 --- a/bundles/org.simantics.editors.win32/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.editors.win32/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Reusable Editors for Windows Bundle-SymbolicName: org.simantics.editors.win32;singleton:=true Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.0", org.eclipse.ui;bundle-version="3.4.0", org.eclipse.core.resources;bundle-version="3.4.0", diff --git a/bundles/org.simantics.editors/.classpath b/bundles/org.simantics.editors/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.editors/.classpath +++ b/bundles/org.simantics.editors/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.editors/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.editors/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.editors/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.editors/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.editors/META-INF/MANIFEST.MF b/bundles/org.simantics.editors/META-INF/MANIFEST.MF index 832274725..3ff52984d 100644 --- a/bundles/org.simantics.editors/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.editors/META-INF/MANIFEST.MF @@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.ui, org.simantics.utils.ui;bundle-version="1.0.0", org.simantics.utils.ui.workbench;bundle-version="1.0.0", org.eclipse.ui.ide;bundle-version="3.7.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.editors, org.simantics.editors.internal;x-friends:="org.simantics.editors.win32" diff --git a/bundles/org.simantics.equation/.classpath b/bundles/org.simantics.equation/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.equation/.classpath +++ b/bundles/org.simantics.equation/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.equation/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.equation/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.equation/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.equation/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.equation/META-INF/MANIFEST.MF b/bundles/org.simantics.equation/META-INF/MANIFEST.MF index 217052d50..ea3183872 100644 --- a/bundles/org.simantics.equation/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.equation/META-INF/MANIFEST.MF @@ -15,5 +15,5 @@ Require-Bundle: org.eclipse.ui, Bundle-ActivationPolicy: lazy Export-Package: org.simantics.equation.solver, org.simantics.equation.stubs -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.simantics.equation diff --git a/bundles/org.simantics.event.ontology/.classpath b/bundles/org.simantics.event.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.event.ontology/.classpath +++ b/bundles/org.simantics.event.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.event.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.event.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.event.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.event.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.event.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.event.ontology/META-INF/MANIFEST.MF index 11b0c889e..53ef2d8a7 100644 --- a/bundles/org.simantics.event.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.event.ontology/META-INF/MANIFEST.MF @@ -8,7 +8,7 @@ Require-Bundle: org.simantics.layer0;visibility:=reexport, org.simantics.project.ontology;bundle-version="1.0.0", org.simantics.viewpoint.ontology;bundle-version="1.0.0", org.simantics.silk.ontology;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.event.ontology Bundle-Vendor: Semantum Oy Automatic-Module-Name: org.simantics.event.ontology diff --git a/bundles/org.simantics.event/.classpath b/bundles/org.simantics.event/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.event/.classpath +++ b/bundles/org.simantics.event/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.event/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.event/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.event/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.event/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.event/META-INF/MANIFEST.MF b/bundles/org.simantics.event/META-INF/MANIFEST.MF index 2ccee86aa..f7ea7e744 100644 --- a/bundles/org.simantics.event/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.event/META-INF/MANIFEST.MF @@ -13,7 +13,7 @@ Require-Bundle: org.eclipse.ui, org.simantics.browsing.ui.model;bundle-version="1.0.0", org.simantics.views.swt;bundle-version="1.0.0", org.simantics.selectionview;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.event, org.simantics.event.util, diff --git a/bundles/org.simantics.excel/.classpath b/bundles/org.simantics.excel/.classpath index ad32c83a7..e801ebfb4 100644 --- a/bundles/org.simantics.excel/.classpath +++ b/bundles/org.simantics.excel/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.excel/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.excel/.settings/org.eclipse.jdt.core.prefs index e52cbc8ce..7adc0fb9a 100644 --- a/bundles/org.simantics.excel/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.excel/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,10 @@ -#Wed Sep 30 09:11:05 EEST 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.excel/META-INF/MANIFEST.MF b/bundles/org.simantics.excel/META-INF/MANIFEST.MF index 9085bef9a..28ebf5dc4 100644 --- a/bundles/org.simantics.excel/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.excel/META-INF/MANIFEST.MF @@ -8,7 +8,7 @@ Bundle-Vendor: VTT Technical Research Centre of Finland Require-Bundle: org.eclipse.core.runtime, org.simantics.utils;bundle-version="1.0.0", org.eclipse.core.resources;bundle-version="3.6.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.excel Automatic-Module-Name: org.simantics.excel diff --git a/bundles/org.simantics.excel/SimanticsExcel_64.dll b/bundles/org.simantics.excel/SimanticsExcel_64.dll new file mode 100644 index 000000000..9be7f04fe Binary files /dev/null and b/bundles/org.simantics.excel/SimanticsExcel_64.dll differ diff --git a/bundles/org.simantics.excel/build.properties b/bundles/org.simantics.excel/build.properties index 9a56e9b7e..4f7390681 100644 --- a/bundles/org.simantics.excel/build.properties +++ b/bundles/org.simantics.excel/build.properties @@ -13,4 +13,5 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - SimanticsExcel.dll + SimanticsExcel.dll,\ + scl/ diff --git a/bundles/org.simantics.excel/native/Interface.cpp b/bundles/org.simantics.excel/native/Interface.cpp index 46f894c63..9e67f4aa8 100644 --- a/bundles/org.simantics.excel/native/Interface.cpp +++ b/bundles/org.simantics.excel/native/Interface.cpp @@ -1,31 +1,21 @@ -//#include "stdafx.h" - -//#ifndef _UNICODE -//#define _UNICODE -//#endif - #include #include -//#include -//#include +#include +#include +#include +#include using namespace std; -#import "c:/program files (x86)/common files/microsoft shared/office12/mso.dll" \ - rename( "RGB", "MSORGB" ) - -using namespace Office; - -#import "c:/program files (x86)/common files/microsoft shared/vba/vba6/vbe6ext.olb" \ - -using namespace VBIDE; +// mso.dll +#import "libid:{2df8d04c-5bfa-101b-bde5-00aa0044de52}" auto_rename +// vb6ext.olb +#import "libid:{0002e157-0000-0000-c000-000000000046}" auto_rename +// excel.exe +#import "libid:{00020813-0000-0000-c000-000000000046}" auto_rename -#import "c:/program files (x86)/microsoft office/office12/excel.exe" \ - rename( "DialogBox", "ExcelDialogBox" ) \ - rename( "RGB", "ExcelRGB" ) \ - rename( "CopyFile", "ExcelCopyFile" ) \ - rename( "ReplaceText", "ExcelReplaceText" ) +using namespace Excel; #include "jni2.h" @@ -34,10 +24,10 @@ using namespace VBIDE; #define SIMANTICS_DEBUG(...) -using namespace std; -using namespace Excel; +//using namespace std; +//using namespace Office; -map handles; +map handles; static int handleCounter = 1; void replace(std::string &s, const std::string &s1, const std::string &s2) { @@ -464,7 +454,7 @@ JNIEXPORT jint JNICALL Java_org_simantics_excel_Excel_close(JNIEnv *env, jobject } -/** + JNIEXPORT jdouble JNICALL Java_org_simantics_excel_Excel_getDouble(JNIEnv *env, jobject, jint handle, jint row, jint column) { SIMANTICS_DEBUG("getDouble(%d, %d)\r\n", row, column); @@ -489,7 +479,7 @@ JNIEXPORT jdouble JNICALL Java_org_simantics_excel_Excel_getDouble(JNIEnv *env, } JNIEXPORT jstring JNICALL Java_org_simantics_excel_Excel_getString(JNIEnv *env, jobject, jint handle, jint row, jint column) { - + USES_CONVERSION; //string val = getString(env, value); SIMANTICS_DEBUG("getString(%d, %d)\r\n", row, column); @@ -499,30 +489,30 @@ JNIEXPORT jstring JNICALL Java_org_simantics_excel_Excel_getString(JNIEnv *env, Excel::RangePtr range = sheet->Cells; if(!range) return NULL; - variant_t val = range->Item[row+1][column+1]; - if (val.vt != VT_NULL) { // val.vt seems to be always VT_DISPATCH. - try { + _bstr_t val = _bstr_t(range->Item[row + 1][column + 1]); + //if (val.vt != VT_NULL) { // val.vt seems to be always VT_DISPATCH. + //try { //this call will crash the application, if the cell is empty! - _bstr_t bstrt = val; - TCHAR text[1024]; + //_bstr_t bstrt = val; + //std::string text(val); + //CString text(val); + //text. + //TCHAR text[1024]; // TODO: this uses wide character (16-bit) while NewStringUTF expext regular character (8-bit), hence Java gets only the fisrt charater of the whole string. - _stprintf(text, _T("%s"), (LPCTSTR)bstrt); + //_stprintf(text, _T("%s"), (LPCTSTR)bstrt); //const char *text = bstrt; SIMANTICS_DEBUG("%s\r\n",text); - - // this code returns "??" for all cells. - //BSTR bstr = val.bstrVal; - //const char *text = _com_util::ConvertBSTRToString(bstr); - jstring ret = env->NewStringUTF((const char*)text); - delete[] text; - return ret; - } catch (...) { - return NULL; - } - } - SIMANTICS_DEBUG("%d\r\n",val.vt); - return NULL; + string text(val); + + + return env->NewStringUTF(text.c_str()); + + //} catch (...) { + // return NULL; + //} + //} + //SIMANTICS_DEBUG("%d\r\n",val.vt); + //return NULL; } -*/ \ No newline at end of file diff --git a/bundles/org.simantics.excel/native/SimanticsExcel.sln b/bundles/org.simantics.excel/native/SimanticsExcel.sln index 59c24ad34..bb04a663d 100644 --- a/bundles/org.simantics.excel/native/SimanticsExcel.sln +++ b/bundles/org.simantics.excel/native/SimanticsExcel.sln @@ -1,7 +1,9 @@  -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimanticsExcel", "SimanticsExcel.vcproj", "{E106958A-412F-4782-81CD-DF380D66BA6B}" +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.40629.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimanticsExcel", "SimanticsExcel.vcxproj", "{E106958A-412F-4782-81CD-DF380D66BA6B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,8 +13,8 @@ Global GlobalSection(ProjectConfigurationPlatforms) = postSolution {E106958A-412F-4782-81CD-DF380D66BA6B}.Debug|Win32.ActiveCfg = Debug|Win32 {E106958A-412F-4782-81CD-DF380D66BA6B}.Debug|Win32.Build.0 = Debug|Win32 - {E106958A-412F-4782-81CD-DF380D66BA6B}.Release|Win32.ActiveCfg = Release|Win32 - {E106958A-412F-4782-81CD-DF380D66BA6B}.Release|Win32.Build.0 = Release|Win32 + {E106958A-412F-4782-81CD-DF380D66BA6B}.Release|Win32.ActiveCfg = Release|x64 + {E106958A-412F-4782-81CD-DF380D66BA6B}.Release|Win32.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/bundles/org.simantics.excel/native/SimanticsExcel.vcxproj b/bundles/org.simantics.excel/native/SimanticsExcel.vcxproj index 77b342183..67c676b43 100644 --- a/bundles/org.simantics.excel/native/SimanticsExcel.vcxproj +++ b/bundles/org.simantics.excel/native/SimanticsExcel.vcxproj @@ -1,14 +1,22 @@  - + Debug Win32 + + Debug + x64 + Release Win32 + + Release + x64 + {E106958A-412F-4782-81CD-DF380D66BA6B} @@ -18,12 +26,27 @@ DynamicLibrary + v120 + false + Unicode + true + + + DynamicLibrary + v120 false Unicode true DynamicLibrary + v120 + false + Unicode + + + DynamicLibrary + v120 false Unicode @@ -33,20 +56,38 @@ + + + + + + - <_ProjectFileVersion>10.0.40219.1 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - false - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - false + <_ProjectFileVersion>12.0.30501.0 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + false + + + true + false + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + false + + + false + false @@ -60,8 +101,7 @@ EnableFastChecks MultiThreadedDebugDLL true - - + Level3 EditAndContinue @@ -78,7 +118,64 @@ MachineX86 + + + _DEBUG;%(PreprocessorDefinitions) + false + + + Disabled + WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + true + + + Level3 + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + $(IntDir);%(AdditionalIncludeDirectories) + + + LinkVerboseLib + .\SimanticsExcel.def + true + Windows + + + + NDEBUG;%(PreprocessorDefinitions) + false + + + MaxSpeed + true + WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + Level3 + ProgramDatabase + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + $(IntDir);%(AdditionalIncludeDirectories) + + + .\SimanticsExcel.def + true + Windows + true + true + MachineX86 + + + NDEBUG;%(PreprocessorDefinitions) false @@ -105,7 +202,6 @@ Windows true true - MachineX86 @@ -113,12 +209,11 @@ - - - + + @@ -127,6 +222,9 @@ + + + diff --git a/bundles/org.simantics.excel/native/jni2.h b/bundles/org.simantics.excel/native/jni2.h index d2c7715f0..ba3eeec8b 100644 --- a/bundles/org.simantics.excel/native/jni2.h +++ b/bundles/org.simantics.excel/native/jni2.h @@ -14,9 +14,8 @@ JNIEXPORT jint JNICALL Java_org_simantics_excel_Excel_setString(JNIEnv *env, job JNIEXPORT jint JNICALL Java_org_simantics_excel_Excel_setName(JNIEnv *env, jobject, jint handle, jint row, jint column, jstring value); JNIEXPORT jint JNICALL Java_org_simantics_excel_Excel_setVisible(JNIEnv *env, jobject, jint handle, jboolean value); JNIEXPORT jint JNICALL Java_org_simantics_excel_Excel_close(JNIEnv *env, jobject, jint handle); - -//JNIEXPORT jstring JNICALL Java_org_simantics_excel_Excel_getString(JNIEnv *env, jobject, jint handle, jint row, jint column); -//JNIEXPORT jdouble JNICALL Java_org_simantics_excel_Excel_getDouble(JNIEnv *env, jobject, jint handle, jint row, jint column); +JNIEXPORT jstring JNICALL Java_org_simantics_excel_Excel_getString(JNIEnv *env, jobject, jint handle, jint row, jint column); +JNIEXPORT jdouble JNICALL Java_org_simantics_excel_Excel_getDouble(JNIEnv *env, jobject, jint handle, jint row, jint column); #ifdef __cplusplus } diff --git a/bundles/org.simantics.excel/scl/Excel.scl b/bundles/org.simantics.excel/scl/Excel.scl new file mode 100644 index 000000000..4314025ed --- /dev/null +++ b/bundles/org.simantics.excel/scl/Excel.scl @@ -0,0 +1,19 @@ +importJava "org.simantics.excel.Excel" where + + data Excel + + @JavaName "getInstance" + excelInstance :: () -> Excel + + @JavaName "open2_" + openExcelSheet :: Excel -> String -> String -> Integer + @JavaName "close_" + closeExcelSheet :: Excel -> Integer -> () + @JavaName "setString_" + setExcelString :: Excel -> Integer -> Integer -> Integer -> String -> Integer + @JavaName "getString_" + getExcelString :: Excel -> Integer -> Integer -> Integer -> String + @JavaName "setDouble_" + setExcelDouble :: Excel -> Integer -> Integer -> Integer -> Double -> Integer + @JavaName "getDouble_" + getExcelDouble :: Excel -> Integer -> Integer -> Integer -> Double diff --git a/bundles/org.simantics.excel/src/org/simantics/excel/Excel.java b/bundles/org.simantics.excel/src/org/simantics/excel/Excel.java index bf7ddb5d5..d692206bd 100644 --- a/bundles/org.simantics.excel/src/org/simantics/excel/Excel.java +++ b/bundles/org.simantics.excel/src/org/simantics/excel/Excel.java @@ -45,6 +45,10 @@ public class Excel { private static Excel instance; + public static Excel getInstance() throws ExcelException { + return getInstance(System.out); + } + public static Excel getInstance(PrintStream out) throws ExcelException { if(instance == null) { @@ -89,11 +93,11 @@ public class Excel { File extractDir = context.getDataFile(""); if (extractDir == null) - throw new IOException("Bundle '" + Activator.PLUGIN_ID + " context has no file system support. Cannot extract server executables."); + throw new IOException("Bundle '" + Activator.PLUGIN_ID + " context has no file system support. Cannot extract DLLs."); if (!extractDir.exists()) if (!extractDir.mkdir()) - throw new IOException("Could not create directory '" + extractDir.getCanonicalPath() + "' for storing Balas solver data."); + throw new IOException("Could not create directory '" + extractDir.getCanonicalPath() + "' for communicating with Excel."); return extractDir; @@ -266,7 +270,7 @@ public class Excel { if (!extractDir.exists()) if (!extractDir.mkdir()) - throw new IOException("Could not create directory '" + extractDir.getCanonicalPath() + "' for storing Balas solver data."); + throw new IOException("Could not create directory '" + extractDir.getCanonicalPath() + "' for communicating with Excel."); String asd = ""; ExecEnvironment env = ExecEnvironment.calculate(); @@ -306,8 +310,8 @@ public class Excel { private native int setVisible(int handle, boolean value); private native int close(int handle); -// private native double getDouble(int handle, int row, int column); -// private native String getString(int handle, int row, int column); + private native double getDouble(int handle, int row, int column); + private native String getString(int handle, int row, int column); final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); @@ -331,6 +335,20 @@ public class Excel { }); } + public int open2_(final String fileName, final String sheetName) { + try { + return scheduler.submit(new Callable() { + @Override + public Integer call() throws Exception { + return Integer.parseInt(open(fileName, sheetName)); + } + }).get(); + } catch (Exception e) { + e.printStackTrace(); + return -1; + } + } + public String open_(final String fileName, final String sheetName) { try { return scheduler.submit(new Callable() { @@ -437,32 +455,32 @@ public class Excel { } } -// public double getDouble_(final int handle, final int row, final int column) { -// try { -// return scheduler.submit(new Callable() { -// @Override -// public Double call() throws Exception { -// return getDouble(handle, row, column); -// } -// }).get(); -// } catch (Exception e) { -// e.printStackTrace(); -// return Double.NaN; -// } -// } -// -// public String getString_(final int handle, final int row, final int column) { -// try { -// return scheduler.submit(new Callable() { -// @Override -// public String call() throws Exception { -// return getString(handle, row, column); -// } -// }).get(); -// } catch (Exception e) { -// e.printStackTrace(); -// return null; -// } -// } + public double getDouble_(final int handle, final int row, final int column) { + try { + return scheduler.submit(new Callable() { + @Override + public Double call() throws Exception { + return getDouble(handle, row, column); + } + }).get(); + } catch (Exception e) { + e.printStackTrace(); + return Double.NaN; + } + } + + public String getString_(final int handle, final int row, final int column) { + try { + return scheduler.submit(new Callable() { + @Override + public String call() throws Exception { + return getString(handle, row, column); + } + }).get(); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } } diff --git a/bundles/org.simantics.export.core/.classpath b/bundles/org.simantics.export.core/.classpath index be475a6ea..8b22afe9c 100644 --- a/bundles/org.simantics.export.core/.classpath +++ b/bundles/org.simantics.export.core/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.export.core/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.export.core/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.export.core/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.export.core/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.export.core/META-INF/MANIFEST.MF b/bundles/org.simantics.export.core/META-INF/MANIFEST.MF index 946657f54..4f50d5ead 100644 --- a/bundles/org.simantics.export.core/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.export.core/META-INF/MANIFEST.MF @@ -17,7 +17,7 @@ Require-Bundle: org.eclipse.core.runtime, org.simantics;bundle-version="1.0.0", com.lowagie.text;bundle-version="2.1.7";resolution:=optional, org.slf4j.api -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.export.core, org.simantics.export.core.error, org.simantics.export.core.impl, diff --git a/bundles/org.simantics.export.ui/.classpath b/bundles/org.simantics.export.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.export.ui/.classpath +++ b/bundles/org.simantics.export.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.export.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.export.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.export.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.export.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.export.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.export.ui/META-INF/MANIFEST.MF index 99f9aaba6..79807ff04 100644 --- a/bundles/org.simantics.export.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.export.ui/META-INF/MANIFEST.MF @@ -19,5 +19,5 @@ Require-Bundle: org.eclipse.ui, org.simantics.db.layer0;bundle-version="1.1.0", org.simantics.utils.ui;bundle-version="1.1.0", org.simantics.ui;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.simantics.export.ui diff --git a/bundles/org.simantics.fastlz/.classpath b/bundles/org.simantics.fastlz/.classpath index 21329daa4..83e26c9bf 100644 --- a/bundles/org.simantics.fastlz/.classpath +++ b/bundles/org.simantics.fastlz/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.fastlz/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.fastlz/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.fastlz/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.fastlz/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.fastlz/META-INF/MANIFEST.MF b/bundles/org.simantics.fastlz/META-INF/MANIFEST.MF index f05b9d965..6e85cea8d 100644 --- a/bundles/org.simantics.fastlz/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.fastlz/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Compression Codecs Bundle-SymbolicName: org.simantics.fastlz Bundle-Version: 1.2.1.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-Activator: org.simantics.fastlz.bundle.Activator Require-Bundle: org.eclipse.core.runtime, org.junit;bundle-version="4.12.0";resolution:=optional, diff --git a/bundles/org.simantics.fileimport.ui/.classpath b/bundles/org.simantics.fileimport.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.fileimport.ui/.classpath +++ b/bundles/org.simantics.fileimport.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.fileimport.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.fileimport.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.fileimport.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.fileimport.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.fileimport.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.fileimport.ui/META-INF/MANIFEST.MF index 3f0eb69b3..e41e8a962 100644 --- a/bundles/org.simantics.fileimport.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.fileimport.ui/META-INF/MANIFEST.MF @@ -12,7 +12,7 @@ Require-Bundle: org.eclipse.ui, org.simantics.fileimport;bundle-version="1.0.0", org.slf4j.api, org.simantics.db -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Import-Package: javax.inject;version="1.0.0" Bundle-ActivationPolicy: lazy Automatic-Module-Name: org.simantics.fileimport.ui diff --git a/bundles/org.simantics.fileimport/.classpath b/bundles/org.simantics.fileimport/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.fileimport/.classpath +++ b/bundles/org.simantics.fileimport/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.fileimport/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.fileimport/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.fileimport/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.fileimport/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.fileimport/META-INF/MANIFEST.MF b/bundles/org.simantics.fileimport/META-INF/MANIFEST.MF index 12f2e3db6..7adcb430e 100644 --- a/bundles/org.simantics.fileimport/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.fileimport/META-INF/MANIFEST.MF @@ -5,14 +5,13 @@ Bundle-SymbolicName: org.simantics.fileimport;singleton:=true Bundle-Version: 1.0.0.qualifier Bundle-Activator: org.simantics.fileimport.Activator Require-Bundle: org.eclipse.core.runtime, - org.apache.log4j, org.simantics.db, org.simantics, org.simantics.graphfile;bundle-version="0.1.0", org.simantics.graphfile.ontology;bundle-version="0.1.0", org.simantics.modeling;bundle-version="1.1.1", org.slf4j.api -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.fileimport Service-Component: OSGI-INF/FileReferenceFileImport.xml, diff --git a/bundles/org.simantics.filesystem.services/.classpath b/bundles/org.simantics.filesystem.services/.classpath index b862a296d..e801ebfb4 100644 --- a/bundles/org.simantics.filesystem.services/.classpath +++ b/bundles/org.simantics.filesystem.services/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/bundles/org.simantics.filesystem.services/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.filesystem.services/.settings/org.eclipse.jdt.core.prefs index 295926d96..7adc0fb9a 100644 --- a/bundles/org.simantics.filesystem.services/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.filesystem.services/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.filesystem.services/META-INF/MANIFEST.MF b/bundles/org.simantics.filesystem.services/META-INF/MANIFEST.MF index 53f44ce9c..d2c2f03b2 100644 --- a/bundles/org.simantics.filesystem.services/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.filesystem.services/META-INF/MANIFEST.MF @@ -8,7 +8,7 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.osgi.services, org.simantics.utils.datastructures, org.slf4j.api -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Bundle-Vendor: Semantum Oy Export-Package: org.simantics.filesystem.services.sizetracker diff --git a/bundles/org.simantics.g2d.ontology/.classpath b/bundles/org.simantics.g2d.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.g2d.ontology/.classpath +++ b/bundles/org.simantics.g2d.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.g2d.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.g2d.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.g2d.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.g2d.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.g2d.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.g2d.ontology/META-INF/MANIFEST.MF index c75b66080..8de2fc243 100644 --- a/bundles/org.simantics.g2d.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.g2d.ontology/META-INF/MANIFEST.MF @@ -5,6 +5,6 @@ Bundle-SymbolicName: org.simantics.g2d.ontology Bundle-Version: 1.1.0.qualifier Require-Bundle: org.simantics.layer0, org.simantics.selectionview.ontology;bundle-version="1.2.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.diagram.stubs Automatic-Module-Name: org.simantics.g2d.ontology diff --git a/bundles/org.simantics.g2d.ontology/graph/G2D.pgraph b/bundles/org.simantics.g2d.ontology/graph/G2D.pgraph index ce06a4109..269f6a4fb 100644 --- a/bundles/org.simantics.g2d.ontology/graph/G2D.pgraph +++ b/bundles/org.simantics.g2d.ontology/graph/G2D.pgraph @@ -94,6 +94,8 @@ G2D.StrokeType.Scaling : G2D.StrokeType G2D.StrokeType.Nonscaling : G2D.StrokeType G2D.HasRounding L0.Double +G2D.HasOffset L0.Double G2D.HasBranchPointRadius L0.Double G2D.LineEnd G2D.Color diff --git a/bundles/org.simantics.g2d/.classpath b/bundles/org.simantics.g2d/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.g2d/.classpath +++ b/bundles/org.simantics.g2d/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.g2d/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.g2d/.settings/org.eclipse.jdt.core.prefs index 3a2153707..7adc0fb9a 100644 --- a/bundles/org.simantics.g2d/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.g2d/.settings/org.eclipse.jdt.core.prefs @@ -1,11 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.g2d/META-INF/MANIFEST.MF b/bundles/org.simantics.g2d/META-INF/MANIFEST.MF index ee5b50be2..10037c36e 100644 --- a/bundles/org.simantics.g2d/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.g2d/META-INF/MANIFEST.MF @@ -11,7 +11,6 @@ Require-Bundle: org.eclipse.core.runtime, org.simantics.utils.thread, org.simantics.utils.thread.swt, org.simantics.utils.ui;bundle-version="1.0.0", - org.apache.commons.collections;bundle-version="3.2.1", org.apache.commons.math3, gnu.trove3;bundle-version="3.0.0", org.simantics.scenegraph;bundle-version="1.1.1";visibility:=reexport, @@ -22,8 +21,7 @@ Require-Bundle: org.eclipse.core.runtime, org.simantics.db;bundle-version="1.1.0", org.simantics.ui;bundle-version="1.0.0", org.slf4j.api, - org.eclipse.collections.eclipse-collections-api, - org.eclipse.collections.eclipse-collections + org.eclipse.collections Export-Package: org.simantics.g2d.canvas, org.simantics.g2d.canvas.impl, org.simantics.g2d.chassis, @@ -68,6 +66,6 @@ Export-Package: org.simantics.g2d.canvas, org.simantics.g2d.tooltip, org.simantics.g2d.utils, org.simantics.g2d.utils.geom -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ClassPath: . Automatic-Module-Name: org.simantics.g2d diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/participant/ElementPainter.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/participant/ElementPainter.java index 7896e52a7..9134c1729 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/participant/ElementPainter.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/participant/ElementPainter.java @@ -1033,6 +1033,17 @@ public class ElementPainter extends AbstractDiagramParticipant implements Compos return result; } + + /** + * We need to have separate class for SelectionNode, so that SCLSceneGraph can handle this properly. + * + */ + public static class SelectionShapeNode extends ShapeNode { + + private static final long serialVersionUID = -5393630944240940166L; + + } + public void paintSelectionFrame(int selectionId, G2DParentNode elementNode, G2DParentNode selectionNode, final IElement e, Color color) { // The element node already has the correct transform. AffineTransform selectionTransform = ElementUtils.getTransform(e);// no it doesnt ... new AffineTransform(); @@ -1054,7 +1065,7 @@ public class ElementPainter extends AbstractDiagramParticipant implements Compos Outline outline = (Outline) es.getAdapter(Outline.class); if (outline == null || outline.getElementShape(e) == null) continue; - ShapeNode shapenode = shapeholder.getOrCreateNode(getNodeId("outline", e, es), ShapeNode.class); + ShapeNode shapenode = shapeholder.getOrCreateNode(getNodeId("outline", e, es), SelectionShapeNode.class); // shapenode.setShape(es.getSelectionShape(e)); // shapenode.setStroke(SELECTION_STROKE); // shapenode.setScaleStroke(true); @@ -1090,7 +1101,7 @@ public class ElementPainter extends AbstractDiagramParticipant implements Compos G2DParentNode shapeholder = selectionNode.getOrCreateNode(getNodeId("outlines", e), G2DParentNode.class); for (SelectionOutline es : shapeHandlers) { - ShapeNode shapenode = shapeholder.getOrCreateNode(getNodeId("outline", e, es), ShapeNode.class); + ShapeNode shapenode = shapeholder.getOrCreateNode(getNodeId("outline", e, es), SelectionShapeNode.class); // shapenode.setShape(es.getSelectionShape(e)); // shapenode.setStroke(SELECTION_STROKE); // shapenode.setScaleStroke(true); diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/participant/ZOrderHandler.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/participant/ZOrderHandler.java index 007d039f2..8b893a2b1 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/participant/ZOrderHandler.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/participant/ZOrderHandler.java @@ -86,8 +86,8 @@ public class ZOrderHandler extends AbstractDiagramParticipant { int index = elements.indexOf(e); if (index != -1 && selectedElements.contains(e)) { changed |= diagram.moveTo(e, nextPos); - nextPos = index; } + nextPos = index; } if (changed) { notifyZOrderListeners(diagram); @@ -121,8 +121,8 @@ public class ZOrderHandler extends AbstractDiagramParticipant { int index = elements.indexOf(e); if (index != -1 && selectedElements.contains(e)) { changed |= diagram.moveTo(e, nextPos); - nextPos = index; } + nextPos = index; } if (changed) { notifyZOrderListeners(diagram); diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/ShapePick.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/ShapePick.java index a1d31acf0..3766a751b 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/ShapePick.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/ShapePick.java @@ -39,6 +39,8 @@ public class ShapePick implements Pick { pickRect = s.getBounds2D(); Shape es = ElementUtils.getElementShapeOrBounds(e); + // getElementShapeOrBounds returns shape or bounds in local coords! + es = ElementUtils.getTransform(e).createTransformedShape(es); PathIterator iter = es.getPathIterator(null); Collection segments = new ArrayList(); PathUtils.toLineSegments(iter, segments); @@ -55,7 +57,12 @@ public class ShapePick implements Pick { for (double[] seg : segments) { if (pickRect.intersectsLine(seg[0], seg[1], seg[2], seg[3])) return true; + if (pickRect.contains(seg[0], seg[1])) + return true; + if (pickRect.contains(seg[2], seg[3])) + return true; } + return false; } diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/gallery/GalleryViewer.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/gallery/GalleryViewer.java index 5bbe9f26e..d09ecf4a6 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/gallery/GalleryViewer.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/gallery/GalleryViewer.java @@ -631,8 +631,10 @@ public class GalleryViewer extends ContentViewer { ctx.getThreadAccess().asyncExec(() -> { //System.out.println(Thread.currentThread() + ": update scene graph(" + el + ")"); // Update scene graph and repaint. - el.getElementClass().getSingleItem(GalleryItemSGNode.class).update(el); - ctx.getContentContext().setDirty(); + if (!ctx.isDisposed()) { + el.getElementClass().getSingleItem(GalleryItemSGNode.class).update(el); + ctx.getContentContext().setDirty(); + } }); break; } diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/image/impl/ShapeImage.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/image/impl/ShapeImage.java index 77c65cb6e..90ceaa12a 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/image/impl/ShapeImage.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/image/impl/ShapeImage.java @@ -21,7 +21,7 @@ import java.util.EnumSet; import org.simantics.g2d.image.Image; import org.simantics.scenegraph.Node; import org.simantics.scenegraph.g2d.G2DParentNode; -import org.simantics.scenegraph.g2d.nodes.ShapeNode; +import org.simantics.scenegraph.g2d.nodes.ShapeNode2; /** * @author Tuukka Lehtonen @@ -31,7 +31,8 @@ public class ShapeImage extends AbstractImage implements Image { private static final EnumSet defaultFeats = VECTOR; Shape shape; - Paint paint; + Paint fillPaint; + Paint strokePaint; Stroke stroke; EnumSet feats; boolean scaleStroke = false; @@ -41,16 +42,20 @@ public class ShapeImage extends AbstractImage implements Image { } public ShapeImage(Shape shape, Paint fill, Stroke stroke, boolean scaleStroke) { - this(shape, fill, stroke, scaleStroke, defaultFeats); + this(shape, fill, stroke, fill, scaleStroke, defaultFeats); } public ShapeImage(Shape shape, Paint fill, Stroke stroke, EnumSet features) { - this(shape, fill, stroke, false, features); + this(shape, fill, stroke, fill, false, features); + } + public ShapeImage(Shape shape, Paint fill, Stroke stroke, Paint strokeColor, boolean scaleStroke) { + this(shape, fill, stroke, strokeColor, scaleStroke, defaultFeats); } - public ShapeImage(Shape shape, Paint fill, Stroke stroke, boolean scaleStroke, EnumSet features) { + public ShapeImage(Shape shape, Paint fill, Stroke stroke, Paint strokeColor, boolean scaleStroke, EnumSet features) { this.shape = shape; - this.paint = fill; + this.fillPaint = fill; + this.strokePaint = strokeColor; this.stroke = stroke; this.scaleStroke = scaleStroke; this.feats = features; @@ -73,11 +78,11 @@ public class ShapeImage extends AbstractImage implements Image { @Override public Node init(G2DParentNode parent) { - ShapeNode shapeNode = parent.getOrCreateNode("ShapeImage", ShapeNode.class); + ShapeNode2 shapeNode = parent.getOrCreateNode("ShapeImage", ShapeNode2.class); shapeNode.setShape(shape); shapeNode.setStroke(stroke); - shapeNode.setFill(paint != null); - shapeNode.setColor(paint != null ? paint : Color.BLACK); + shapeNode.setFillColor(fillPaint); + shapeNode.setStrokeColor(strokePaint != null ? strokePaint : Color.BLACK); shapeNode.setScaleStroke(scaleStroke); return shapeNode; } diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/participant/OrientationRestorer.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/participant/OrientationRestorer.java index f2a420b12..aafedcc09 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/participant/OrientationRestorer.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/participant/OrientationRestorer.java @@ -88,7 +88,7 @@ public class OrientationRestorer extends AbstractCanvasParticipant { // long delay = 1000 / 25; this sounds quite frequent long delay = 1000 / 10; lastTrigger = System.currentTimeMillis(); - timer.scheduleAtFixedRate(task, delay, delay, TimeUnit.MILLISECONDS); + timer.scheduleWithFixedDelay(task, delay, delay, TimeUnit.MILLISECONDS); } @HintListener(Class = Hints.class, Field = "KEY_CANVAS_BOUNDS") diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/participant/TimeParticipant.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/participant/TimeParticipant.java index 9103dfd63..7eb4f4c37 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/participant/TimeParticipant.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/participant/TimeParticipant.java @@ -207,7 +207,7 @@ public class TimeParticipant extends AbstractCanvasParticipant { return; long interval = getInterval(); - future = ThreadUtils.getNonBlockingWorkExecutor().scheduleAtFixedRate(onTimer, DEFAULT_INTERVAL, interval, TimeUnit.MILLISECONDS); + future = ThreadUtils.getNonBlockingWorkExecutor().scheduleWithFixedDelay(onTimer, DEFAULT_INTERVAL, interval, TimeUnit.MILLISECONDS); } private void cancelTimer() { diff --git a/bundles/org.simantics.gnuplot/.classpath b/bundles/org.simantics.gnuplot/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.gnuplot/.classpath +++ b/bundles/org.simantics.gnuplot/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.gnuplot/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.gnuplot/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.gnuplot/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.gnuplot/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.gnuplot/META-INF/MANIFEST.MF b/bundles/org.simantics.gnuplot/META-INF/MANIFEST.MF index 8230ed887..05c7ed1b6 100644 --- a/bundles/org.simantics.gnuplot/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.gnuplot/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Gnuplot front end Bundle-SymbolicName: org.simantics.gnuplot Bundle-Version: 0.0.1.qualifier Bundle-Vendor: Semantum Oy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.gnuplot Bundle-ClassPath: . Automatic-Module-Name: org.simantics.gnuplot diff --git a/bundles/org.simantics.gnuplot/pom.xml b/bundles/org.simantics.gnuplot/pom.xml index 2d270fb11..d1d621952 100644 --- a/bundles/org.simantics.gnuplot/pom.xml +++ b/bundles/org.simantics.gnuplot/pom.xml @@ -17,30 +17,32 @@ + 11 + 11 UTF-8 - 1.5.0 + 1.6.0 src + + org.codehaus.mojo + versions-maven-plugin + 2.7 + + false + + org.eclipse.tycho tycho-maven-plugin ${tycho-version} true - - maven-compiler-plugin - 3.3 - - 1.8 - 1.8 - - maven-assembly-plugin - 2.6 + 3.2.0 jar-with-dependencies diff --git a/bundles/org.simantics.graph.compiler/.classpath b/bundles/org.simantics.graph.compiler/.classpath index 8a3b30d04..6248f62f7 100644 --- a/bundles/org.simantics.graph.compiler/.classpath +++ b/bundles/org.simantics.graph.compiler/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.graph.compiler/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.graph.compiler/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.graph.compiler/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.graph.compiler/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.graph.compiler/META-INF/MANIFEST.MF b/bundles/org.simantics.graph.compiler/META-INF/MANIFEST.MF index 8b22e78eb..a90285e21 100644 --- a/bundles/org.simantics.graph.compiler/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.graph.compiler/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Compiler Bundle-SymbolicName: org.simantics.graph.compiler;singleton:=true Bundle-Version: 1.1.18.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.graph;bundle-version="1.1.15";visibility:=reexport, org.simantics.databoard;bundle-version="0.6.6", freemarker;bundle-version="2.3.23", diff --git a/bundles/org.simantics.graph.db/.classpath b/bundles/org.simantics.graph.db/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.graph.db/.classpath +++ b/bundles/org.simantics.graph.db/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.graph.db/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.graph.db/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.graph.db/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.graph.db/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.graph.db/META-INF/MANIFEST.MF b/bundles/org.simantics.graph.db/META-INF/MANIFEST.MF index 2bd96db62..14e0b79ab 100644 --- a/bundles/org.simantics.graph.db/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.graph.db/META-INF/MANIFEST.MF @@ -3,12 +3,12 @@ Bundle-ManifestVersion: 2 Bundle-Name: Transferable Graph Database Binding Bundle-SymbolicName: org.simantics.graph.db Bundle-Version: 1.1.9.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.graph;bundle-version="1.0.0";visibility:=reexport, org.simantics.db.common;bundle-version="0.8.0", gnu.trove3;bundle-version="3.0.3", org.simantics.layer0;bundle-version="1.0.0", - org.slf4j.api;bundle-version="1.7.2" + org.slf4j.api Export-Package: org.simantics.graph.db Bundle-Vendor: VTT Technical Research Centre of Finland Automatic-Module-Name: org.simantics.graph.db diff --git a/bundles/org.simantics.graph/.classpath b/bundles/org.simantics.graph/.classpath index 8a3b30d04..6248f62f7 100644 --- a/bundles/org.simantics.graph/.classpath +++ b/bundles/org.simantics.graph/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.graph/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.graph/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.graph/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.graph/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.graph/META-INF/MANIFEST.MF b/bundles/org.simantics.graph/META-INF/MANIFEST.MF index e59984562..4a2045bbf 100644 --- a/bundles/org.simantics.graph/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.graph/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Transferable Graph Runtime Bundle-SymbolicName: org.simantics.graph Bundle-Version: 1.1.15.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.databoard;bundle-version="0.6.6", gnu.trove3;bundle-version="3.0.0";visibility:=reexport, org.junit;bundle-version="4.12.0";resolution:=optional diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/FixExportedOntology.java b/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/FixExportedOntology.java index 17aa3ed26..33291cdf1 100644 --- a/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/FixExportedOntology.java +++ b/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/FixExportedOntology.java @@ -41,8 +41,9 @@ public class FixExportedOntology { private static Path replaceExtension(Path p, String newExtension) { String newName = p.getFileName().toString(); - if (newName.contains(".")) - newName = newName.split("\\.")[0]; + int lastDot = newName.lastIndexOf('.'); + if (lastDot > -1) + newName = newName.substring(0, lastDot); return p.resolveSibling(newName + newExtension); } diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/representation/TransferableGraphUtils.java b/bundles/org.simantics.graph/src/org/simantics/graph/representation/TransferableGraphUtils.java index f2321dce9..9873f8f1e 100644 --- a/bundles/org.simantics.graph/src/org/simantics/graph/representation/TransferableGraphUtils.java +++ b/bundles/org.simantics.graph/src/org/simantics/graph/representation/TransferableGraphUtils.java @@ -156,25 +156,27 @@ public class TransferableGraphUtils { } Identity consistsOf = findExternal(tg, "http://www.simantics.org/Layer0-1.1/ConsistsOf"); Identity hasName = findExternal(tg, "http://www.simantics.org/Layer0-1.1/HasName"); - for (int i = 0; i < tg.statements.length; i += 4) { - if (tg.statements[i] == parentResource) { - if (tg.statements[i + 1] == consistsOf.resource) { - Identity identity = getIdentity(tg, tg.statements[i + 3]); - if (identity != null) { - if (identity.definition instanceof Internal) { - Internal internal = (Internal) identity.definition; - result.put(internal.name, identity); - } - } else { - int possibleNameResource = getPossibleObject2(tg, tg.statements[i + 3], hasName); - if (possibleNameResource != NOT_FOUND) { - Value value = findValue(tg, possibleNameResource); - if (value != null) { - try { - String name = (String) value.value.getValue(Bindings.STRING); - result.put(name, new Identity(tg.statements[i + 3], new Internal(tg.statements[i], name))); - } catch (AdaptException e) { - e.printStackTrace(); + if(consistsOf != null && hasName != null) { + for (int i = 0; i < tg.statements.length; i += 4) { + if (tg.statements[i] == parentResource) { + if (tg.statements[i + 1] == consistsOf.resource) { + Identity identity = getIdentity(tg, tg.statements[i + 3]); + if (identity != null) { + if (identity.definition instanceof Internal) { + Internal internal = (Internal) identity.definition; + result.put(internal.name, identity); + } + } else { + int possibleNameResource = getPossibleObject2(tg, tg.statements[i + 3], hasName); + if (possibleNameResource != NOT_FOUND) { + Value value = findValue(tg, possibleNameResource); + if (value != null) { + try { + String name = (String) value.value.getValue(Bindings.STRING); + result.put(name, new Identity(tg.statements[i + 3], new Internal(tg.statements[i], name))); + } catch (AdaptException e) { + e.printStackTrace(); + } } } } diff --git a/bundles/org.simantics.graphfile.ontology/.classpath b/bundles/org.simantics.graphfile.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.graphfile.ontology/.classpath +++ b/bundles/org.simantics.graphfile.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.graphfile.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.graphfile.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.graphfile.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.graphfile.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.graphfile.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.graphfile.ontology/META-INF/MANIFEST.MF index 3b0863d03..2566020c9 100644 --- a/bundles/org.simantics.graphfile.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.graphfile.ontology/META-INF/MANIFEST.MF @@ -5,6 +5,6 @@ Bundle-SymbolicName: org.simantics.graphfile.ontology Bundle-Version: 0.1.0.qualifier Bundle-Vendor: VTT Technical Research Centre of Finland Require-Bundle: org.simantics.layer0;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.graphfile.ontology Automatic-Module-Name: org.simantics.graphfile.ontology diff --git a/bundles/org.simantics.graphfile.ui.ontology/.classpath b/bundles/org.simantics.graphfile.ui.ontology/.classpath new file mode 100644 index 000000000..e801ebfb4 --- /dev/null +++ b/bundles/org.simantics.graphfile.ui.ontology/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/bundles/org.simantics.graphfile.ui.ontology/.project b/bundles/org.simantics.graphfile.ui.ontology/.project new file mode 100644 index 000000000..740f3f884 --- /dev/null +++ b/bundles/org.simantics.graphfile.ui.ontology/.project @@ -0,0 +1,34 @@ + + + org.simantics.graphfile.ui.ontology + + + + + + org.simantics.graph.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + org.simantics.graph.nature + + diff --git a/bundles/org.simantics.graphfile.ui.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.graphfile.ui.ontology/META-INF/MANIFEST.MF new file mode 100644 index 000000000..aceca4b3e --- /dev/null +++ b/bundles/org.simantics.graphfile.ui.ontology/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: http://www.simantics.org/GraphFileUI +Bundle-SymbolicName: org.simantics.graphfile.ui.ontology +Bundle-Version: 1.0.0.qualifier +Automatic-Module-Name: org.simantics.graphfile.ui.ontology +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Require-Bundle: org.simantics.modeling.ontology;bundle-version="1.2.0", + org.simantics.silk.ontology;bundle-version="1.1.0", + org.simantics.layer0;bundle-version="1.1.0", + org.simantics.viewpoint.ontology;bundle-version="1.2.0", + org.simantics.action.ontology;bundle-version="1.1.0", + org.simantics.graphfile.ontology;bundle-version="0.1.0" diff --git a/bundles/org.simantics.graphfile.ui.ontology/build.properties b/bundles/org.simantics.graphfile.ui.ontology/build.properties new file mode 100644 index 000000000..e85b630a0 --- /dev/null +++ b/bundles/org.simantics.graphfile.ui.ontology/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + graph.tg diff --git a/bundles/org.simantics.graphfile.ui.ontology/graph/GraphFileUI.pgraph b/bundles/org.simantics.graphfile.ui.ontology/graph/GraphFileUI.pgraph new file mode 100644 index 000000000..196296ec4 --- /dev/null +++ b/bundles/org.simantics.graphfile.ui.ontology/graph/GraphFileUI.pgraph @@ -0,0 +1,48 @@ +L0 = +MOD = +SILK = +VP = +ACT = +GF = + +GFUI = : L0.Ontology + @L0.new + L0.HasResourceClass "org.simantics.graphfile.ui.ontology.GraphFileUIResource" : L0.String + +GFUI.BrowseContext : VP.BrowseContext + +ACTIONS = GFUI.BrowseContext.Actions : L0.Library + +ACTIONS.ImportFileDocument : ACT.Action +ACTIONS.ImportDocumentFolder : ACT.Action +ACTIONS.NewFileDocument : ACT.Action +ACTIONS.NewDocumentFolder : ACT.Action +ACTIONS.ExportFileDocument : ACT.Action +ACTIONS.ExportDocumentFolder : ACT.Action + +GFUI.ModelingBrowseContext : VP.BrowseContext + VP.BrowseContext.IsIncludedIn MOD.ModelingBrowseContext + @VP.relationChildRule L0.Library L0.ConsistsOf GF.Folder + @VP.relationChildRule L0.Library L0.ConsistsOf GF.File + @VP.relationChildRule GF.Folder L0.ConsistsOf GF.File + @VP.relationChildRule GF.Folder L0.ConsistsOf GF.Folder + + @VP.constantImageRule GF.Folder SILK.folder_page + @VP.constantImageRule GF.File SILK.page_white + @VP.customLabelRule GF.File VP.ResourceNameLabelRule + +GFUI.ModelingActionContext : VP.BrowseContext + VP.BrowseContext.IsIncludedIn MOD.ModelingActionContext + @VP.actionContribution "Folder" L0.Library SILK.folder_page VP.NewActionCategory ACTIONS.NewDocumentFolder + @VP.actionContribution "Folder" GF.Folder SILK.folder_page VP.NewActionCategory ACTIONS.NewDocumentFolder + @VP.actionContribution "File" L0.Library SILK.page_white VP.NewActionCategory ACTIONS.NewFileDocument + @VP.actionContribution "File" GF.Folder SILK.page_white VP.NewActionCategory ACTIONS.NewFileDocument + + @VP.actionContribution "Files" L0.Library SILK.page_white VP.ImportActionCategory ACTIONS.ImportFileDocument + @VP.actionContribution "Files" GF.Folder SILK.page_white VP.ImportActionCategory ACTIONS.ImportFileDocument + + @VP.actionContribution "Folder" L0.Library SILK.folder_page VP.ImportActionCategory ACTIONS.ImportDocumentFolder + @VP.actionContribution "Folder" GF.Folder SILK.folder_page VP.ImportActionCategory ACTIONS.ImportDocumentFolder + + @VP.actionContribution "File" GF.File SILK.page_white VP.ExportActionCategory ACTIONS.ExportFileDocument + @VP.actionContribution "Folder" GF.Folder SILK.folder_page VP.ExportActionCategory ACTIONS.ExportDocumentFolder \ No newline at end of file diff --git a/bundles/org.simantics.graphfile.ui/.classpath b/bundles/org.simantics.graphfile.ui/.classpath new file mode 100644 index 000000000..e801ebfb4 --- /dev/null +++ b/bundles/org.simantics.graphfile.ui/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/bundles/org.simantics.graphfile.ui/.project b/bundles/org.simantics.graphfile.ui/.project new file mode 100644 index 000000000..7533101c2 --- /dev/null +++ b/bundles/org.simantics.graphfile.ui/.project @@ -0,0 +1,28 @@ + + + org.simantics.graphfile.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/bundles/org.simantics.graphfile.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.graphfile.ui/META-INF/MANIFEST.MF new file mode 100644 index 000000000..947f314d9 --- /dev/null +++ b/bundles/org.simantics.graphfile.ui/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: GraphfileUI +Bundle-SymbolicName: org.simantics.graphfile.ui;singleton:=true +Bundle-Version: 1.0.0.qualifier +Automatic-Module-Name: org.simantics.graphfile.ui +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Require-Bundle: org.eclipse.ui.editors, + org.simantics.ui, + org.eclipse.jface.text;bundle-version="3.12.0", + org.simantics.graphfile.ontology, + org.slf4j.api;bundle-version="1.7.25", + org.simantics.document.ui;bundle-version="1.0.0" diff --git a/bundles/org.simantics.graphfile.ui/adapters.xml b/bundles/org.simantics.graphfile.ui/adapters.xml new file mode 100644 index 000000000..6eceb37e4 --- /dev/null +++ b/bundles/org.simantics.graphfile.ui/adapters.xml @@ -0,0 +1,50 @@ + + + + + + + + http://www.simantics.org/Layer0-0.0/ConsistsOf + + + + http://www.simantics.org/GraphFile-0.0/Folder + http://www.simantics.org/Layer0-0.0/ConsistsOf + + + + http://www.simantics.org/Layer0-0.0/ConsistsOf + File + + + + http://www.simantics.org/GraphFile-0.0/Folder + http://www.simantics.org/Layer0-0.0/ConsistsOf + + + + + http://www.simantics.org/Layer0-0.0/ConsistsOf + false + + + + \ No newline at end of file diff --git a/bundles/org.simantics.graphfile.ui/build.properties b/bundles/org.simantics.graphfile.ui/build.properties new file mode 100644 index 000000000..2df8c94f4 --- /dev/null +++ b/bundles/org.simantics.graphfile.ui/build.properties @@ -0,0 +1,6 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + adapters.xml diff --git a/bundles/org.simantics.graphfile.ui/plugin.xml b/bundles/org.simantics.graphfile.ui/plugin.xml new file mode 100644 index 000000000..925a7f3f8 --- /dev/null +++ b/bundles/org.simantics.graphfile.ui/plugin.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + diff --git a/bundles/org.simantics.graphfile.ui/src/org/simantics/graphfile/ui/editor/PlainTextEditor.java b/bundles/org.simantics.graphfile.ui/src/org/simantics/graphfile/ui/editor/PlainTextEditor.java new file mode 100644 index 000000000..d30210f30 --- /dev/null +++ b/bundles/org.simantics.graphfile.ui/src/org/simantics/graphfile/ui/editor/PlainTextEditor.java @@ -0,0 +1,92 @@ +package org.simantics.graphfile.ui.editor; + +import java.util.function.Supplier; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.editors.text.TextEditor; +import org.simantics.Simantics; +import org.simantics.db.Session; +import org.simantics.db.common.request.ParametrizedRead; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.request.combinations.Combinators; +import org.simantics.ui.workbench.IResourceEditorInput; +import org.simantics.ui.workbench.ResourceEditorSupport; +import org.simantics.ui.workbench.TitleRequest; +import org.simantics.ui.workbench.TitleUpdater; +import org.simantics.ui.workbench.ToolTipRequest; +import org.simantics.ui.workbench.editor.input.InputValidationCombinators; + +/** + * @author Antti Villberg + */ +public class PlainTextEditor extends TextEditor { + + boolean isDisposed = false; + + ParametrizedRead INPUT_VALIDATOR = + Combinators.compose( + InputValidationCombinators.hasURI(), + InputValidationCombinators.extractInputResource() + ); + + ResourceEditorSupport support; + + public PlainTextEditor() { + super(); + setDocumentProvider(new PlainTextEditorDocumentProvider()); + //setSourceViewerConfiguration(new QueueTextEditorViewerConfiguration(new QueueTextEditorColorManager())); + } + + @Override + public void init(IEditorSite site, IEditorInput input) throws PartInitException { + super.init(site, input); + + support = new ResourceEditorSupport(this, INPUT_VALIDATOR); + support.activateValidation(); + try { + getResourceEditorInput().init(null); + } catch (DatabaseException e) { + throw new PartInitException("Failed to initialize " + input, e); + } + } + + protected IResourceEditorInput getResourceEditorInput() { + return (IResourceEditorInput) getEditorInput(); + } + + @Override + public void createPartControl(Composite parent) { + super.createPartControl(parent); + updatePartName(); + } + + private void updatePartName() { + setPartName(getEditorInput().getName()); + + Session session = Simantics.peekSession(); + if (session != null) { + Supplier disposedCallback = () -> isDisposed; + session.asyncRequest( + new TitleRequest(null, getResourceEditorInput()), + new TitleUpdater(getSite().getShell().getDisplay(), this::setPartName, disposedCallback)); + session.asyncRequest( + new ToolTipRequest(getSite().getId(), getResourceEditorInput()), + new TitleUpdater(getSite().getShell().getDisplay(), this::setTitleToolTip, disposedCallback)); + } + + } + + @Override + public void dispose() { + isDisposed = true; + if (support != null) { + support.dispose(); + support = null; + } + super.dispose(); + } + +} diff --git a/bundles/org.simantics.graphfile.ui/src/org/simantics/graphfile/ui/editor/PlainTextEditorDocumentProvider.java b/bundles/org.simantics.graphfile.ui/src/org/simantics/graphfile/ui/editor/PlainTextEditorDocumentProvider.java new file mode 100644 index 000000000..3eb40ead5 --- /dev/null +++ b/bundles/org.simantics.graphfile.ui/src/org/simantics/graphfile/ui/editor/PlainTextEditorDocumentProvider.java @@ -0,0 +1,108 @@ +package org.simantics.graphfile.ui.editor; + +import java.io.StringWriter; +import java.nio.charset.StandardCharsets; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.operation.IRunnableContext; +import org.eclipse.jface.text.Document; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.source.AnnotationModel; +import org.eclipse.jface.text.source.IAnnotationModel; +import org.eclipse.ui.texteditor.AbstractDocumentProvider; +import org.simantics.Simantics; +import org.simantics.databoard.Bindings; +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.WriteGraph; +import org.simantics.db.common.request.UniqueRead; +import org.simantics.db.common.request.WriteRequest; +import org.simantics.db.common.utils.NameUtils; +import org.simantics.db.exception.DatabaseException; +import org.simantics.document.DocumentResource; +import org.simantics.graphfile.ontology.GraphFileResource; +import org.simantics.ui.workbench.ResourceEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PlainTextEditorDocumentProvider extends AbstractDocumentProvider { + + private static final Logger LOGGER = LoggerFactory.getLogger(PlainTextEditor.class); + + protected String currentText; + + @Override + protected IDocument createDocument(Object element) throws CoreException { + ResourceEditorInput input = (ResourceEditorInput)element; + final Resource resource = input.getResource(); + try { + return Simantics.getSession().syncRequest(new UniqueRead() { + @Override + public Document perform(ReadGraph graph) throws DatabaseException { + + GraphFileResource GF = GraphFileResource.getInstance(graph); + DocumentResource DOC = DocumentResource.getInstance(graph); + if (!graph.isInstanceOf(resource, DOC.FileDocument)) + throw new DatabaseException("Invalid input resource for PlainTextEditor: " + NameUtils.getSafeName(graph, resource)); + + byte[] bytes = graph.getPossibleRelatedValue(resource, GF.HasFiledata, Bindings.BYTE_ARRAY); + + currentText = bytes != null ? new String(bytes, StandardCharsets.UTF_8) : ""; + + return new Document(currentText); + + } + }); + } catch (DatabaseException e) { + StringWriter sw = new StringWriter(); + LOGGER.error("Failed to create document", e); + return new Document(sw.toString()); + } + } + + @Override + protected IAnnotationModel createAnnotationModel(Object element) + throws CoreException { + return new AnnotationModel(); + } + + @Override + protected void doSaveDocument(IProgressMonitor monitor, Object element, + IDocument document, boolean overwrite) throws CoreException { + ResourceEditorInput input = (ResourceEditorInput)element; + final Resource resource = input.getResource(); + final String text = document.get(); + currentText = text; + Simantics.getSession().asyncRequest(new WriteRequest() { + @Override + public void perform(WriteGraph graph) throws DatabaseException { + graph.markUndoPoint(); + GraphFileResource GF = GraphFileResource.getInstance(graph); + graph.claimLiteral(resource, GF.HasFiledata, text.getBytes(StandardCharsets.UTF_8)); + graph.claimLiteral(resource, GF.LastModified, System.currentTimeMillis()); + } + }); + } + + @Override + protected IRunnableContext getOperationRunner(IProgressMonitor monitor) { + return null; + } + + @Override + public boolean isModifiable(Object element) { + return true; + } + + @Override + public boolean isReadOnly(Object element) { + return false; + } + + @Override + public boolean canSaveDocument(Object element) { + return !getDocument(element).get().equals(currentText); + } + +} diff --git a/bundles/org.simantics.graphfile/.classpath b/bundles/org.simantics.graphfile/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.graphfile/.classpath +++ b/bundles/org.simantics.graphfile/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.graphfile/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.graphfile/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.graphfile/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.graphfile/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.graphfile/META-INF/MANIFEST.MF b/bundles/org.simantics.graphfile/META-INF/MANIFEST.MF index 2763bd78f..82bbe06e7 100644 --- a/bundles/org.simantics.graphfile/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.graphfile/META-INF/MANIFEST.MF @@ -13,7 +13,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0", org.eclipse.ui.ide;bundle-version="3.7.0", org.eclipse.jface;bundle-version="3.7.0", org.simantics.utils.ui;bundle-version="1.1.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.graphfile.adapters, org.simantics.graphfile.hack, diff --git a/bundles/org.simantics.graphviz.ui/.classpath b/bundles/org.simantics.graphviz.ui/.classpath index f6b3a270b..e6f2f43f3 100644 --- a/bundles/org.simantics.graphviz.ui/.classpath +++ b/bundles/org.simantics.graphviz.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.graphviz.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.graphviz.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.graphviz.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.graphviz.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.graphviz.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.graphviz.ui/META-INF/MANIFEST.MF index 2f469dc58..d435ec152 100644 --- a/bundles/org.simantics.graphviz.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.graphviz.ui/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Graphviz UI Bundle-SymbolicName: org.simantics.graphviz.ui Bundle-Version: 1.1.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.ui;bundle-version="3.5.0", org.simantics.graphviz;bundle-version="1.0.0", org.eclipse.core.runtime;bundle-version="3.5.0", diff --git a/bundles/org.simantics.graphviz/.classpath b/bundles/org.simantics.graphviz/.classpath index f6b3a270b..e6f2f43f3 100644 --- a/bundles/org.simantics.graphviz/.classpath +++ b/bundles/org.simantics.graphviz/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.graphviz/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.graphviz/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.graphviz/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.graphviz/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.graphviz/META-INF/MANIFEST.MF b/bundles/org.simantics.graphviz/META-INF/MANIFEST.MF index ea99ad54b..57de81b98 100644 --- a/bundles/org.simantics.graphviz/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.graphviz/META-INF/MANIFEST.MF @@ -5,9 +5,9 @@ Bundle-SymbolicName: org.simantics.graphviz Bundle-Version: 1.1.0.qualifier Bundle-Activator: org.simantics.graphviz.Activator Require-Bundle: org.eclipse.core.runtime, - org.slf4j.api;bundle-version="1.7.25" + org.slf4j.api Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.graphviz, org.simantics.graphviz.continuation, org.simantics.graphviz.drawable, diff --git a/bundles/org.simantics.help.base/.classpath b/bundles/org.simantics.help.base/.classpath index 098194ca4..e801ebfb4 100644 --- a/bundles/org.simantics.help.base/.classpath +++ b/bundles/org.simantics.help.base/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.help.base/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.help.base/.settings/org.eclipse.jdt.core.prefs index f42de363a..7adc0fb9a 100644 --- a/bundles/org.simantics.help.base/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.help.base/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.help.base/META-INF/MANIFEST.MF b/bundles/org.simantics.help.base/META-INF/MANIFEST.MF index a262f46d0..ac460b044 100644 --- a/bundles/org.simantics.help.base/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.help.base/META-INF/MANIFEST.MF @@ -8,9 +8,9 @@ Bundle-Vendor: Semantum Oy Require-Bundle: org.eclipse.core.runtime, org.eclipse.help.base, org.apache.commons.logging;bundle-version="1.0.4", - org.apache.pdfbox;bundle-version="2.0.2", - org.apache.pdfbox.fontbox;bundle-version="2.0.2" -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 + org.apache.pdfbox;bundle-version="[2.0.2,2.1.0)", + org.apache.pdfbox.fontbox;bundle-version="[2.0.2,2.1.0)" +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Bundle-ClassPath: . Automatic-Module-Name: org.simantics.help.base diff --git a/bundles/org.simantics.help.core/.classpath b/bundles/org.simantics.help.core/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.help.core/.classpath +++ b/bundles/org.simantics.help.core/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.help.core/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.help.core/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.help.core/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.help.core/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.help.core/META-INF/MANIFEST.MF b/bundles/org.simantics.help.core/META-INF/MANIFEST.MF index d8094af2e..6f1793200 100644 --- a/bundles/org.simantics.help.core/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.help.core/META-INF/MANIFEST.MF @@ -17,7 +17,7 @@ Require-Bundle: org.eclipse.ui, org.simantics.document.base.ontology, org.eclipse.mylyn.wikitext;bundle-version="3.0.6", org.eclipse.mylyn.wikitext.mediawiki;bundle-version="3.0.6" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.help.core Bundle-Vendor: Semantum Oy diff --git a/bundles/org.simantics.help.ontology/.classpath b/bundles/org.simantics.help.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.help.ontology/.classpath +++ b/bundles/org.simantics.help.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.help.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.help.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.help.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.help.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.help.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.help.ontology/META-INF/MANIFEST.MF index 80d3c7680..72fd2f572 100644 --- a/bundles/org.simantics.help.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.help.ontology/META-INF/MANIFEST.MF @@ -7,7 +7,7 @@ Require-Bundle: org.simantics.layer0, org.simantics.viewpoint.ontology;bundle-version="1.2.0", org.simantics.modeling.ontology;bundle-version="1.2.0", org.simantics.silk.ontology;bundle-version="1.1.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.help Bundle-Vendor: Semantum Oy Automatic-Module-Name: org.simantics.help.ontology diff --git a/bundles/org.simantics.help.ui/.classpath b/bundles/org.simantics.help.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.help.ui/.classpath +++ b/bundles/org.simantics.help.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.help.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.help.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.help.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.help.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.help.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.help.ui/META-INF/MANIFEST.MF index d7bd01e12..a6a0ed24f 100644 --- a/bundles/org.simantics.help.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.help.ui/META-INF/MANIFEST.MF @@ -14,7 +14,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.core.resources;bundle-version="3.10.1", org.simantics.help.core, org.slf4j.api -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Bundle-ClassPath: . Bundle-Vendor: Semantum Oy diff --git a/bundles/org.simantics.history.rest/.classpath b/bundles/org.simantics.history.rest/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.history.rest/.classpath +++ b/bundles/org.simantics.history.rest/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.history.rest/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.history.rest/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.history.rest/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.history.rest/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.history.rest/META-INF/MANIFEST.MF b/bundles/org.simantics.history.rest/META-INF/MANIFEST.MF index 030278955..e5857318e 100644 --- a/bundles/org.simantics.history.rest/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.history.rest/META-INF/MANIFEST.MF @@ -5,20 +5,20 @@ Bundle-SymbolicName: org.simantics.history.rest Bundle-Version: 1.0.0.qualifier Bundle-Vendor: Semantum Oy Automatic-Module-Name: org.simantics.history.rest -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.history;bundle-version="1.0.0", org.eclipse.core.runtime;bundle-version="3.13.0", org.glassfish.jersey.core.jersey-server, - javax.ws.rs-api, + jakarta.ws.rs-api, org.simantics.scl.compiler, org.simantics.scl.osgi, org.eclipse.jetty.servlet, org.glassfish.jersey.containers.jersey-container-servlet-core, javax.servlet-api, - org.eclipse.jetty.server, - org.eclipse.jetty.util, - org.eclipse.jetty.io, - org.eclipse.jetty.servlets, + org.eclipse.jetty.server;bundle-version="9.4.24", + org.eclipse.jetty.util;bundle-version="9.4.24", + org.eclipse.jetty.io;bundle-version="9.4.24", + org.eclipse.jetty.servlets;bundle-version="9.4.24", com.fasterxml.jackson.core.jackson-core;bundle-version="2.8.8", com.fasterxml.jackson.core.jackson-annotations;bundle-version="2.8.0", com.fasterxml.jackson.core.jackson-databind;bundle-version="2.8.8", @@ -32,7 +32,6 @@ Require-Bundle: org.simantics.history;bundle-version="1.0.0", org.simantics.db;bundle-version="1.1.0", org.simantics.db.common;bundle-version="1.1.0", org.simantics.db.layer0;bundle-version="1.1.0", - org.simantics;bundle-version="1.0.0", - org.eclipse.jetty.servlets + org.simantics;bundle-version="1.0.0" Bundle-ClassPath: . Export-Package: org.simantics.history.rest diff --git a/bundles/org.simantics.history/.classpath b/bundles/org.simantics.history/.classpath index 0a61ffeb4..d2debb82b 100644 --- a/bundles/org.simantics.history/.classpath +++ b/bundles/org.simantics.history/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.history/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.history/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.history/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.history/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.history/META-INF/MANIFEST.MF b/bundles/org.simantics.history/META-INF/MANIFEST.MF index fa32108ed..00ef5321c 100644 --- a/bundles/org.simantics.history/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.history/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: History Bundle-SymbolicName: org.simantics.history;singleton:=true Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.databoard;bundle-version="0.6.2", org.junit;bundle-version="4.8.1";resolution:=optional, org.simantics.utils;bundle-version="1.1.0";resolution:=optional, diff --git a/bundles/org.simantics.history/src/org/simantics/history/csv/CSVFormatter.java b/bundles/org.simantics.history/src/org/simantics/history/csv/CSVFormatter.java index 4e405e2ac..b04e0dd37 100644 --- a/bundles/org.simantics.history/src/org/simantics/history/csv/CSVFormatter.java +++ b/bundles/org.simantics.history/src/org/simantics/history/csv/CSVFormatter.java @@ -38,6 +38,23 @@ import org.simantics.history.util.ValueBand; */ public class CSVFormatter { + /** + * This is the tolerance used to decide whether or not the last data point of + * the exported items is included in the exported material or not. If + * 0 <= (t - t(lastDataPoint) < {@value #RESAMPLING_END_TIMESTAMP_INCLUSION_TOLERANCE} + * is true, then the last exported data point will be + * lastDataPoint, with timestamp t(lastDataPoint) even + * if t > t(lastDataPoint). + * + *

+ * This works around problems where floating point inaccuracy causes a data + * point to be left out from the the export when it would be fair for the user + * to expect the data to be exported would contain a point with time stamp + * 9.999999999999996 when sampling with time-step 1.0 + * starting from time 0.0. + */ + private static final double RESAMPLING_END_TIMESTAMP_INCLUSION_TOLERANCE = 1e-13; + List items = new ArrayList(); double from = -Double.MAX_VALUE; double end = Double.MAX_VALUE; @@ -308,7 +325,7 @@ public class CSVFormatter { // Sampling based on given startTime and timeStep if(timeStep > 0) { - // Find the first sample time that contains data + // Find the first sample time that contains data if startTime < _from double n = Math.max(0, Math.ceil((_from-startTime) / timeStep)); time = startTime + n*timeStep; @@ -329,6 +346,13 @@ public class CSVFormatter { BigDecimal bigTime = new BigDecimal(String.valueOf(time)); BigDecimal bigTimeStep = new BigDecimal(String.valueOf(timeStep)); + // Loop kill-switch for the case where timeStep > 0 + boolean breakAfterNextWrite = false; + +// System.out.println("time: " + time); +// System.out.println("timeStep: " + timeStep); +// System.out.println("_end: " + Double.toString(_end)); + for (Item i : items) i.iter.gotoTime(time); do { if ( monitor!=null && monitor.isCanceled() ) return; @@ -394,10 +418,26 @@ public class CSVFormatter { sb.append( lineFeed ); - // Read next values, and the following times - if ( timeStep>0.0 ) { - bigTime = bigTime.add(bigTimeStep); - time = bigTime.doubleValue(); + if (breakAfterNextWrite) + break; + + // Read next values, and the following times + if ( timeStep>0.0 ) { + bigTime = bigTime.add(bigTimeStep); + time = bigTime.doubleValue(); + + // gitlab #529: prevent last data point from getting dropped + // due to small imprecisions in re-sampling mode. + double diff = time - _end; + if (diff > 0 && diff <= RESAMPLING_END_TIMESTAMP_INCLUSION_TOLERANCE) { + time = _end; + breakAfterNextWrite = true; + // Take floating point inaccuracy into account when re-sampling + // to prevent the last data point from being left out if there + // is small-enough imprecision in the last data point time stamp + // to be considered negligible compared to expected stepped time. + } + } else { // Get smallest end time that is larger than current time Double nextTime = null; @@ -420,6 +460,7 @@ public class CSVFormatter { if(contains(i, time)) hasMore = true; } + //System.out.println("hasMore @ " + time + " (" + bigTime + ") = " + hasMore); if(!hasMore) break; } while (time<=_end); @@ -587,7 +628,7 @@ public class CSVFormatter { private Formatter evaluateFormatter(Format format, DecimalSeparator target) { // Probe decimal separator String onePointTwo = format.format(1.2); - System.out.println("formatted zeroPointOne: " + onePointTwo); + //System.out.println("formatted zeroPointOne: " + onePointTwo); DecimalSeparator formatSeparator; if (onePointTwo.indexOf('.') != -1) { diff --git a/bundles/org.simantics.image.ontology/.classpath b/bundles/org.simantics.image.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.image.ontology/.classpath +++ b/bundles/org.simantics.image.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.image.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.image.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.image.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.image.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.image.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.image.ontology/META-INF/MANIFEST.MF index 23a7f149a..fb8a85de1 100644 --- a/bundles/org.simantics.image.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.image.ontology/META-INF/MANIFEST.MF @@ -4,6 +4,6 @@ Bundle-Name: http://www.simantics.org/Image Bundle-SymbolicName: org.simantics.image.ontology Bundle-Version: 1.1.0.qualifier Require-Bundle: org.simantics.layer0 -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.diagram.stubs Automatic-Module-Name: org.simantics.image.ontology diff --git a/bundles/org.simantics.image.ui/.classpath b/bundles/org.simantics.image.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.image.ui/.classpath +++ b/bundles/org.simantics.image.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.image.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.image.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.image.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.image.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.image.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.image.ui/META-INF/MANIFEST.MF index ab68e3097..447960251 100644 --- a/bundles/org.simantics.image.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.image.ui/META-INF/MANIFEST.MF @@ -13,7 +13,7 @@ Require-Bundle: org.simantics.ui;bundle-version="1.0.0", org.simantics.image2.ontology;bundle-version="1.0.0", org.simantics.scenegraph;bundle-version="1.1.1" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.image.ui, org.simantics.image.ui.modelBrowser Bundle-Vendor: Semantum Oy diff --git a/bundles/org.simantics.image2.ontology/.classpath b/bundles/org.simantics.image2.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.image2.ontology/.classpath +++ b/bundles/org.simantics.image2.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.image2.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.image2.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.image2.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.image2.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.image2.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.image2.ontology/META-INF/MANIFEST.MF index f01e6f05f..b149860b6 100644 --- a/bundles/org.simantics.image2.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.image2.ontology/META-INF/MANIFEST.MF @@ -4,6 +4,6 @@ Bundle-Name: http://www.simantics.org/Image2 Bundle-SymbolicName: org.simantics.image2.ontology Bundle-Version: 1.2.0.qualifier Require-Bundle: org.simantics.layer0 -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.image2.ontology Automatic-Module-Name: org.simantics.image2.ontology diff --git a/bundles/org.simantics.issues.common/.classpath b/bundles/org.simantics.issues.common/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.issues.common/.classpath +++ b/bundles/org.simantics.issues.common/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.issues.common/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.issues.common/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.issues.common/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.issues.common/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.issues.common/META-INF/MANIFEST.MF b/bundles/org.simantics.issues.common/META-INF/MANIFEST.MF index 7fe964225..25284dccb 100644 --- a/bundles/org.simantics.issues.common/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.issues.common/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Issue Framework Common Parts Bundle-SymbolicName: org.simantics.issues.common;singleton:=true Bundle-Version: 1.1.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.issues;bundle-version="1.1.0", org.simantics.layer0;bundle-version="1.0.0", org.simantics.issues.ontology;bundle-version="1.1.0";visibility:=reexport, diff --git a/bundles/org.simantics.issues.ontology/.classpath b/bundles/org.simantics.issues.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.issues.ontology/.classpath +++ b/bundles/org.simantics.issues.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.issues.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.issues.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.issues.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.issues.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.issues.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.issues.ontology/META-INF/MANIFEST.MF index aaec74f25..6ab043f06 100644 --- a/bundles/org.simantics.issues.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.issues.ontology/META-INF/MANIFEST.MF @@ -11,6 +11,6 @@ Require-Bundle: org.simantics.layer0, org.simantics.layer0x.ontology;bundle-version="1.0.0", org.simantics.views.ontology;bundle-version="1.1.0", org.simantics.scenegraph.ontology;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.issues.ontology Automatic-Module-Name: org.simantics.issues.ontology diff --git a/bundles/org.simantics.issues.ui.ontology/.classpath b/bundles/org.simantics.issues.ui.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.issues.ui.ontology/.classpath +++ b/bundles/org.simantics.issues.ui.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.issues.ui.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.issues.ui.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.issues.ui.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.issues.ui.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.issues.ui.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.issues.ui.ontology/META-INF/MANIFEST.MF index 80068cc2c..e97c47caa 100644 --- a/bundles/org.simantics.issues.ui.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.issues.ui.ontology/META-INF/MANIFEST.MF @@ -14,6 +14,6 @@ Require-Bundle: org.simantics.layer0, org.simantics.viewpoint.ontology;bundle-version="1.1.0", org.simantics.simulation.ontology;bundle-version="1.0.0", org.simantics.modeling.ontology;bundle-version="1.2.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.issues.ui.ontology Automatic-Module-Name: org.simantics.issues.ui.ontology diff --git a/bundles/org.simantics.issues.ui/.classpath b/bundles/org.simantics.issues.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.issues.ui/.classpath +++ b/bundles/org.simantics.issues.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.issues.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.issues.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.issues.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.issues.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.issues.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.issues.ui/META-INF/MANIFEST.MF index da218152b..abb1bf685 100644 --- a/bundles/org.simantics.issues.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.issues.ui/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Issue Framework UI Bundle-SymbolicName: org.simantics.issues.ui;singleton:=true Bundle-Version: 1.1.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.issues;bundle-version="1.0.0", org.simantics.issues.ontology;bundle-version="1.1.0", org.simantics.diagram.ontology;bundle-version="1.1.1", @@ -24,6 +24,7 @@ Bundle-ActivationPolicy: lazy Bundle-Activator: org.simantics.issues.ui.internal.Activator Export-Package: org.simantics.issues.ui, org.simantics.issues.ui.contribution, - org.simantics.issues.ui.handler + org.simantics.issues.ui.handler, + org.simantics.issues.ui.property Bundle-Vendor: VTT Technical Research Centre of Finland Automatic-Module-Name: org.simantics.issues.ui diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/property/IssuesTab.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/property/IssuesTab.java new file mode 100644 index 000000000..fb1e0a977 --- /dev/null +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/property/IssuesTab.java @@ -0,0 +1,172 @@ +package org.simantics.issues.ui.property; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.CellLabelProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IWorkbenchSite; +import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport; +import org.simantics.databoard.Bindings; +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.common.procedure.adapter.TransientCacheListener; +import org.simantics.db.common.request.ResourceRead; +import org.simantics.db.common.utils.NameUtils; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.management.ISessionContext; +import org.simantics.db.request.Read; +import org.simantics.issues.Severity; +import org.simantics.issues.common.IssueResourceContexts; +import org.simantics.issues.common.ListModelIssuesBySeverity; +import org.simantics.issues.common.SimpleIssue; +import org.simantics.layer0.Layer0; +import org.simantics.modeling.ModelingResources; +import org.simantics.selectionview.PropertyTabContributorImpl; + +/** + * A very simple property tab for listing issues of a selected object. + * + * @author luukkainen + * + */ +public class IssuesTab extends PropertyTabContributorImpl{ + + + private TableViewer viewer; + private Resource model; + private Resource element; + + private List result; + + public IssuesTab(ReadGraph graph, Resource model, Resource element) throws DatabaseException { + this.model = model; + this.element = element; + + Layer0 L0 = Layer0.getInstance(graph); + List contexts = getContexts(graph, element); + Map> issuesBySeverity = graph.syncRequest( + new ListModelIssuesBySeverity(model, true, true, Severity.NOTE), + TransientCacheListener.>>instance()); + + result = new ArrayList<>(); + for (Severity severity : Severity.values()) { + List issues = issuesBySeverity.get(severity); + if (issues != null) { + for (Resource issue : issues) { + Set issueContexts = graph.syncRequest(new IssueResourceContexts(issue)); + if (!Collections.disjoint(issueContexts, contexts)) { + SimpleIssue si = new SimpleIssue((String) graph.getRelatedValue(issue, L0.HasLabel, Bindings.STRING), + severity, issue); + result.add(si); + System.out.println(si.label + " " + si.severity); + } + } + } + } + } + + + /** + * @see org.simantics.modeling.ui.diagram.style.IssueDecorationStyle + * + * @param graph + * @param element + * @return + * @throws DatabaseException + */ + protected List getContexts(ReadGraph graph, Resource element) throws DatabaseException { + + ModelingResources MOD = ModelingResources.getInstance(graph); + List result = new ArrayList(3); + result.add(element); + Resource config = graph.getPossibleObject(element, MOD.ElementToComponent); + if (config != null && result.indexOf(config) == -1) result.add(config); + config = graph.getPossibleObject(element, MOD.DiagramConnectionToConnection); + if (config != null && result.indexOf(config) == -1) result.add(config); + // For diagram reference element support + config = graph.getPossibleObject(element, MOD.HasParentComponent); + if (config != null && result.indexOf(config) == -1) result.add(config); + return result; + + } + + + @Override + public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) { + GridLayoutFactory.fillDefaults().numColumns(2).spacing(0, 0).applyTo(body); + + viewer = new TableViewer(body); + + TableViewerColumn issueColumn = new TableViewerColumn(viewer, SWT.LEFT); + TableViewerColumn severityColumn = new TableViewerColumn(viewer, SWT.LEFT); + + issueColumn.setLabelProvider(new CellLabelProvider() { + + @Override + public void update(ViewerCell cell) { + SimpleIssue issue = (SimpleIssue)cell.getElement(); + cell.setText(issue.label); + + } + }); + severityColumn.setLabelProvider(new CellLabelProvider() { + + @Override + public void update(ViewerCell cell) { + SimpleIssue issue = (SimpleIssue)cell.getElement(); + cell.setText(issue.severity.name()); + } + }); + + issueColumn.getColumn().setWidth(300); + issueColumn.getColumn().setText("Issue"); + + severityColumn.getColumn().setWidth(100); + severityColumn.getColumn().setText("Severity"); + + viewer.getTable().setHeaderVisible(true); + viewer.getTable().setLinesVisible(true); + + viewer.setContentProvider(new IStructuredContentProvider() { + + @Override + public Object[] getElements(Object inputElement) { + List list = (List)inputElement; + return list.toArray(); + } + }); + + viewer.setInput(result); + GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getControl()); + + } + + @Override + public Read getPartNameReadRequest(ISelection forSelection) { + return new ObjectTitleRead(element); + } + + public static class ObjectTitleRead extends ResourceRead { + public ObjectTitleRead(Resource resource) { + super(resource); + } + + @Override + public String perform(ReadGraph graph) throws DatabaseException { + return NameUtils.getSafeName(graph, resource); + } + } + +} diff --git a/bundles/org.simantics.issues/.classpath b/bundles/org.simantics.issues/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.issues/.classpath +++ b/bundles/org.simantics.issues/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.issues/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.issues/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.issues/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.issues/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.issues/META-INF/MANIFEST.MF b/bundles/org.simantics.issues/META-INF/MANIFEST.MF index 423f89f28..9f71c2672 100644 --- a/bundles/org.simantics.issues/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.issues/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Issue Framework Bundle-SymbolicName: org.simantics.issues;singleton:=true Bundle-Version: 1.1.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.issues, org.simantics.issues.preferences Require-Bundle: org.simantics.utils.datastructures;bundle-version="1.0.0", diff --git a/bundles/org.simantics.jdbc.ontology/.classpath b/bundles/org.simantics.jdbc.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.jdbc.ontology/.classpath +++ b/bundles/org.simantics.jdbc.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.jdbc.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.jdbc.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.jdbc.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.jdbc.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.jdbc.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.jdbc.ontology/META-INF/MANIFEST.MF index 200d69f6c..f643b85f7 100644 --- a/bundles/org.simantics.jdbc.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.jdbc.ontology/META-INF/MANIFEST.MF @@ -6,6 +6,6 @@ Bundle-Version: 1.0.0.qualifier Require-Bundle: org.eclipse.core.runtime, org.simantics.layer0, org.simantics.selectionview.ontology;bundle-version="1.2.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.jdbc.ontology Automatic-Module-Name: org.simantics.jdbc.ontology diff --git a/bundles/org.simantics.jdbc/.classpath b/bundles/org.simantics.jdbc/.classpath index b862a296d..e801ebfb4 100644 --- a/bundles/org.simantics.jdbc/.classpath +++ b/bundles/org.simantics.jdbc/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/bundles/org.simantics.jdbc/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.jdbc/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.jdbc/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.jdbc/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.jdbc/META-INF/MANIFEST.MF b/bundles/org.simantics.jdbc/META-INF/MANIFEST.MF index 8199e8979..bcfabfbbf 100644 --- a/bundles/org.simantics.jdbc/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.jdbc/META-INF/MANIFEST.MF @@ -3,13 +3,13 @@ Bundle-ManifestVersion: 2 Bundle-Name: Simantics JDBC support Bundle-SymbolicName: org.simantics.jdbc Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ClassPath: . Require-Bundle: org.eclipse.osgi, org.simantics.simulator.toolkit, org.simantics.databoard, gnu.trove3;bundle-version="3.0.3", - org.slf4j.api;bundle-version="1.7.25", + org.slf4j.api, org.simantics.db.layer0, org.simantics.simulator.toolkit.db, org.simantics, @@ -19,7 +19,7 @@ Require-Bundle: org.eclipse.osgi, io.netty.common;bundle-version="4.1.27", io.netty.handler;bundle-version="4.1.27", io.netty.transport;bundle-version="4.1.27", - pgjdbc-ng;bundle-version="0.7.1" + com.impossibl.pgjdbc-ng;bundle-version="0.8.3" Export-Package: org.simantics.jdbc, org.simantics.jdbc.variable Automatic-Module-Name: org.simantics.jdbc diff --git a/bundles/org.simantics.jdbc/src/org/simantics/jdbc/variable/JDBCSessionManager.java b/bundles/org.simantics.jdbc/src/org/simantics/jdbc/variable/JDBCSessionManager.java index 17ffcf143..9e0c03bfd 100644 --- a/bundles/org.simantics.jdbc/src/org/simantics/jdbc/variable/JDBCSessionManager.java +++ b/bundles/org.simantics.jdbc/src/org/simantics/jdbc/variable/JDBCSessionManager.java @@ -110,7 +110,7 @@ public class JDBCSessionManager extends StandardVariableSessionManager - + diff --git a/bundles/org.simantics.layer0.utils/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.layer0.utils/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.layer0.utils/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.layer0.utils/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.layer0.utils/META-INF/MANIFEST.MF b/bundles/org.simantics.layer0.utils/META-INF/MANIFEST.MF index 36f82a01d..cf4ad8b08 100644 --- a/bundles/org.simantics.layer0.utils/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.layer0.utils/META-INF/MANIFEST.MF @@ -23,5 +23,5 @@ Require-Bundle: gnu.trove3;bundle-version="3.0.3", org.simantics.db.common;bundle-version="1.1.0" Bundle-Vendor: VTT Technical Research Centre of Finland Bundle-ClassPath: . -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.simantics.layer0.utils diff --git a/bundles/org.simantics.layer0/.classpath b/bundles/org.simantics.layer0/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.layer0/.classpath +++ b/bundles/org.simantics.layer0/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.layer0/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.layer0/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.layer0/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.layer0/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.layer0/META-INF/MANIFEST.MF b/bundles/org.simantics.layer0/META-INF/MANIFEST.MF index ac01c010f..0d93d4134 100644 --- a/bundles/org.simantics.layer0/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.layer0/META-INF/MANIFEST.MF @@ -5,7 +5,7 @@ Bundle-SymbolicName: org.simantics.layer0 Bundle-Version: 1.1.0.qualifier Require-Bundle: org.simantics.db;visibility:=reexport Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.layer0 Bundle-Vendor: VTT Technical Research Centre of Finland Automatic-Module-Name: org.simantics.layer0 diff --git a/bundles/org.simantics.layer0x.ontology/.classpath b/bundles/org.simantics.layer0x.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.layer0x.ontology/.classpath +++ b/bundles/org.simantics.layer0x.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.layer0x.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.layer0x.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.layer0x.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.layer0x.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.layer0x.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.layer0x.ontology/META-INF/MANIFEST.MF index 9e8a0aa7e..83ad2bbfe 100644 --- a/bundles/org.simantics.layer0x.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.layer0x.ontology/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: http://www.simantics.org/Layer0X Bundle-SymbolicName: org.simantics.layer0x.ontology Bundle-Version: 1.1.0.qualifier Require-Bundle: org.simantics.layer0 -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.layer0, org.simantics.operation Automatic-Module-Name: org.simantics.layer0x.ontology diff --git a/bundles/org.simantics.logback.configuration/.classpath b/bundles/org.simantics.logback.configuration/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.logback.configuration/.classpath +++ b/bundles/org.simantics.logback.configuration/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.logback.configuration/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.logback.configuration/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.logback.configuration/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.logback.configuration/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.logback.configuration/META-INF/MANIFEST.MF b/bundles/org.simantics.logback.configuration/META-INF/MANIFEST.MF index 665f5bacb..dcd2cb1ab 100644 --- a/bundles/org.simantics.logback.configuration/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.logback.configuration/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Simantics Logback Configuration Bundle-SymbolicName: org.simantics.logback.configuration Bundle-Version: 1.0.0.qualifier Fragment-Host: ch.qos.logback.classic;bundle-version="1.1.7" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: ch.qos.logback.core;bundle-version="1.1.7" Bundle-Vendor: Semantum Oy Eclipse-BundleShape: dir diff --git a/bundles/org.simantics.logging.ui/.classpath b/bundles/org.simantics.logging.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.logging.ui/.classpath +++ b/bundles/org.simantics.logging.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.logging.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.logging.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.logging.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.logging.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.logging.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.logging.ui/META-INF/MANIFEST.MF index 9e35ec2ad..997253929 100644 --- a/bundles/org.simantics.logging.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.logging.ui/META-INF/MANIFEST.MF @@ -12,8 +12,8 @@ Require-Bundle: javax.inject, org.eclipse.core.runtime, org.slf4j.api, org.simantics.logging, - org.simantics.utils.ui -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Import-Package: javax.annotation;version="1.2.0" + org.simantics.utils.ui, + jakarta.annotation-api;bundle-version="1.3.5" +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Automatic-Module-Name: org.simantics.logging.ui diff --git a/bundles/org.simantics.logging/.classpath b/bundles/org.simantics.logging/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.logging/.classpath +++ b/bundles/org.simantics.logging/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.logging/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.logging/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.logging/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.logging/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.logging/META-INF/MANIFEST.MF b/bundles/org.simantics.logging/META-INF/MANIFEST.MF index 96c84263a..abf3a16f6 100644 --- a/bundles/org.simantics.logging/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.logging/META-INF/MANIFEST.MF @@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.core.runtime, ch.qos.logback.classic, ch.qos.logback.core, org.simantics.utils -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Service-Component: logbackLogProvider.xml, dbAndMetadataLogProvider.xml diff --git a/bundles/org.simantics.lz4/.classpath b/bundles/org.simantics.lz4/.classpath index 50096858f..5b663aec3 100644 --- a/bundles/org.simantics.lz4/.classpath +++ b/bundles/org.simantics.lz4/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.lz4/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.lz4/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.lz4/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.lz4/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.lz4/META-INF/MANIFEST.MF b/bundles/org.simantics.lz4/META-INF/MANIFEST.MF index 173d0c6ca..571732375 100644 --- a/bundles/org.simantics.lz4/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.lz4/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: LZ4 Bundle-SymbolicName: org.simantics.lz4 Bundle-Version: 1.3.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ClassPath: . Export-Package: net.jpountz.lz4, org.simantics.lz4 diff --git a/bundles/org.simantics.mapping/.classpath b/bundles/org.simantics.mapping/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.mapping/.classpath +++ b/bundles/org.simantics.mapping/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.mapping/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.mapping/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.mapping/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.mapping/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.mapping/META-INF/MANIFEST.MF b/bundles/org.simantics.mapping/META-INF/MANIFEST.MF index 576c053fe..e3b6b329f 100644 --- a/bundles/org.simantics.mapping/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.mapping/META-INF/MANIFEST.MF @@ -15,5 +15,5 @@ Export-Package: org.simantics.mapping, org.simantics.mapping.rule, org.simantics.mapping.rule.instructions Bundle-Vendor: VTT Technical Research Centre of Finland -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.simantics.mapping diff --git a/bundles/org.simantics.message.ui/.classpath b/bundles/org.simantics.message.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.message.ui/.classpath +++ b/bundles/org.simantics.message.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.message.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.message.ui/.settings/org.eclipse.jdt.core.prefs index 3a2153707..7adc0fb9a 100644 --- a/bundles/org.simantics.message.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.message.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,11 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.message.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.message.ui/META-INF/MANIFEST.MF index fcc3b9f62..e47b7d185 100644 --- a/bundles/org.simantics.message.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.message.ui/META-INF/MANIFEST.MF @@ -13,6 +13,6 @@ Require-Bundle: com.ibm.icu, org.simantics.db.common;bundle-version="[1.0.0,2.0.0)", org.simantics.ui;bundle-version="[1.0.0,2.0.0)", org.simantics.editors;bundle-version="[1.0.0,2.0.0)" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Automatic-Module-Name: org.simantics.message.ui diff --git a/bundles/org.simantics.message/.classpath b/bundles/org.simantics.message/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.message/.classpath +++ b/bundles/org.simantics.message/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.message/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.message/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.message/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.message/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.message/META-INF/MANIFEST.MF b/bundles/org.simantics.message/META-INF/MANIFEST.MF index 64452df16..265b6c83b 100644 --- a/bundles/org.simantics.message/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.message/META-INF/MANIFEST.MF @@ -8,7 +8,7 @@ Bundle-Vendor: Semantum Oy Require-Bundle: org.eclipse.core.runtime, org.simantics.db;bundle-version="[1.0.0,2.0.0)", org.slf4j.api -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.message, org.simantics.message.internal;x-friends:="org.simantics.message.ui", diff --git a/bundles/org.simantics.migration.ui/.classpath b/bundles/org.simantics.migration.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.migration.ui/.classpath +++ b/bundles/org.simantics.migration.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.migration.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.migration.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.migration.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.migration.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.migration.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.migration.ui/META-INF/MANIFEST.MF index ba9eada22..3a3cde3bb 100644 --- a/bundles/org.simantics.migration.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.migration.ui/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Version Migration UI Bundle-SymbolicName: org.simantics.migration.ui Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: gnu.trove3;bundle-version="3.0.0", org.simantics.browsing.ui.model;bundle-version="1.0.0", org.eclipse.ui;bundle-version="3.6.0", diff --git a/bundles/org.simantics.modeling.ontology/.classpath b/bundles/org.simantics.modeling.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.modeling.ontology/.classpath +++ b/bundles/org.simantics.modeling.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.modeling.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.modeling.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.modeling.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.modeling.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.modeling.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.modeling.ontology/META-INF/MANIFEST.MF index c814a674d..39909eeb9 100644 --- a/bundles/org.simantics.modeling.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.modeling.ontology/META-INF/MANIFEST.MF @@ -22,6 +22,6 @@ Require-Bundle: org.simantics.layer0, org.simantics.selectionview.ontology;bundle-version="1.2.0", org.simantics.spreadsheet.ontology;bundle-version="1.2.0", org.simantics.graphfile.ontology;bundle-version="0.1.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.modeling Automatic-Module-Name: org.simantics.modeling.ontology diff --git a/bundles/org.simantics.modeling.ontology/graph/Modeling.pgraph b/bundles/org.simantics.modeling.ontology/graph/Modeling.pgraph index 82808f837..b13462813 100644 --- a/bundles/org.simantics.modeling.ontology/graph/Modeling.pgraph +++ b/bundles/org.simantics.modeling.ontology/graph/Modeling.pgraph @@ -375,6 +375,7 @@ MOD.HasSourceInformation --> MOD.SourceInformation Vector Byte" +STR.ComponentType + MOD.contentDumpFunction + MOD.StructuralComponentTypeContentDumpFunction + @L0.sclValue "structuralComponentTypeContentDump" "Resource -> Vector Byte" + SEL.GenericParameterType MOD.contentDumpFunction MOD.GenericParameterTypeContentDumpFunction diff --git a/bundles/org.simantics.modeling.template2d.ontology/.classpath b/bundles/org.simantics.modeling.template2d.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.modeling.template2d.ontology/.classpath +++ b/bundles/org.simantics.modeling.template2d.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.modeling.template2d.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.modeling.template2d.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.modeling.template2d.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.modeling.template2d.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.modeling.template2d.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.modeling.template2d.ontology/META-INF/MANIFEST.MF index 35ae15e97..c7ecff3ba 100644 --- a/bundles/org.simantics.modeling.template2d.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.modeling.template2d.ontology/META-INF/MANIFEST.MF @@ -29,6 +29,6 @@ Require-Bundle: org.eclipse.core.runtime, org.simantics.silk.ontology;bundle-version="1.0.0", org.simantics.image2.ontology;bundle-version="1.1.0", org.simantics.annotation.ontology;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.modeling.template2d.ontology Automatic-Module-Name: org.simantics.modeling.template2d.ontology diff --git a/bundles/org.simantics.modeling.template2d.ui/.classpath b/bundles/org.simantics.modeling.template2d.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.modeling.template2d.ui/.classpath +++ b/bundles/org.simantics.modeling.template2d.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.modeling.template2d.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.modeling.template2d.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.modeling.template2d.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.modeling.template2d.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.modeling.template2d.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.modeling.template2d.ui/META-INF/MANIFEST.MF index 5ffa50f9d..c4e5e1ebd 100644 --- a/bundles/org.simantics.modeling.template2d.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.modeling.template2d.ui/META-INF/MANIFEST.MF @@ -22,6 +22,6 @@ Require-Bundle: org.simantics.layer0.utils;bundle-version="0.8.0", org.simantics.export.core;bundle-version="1.0.0", org.slf4j.api Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.modeling.template2d.ui.function Automatic-Module-Name: org.simantics.modeling.template2d.ui diff --git a/bundles/org.simantics.modeling.tests/.classpath b/bundles/org.simantics.modeling.tests/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.modeling.tests/.classpath +++ b/bundles/org.simantics.modeling.tests/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.modeling.tests/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.modeling.tests/.settings/org.eclipse.jdt.core.prefs index 374f61e89..7adc0fb9a 100644 --- a/bundles/org.simantics.modeling.tests/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.modeling.tests/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,10 @@ -#Fri May 04 09:08:52 EEST 2012 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.modeling.tests/META-INF/MANIFEST.MF b/bundles/org.simantics.modeling.tests/META-INF/MANIFEST.MF index 48e1e0a95..d9df526eb 100644 --- a/bundles/org.simantics.modeling.tests/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.modeling.tests/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Modeling Tests Bundle-SymbolicName: org.simantics.modeling.tests Bundle-Version: 1.0.0.qualifier Bundle-Vendor: Semantum Oy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.modeling;bundle-version="1.1.1", org.simantics;bundle-version="1.0.0", org.simantics.db.testing;bundle-version="1.0.0", diff --git a/bundles/org.simantics.modeling.ui.workbench/.classpath b/bundles/org.simantics.modeling.ui.workbench/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.modeling.ui.workbench/.classpath +++ b/bundles/org.simantics.modeling.ui.workbench/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.modeling.ui.workbench/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.modeling.ui.workbench/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.modeling.ui.workbench/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.modeling.ui.workbench/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.modeling.ui.workbench/META-INF/MANIFEST.MF b/bundles/org.simantics.modeling.ui.workbench/META-INF/MANIFEST.MF index 7c026c9bd..9099b1c9b 100644 --- a/bundles/org.simantics.modeling.ui.workbench/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.modeling.ui.workbench/META-INF/MANIFEST.MF @@ -4,6 +4,6 @@ Bundle-Name: General Modeling Workbench Contributions Bundle-SymbolicName: org.simantics.modeling.ui.workbench;singleton:=true Bundle-Version: 1.26.0.qualifier Bundle-Vendor: Semantum Oy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.ui Automatic-Module-Name: org.simantics.modeling.ui.workbench diff --git a/bundles/org.simantics.modeling.ui/.classpath b/bundles/org.simantics.modeling.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.modeling.ui/.classpath +++ b/bundles/org.simantics.modeling.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.modeling.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.modeling.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.modeling.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.modeling.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.modeling.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.modeling.ui/META-INF/MANIFEST.MF index f6f6fa484..ac90be688 100644 --- a/bundles/org.simantics.modeling.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.modeling.ui/META-INF/MANIFEST.MF @@ -3,13 +3,10 @@ Bundle-ManifestVersion: 2 Bundle-Name: General Modelling UI Bundle-SymbolicName: org.simantics.modeling.ui;singleton:=true Bundle-Version: 1.1.1.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Require-Bundle: org.simantics.project;bundle-version="1.0.0", - org.eclipse.ui.views;bundle-version="3.3.0", +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Require-Bundle: org.eclipse.ui.views;bundle-version="3.3.0", org.simantics.ui;bundle-version="1.0.0";visibility:=reexport, - org.simantics.structural.ontology;bundle-version="1.0.0";visibility:=reexport, org.simantics.spreadsheet.ontology;bundle-version="1.0.0", - org.simantics.structural2;bundle-version="1.0.0", org.simantics.modeling;bundle-version="1.0.0";visibility:=reexport, org.simantics.utils.thread.swt;bundle-version="1.0.0", org.simantics.simulation;bundle-version="1.0.0", @@ -17,24 +14,19 @@ Require-Bundle: org.simantics.project;bundle-version="1.0.0", org.simantics.browsing.ui.platform;bundle-version="1.0.0";visibility:=reexport, org.simantics.structural.ui;bundle-version="1.0.0", org.eclipse.ui.forms;bundle-version="3.4.1", - org.simantics.basicexpression;bundle-version="1.0.0", org.simantics.layer0.utils;bundle-version="0.8.0", org.simantics.browsing.ui.model;bundle-version="1.0.0", org.simantics.scenegraph.swing;bundle-version="1.0.0", org.simantics.selectionview;bundle-version="1.0.0", - org.simantics.trend;bundle-version="1.0.0", org.simantics.history;bundle-version="1.0.0", - com.famfamfam.silk;bundle-version="1.3.0", - org.simantics.issues.ontology;bundle-version="1.1.0", org.simantics.issues.common;bundle-version="1.1.0", + org.simantics.image.ui, org.eclipse.help;bundle-version="3.5.0", org.simantics.scenegraph.profile;bundle-version="1.0.0", org.simantics.issues;bundle-version="1.1.0", org.simantics.document;bundle-version="1.0.0", - org.simantics.graph.db;bundle-version="1.1.9", + org.simantics.views, org.bouncycastle.bcprov-jdk14;bundle-version="1.38.0", - org.simantics.image2.ontology;bundle-version="1.1.0", - org.simantics.scl.compiler;bundle-version="0.4.0", org.simantics.scl.osgi;bundle-version="1.0.4", org.eclipse.jface.text;bundle-version="3.7.1", org.simantics.graphviz, @@ -44,8 +36,6 @@ Require-Bundle: org.simantics.project;bundle-version="1.0.0", org.eclipse.nebula.widgets.cdatetime;bundle-version="0.14.0", org.eclipse.ui.editors;bundle-version="3.7.0", org.eclipse.ui.ide;bundle-version="3.7.0", - org.eclipse.core.resources;bundle-version="3.7.100", - org.eclipse.text, org.simantics.scl.db;bundle-version="0.1.3", org.simantics.scl.ui;bundle-version="0.5.0", org.simantics.graph.compiler;bundle-version="1.1.11", @@ -55,17 +45,12 @@ Require-Bundle: org.simantics.project;bundle-version="1.0.0", org.eclipse.e4.ui.model.workbench;bundle-version="1.1.100.v20150407-1430", org.eclipse.e4.ui.services;bundle-version="1.2.0", org.eclipse.e4.ui.workbench, - org.eclipse.swt, - org.simantics.db.layer0, - org.simantics.silk.ontology;bundle-version="1.1.0", - org.simantics.image.ui;bundle-version="1.0.0", org.simantics.export.core;bundle-version="1.0.0", org.slf4j.api, - org.simantics.graphfile.ontology, - org.eclipse.e4.core.services, - org.eclipse.mylyn.wikitext;bundle-version="3.0.6", - org.eclipse.mylyn.wikitext.markdown;bundle-version="3.0.6", - org.eclipse.mylyn.wikitext.ui;bundle-version="3.0.6" + org.eclipse.mylyn.wikitext.markdown, + org.eclipse.mylyn.wikitext.ui, + org.eclipse.mylyn.wikitext, + jakarta.annotation-api;bundle-version="1.3.5" Export-Package: org.simantics.modeling.ui, org.simantics.modeling.ui.actions, org.simantics.modeling.ui.chart.property, @@ -96,7 +81,6 @@ Export-Package: org.simantics.modeling.ui, Bundle-Activator: org.simantics.modeling.ui.Activator Bundle-ActivationPolicy: lazy Bundle-Vendor: VTT Technical Research Centre of Finland -Import-Package: org.osgi.service.event, - org.simantics.views, - javax.inject +Import-Package: javax.inject, + org.osgi.service.event Automatic-Module-Name: org.simantics.modeling.ui diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/ObtainedDoubleAdapter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/ObtainedDoubleAdapter.java index 79f32fcd2..ff257169c 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/ObtainedDoubleAdapter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/ObtainedDoubleAdapter.java @@ -20,6 +20,7 @@ import org.simantics.db.RelationContext; import org.simantics.db.Resource; import org.simantics.db.Statement; import org.simantics.db.common.adaption.SimpleContextualAdapter; +import org.simantics.db.exception.AdaptionException; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.property.OrderedResource; import org.simantics.operation.Layer0X; @@ -46,7 +47,7 @@ public class ObtainedDoubleAdapter extends SimpleContextualAdapter getInputValidator() { - return new ParametrizedRead() { - @Override - public Read get(IResourceEditorInput parameter) { - return Combinators.constant(Boolean.TRUE); - } - }; + // No-op validator that always returns true + return param -> Combinators.constant(Boolean.TRUE); } @Override @@ -131,12 +131,14 @@ public class ComponentTypeScriptEditor extends SCLModuleEditor { @Override public void run(ReadGraph graph) throws DatabaseException { StructuralResource2 STR = StructuralResource2.getInstance(graph); - final String type = graph.getPossibleRelatedValue(script, STR.ComponentTypeScript_type); + String type = graph.getPossibleRelatedValue(script, STR.ComponentTypeScript_type); if(type != null) + scriptType = type; combo.getDisplay().asyncExec(() -> { for(int i=0;i { int id = combo.getSelectionIndex(); + if (id == scriptTypeIndex) + return; + if (docProvider.isReadOnly(getEditorInput())) { + // Return configured selection + combo.select(scriptTypeIndex); + return; + } + String newType = EXECUTION_PHASES[id]; Simantics.getSession().asyncRequest((WriteGraph graph) -> { StructuralResource2 STR = StructuralResource2.getInstance(graph); String currentType = graph.getPossibleRelatedValue(script, STR.ComponentTypeScript_type); - String newType = EXECUTION_PHASES[id]; if(!newType.equals(currentType)) graph.claimLiteral(script, STR.ComponentTypeScript_type, newType, Bindings.STRING); + }, exc -> { + if (exc == null) { + scriptType = newType; + scriptTypeIndex = id; + } else { + ExceptionUtils.logError(exc); + } }); })); GridDataFactory.fillDefaults().grab(true, false).applyTo(combo); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentTypeCodeDocumentProvider.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentTypeCodeDocumentProvider.java index 1a1eb723f..5cc209943 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentTypeCodeDocumentProvider.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentTypeCodeDocumentProvider.java @@ -31,6 +31,7 @@ import org.simantics.scl.ui.editor.SCLSourceViewerConfigurationNew; import org.simantics.scl.ui.editor.TextAndErrors; import org.simantics.structural2.scl.procedural.CompileProceduralComponentTypeRequest; import org.simantics.structural2.scl.procedural.ProceduralComponentTypeCompilationException; +import org.simantics.structural2.utils.StructuralUtils; import org.simantics.ui.workbench.ResourceEditorInput; import org.simantics.utils.logging.TimeLogger; import org.simantics.utils.ui.SWTUtils; @@ -55,6 +56,7 @@ public class ProceduralComponentTypeCodeDocumentProvider extends SCLModuleEditor @Override public Document perform(ReadGraph graph) throws DatabaseException { currentText = graph.getValue(resource, Bindings.STRING); + immutable = StructuralUtils.isImmutable(graph, resource); errorHappened = false; return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$ } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/ObtainedColorAdapter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/ObtainedColorAdapter.java index 21c820864..acb258110 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/ObtainedColorAdapter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/ObtainedColorAdapter.java @@ -10,6 +10,7 @@ import org.simantics.db.RelationContext; import org.simantics.db.Resource; import org.simantics.db.Statement; import org.simantics.db.common.adaption.SimpleContextualAdapter; +import org.simantics.db.exception.AdaptionException; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.property.OrderedResource; import org.simantics.diagram.stubs.DiagramResource; @@ -34,7 +35,7 @@ public class ObtainedColorAdapter extends SimpleContextualAdapter { private static final String DECORATION_NODE_NAME = "issueDecorations"; //$NON-NLS-1$ - private List getContexts(ReadGraph graph, Resource element) throws DatabaseException { + protected List getContexts(ReadGraph graph, Resource element) throws DatabaseException { ModelingResources MOD = ModelingResources.getInstance(graph); List result = new ArrayList(3); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewer.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewer.java index 409aecbea..88d85cfbf 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewer.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewer.java @@ -67,7 +67,9 @@ import org.simantics.diagram.handler.DeleteHandler; import org.simantics.diagram.handler.ExpandSelectionHandler; import org.simantics.diagram.handler.SimpleElementTransformHandler; import org.simantics.diagram.layer.ILayersViewPage; +import org.simantics.diagram.participant.ConnectionCrossingsParticipant; import org.simantics.diagram.participant.ContextUtil; +import org.simantics.diagram.participant.CopyAsSVGParticipant; import org.simantics.diagram.participant.PointerInteractor2; import org.simantics.diagram.participant.SGFocusParticipant; import org.simantics.diagram.query.DiagramRequests; @@ -330,6 +332,8 @@ public class DiagramViewer //ctx.add(new ZoomTransitionParticipant(TransitionFunction.SIGMOID)); //ctx.add(new TooltipParticipant()); ctx.add(new TerminalTooltipParticipant()); + ctx.add(new ConnectionCrossingsParticipant(getInputResource())); + ctx.add(new CopyAsSVGParticipant()); } protected void addPainterParticipants(ICanvasContext ctx) { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerLoadJob.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerLoadJob.java index decf3356c..dc9d9d1be 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerLoadJob.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerLoadJob.java @@ -111,8 +111,8 @@ public class DiagramViewerLoadJob extends DatabaseJob { }); END(task); } catch (Throwable t) { - viewer = null; LOGGER.error("Failed to complete loading of diagram {} in the canvas thread", viewer.diagramResource, t); + viewer = null; } } }); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerSelectionProvider.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerSelectionProvider.java index b7ea5ac78..d9d14c37e 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerSelectionProvider.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerSelectionProvider.java @@ -17,7 +17,6 @@ import org.simantics.db.layer0.SelectionHints; import org.simantics.db.layer0.request.PossibleModel; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; -import org.simantics.diagram.Logger; import org.simantics.diagram.flag.FlagUtil; import org.simantics.diagram.stubs.DiagramResource; import org.simantics.diagram.ui.DiagramModelHints; @@ -36,6 +35,8 @@ import org.simantics.ui.selection.WorkbenchSelectionContentType; import org.simantics.utils.DataContainer; import org.simantics.utils.threads.IThreadWorkQueue; import org.simantics.utils.ui.ErrorLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author Antti Villberg @@ -44,6 +45,8 @@ public class DiagramViewerSelectionProvider extends WorkbenchSelectionProvider { protected static class SelectionElement extends AdaptableHintContext { + private static final Logger LOGGER = LoggerFactory.getLogger(SelectionElement.class); + final public Resource runtime; final public Resource element; @@ -108,7 +111,7 @@ public class DiagramViewerSelectionProvider extends WorkbenchSelectionProvider { } }); } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("WorkbenchSelectionElement.getContent failed for type AnyVariable", e); } } else if(contentType instanceof ParentVariable) { @@ -117,10 +120,7 @@ public class DiagramViewerSelectionProvider extends WorkbenchSelectionProvider { return (T) type.processor.sync(new ResourceRead2(runtime, element) { @Override public Variable perform(ReadGraph graph) throws DatabaseException { - DiagramResource DIA = DiagramResource.getInstance(graph); - ModelingResources MOD = ModelingResources.getInstance(graph); - Layer0 L0 = Layer0.getInstance(graph); String uri = graph.getPossibleRelatedValue(resource, DIA.RuntimeDiagram_HasVariable); if (uri == null) @@ -134,7 +134,7 @@ public class DiagramViewerSelectionProvider extends WorkbenchSelectionProvider { } }); } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("WorkbenchSelectionElement.getContent failed for type ParentVariable", e); } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/PopulateElementDropParticipant.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/PopulateElementDropParticipant.java index ac9413064..4e7ac0ab8 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/PopulateElementDropParticipant.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/PopulateElementDropParticipant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * Copyright (c) 2007, 2020 Association for Decentralized Information Management * in Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -45,7 +45,6 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.request.IsLinkedTo; import org.simantics.db.layer0.util.Layer0Utils; import org.simantics.db.service.SerialisationSupport; -import org.simantics.diagram.Logger; import org.simantics.diagram.adapter.GraphToDiagramSynchronizer; import org.simantics.diagram.content.Change; import org.simantics.diagram.content.DiagramContentChanges; @@ -83,12 +82,16 @@ import org.simantics.ui.dnd.LocalObjectTransferable; import org.simantics.ui.selection.WorkbenchSelectionElement; import org.simantics.ui.workbench.e4.E4WorkbenchUtils; import org.simantics.utils.logging.TimeLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This participant populates Elements from ElementClass-resources drops */ public class PopulateElementDropParticipant extends AbstractDiagramParticipant implements IDropTargetParticipant { + private static final Logger LOGGER = LoggerFactory.getLogger(PopulateElementDropParticipant.class); + @Dependency PickContext pickContext; @Dependency TransformUtil transformUtil; @@ -321,7 +324,7 @@ public class PopulateElementDropParticipant extends AbstractDiagramParticipant i }); } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("symbolDropHandler invocation failed", e); } return; diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/expression/InvertBasicExpressionVisitor.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/expression/InvertBasicExpressionVisitor.java index 3f4ccc20b..9101700d0 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/expression/InvertBasicExpressionVisitor.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/expression/InvertBasicExpressionVisitor.java @@ -1,109 +1,15 @@ package org.simantics.modeling.ui.expression; -import java.util.Stack; - -import org.simantics.basicexpression.analysis.DepthFirstAdapter; -import org.simantics.basicexpression.node.AConstantValue; -import org.simantics.basicexpression.node.ADivMultiplicative; -import org.simantics.basicexpression.node.AMultMultiplicative; -import org.simantics.basicexpression.node.APlusExpression; import org.simantics.basicexpression.node.AStringValue; +import org.simantics.modeling.InvertBasicExpressionVisitorBase; import org.simantics.utils.datastructures.Triple; -public class InvertBasicExpressionVisitor extends DepthFirstAdapter { - - Stack stack = new Stack(); - - public Object getResult() { - return stack.pop(); - } - - public void outAConstantValue(AConstantValue node) { - stack.push(Double.valueOf(node.toString())); - } +public class InvertBasicExpressionVisitor extends InvertBasicExpressionVisitorBase { + @Override public void outAStringValue(AStringValue node) { String value = node.toString(); stack.push(Triple.make(1.0, 0.0, value.substring(1, value.length() - 2).trim())); } - @SuppressWarnings("unchecked") - public void outAPlusExpression(APlusExpression node) { - - final Object o1 = stack.pop(); - final Object o2 = stack.pop(); - - if(o1 instanceof Double && o2 instanceof Triple) { - Triple p = (Triple)o2; - stack.push(Triple.make(p.first, p.second + (Double)o1, p.third)); - } else if (o2 instanceof Double && o1 instanceof Triple) { - Triple p = (Triple)o1; - stack.push(Triple.make(p.first, p.second + (Double)o2, p.third)); - } else if (o2 instanceof Double && o1 instanceof Double) { - stack.push((Double)o1 + (Double)o2); - } else { - stack.push(Double.NaN); - } - - } - - @SuppressWarnings("unchecked") - public void outAMinusExpression(APlusExpression node) { - - final Object o1 = stack.pop(); - final Object o2 = stack.pop(); - - if(o1 instanceof Double && o2 instanceof Triple) { - Triple p = (Triple)o2; - stack.push(Triple.make(-p.first, (Double)o1 - p.second, p.third )); - } else if (o2 instanceof Double && o1 instanceof Triple) { - Triple p = (Triple)o1; - stack.push(Triple.make(p.first, p.second - (Double)o2, p.third)); - } else if (o2 instanceof Double && o1 instanceof Double) { - stack.push((Double)o1 - (Double)o2); - } else { - stack.push(Double.NaN); - } - - } - - @SuppressWarnings("unchecked") - public void outAMultMultiplicative(AMultMultiplicative node) { - - final Object o1 = stack.pop(); - final Object o2 = stack.pop(); - - if(o1 instanceof Double && o2 instanceof Triple) { - Triple p = (Triple)o2; - stack.push(Triple.make(p.first * (Double)o1, p.second * (Double)o1, p.third)); - } else if (o2 instanceof Double && o1 instanceof Triple) { - Triple p = (Triple)o1; - stack.push(Triple.make(p.first * (Double)o2, p.second * (Double)o2, p.third)); - } else if (o2 instanceof Double && o1 instanceof Double) { - stack.push((Double)o1 * (Double)o2); - } else { - stack.push(Double.NaN); - } - - } - - @SuppressWarnings("unchecked") - public void outADivMultiplicative(ADivMultiplicative node) { - - final Object o1 = stack.pop(); - final Object o2 = stack.pop(); - - if(o1 instanceof Double && o2 instanceof Triple) { - stack.push(Double.NaN); - } else if (o2 instanceof Double && o1 instanceof Triple) { - Triple p = (Triple)o1; - stack.push(Triple.make(p.first / (Double)o2, p.second / (Double)o2, p.third)); - } else if (o2 instanceof Double && o1 instanceof Double) { - stack.push((Double)o1 / (Double)o2); - } else { - stack.push(Double.NaN); - } - - } - } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/ContextualHelp.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/ContextualHelp.java index 0d0ec7ce6..e7bfd35fa 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/ContextualHelp.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/ContextualHelp.java @@ -20,16 +20,13 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.handlers.HandlerUtil; import org.simantics.Simantics; -import org.simantics.databoard.Bindings; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.UniqueRead; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.variable.Variable; -import org.simantics.modeling.ModelingResources; -import org.simantics.modeling.PropertyVariables; +import org.simantics.modeling.help.HelpContexts; import org.simantics.ui.selection.WorkbenchSelectionUtils; -import org.simantics.utils.ui.AdaptionUtils; import org.slf4j.LoggerFactory; public class ContextualHelp extends AbstractHandler { @@ -47,7 +44,7 @@ public class ContextualHelp extends AbstractHandler { return Simantics.getSession().syncRequest(new UniqueRead() { @Override public String perform(ReadGraph graph) throws DatabaseException { - return getPossibleId(graph, resource, variable, sel); + return HelpContexts.getPossibleId(graph, resource, variable, sel); } }); } catch (DatabaseException e) { @@ -64,34 +61,12 @@ public class ContextualHelp extends AbstractHandler { return null; } + /** + * @deprecated use {@link HelpContexts#getPossibleId(ReadGraph, Resource, Variable, Object)} instead + */ + @Deprecated public static String getPossibleId(ReadGraph graph, Resource resource, Variable variable, ISelection sel) throws DatabaseException { - ModelingResources MOD = ModelingResources.getInstance(graph); - if (resource != null) { - Resource component = graph.getPossibleObject(resource, MOD.ElementToComponent); - String id = component != null ? graph.getPossibleRelatedValue2(component, MOD.contextualHelpId, Bindings.STRING) : null; - if (id != null) - return id; - id = graph.getPossibleRelatedValue2(resource, MOD.contextualHelpId, Bindings.STRING); - if (id != null) - return id; - } - - if (variable != null) { - String id = variable.getPossiblePropertyValue(graph, MOD.contextualHelpId, Bindings.STRING); - if (id != null) - return id; - } - - // TODO: consider removing this block - if (sel != null) { - PropertyVariables vars = AdaptionUtils.adaptToSingle(sel, PropertyVariables.class); - Variable var = vars != null ? vars.getConfiguration() : null; - String id = var != null ? var.getPossiblePropertyValue(graph, MOD.contextualHelpId, Bindings.STRING) : null; - if (id != null) - return id; - } - - return null; + return HelpContexts.getPossibleId(graph, resource, variable, sel); } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/pdf/PDFPainter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/pdf/PDFPainter.java index bec1e5408..0b7cd63e4 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/pdf/PDFPainter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/pdf/PDFPainter.java @@ -89,7 +89,15 @@ public class PDFPainter { ThreadUtils.asyncExec(thread, () -> { try { - PDFBuilder chassis = new PDFBuilder(writer, mapper, pageSize, pageDesc, fitDiagramContentsToPageMargins || isSymbol); + boolean fitToContent = fitDiagramContentsToPageMargins || isSymbol; + if (!fitToContent) { + // Prevent PDF printing from drawing page borders if the + // print area is fitted directly to the page size. + // This avoids unwanted black half-visible edges. + ctx.getDefaultHintContext().setHint(Hints.KEY_DISPLAY_PAGE, false); + } + + PDFBuilder chassis = new PDFBuilder(writer, mapper, pageSize, pageDesc, fitToContent); chassis.paint(ctx, true); } catch (Throwable e) { exception[0] = new DatabaseException(e); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/preferences/CSVPreferencePage.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/preferences/CSVPreferencePage.java index aadd9395a..7a2e7a6eb 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/preferences/CSVPreferencePage.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/preferences/CSVPreferencePage.java @@ -23,8 +23,10 @@ import org.eclipse.jface.preference.IntegerFieldEditor; import org.eclipse.jface.preference.StringFieldEditor; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; import org.eclipse.ui.preferences.ScopedPreferenceStore; @@ -110,7 +112,8 @@ public class CSVPreferencePage extends FieldEditorPreferencePage implements IWor fExtensionEditor = new StringFieldEditor(CSVPreferences.P_CSV_FILE_EXTENSION, "File extension", getFieldEditorParent()); addField(fExtensionEditor); - fResamplingEditor = new BooleanFieldEditor(CSVPreferences.P_CSV_RESAMPLE, "Resampling", getFieldEditorParent()); + fResamplingEditor = new BooleanFieldEditor(CSVPreferences.P_CSV_RESAMPLE, "&Resample", getFieldEditorParent()); + fResamplingEditor.getDescriptionControl(getFieldEditorParent()).setToolTipText("Resample exported data from raw data"); addField(fResamplingEditor); fSamplingModeEditor = new ComboFieldEditor(CSVPreferences.P_CSV_SAMPLING_MODE, "Sampling mode", @@ -127,8 +130,9 @@ public class CSVPreferencePage extends FieldEditorPreferencePage implements IWor return true; } try { + @SuppressWarnings("unused") double number = Double.parseDouble(text); - return number>0; + return true; } catch (NumberFormatException e1) { return false; } @@ -136,6 +140,8 @@ public class CSVPreferencePage extends FieldEditorPreferencePage implements IWor }; fStartEditor.setEmptyStringAllowed(true); fStartEditor.setErrorMessage("Enter valid start time value (s)"); + fStartEditor.getTextControl(getFieldEditorParent()).setToolTipText("Time to start resampling from"); + addField(fStartEditor); fStepEditor = new StringFieldEditor(CSVPreferences.P_CSV_TIME_STEP, "Step size (s)", getFieldEditorParent()) { protected boolean doCheckState() { @@ -153,6 +159,7 @@ public class CSVPreferencePage extends FieldEditorPreferencePage implements IWor }; fStepEditor.setEmptyStringAllowed(true); fStepEditor.setErrorMessage("Enter valid time step value (s)"); + fStepEditor.getTextControl(getFieldEditorParent()).setToolTipText("Time step to use when resampling"); addField(fStepEditor); Group significantDigitsGroup = new Group(getFieldEditorParent(), SWT.NONE); @@ -171,6 +178,8 @@ public class CSVPreferencePage extends FieldEditorPreferencePage implements IWor addField(fDoubleDigitsEditor); GridLayoutFactory.swtDefaults().numColumns(2).applyTo(significantDigitsGroup); + + updateSampling(getPreferenceStore().getBoolean(CSVPreferences.P_CSV_RESAMPLE)); } /** @@ -187,6 +196,8 @@ public class CSVPreferencePage extends FieldEditorPreferencePage implements IWor } else if (source == fColumnSeparatorEditor) { columnSeparatorValue = (String) event.getNewValue(); validate = true; + } else if (source == fResamplingEditor) { + updateSampling(); } if (validate) { if (decimalSeparatorValue.equals(columnSeparatorValue)) { @@ -201,4 +212,16 @@ public class CSVPreferencePage extends FieldEditorPreferencePage implements IWor super.propertyChange(event); } + private void updateSampling() { + updateSampling(fResamplingEditor.getBooleanValue()); + } + + private void updateSampling(boolean resample) { + Label fStartLabel = fStartEditor.getLabelControl(getFieldEditorParent()); + Label fStepLabel = fStepEditor.getLabelControl(getFieldEditorParent()); + Color gray = fStartLabel.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY); + fStartLabel.setForeground(resample ? null : gray); + fStepLabel.setForeground(resample ? null : gray); + } + } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sg/DiagramSceneGraphProvider.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sg/DiagramSceneGraphProvider.java index d3170b950..302e074fc 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sg/DiagramSceneGraphProvider.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sg/DiagramSceneGraphProvider.java @@ -26,6 +26,7 @@ import org.simantics.db.exception.ManyObjectsForFunctionalRelationException; import org.simantics.db.exception.NoSingleResultException; import org.simantics.db.exception.ServiceException; import org.simantics.db.management.ISessionContext; +import org.simantics.db.procedure.Listener; import org.simantics.db.request.Read; import org.simantics.diagram.adapter.DefaultConnectionClassFactory; import org.simantics.diagram.adapter.FlagClassFactory; @@ -35,6 +36,7 @@ import org.simantics.diagram.handler.CopyPasteStrategy; import org.simantics.diagram.handler.DefaultCopyPasteStrategy; import org.simantics.diagram.handler.DeleteHandler; import org.simantics.diagram.handler.SimpleElementTransformHandler; +import org.simantics.diagram.participant.ConnectionCrossingsParticipant; import org.simantics.diagram.query.DiagramRequests; import org.simantics.diagram.runtime.RuntimeDiagramManager; import org.simantics.diagram.stubs.DiagramResource; @@ -97,6 +99,7 @@ import org.simantics.utils.page.PageDesc; import org.simantics.utils.page.PageOrientation; import org.simantics.utils.threads.AWTThread; import org.simantics.utils.threads.IThreadWorkQueue; +import org.simantics.utils.threads.ThreadUtils; import org.simantics.utils.ui.ErrorLogger; @@ -249,6 +252,7 @@ public class DiagramSceneGraphProvider implements ICanvasSceneGraphProvider, IDi ctx.add( new Selection() ); ctx.add( new DiagramParticipant() ); ctx.add( new ElementPainter(true) ); + ctx.add( new ConnectionCrossingsParticipant(resource)); //ctx.add( new ElementHeartbeater() ); ctx.add( new ZOrderHandler() ); @@ -288,6 +292,30 @@ public class DiagramSceneGraphProvider implements ICanvasSceneGraphProvider, IDi DiagramDesc diagramDesc = Simantics.getSession().syncRequest(DiagramRequests.getDiagramDesc(diagramResource)); if (diagramDesc != null) setDiagramDesc(ctx, diagramDesc); + + // Create a listener to react to page setting changes. + Simantics.getSession().asyncRequest(DiagramRequests.getDiagramDesc(diagramResource), new Listener() { + @Override + public void execute(DiagramDesc result) { + if (result != null && ctx != null) { + ThreadUtils.asyncExec(ctx.getThreadAccess(), () -> { + if (ctx != null) { + setDiagramDesc(ctx, result); + } + }); + } + } + + @Override + public void exception(Throwable t) { + ErrorLogger.defaultLogError(t); + } + + @Override + public boolean isDisposed() { + return DiagramSceneGraphProvider.this.ctx == null; + } + }); } catch (DatabaseException e) { ErrorLogger.defaultLogError(e); } @@ -296,7 +324,7 @@ public class DiagramSceneGraphProvider implements ICanvasSceneGraphProvider, IDi protected void setDiagramDesc(ICanvasContext ctx, DiagramDesc diagramDesc) { IHintContext hints = ctx.getDefaultHintContext(); hints.setHint(Hints.KEY_PAGE_DESC, diagramDesc.getPageDesc()); - //hints.setHint(Hints.KEY_DISPLAY_PAGE, diagramDesc.isPageBordersVisible()); + hints.setHint(Hints.KEY_DISPLAY_PAGE, diagramDesc.isPageBordersVisible()); hints.setHint(Hints.KEY_DISPLAY_MARGINS, diagramDesc.isMarginsVisible()); } @@ -348,13 +376,7 @@ public class DiagramSceneGraphProvider implements ICanvasSceneGraphProvider, IDi } try { - - IModelingRules modelingRules = Simantics.getSession().syncRequest(DiagramRequests.getModelingRules(resource, null)); - if (modelingRules != null) { - initialHints.setHint(DiagramModelHints.KEY_MODELING_RULES, modelingRules); - } - - initialHints.setHint(SynchronizationHints.COPY_ADVISOR, getCopyAdvisor()); + fillInitialDiagramHints(initialHints); final RuntimeDiagramManager runtimeDiagramManager = RuntimeDiagramManager.create(Simantics.getSession(), resource, modelURI, RVI); @@ -385,6 +407,15 @@ public class DiagramSceneGraphProvider implements ICanvasSceneGraphProvider, IDi return ctx.getSceneGraph(); } + protected void fillInitialDiagramHints(IHintContext initialHints) throws DatabaseException { + IModelingRules modelingRules = Simantics.getSession().syncRequest(DiagramRequests.getModelingRules(resource, null)); + if (modelingRules != null) { + initialHints.setHint(DiagramModelHints.KEY_MODELING_RULES, modelingRules); + } + + initialHints.setHint(SynchronizationHints.COPY_ADVISOR, getCopyAdvisor()); + } + protected IElementClassProvider createElementClassProvider(ReadGraph graph) throws DatabaseException { DiagramResource dr = DiagramResource.getInstance(graph); return ElementClassProviders.mappedProvider( diff --git a/bundles/org.simantics.modeling/.classpath b/bundles/org.simantics.modeling/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.modeling/.classpath +++ b/bundles/org.simantics.modeling/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.modeling/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.modeling/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.modeling/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.modeling/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.modeling/META-INF/MANIFEST.MF b/bundles/org.simantics.modeling/META-INF/MANIFEST.MF index c1d891b0a..e00a8e114 100644 --- a/bundles/org.simantics.modeling/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.modeling/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Structural Modeling Plug-in Bundle-SymbolicName: org.simantics.modeling;singleton:=true Bundle-Version: 1.1.1.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.simulation;bundle-version="1.0.0", org.simantics.mapping;bundle-version="1.0.0", org.simantics.diagram;bundle-version="0.9.4";visibility:=reexport, @@ -39,7 +39,7 @@ Require-Bundle: org.simantics.simulation;bundle-version="1.0.0", org.simantics.scl.ui;bundle-version="0.5.0", org.slf4j.api, org.simantics.graphfile.ontology, - org.apache.batik, + org.apache.batik;bundle-version="1.12.0", org.simantics.graph.compiler, org.simantics.browsing.ui;bundle-version="1.1.0" Export-Package: org.simantics.modeling, @@ -47,6 +47,7 @@ Export-Package: org.simantics.modeling, org.simantics.modeling.adapters, org.simantics.modeling.export, org.simantics.modeling.flags, + org.simantics.modeling.help, org.simantics.modeling.mapping, org.simantics.modeling.migration, org.simantics.modeling.preferences, diff --git a/bundles/org.simantics.modeling/scl/Simantics/ChangeInformation.scl b/bundles/org.simantics.modeling/scl/Simantics/ChangeInformation.scl new file mode 100644 index 000000000..9d858d9d6 --- /dev/null +++ b/bundles/org.simantics.modeling/scl/Simantics/ChangeInformation.scl @@ -0,0 +1,2 @@ +importJava "org.simantics.modeling.adapters.ChangeInformation" where + data ChangeInformation diff --git a/bundles/org.simantics.modeling/scl/Simantics/Testing.scl b/bundles/org.simantics.modeling/scl/Simantics/Testing.scl index f1ebaf50c..08f9f2868 100644 --- a/bundles/org.simantics.modeling/scl/Simantics/Testing.scl +++ b/bundles/org.simantics.modeling/scl/Simantics/Testing.scl @@ -11,5 +11,6 @@ importJava "org.simantics.modeling.ContentDumps" where pgraphContentDump :: Resource -> Vector Byte graphFileContentDump :: Resource -> Vector Byte structuralComponentContentDump :: Resource -> Vector Byte + structuralComponentTypeContentDump :: Resource -> Vector Byte genericParameterTypeContentDump :: Resource -> Vector Byte diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/ContentDumps.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/ContentDumps.java index 687544e78..39ed968dd 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/ContentDumps.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/ContentDumps.java @@ -2,6 +2,8 @@ package org.simantics.modeling; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; +import java.util.Collection; +import java.util.Map; import java.util.TreeMap; import java.util.TreeSet; @@ -9,6 +11,7 @@ import org.simantics.databoard.Bindings; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.utils.CommonDBUtils; +import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; @@ -47,12 +50,10 @@ public class ContentDumps { return graph.getRelatedValue(resource, GF.HasFiledata, Bindings.BYTE_ARRAY); } - public static byte[] structuralComponentContentDump(ReadGraph graph, Resource resource) throws DatabaseException { - - StringBuilder dump = new StringBuilder(); + private static StringBuilder structuralComponentContentDump(ReadGraph graph, Resource resource, StringBuilder dump) throws DatabaseException { Variable v = Variables.getVariable(graph, resource); - + TreeSet types = new TreeSet<>(); for(Resource t : graph.getPrincipalTypes(resource)) { types.add(graph.getURI(t)); @@ -87,6 +88,47 @@ public class ContentDumps { dump.append("\n"); } } + + return dump; + } + + public static byte[] structuralComponentContentDump(ReadGraph graph, Resource resource) throws DatabaseException { + return structuralComponentContentDump(graph, resource, new StringBuilder()).toString().getBytes(UTF8); + } + + public static byte[] structuralComponentTypeContentDump(ReadGraph graph, Resource resource) throws DatabaseException { + StringBuilder dump = structuralComponentContentDump(graph, resource, new StringBuilder()); + + StructuralResource2 STR = StructuralResource2.getInstance(graph); + + // Dump procedural component type code if present + String proceduralCode = graph.getPossibleRelatedValue(resource, STR.ProceduralComponentType_code, Bindings.STRING); + if (proceduralCode != null) { + dump + .append("\n---- ProceduralComponentType.code begins ----\n") + .append(proceduralCode) + .append("---- ProceduralComponentType.code ends ----\n"); + } + + // Dump component type SCL scripts + Collection scripts = graph.getObjects(resource, STR.ComponentType_hasScript); + if (!scripts.isEmpty()) { + dump.append("\nComponentType.hasScript (").append(scripts.size()).append(")\n"); + TreeMap sortedScripts = new TreeMap<>(); + for (Resource script : scripts) + sortedScripts.put(NameUtils.getSafeName(graph, script), script); + for (Map.Entry entry : sortedScripts.entrySet()) { + String name = entry.getKey(); + Resource script = entry.getValue(); + String type = graph.getPossibleRelatedValue(script, STR.ComponentTypeScript_type, Bindings.STRING); + String code = graph.getPossibleRelatedValue(script, STR.ComponentTypeScript_code, Bindings.STRING); + dump + .append("---- script `").append(name).append("` of type `").append(type).append("` begins ----\n") + .append(code) + .append("\n---- script `").append(name).append("` of type `").append(type).append("` ends ----\n"); + } + } + return dump.toString().getBytes(UTF8); } diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/InvertBasicExpressionVisitor.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/InvertBasicExpressionVisitor.java index 5bcce3ee4..6293cbac9 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/InvertBasicExpressionVisitor.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/InvertBasicExpressionVisitor.java @@ -1,14 +1,6 @@ package org.simantics.modeling; -import java.util.Stack; - import org.simantics.basicexpression.Expressions; -import org.simantics.basicexpression.analysis.DepthFirstAdapter; -import org.simantics.basicexpression.node.AConstantValue; -import org.simantics.basicexpression.node.ADivMultiplicative; -import org.simantics.basicexpression.node.AMultMultiplicative; -import org.simantics.basicexpression.node.APlusExpression; -import org.simantics.basicexpression.node.AVariablePrimary; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -19,110 +11,14 @@ import org.simantics.structural.stubs.StructuralResource2; import org.simantics.utils.datastructures.Pair; import org.simantics.utils.datastructures.Triple; -public class InvertBasicExpressionVisitor extends DepthFirstAdapter { - - Stack stack = new Stack(); - - public Object getResult() { - if(stack.size() != 1) return null; - return stack.pop(); - } - - public void outAConstantValue(AConstantValue node) { - stack.push(Double.valueOf(node.toString())); - } - - @Override - public void outAVariablePrimary(AVariablePrimary node) { - String value = node.toString().trim(); - stack.push(Triple.make(1.0, 0.0, value)); - } - - @SuppressWarnings("unchecked") - public void outAPlusExpression(APlusExpression node) { - - final Object o1 = stack.pop(); - final Object o2 = stack.pop(); - - if(o1 instanceof Double && o2 instanceof Triple) { - Triple p = (Triple)o2; - stack.push(Triple.make(p.first, p.second + (Double)o1, p.third)); - } else if (o2 instanceof Double && o1 instanceof Triple) { - Triple p = (Triple)o1; - stack.push(Triple.make(p.first, p.second + (Double)o2, p.third)); - } else if (o2 instanceof Double && o1 instanceof Double) { - stack.push((Double)o1 + (Double)o2); - } else { - stack.push(Double.NaN); - } - - } - - @SuppressWarnings("unchecked") - public void outAMinusExpression(APlusExpression node) { - - final Object o1 = stack.pop(); - final Object o2 = stack.pop(); - - if(o1 instanceof Double && o2 instanceof Triple) { - Triple p = (Triple)o2; - stack.push(Triple.make(-p.first, (Double)o1 - p.second, p.third )); - } else if (o2 instanceof Double && o1 instanceof Triple) { - Triple p = (Triple)o1; - stack.push(Triple.make(p.first, p.second - (Double)o2, p.third)); - } else if (o2 instanceof Double && o1 instanceof Double) { - stack.push((Double)o1 - (Double)o2); - } else { - stack.push(Double.NaN); - } - - } - - @SuppressWarnings("unchecked") - public void outAMultMultiplicative(AMultMultiplicative node) { - - final Object o1 = stack.pop(); - final Object o2 = stack.pop(); - - if(o1 instanceof Double && o2 instanceof Triple) { - Triple p = (Triple)o2; - stack.push(Triple.make(p.first * (Double)o1, p.second * (Double)o1, p.third)); - } else if (o2 instanceof Double && o1 instanceof Triple) { - Triple p = (Triple)o1; - stack.push(Triple.make(p.first * (Double)o2, p.second * (Double)o2, p.third)); - } else if (o2 instanceof Double && o1 instanceof Double) { - stack.push((Double)o1 * (Double)o2); - } else { - stack.push(Double.NaN); - } - - } - - @SuppressWarnings("unchecked") - public void outADivMultiplicative(ADivMultiplicative node) { - - final Object o1 = stack.pop(); - final Object o2 = stack.pop(); - - if(o1 instanceof Double && o2 instanceof Triple) { - stack.push(Double.NaN); - } else if (o2 instanceof Double && o1 instanceof Triple) { - Triple p = (Triple)o1; - stack.push(Triple.make(p.first / (Double)o2, p.second / (Double)o2, p.third)); - } else if (o2 instanceof Double && o1 instanceof Double) { - stack.push((Double)o1 / (Double)o2); - } else { - stack.push(Double.NaN); - } - - } +public class InvertBasicExpressionVisitor extends InvertBasicExpressionVisitorBase { private static final String MAGIC = "_111_"; - + private static String replaced(String expression) { return expression.replaceAll("\\.([A-Za-z])", MAGIC + "$1"); } - + public static void invert(WriteGraph graph, Variable base, String expression, Object value) throws DatabaseException { InvertBasicExpressionVisitor visitor = new InvertBasicExpressionVisitor(); Expressions.evaluate(replaced(expression), visitor); @@ -208,26 +104,36 @@ public class InvertBasicExpressionVisitor extends DepthFirstAdapter { } - public static Variable possibleInvertibleExpressionReferencedProperty(ReadGraph graph, Variable base, String expression) throws DatabaseException { + @SuppressWarnings("unchecked") + private static Triple possibleInvertibleExpression(ReadGraph graph, Variable base, String expression) throws DatabaseException { if (base == null || expression == null || expression.isEmpty()) return null; InvertBasicExpressionVisitor visitor = new InvertBasicExpressionVisitor(); //System.out.println("invert : " + expression + " -> " + replaced(expression) + " for " + base.getURI(graph)); Expressions.evaluate(replaced(expression), visitor); - Object pair = visitor.getResult(); - if(pair == null) - return null; - if(pair instanceof Triple) { - @SuppressWarnings("unchecked") - Triple data = (Triple)pair; - String key = data.third.replace(MAGIC,"."); - String path = getVariablePath(graph, base, key); - if (path == null) - return null; - Variable targetVariable = base.browsePossible(graph, path); - return targetVariable; - } + Object result = visitor.getResult(); + if (result instanceof Triple) + return (Triple) result; return null; } + public static Variable possibleInvertibleExpressionReferencedProperty(ReadGraph graph, Variable base, String expression) throws DatabaseException { + Triple data = possibleInvertibleExpression(graph, base, expression); + if (data == null) + return null; + String path = getVariablePath(graph, base, data.third.replace(MAGIC, ".")); + return path != null ? base.browsePossible(graph, path) : null; + } + + public static Triple possibleInvertibleExpressionReferencedTransformedProperty(ReadGraph graph, Variable base, String expression) throws DatabaseException { + Triple data = possibleInvertibleExpression(graph, base, expression); + if (data == null) + return null; + String path = getVariablePath(graph, base, data.third.replace(MAGIC, ".")); + if (path == null) + return null; + Variable targetVariable = base.browsePossible(graph, path); + return targetVariable != null ? Triple.make(data.first, data.second, targetVariable) : null; + } + } diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/InvertBasicExpressionVisitorBase.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/InvertBasicExpressionVisitorBase.java new file mode 100644 index 000000000..8ccf5c28c --- /dev/null +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/InvertBasicExpressionVisitorBase.java @@ -0,0 +1,141 @@ +/******************************************************************************* + * Copyright (c) 2020 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Semantum Oy - initial API and implementation + *******************************************************************************/ +package org.simantics.modeling; + +import java.util.Stack; + +import org.simantics.basicexpression.analysis.DepthFirstAdapter; +import org.simantics.basicexpression.node.AConstantValue; +import org.simantics.basicexpression.node.ADivMultiplicative; +import org.simantics.basicexpression.node.AMinusExpression; +import org.simantics.basicexpression.node.AMultMultiplicative; +import org.simantics.basicexpression.node.APlusExpression; +import org.simantics.basicexpression.node.AVariablePrimary; +import org.simantics.utils.datastructures.Triple; + +/** + * @author Tuukka Lehtonen + */ +public class InvertBasicExpressionVisitorBase extends DepthFirstAdapter { + + protected Stack stack = new Stack<>(); + + public InvertBasicExpressionVisitorBase() { + super(); + } + + public Object getResult() { + if(stack.size() != 1) return null; + return stack.pop(); + } + + @Override + public void outAConstantValue(AConstantValue node) { + stack.push(Double.valueOf(node.toString())); + } + + @Override + public void outAVariablePrimary(AVariablePrimary node) { + String value = node.toString().trim(); + stack.push(Triple.make(1.0, 0.0, value)); + } + + @SuppressWarnings("unchecked") + @Override + public void outAPlusExpression(APlusExpression node) { + + final Object o1 = stack.pop(); + final Object o2 = stack.pop(); + + if(o1 instanceof Double && o2 instanceof Triple) { + Triple p = (Triple)o2; + stack.push(Triple.make(p.first, p.second + (Double)o1, p.third)); + } else if (o2 instanceof Double && o1 instanceof Triple) { + Triple p = (Triple)o1; + stack.push(Triple.make(p.first, p.second + (Double)o2, p.third)); + } else if (o2 instanceof Double && o1 instanceof Double) { + stack.push((Double)o1 + (Double)o2); + } else { + stack.push(Double.NaN); + } + + } + + @SuppressWarnings("unchecked") + @Override + public void outAMinusExpression(AMinusExpression node) { + + final Object o1 = stack.pop(); + final Object o2 = stack.pop(); + + // o2 - o1 + if(o1 instanceof Double && o2 instanceof Triple) { + // o2 - double o1 + Triple p = (Triple)o2; + stack.push(Triple.make(p.first, p.second - (Double)o1, p.third)); + } else if (o2 instanceof Double && o1 instanceof Triple) { + // double o2 - o1 + Triple p = (Triple)o1; + stack.push(Triple.make(-p.first, (Double)o2 - p.second, p.third)); + } else if (o2 instanceof Double && o1 instanceof Double) { + stack.push((Double)o2 - (Double)o1); + } else { + stack.push(Double.NaN); + } + + } + + @SuppressWarnings("unchecked") + @Override + public void outAMultMultiplicative(AMultMultiplicative node) { + + final Object o1 = stack.pop(); + final Object o2 = stack.pop(); + + if(o1 instanceof Double && o2 instanceof Triple) { + Triple p = (Triple)o2; + stack.push(Triple.make(p.first * (Double)o1, p.second * (Double)o1, p.third)); + } else if (o2 instanceof Double && o1 instanceof Triple) { + Triple p = (Triple)o1; + stack.push(Triple.make(p.first * (Double)o2, p.second * (Double)o2, p.third)); + } else if (o2 instanceof Double && o1 instanceof Double) { + stack.push((Double)o1 * (Double)o2); + } else { + stack.push(Double.NaN); + } + + } + + @SuppressWarnings("unchecked") + @Override + public void outADivMultiplicative(ADivMultiplicative node) { + + final Object o1 = stack.pop(); + final Object o2 = stack.pop(); + + // o2 / o1 + if(o1 instanceof Double && o2 instanceof Triple) { + // o2 / double o1 + Triple p = (Triple)o2; + stack.push(Triple.make(p.first / (Double)o1, p.second / (Double)o1, p.third)); + } else if (o2 instanceof Double && o1 instanceof Triple) { + // double o2 / o1 + stack.push(Double.NaN); + } else if (o2 instanceof Double && o1 instanceof Double) { + stack.push((Double)o2 / (Double)o1); + } else { + stack.push(Double.NaN); + } + + } + +} \ No newline at end of file diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/ModelingUtils.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/ModelingUtils.java index 1edf3cd31..a42e51a16 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/ModelingUtils.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/ModelingUtils.java @@ -70,6 +70,7 @@ import org.simantics.db.Session; import org.simantics.db.Statement; import org.simantics.db.VirtualGraph; import org.simantics.db.WriteGraph; +import org.simantics.db.WriteOnlyGraph; import org.simantics.db.common.Indexing; import org.simantics.db.common.NamedResource; import org.simantics.db.common.QueryMemoryWatcher; @@ -82,10 +83,10 @@ import org.simantics.db.common.request.ObjectsWithType; import org.simantics.db.common.request.PossibleIndexRoot; import org.simantics.db.common.request.ReadRequest; import org.simantics.db.common.request.ResourceRead2; +import org.simantics.db.common.request.WriteOnlyRequest; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.common.request.WriteResultRequest; import org.simantics.db.common.utils.ListUtils; -import org.simantics.db.common.utils.Logger; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.common.utils.OrderedSetUtils; import org.simantics.db.common.utils.VersionInfo; @@ -123,7 +124,6 @@ import org.simantics.db.layer0.util.SimanticsKeys; import org.simantics.db.layer0.util.TransferableGraphConfiguration2; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; -import org.simantics.db.request.Read; import org.simantics.db.service.ClusterControl; import org.simantics.db.service.CollectionSupport; import org.simantics.db.service.GraphChangeListenerSupport; @@ -166,12 +166,16 @@ import org.simantics.utils.datastructures.Pair; import org.simantics.utils.datastructures.Triple; import org.simantics.utils.datastructures.hints.HintContext; import org.simantics.utils.ui.dialogs.ListDialog; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author Hannu Niemistö */ public class ModelingUtils { + private static final Logger LOGGER = LoggerFactory.getLogger(ModelingUtils.class); + private ReadGraph g; private WriteGraph wg; public Layer0 b; @@ -478,7 +482,7 @@ public class ModelingUtils { } catch (Exception e) { - Logger.defaultLogError(e); + LOGGER.error("Model import failed", e); } } @@ -598,7 +602,9 @@ public class ModelingUtils { } public static void untrackDependencies() { - untrackDependencies(Simantics.getSession()); + Session s = Simantics.peekSession(); + if (s != null) + untrackDependencies(s); } public static void untrackDependencies(RequestProcessor processor) { @@ -615,7 +621,7 @@ public class ModelingUtils { }); } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("untrackDependenices failed", e); } } @@ -638,7 +644,7 @@ public class ModelingUtils { }); } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("trackDependenices failed", e); } } @@ -1256,7 +1262,7 @@ public class ModelingUtils { return advisor.getRoot(); } catch (Throwable t) { - Logger.defaultLogError("Unexpected exception while importing diagram template.", t); + LOGGER.error("Unexpected exception while importing diagram template.", t); } finally { } @@ -1442,7 +1448,7 @@ public class ModelingUtils { Variant draftStatus = dc.metadata.get(DraftStatusBean.EXTENSION_KEY); return MigrationUtils.importSharedOntology(Simantics.getSession(), tg, draftStatus == null); } catch (Exception e) { - Logger.defaultLogError(e); + LOGGER.error("importSharedOntologyWithResult failed", e); throw e; } } @@ -2459,16 +2465,34 @@ public class ModelingUtils { return DiagramGraphUtil.getModelingRules(graph, diagramResource, null); } + //------------------------------------------------------------------------- + + private static final String VG_CHANGE_INFORMATION = "changeInformation"; //$NON-NLS-1$ + public static void markChanged(WriteGraph graph, Resource r) throws DatabaseException { - VirtualGraphSupport support = Simantics.getSession().getService(VirtualGraphSupport.class); - VirtualGraph vg = support.getWorkspacePersistent("changeInformation"); - graph.syncRequest(new WriteRequest(vg) { + VirtualGraph vg = Simantics.getSession().getService(VirtualGraphSupport.class) + .getWorkspacePersistent(VG_CHANGE_INFORMATION); + ModelingResources MOD = ModelingResources.getInstance(graph); + graph.syncRequest(new WriteOnlyRequest(vg) { @Override - public void perform(WriteGraph graph) throws DatabaseException { - ModelingResources MOD = ModelingResources.getInstance(graph); + public void perform(WriteOnlyGraph graph) throws DatabaseException { graph.claim(r, MOD.changed, MOD.changed, r); } }); } - + + public static void markChanged(RequestProcessor processor, Iterable rs) throws DatabaseException { + VirtualGraph vg = Simantics.getSession().getService(VirtualGraphSupport.class) + .getWorkspacePersistent(VG_CHANGE_INFORMATION); + ModelingResources MOD = ModelingResources.getInstance(processor); + processor.syncRequest(new WriteOnlyRequest(vg) { + @Override + public void perform(WriteOnlyGraph graph) throws DatabaseException { + for (Resource r : rs) { + graph.claim(r, MOD.changed, MOD.changed, r); + } + } + }); + } + } diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/ProceduralSubstructureMapRequest.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/ProceduralSubstructureMapRequest.java index e8c54fa98..6256891b8 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/ProceduralSubstructureMapRequest.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/ProceduralSubstructureMapRequest.java @@ -3,6 +3,7 @@ package org.simantics.modeling; import gnu.trove.map.hash.THashMap; import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.request.PropertyInfo; import org.simantics.db.layer0.request.PropertyInfoRequest; @@ -21,19 +22,28 @@ public class ProceduralSubstructureMapRequest extends VariableRead> perform(ReadGraph graph) throws DatabaseException { THashMap> propertyMap = new THashMap>(); for(Variable child : variable.getChildren(graph)) { - for(Variable property : child.getProperties(graph)) { - PropertyInfo propertyInfo = graph.syncRequest(new PropertyInfoRequest(property.getPredicateResource(graph))); + for(Variable property : child.getProperties(graph)) { + Resource predicate = property.getPossiblePredicateResource(graph); + if (predicate == null) + continue; + + PropertyInfo propertyInfo = graph.syncRequest(new PropertyInfoRequest(predicate)); propertyMap.put(child.getName(graph) + "." + propertyInfo.name, Pair.make("/" + child.getName(graph) + "#" + propertyInfo.name, SCLTypeUtils.getType(propertyInfo))); - } + } } - for(Variable property : variable.getProperties(graph)) { - PropertyInfo propertyInfo = graph.syncRequest(new PropertyInfoRequest(property.getPredicateResource(graph))); + for(Variable property : variable.getProperties(graph)) { + Resource predicate = property.getPossiblePredicateResource(graph); + if (predicate == null) + continue; + + PropertyInfo propertyInfo = graph.syncRequest(new PropertyInfoRequest(predicate)); propertyMap.put(propertyInfo.name, Pair.make("#" + propertyInfo.name, SCLTypeUtils.getType(propertyInfo))); - } + } + return propertyMap; } diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLAction.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLAction.java index 47c7d3466..ba7e7117f 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLAction.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLAction.java @@ -8,11 +8,14 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.ActionFactory; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; -import org.simantics.diagram.Logger; import org.simantics.scl.runtime.function.Function1; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SCLAction implements ActionFactory { + private static final Logger LOGGER = LoggerFactory.getLogger(SCLAction.class); + final private Resource rule; public SCLAction(ReadGraph graph, Resource rule) throws DatabaseException { @@ -52,7 +55,7 @@ public class SCLAction implements ActionFactory { Function1 function = Simantics.getSession().syncRequest(new RuleFunctionRequest(rule)); function.apply(resource); } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("SCLActionRunnable failed to request/apply RuleFunction {}", rule, e); } } diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLDropAction.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLDropAction.java index 74b19a214..f1d385545 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLDropAction.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLDropAction.java @@ -8,11 +8,14 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.DropActionFactory; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; -import org.simantics.diagram.Logger; import org.simantics.scl.runtime.function.Function3; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SCLDropAction implements DropActionFactory { + private static final Logger LOGGER = LoggerFactory.getLogger(SCLDropAction.class); + final private Resource rule; public SCLDropAction(ReadGraph graph, Resource rule) throws DatabaseException { @@ -55,7 +58,7 @@ public class SCLDropAction implements DropActionFactory { Function3 function = Simantics.getSession().syncRequest(new RuleFunctionRequest(rule)); function.apply(target, source, operation); } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("SCLDropActionRunnable failed to request/apply RuleFunction {}", rule, e); } } diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java index fad803ce4..82115ef0e 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java @@ -51,6 +51,7 @@ import org.simantics.g2d.canvas.ICanvasContext; import org.simantics.g2d.diagram.DiagramHints; import org.simantics.g2d.diagram.IDiagram; import org.simantics.g2d.diagram.handler.DataElementMap; +import org.simantics.g2d.diagram.participant.ElementPainter.SelectionShapeNode; import org.simantics.g2d.diagram.participant.Selection; import org.simantics.g2d.element.IElement; import org.simantics.g2d.scenegraph.ICanvasSceneGraphProvider; @@ -914,6 +915,39 @@ public class SCLScenegraph { parentBuilder.append(ALL_SECTIONS, "\n"); } } + } else if (node instanceof TextNode) { + TextNode text = (TextNode)node; + + SingleElementNode parentSEN = (SingleElementNode)NodeUtil.getNearestParentOfType(node, SingleElementNode.class); + if(parentSEN != null) { + + text.setShowSelection(false); + Element doc = renderSVGNode(svgGenerator, (IG2DNode)node); + String svg = printSVGDocument(doc); + parentBuilder.append(MAIN_SECTION, svg); + + RenderSVGContext parentBuilder2 = getParentBuilder(parentSEN); + + String key = getKey(parentSEN); + text.setShowSelection(true); + doc = renderSVGNode(svgGenerator, (IG2DNode)node); + svg = printSVGDocument(doc); + + parentBuilder2.append(SELECTION_SECTION, "\n"); + parentBuilder2.append(SELECTION_SECTION, svg); + parentBuilder2.append(SELECTION_SECTION, "\n"); + parentBuilder2.append(SELECTION_MASK_SECTION, "\n"); + Rectangle2D rect = text.getBounds(); + // NaN + if(rect.getHeight() == rect.getHeight() && rect.getWidth() == rect.getWidth()) { + parentBuilder2.append(SELECTION_MASK_SECTION,""); + } + parentBuilder2.append(SELECTION_MASK_SECTION,"\n"); + + } } else if (!(node instanceof RouteGraphNode) && !(node instanceof LinkNode)){ try { Element doc = renderSVGNode(svgGenerator, (IG2DNode)node); @@ -931,9 +965,31 @@ public class SCLScenegraph { if (!hasContent) return; String svg = printSVGDocument(doc); - parentBuilder.append(MAIN_SECTION, ""); - parentBuilder.append(MAIN_SECTION, svg); - parentBuilder.append(MAIN_SECTION, "\n"); + if (node instanceof SelectionShapeNode) { + SingleElementNode parentSEN = (SingleElementNode)NodeUtil.getNearestParentOfType(node, SingleElementNode.class); + if(parentSEN != null) { + String key = getKey(parentSEN); + RenderSVGContext parentBuilder2 = getParentBuilder(parentSEN); + parentBuilder2.append(SELECTION_SECTION, "\n"); + parentBuilder2.append(SELECTION_SECTION, svg); + parentBuilder2.append(SELECTION_SECTION, "\n"); + + parentBuilder2.append(SELECTION_MASK_SECTION, "\n"); + Rectangle2D rect = node.getBounds(); + // NaN + if(rect.getHeight() == rect.getHeight() && rect.getWidth() == rect.getWidth()) { + parentBuilder2.append(SELECTION_MASK_SECTION,""); + } + parentBuilder2.append(SELECTION_MASK_SECTION,"\n"); + } + } else { + parentBuilder.append(MAIN_SECTION, ""); + parentBuilder.append(MAIN_SECTION, svg); + parentBuilder.append(MAIN_SECTION, "\n"); + } } catch (Exception e) { // TODO: There are nodes that do not behave well when rendered to SVG. For backwards compatibility, we don't handle the exceptions. } diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLTypeUtils.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLTypeUtils.java index 27955fb7e..eeabbd960 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLTypeUtils.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLTypeUtils.java @@ -13,6 +13,7 @@ import org.simantics.databoard.type.LongType; import org.simantics.databoard.type.StringType; import org.simantics.db.layer0.request.PropertyInfo; import org.simantics.scl.compiler.types.TCon; +import org.simantics.scl.compiler.types.TVar; import org.simantics.scl.compiler.types.Type; import org.simantics.scl.compiler.types.Types; import org.simantics.scl.compiler.types.kinds.Kinds; @@ -23,6 +24,8 @@ public class SCLTypeUtils { private static final Logger LOGGER = LoggerFactory.getLogger(SCLTypeUtils.class); private static final THashMap TYPE_MAP = new THashMap(); + private static final TVar STAR = Types.var(Kinds.STAR); + private static void add(TCon type) { TYPE_MAP.put(type.name, type); } @@ -66,6 +69,7 @@ public class SCLTypeUtils { Types.functionE(new Type[] {variable, Types.RESOURCE}, Types.READ_GRAPH, Types.RESOURCE)); add((TCon)Types.RESOURCE); + add(Types.con("Simantics/ChangeInformation", "ChangeInformation")); // MOD.ChangeInformation add(Types.con("Simantics/GUID", "GUID")); // L0.GUID add(Types.con("Simantics/Variables", "StructuredProperty")); // L0.methods add(Types.con("Simantics/Variables", "ValueAccessor")); // L0.ValueAccessor @@ -81,7 +85,7 @@ public class SCLTypeUtils { Type type = TYPE_MAP.get(typeText); if(type == null) { LOGGER.warn("SCLTypeUtils.getType cannot transform '" + typeText + "' to type. Returns a as default."); - return Types.var(Kinds.STAR); + return STAR; } return type; } @@ -105,18 +109,23 @@ public class SCLTypeUtils { return Types.list(getType(((ArrayType)dataType).componentType)); else { LOGGER.warn("SCLTypeUtils.getType cannot transform data type '" + dataType + "' to type. Returns a as default."); - return Types.var(Kinds.STAR); + return STAR; } } - public static Type getType(PropertyInfo propertyInfo) { + public static Type getType(PropertyInfo propertyInfo, boolean warnOfNoTypeInformation) { if(propertyInfo.requiredValueType != null) return getType(propertyInfo.requiredValueType); else if(propertyInfo.requiredDatatype != null) return getType(propertyInfo.requiredDatatype); else { - LOGGER.warn(propertyInfo.name + " doesn't have type information. Returns a as default."); - return Types.var(Kinds.STAR); + if (warnOfNoTypeInformation) + LOGGER.warn(propertyInfo.name + " doesn't have type information. Returns a as default."); + return STAR; } } + + public static Type getType(PropertyInfo propertyInfo) { + return getType(propertyInfo, propertyInfo.isHasProperty); + } } diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/actions/Help.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/actions/Help.java index ba1243108..22327aeb3 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/actions/Help.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/actions/Help.java @@ -16,38 +16,36 @@ import org.simantics.Simantics; import org.simantics.databoard.Bindings; import org.simantics.db.Resource; import org.simantics.db.common.primitiverequest.PossibleRelatedValue2; -import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.ActionFactory; import org.simantics.modeling.ModelingResources; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class Help implements ActionFactory { + private static final Logger LOGGER = LoggerFactory.getLogger(Help.class); + @Override public Runnable create(Object target) { - - if(!(target instanceof Resource)) + if (!(target instanceof Resource)) return null; - final Resource resource = (Resource)target; - - return new Runnable() { - @Override - public void run() { - - try { - ModelingResources MOD = ModelingResources.getInstance(Simantics.getSession()); - String id = Simantics.sync(new PossibleRelatedValue2(resource, MOD.contextualHelpId, Bindings.STRING)); - if(id == null) { - PlatformUI.getWorkbench().getHelpSystem().displayDynamicHelp(); - return; - } - PlatformUI.getWorkbench().getHelpSystem().displayHelp(id); - } catch (DatabaseException e) { - Logger.defaultLogError(e); + final Resource resource = (Resource) target; + + return () -> { + try { + ModelingResources MOD = ModelingResources.getInstance(Simantics.getSession()); + String id = Simantics.sync(new PossibleRelatedValue2(resource, MOD.contextualHelpId, Bindings.STRING)); + if (id == null) { + PlatformUI.getWorkbench().getHelpSystem().displayDynamicHelp(); + return; } - + PlatformUI.getWorkbench().getHelpSystem().displayHelp(id); + } catch (DatabaseException e) { + LOGGER.error("Failed to display help for resource {}", resource, e); } }; } + } diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/help/HelpContexts.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/help/HelpContexts.java new file mode 100644 index 000000000..ca25cf417 --- /dev/null +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/help/HelpContexts.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2020 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Semantum Oy- initial API and implementation + *******************************************************************************/ +package org.simantics.modeling.help; + +import org.simantics.databoard.Bindings; +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.variable.Variable; +import org.simantics.modeling.ModelingResources; +import org.simantics.modeling.PropertyVariables; +import org.simantics.utils.ui.AdaptionUtils; + +/** + * @author Tuukka Lehtonen + * @since 1.46.0 + */ +public class HelpContexts { + + /** + * @param graph + * @param resource + * @param variable + * @param selection optional ISelection + * @return + * @throws DatabaseException + */ + public static String getPossibleId(ReadGraph graph, Resource resource, Variable variable, Object selection) throws DatabaseException { + ModelingResources MOD = ModelingResources.getInstance(graph); + if (resource != null) { + Resource component = graph.getPossibleObject(resource, MOD.ElementToComponent); + String id = component != null ? graph.getPossibleRelatedValue2(component, MOD.contextualHelpId, Bindings.STRING) : null; + if (id != null) + return id; + id = graph.getPossibleRelatedValue2(resource, MOD.contextualHelpId, Bindings.STRING); + if (id != null) + return id; + } + + if (variable != null) { + String id = variable.getPossiblePropertyValue(graph, MOD.contextualHelpId, Bindings.STRING); + if (id != null) + return id; + } + + // TODO: consider removing this block + if (selection != null) { + PropertyVariables vars = AdaptionUtils.adaptToSingle(selection, PropertyVariables.class); + Variable var = vars != null ? vars.getConfiguration() : null; + String id = var != null ? var.getPossiblePropertyValue(graph, MOD.contextualHelpId, Bindings.STRING) : null; + if (id != null) + return id; + } + + return null; + } + + public static String getPossibleId(ReadGraph graph, Variable variable, String property) throws DatabaseException { + ModelingResources MOD = ModelingResources.getInstance(graph); + Variable prop = variable != null ? variable.getPossibleProperty(graph, property) : null; + return prop != null ? prop.getPossiblePropertyValue(graph, MOD.contextualHelpId, Bindings.STRING) : null; + } + +} diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/mapping/ComponentCopyAdvisor.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/mapping/ComponentCopyAdvisor.java index 3e6e9c1b9..021ecc436 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/mapping/ComponentCopyAdvisor.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/mapping/ComponentCopyAdvisor.java @@ -32,7 +32,6 @@ import org.simantics.modeling.ModelingUtils; import org.simantics.modeling.services.ComponentNamingUtil; import org.simantics.modeling.services.NamingException; import org.simantics.project.IProject; -import org.simantics.structural.stubs.StructuralResource2; import gnu.trove.map.hash.THashMap; @@ -58,7 +57,6 @@ public class ComponentCopyAdvisor extends GraphCopyAdvisor { @Override public Object copy(ISynchronizationContext context, WriteGraph graph, Resource source, Resource sourceContainer, Resource targetContainer, Map map) throws DatabaseException { - StructuralResource2 STR = StructuralResource2.getInstance(graph); Resource copy = CopyAdvisorUtil.copy2(graph, source, null, map); Layer0 L0 = Layer0.getInstance(graph); diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileProceduralSCLMonitorRequest.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileProceduralSCLMonitorRequest.java index 4c7964513..79eb3d6ba 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileProceduralSCLMonitorRequest.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileProceduralSCLMonitorRequest.java @@ -11,7 +11,7 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.request.VariableRead; import org.simantics.db.layer0.scl.AbstractExpressionCompilationContext; import org.simantics.db.layer0.scl.AbstractExpressionCompilationRequest; -import org.simantics.db.layer0.util.RuntimeEnvironmentRequest; +import org.simantics.db.layer0.util.RuntimeEnvironmentRequest2; import org.simantics.db.layer0.variable.Variable; import org.simantics.layer0.Layer0; import org.simantics.modeling.ProceduralSubstructureMapRequest; @@ -88,7 +88,7 @@ public class CompileProceduralSCLMonitorRequest extends AbstractExpressionCompil public CompilationContext perform(ReadGraph graph) throws DatabaseException { Resource indexRoot = graph.syncRequest(new IndexRoot(componentType)); - RuntimeEnvironment runtimeEnvironment = graph.syncRequest(new RuntimeEnvironmentRequest(indexRoot)); + RuntimeEnvironment runtimeEnvironment = graph.syncRequest(new RuntimeEnvironmentRequest2(componentType, indexRoot)); THashMap> propertyMap = graph.sync(new ProceduralSubstructureMapRequest(componentVariable)); return new CompilationContext(runtimeEnvironment, propertyMap); diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileSCLMonitorRequest.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileSCLMonitorRequest.java index dfea83931..b9ec1affc 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileSCLMonitorRequest.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileSCLMonitorRequest.java @@ -9,7 +9,7 @@ import org.simantics.db.common.request.ResourceRead; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.scl.AbstractExpressionCompilationContext; import org.simantics.db.layer0.scl.AbstractExpressionCompilationRequest; -import org.simantics.db.layer0.util.RuntimeEnvironmentRequest; +import org.simantics.db.layer0.util.RuntimeEnvironmentRequest2; import org.simantics.db.layer0.variable.Variable; import org.simantics.layer0.Layer0; import org.simantics.modeling.ComponentTypeSubstructure; @@ -114,7 +114,7 @@ public class CompileSCLMonitorRequest extends AbstractExpressionCompilationReque public CompilationContext perform(ReadGraph graph) throws DatabaseException { Resource indexRoot = graph.syncRequest(new IndexRoot(resource)); - RuntimeEnvironment runtimeEnvironment = graph.syncRequest(new RuntimeEnvironmentRequest(indexRoot)); + RuntimeEnvironment runtimeEnvironment = graph.syncRequest(new RuntimeEnvironmentRequest2(resource, indexRoot)); return new CompilationContext(runtimeEnvironment, ComponentTypeSubstructure.forType(graph, resource)); } }); diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileSCLQueryRequest.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileSCLQueryRequest.java index 1cef75ddf..dab7aa0e7 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileSCLQueryRequest.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileSCLQueryRequest.java @@ -7,8 +7,8 @@ import org.simantics.db.Resource; import org.simantics.db.common.procedure.adapter.TransientCacheListener; import org.simantics.db.common.request.IndexRoot; import org.simantics.db.common.request.ResourceRead2; +import org.simantics.db.common.request.RuntimeEnvironmentRequest; import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.util.RuntimeEnvironmentRequest; import org.simantics.db.layer0.variable.Variable; import org.simantics.layer0.Layer0; import org.simantics.scl.compiler.common.names.Name; diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/GraphModuleSourceRepository.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/GraphModuleSourceRepository.java index 8eed51aca..a70844cd3 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/GraphModuleSourceRepository.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/GraphModuleSourceRepository.java @@ -12,6 +12,8 @@ import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.procedure.SyncListener; import org.simantics.db.request.Read; +import org.simantics.db.request.ReadExt; +import org.simantics.db.request.RequestFlags; import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingUtils; import org.simantics.modeling.internal.Activator; @@ -137,6 +139,29 @@ public enum GraphModuleSourceRepository implements ModuleSourceRepository { } } + static class PossibleResourceIU extends UnaryRead implements ReadExt { + + public PossibleResourceIU(String parameter) { + super(parameter); + } + + @Override + public Resource perform(ReadGraph graph) throws DatabaseException { + return graph.getPossibleResource(parameter); + } + + @Override + public boolean isImmutable(ReadGraph graph) throws DatabaseException { + return false; + } + + @Override + public int getType() { + return RequestFlags.IMMEDIATE_UPDATE; + } + + } + static class ReadModuleSource extends UnaryRead { public ReadModuleSource(String moduleName) { super(moduleName); @@ -144,7 +169,7 @@ public enum GraphModuleSourceRepository implements ModuleSourceRepository { @Override public ModuleSource perform(ReadGraph graph) throws DatabaseException { - Resource moduleResource = graph.getPossibleResource(parameter); + Resource moduleResource = graph.syncRequest(new PossibleResourceIU(parameter)); if(moduleResource == null) return null; Layer0 L0 = Layer0.getInstance(graph); diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/utils/DumpOntologyStructure.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/utils/DumpOntologyStructure.java index 5bb3d9ca2..e058f2c36 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/utils/DumpOntologyStructure.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/utils/DumpOntologyStructure.java @@ -5,7 +5,9 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import java.util.TreeMap; import org.simantics.Simantics; @@ -32,17 +34,48 @@ public class DumpOntologyStructure { private Resource ontology; private Map names = new HashMap<>(); - private Map parents = new HashMap<>(); + private Map parents = new TreeMap<>(); private Map libraryFolders = new HashMap<>(); private Map contentDumps = new HashMap<>(); private void readNameAndParent(ReadGraph graph, Resource container, Resource r) throws DatabaseException { + String name = NameUtils.getSafeName(graph, r); parents.put(r, container); - names.put(r, NameUtils.getSafeName(graph, r)); + names.put(r, FileUtils.escapeFileName(name)); } - private Collection containers() { - return parents.values(); + /* + * This shall return containers sorted by full path. + * This makes processing order stable and ensures that + * directories are processed before their contents. + */ + private Collection sortedContainers(File rootFolder) { + Set parentSet = new HashSet(parents.values()); + TreeMap result = new TreeMap<>(); + for(Resource r : parentSet) { + File f = getFolder(rootFolder, r); + result.put(f.getAbsolutePath(), r); + } + return result.values(); + } + + private Collection sortedResources(File rootFolder) { + TreeMap result = new TreeMap<>(); + for(Resource r : parents.keySet()) { + byte[] dump = contentDumps.get(r); + if(dump == null) + dump = "".getBytes(StandardCharsets.UTF_8); + if(isParent(r)) { + if(dump.length > 0) { + File f = new File(getFolder(rootFolder, r), "__contents__"); + result.put(f.getAbsolutePath(), r); + } + } else { + File f = getFile(rootFolder, r); + result.put(f.getAbsolutePath(), r); + } + } + return result.values(); } private void readHierarchy(ReadGraph graph, Resource container) throws DatabaseException { @@ -110,37 +143,56 @@ public class DumpOntologyStructure { public void write(File unsafeFolder) throws IOException { File folder = escapeFile(unsafeFolder); FileUtils.delete(folder.toPath()); - folder.mkdirs(); + folder.getParentFile().mkdirs(); writeDirectories(folder); writeResources(folder); } + Resource getParent(Resource r) { + return parents.get(r); + } + private File getFolder(File root, Resource library) { if(ontology.equals(library)) return root; - Resource parent = parents.get(library); + Resource parent = getParent(library); if(parent == null) throw new IllegalStateException("null parent for " + library); File parentFolder = getFolder(root, parent); - return new File(parentFolder, FileUtils.escapeFileName(names.get(library))); + return new File(parentFolder, names.get(library)); } private File getFile(File rootFolder, Resource r) { - Resource parent = parents.get(r); + Resource parent = getParent(r); File folder = getFolder(rootFolder, parent); - return new File(folder, FileUtils.escapeFileName(names.get(r))); + return new File(folder, names.get(r)); } + private File makeUnique(File original, Resource r) { + int counter = 2; + File file = new File(original.getParent(), original.getName()); + File test = file; + while(test.exists()) { + // Here we have a name clash with small and big letters! (windows) + test = new File(file.getParent(), file.getName() + "____" + (counter++)); + } + // Enforce this renaming in future operations also + names.put(r, test.getName()); + return test; + } + private void writeDirectories(File rootFolder) { - for(Resource library : containers()) { - File folder = getFolder(rootFolder, library); + // Here stuff shall be returned in alphabetical order + for(Resource library : sortedContainers(rootFolder)) { + File folder = makeUnique(getFolder(rootFolder, library), library); folder.mkdirs(); libraryFolders.put(library, folder); } } private void writeResources(File rootFolder) throws IOException { - for(Resource r : parents.keySet()) { + // Here stuff shall be returned in alphabetical order + for(Resource r : sortedResources(rootFolder)) { writeResource(rootFolder, r); } } @@ -162,7 +214,7 @@ public class DumpOntologyStructure { } private void write(File rootFolder, Resource resource, byte[] bytes) throws IOException { - FileUtils.writeFile(getFile(rootFolder, resource), bytes); + FileUtils.writeFile(makeUnique(getFile(rootFolder, resource), resource), bytes); } } \ No newline at end of file diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/utils/OntologicalRequirementEnforceRequest.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/utils/OntologicalRequirementEnforceRequest.java index 3f8ffb15b..d8eed0a66 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/utils/OntologicalRequirementEnforceRequest.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/utils/OntologicalRequirementEnforceRequest.java @@ -21,17 +21,28 @@ import org.simantics.modeling.adapters.ChangeInformation; */ public class OntologicalRequirementEnforceRequest extends WriteRequest { + private static final String PROP_WRITE_CHANGED_TAGS = "org.simantics.modeling.writeChangedTags"; //$NON-NLS-1$ + private Collection creates; private Collection modis; private Collection ids; private String author; private long time; + private static String getAuthor() { + return System.getProperty("user.name", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } + + private static boolean writeChangedTags() { + return !System.getProperty(PROP_WRITE_CHANGED_TAGS, "") //$NON-NLS-1$ + .equalsIgnoreCase("false"); //$NON-NLS-1$ + } + public OntologicalRequirementEnforceRequest(Collection creates, Collection modis, Collection ids) { this(creates, modis, ids, - System.getProperty("user.name", ""), + getAuthor(), System.currentTimeMillis()); } @@ -45,7 +56,7 @@ public class OntologicalRequirementEnforceRequest extends WriteRequest { @Override public void perform(WriteGraph graph) throws DatabaseException { - update(graph, creates, modis, ids, true, author, time, true); + update(graph, creates, modis, ids, true, author, time, true, writeChangedTags()); } public static void update( @@ -61,7 +72,7 @@ public class OntologicalRequirementEnforceRequest extends WriteRequest { modis, ids, addComment, - System.getProperty("user.name", ""), + getAuthor(), System.currentTimeMillis(), disableDependencyIndexing); @@ -76,10 +87,24 @@ public class OntologicalRequirementEnforceRequest extends WriteRequest { String author, long time, boolean disableDependencyIndexing) throws DatabaseException + { + update(graph, creates, modis, ids, addComment, author, time, disableDependencyIndexing, writeChangedTags()); + } + + public static void update( + WriteGraph graph, + Collection creates, + Collection modis, + Collection ids, + boolean addComment, + String author, + long time, + boolean disableDependencyIndexing, + boolean writeChangedTags) throws DatabaseException { if (disableDependencyIndexing) Layer0Utils.setDependenciesIndexingDisabled(graph, true); - + ModelingResources MOD = ModelingResources.getInstance(graph); Layer0 L0 = Layer0.getInstance(graph); @@ -93,8 +118,9 @@ public class OntologicalRequirementEnforceRequest extends WriteRequest { for (Resource c : creates) { CommonDBUtils.selectClusterSet(graph, c); graph.claimLiteral(c, MOD.changeInformation, MOD.changeInformation_Inverse, MOD.ChangeInformation, info, ChangeInformation.BINDING); - ModelingUtils.markChanged(graph, c); } + if (writeChangedTags) + ModelingUtils.markChanged(graph, creates); } for (Resource m : modis) { @@ -109,9 +135,10 @@ public class OntologicalRequirementEnforceRequest extends WriteRequest { info.modifiedBy = author; CommonDBUtils.selectClusterSet(graph, m); graph.claimLiteral(m, MOD.changeInformation, MOD.changeInformation_Inverse, MOD.ChangeInformation, info, ChangeInformation.BINDING); - ModelingUtils.markChanged(graph, m); } - + if (writeChangedTags) + ModelingUtils.markChanged(graph, modis); + for (Resource r : ids) { if (!graph.hasStatement(r, L0.identifier)) { CommonDBUtils.selectClusterSet(graph, r); @@ -119,10 +146,8 @@ public class OntologicalRequirementEnforceRequest extends WriteRequest { } } - graph.addMetadata( graph.getMetadata(CommentMetadata.class).add("Updated change information") ); - + graph.addMetadata( graph.getMetadata(CommentMetadata.class).add("Updated change information") ); //$NON-NLS-1$ graph.addMetadata( graph.getMetadata(ChangeHistoryUpdated.class) ); - } } \ No newline at end of file diff --git a/bundles/org.simantics.msvc.runtime.x86_64/.classpath b/bundles/org.simantics.msvc.runtime.x86_64/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.msvc.runtime.x86_64/.classpath +++ b/bundles/org.simantics.msvc.runtime.x86_64/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.msvc.runtime.x86_64/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.msvc.runtime.x86_64/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.msvc.runtime.x86_64/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.msvc.runtime.x86_64/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.msvc.runtime.x86_64/META-INF/MANIFEST.MF b/bundles/org.simantics.msvc.runtime.x86_64/META-INF/MANIFEST.MF index d4ecac0f2..972ff89e4 100644 --- a/bundles/org.simantics.msvc.runtime.x86_64/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.msvc.runtime.x86_64/META-INF/MANIFEST.MF @@ -5,7 +5,7 @@ Bundle-SymbolicName: org.simantics.msvc.runtime.x86_64 Bundle-Version: 10.0.40219.qualifier Bundle-Vendor: Semantum Oy Fragment-Host: org.simantics.msvc.runtime -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Eclipse-PlatformFilter: (& (osgi.os=win32) (osgi.arch=x86_64)) Bundle-NativeCode: msvcr100.dll; msvcp100.dll; processor=x86_64 Automatic-Module-Name: org.simantics.msvc.runtime.x86_64 diff --git a/bundles/org.simantics.msvc.runtime/.classpath b/bundles/org.simantics.msvc.runtime/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.msvc.runtime/.classpath +++ b/bundles/org.simantics.msvc.runtime/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.msvc.runtime/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.msvc.runtime/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.msvc.runtime/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.msvc.runtime/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.msvc.runtime/META-INF/MANIFEST.MF b/bundles/org.simantics.msvc.runtime/META-INF/MANIFEST.MF index d741eef76..36cb8eba7 100644 --- a/bundles/org.simantics.msvc.runtime/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.msvc.runtime/META-INF/MANIFEST.MF @@ -6,7 +6,7 @@ Bundle-Version: 10.0.40219.qualifier Bundle-Activator: org.simantics.msvc.runtime.Activator Bundle-Vendor: Semantum Oy Require-Bundle: org.eclipse.core.runtime -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.msvc.runtime Automatic-Module-Name: org.simantics.msvc.runtime diff --git a/bundles/org.simantics.nativemem/.classpath b/bundles/org.simantics.nativemem/.classpath index b862a296d..e801ebfb4 100644 --- a/bundles/org.simantics.nativemem/.classpath +++ b/bundles/org.simantics.nativemem/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/bundles/org.simantics.nativemem/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.nativemem/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.nativemem/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.nativemem/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.nativemem/META-INF/MANIFEST.MF b/bundles/org.simantics.nativemem/META-INF/MANIFEST.MF index 06b614424..86d19f7b4 100644 --- a/bundles/org.simantics.nativemem/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.nativemem/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Native Memory Tracking Bundle-SymbolicName: org.simantics.nativemem Bundle-Version: 1.0.0.qualifier Bundle-Vendor: Semantum Oy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ClassPath: . Export-Package: org.simantics.nativemem Require-Bundle: com.sun.jna;bundle-version="4.3.0", diff --git a/bundles/org.simantics.objmap2/.classpath b/bundles/org.simantics.objmap2/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.objmap2/.classpath +++ b/bundles/org.simantics.objmap2/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.objmap2/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.objmap2/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.objmap2/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.objmap2/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.objmap2/META-INF/MANIFEST.MF b/bundles/org.simantics.objmap2/META-INF/MANIFEST.MF index 55a1393f5..8b9e0e523 100644 --- a/bundles/org.simantics.objmap2/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.objmap2/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Objmap2 Bundle-SymbolicName: org.simantics.objmap2 Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.db;bundle-version="1.1.0", gnu.trove3;bundle-version="3.0.0", org.eclipse.core.runtime;bundle-version="3.7.0", diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/forward/IForwardMappingRule.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/forward/IForwardMappingRule.java index d6c707e02..27a1aeb1a 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/forward/IForwardMappingRule.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/forward/IForwardMappingRule.java @@ -15,6 +15,11 @@ import org.simantics.db.ReadGraph; import org.simantics.objmap.exceptions.MappingException; public interface IForwardMappingRule { + /** + * Check whether a range element needs to be updated due to a change in the range element, without modifying the range element. + */ + boolean checkChanges(ReadGraph graph, IForwardMapping mapping, Domain domainElement, Range rangeElement) throws MappingException; + /** * Modifies the range element so that it corresponds to the domain element. * @param g read transaction @@ -24,6 +29,6 @@ public interface IForwardMappingRule { * @return true if the rule made some modifications * @throws MappingException */ - boolean updateRange(ReadGraph graph, IForwardMapping mapping, Domain domainElement, Range rangeElement) throws MappingException; + boolean updateRange(ReadGraph graph, IForwardMapping mapping, Domain domainElement, Range rangeElement) throws MappingException; void createRange(ReadGraph graph, IForwardMapping mapping, Domain domainElement, Range rangeElement) throws MappingException; } diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/UpdateMethodFactory.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/UpdateMethodFactory.java index e1de9f20c..79c39ecfa 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/UpdateMethodFactory.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/UpdateMethodFactory.java @@ -58,6 +58,12 @@ public class UpdateMethodFactory implements IMethodRuleFactory map, Domain domainElement, + Range rangeElement) throws MappingException { + return false; + } + public void createDomain(WriteGraph g, IBackwardMapping map, Domain domainElement, Range rangeElement) throws MappingException { updateDomain(g, map, domainElement, rangeElement); }; diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/Mapping.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/Mapping.java index c2ecdf1b1..4820dae01 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/Mapping.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/Mapping.java @@ -12,8 +12,6 @@ package org.simantics.objmap.graph.impl; -import gnu.trove.map.hash.THashMap; - import java.util.AbstractSet; import java.util.ArrayList; import java.util.Collection; @@ -21,12 +19,9 @@ import java.util.Iterator; import java.util.List; import java.util.Set; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.simantics.db.ReadGraph; import org.simantics.db.WriteGraph; import org.simantics.db.exception.DatabaseException; - import org.simantics.objmap.backward.IBackwardMapping; import org.simantics.objmap.exceptions.MappingException; import org.simantics.objmap.forward.IForwardMapping; @@ -34,6 +29,10 @@ import org.simantics.objmap.graph.IMapping; import org.simantics.objmap.graph.IMappingListener; import org.simantics.objmap.graph.schema.ILinkType; import org.simantics.objmap.graph.schema.IMappingSchema; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import gnu.trove.map.hash.THashMap; /** * An implementation of IMapping. The class should not be created @@ -79,7 +78,7 @@ public class Mapping implements IMapping { link.type = type; link.domainElement = domainElement; domain.put(domainElement, link); - type.createDomain(g, new RangeToDomain(g), domainElement, link.rangeElement); + type.createDomain(g, new RangeToDomain(), domainElement, link.rangeElement); // TODO Should we do this only if the mapping is listening? domainModified(link); @@ -92,7 +91,7 @@ public class Mapping implements IMapping { link.type = type; link.rangeElement = rangeElement; range.put(rangeElement, link); - type.createRange(g, new DomainToRange(g), link.domainElement, rangeElement); + type.createRange(g, new DomainToRange(), link.domainElement, rangeElement); } Set domainSet = new AbstractSet() { @@ -173,10 +172,7 @@ public class Mapping implements IMapping { class DomainToRange implements IForwardMapping { - ReadGraph g; - - public DomainToRange(ReadGraph g) { - this.g = g; + public DomainToRange() { } @Override @@ -197,10 +193,10 @@ public class Mapping implements IMapping { link.domainModified = true; modifiedDomainLinks.add(link); domain.put(element, link); - createRange(g, link); + createRange(graph, link); } else if(link.type == null) - createRange(g, link); + createRange(graph, link); return link.rangeElement; } @@ -213,12 +209,10 @@ public class Mapping implements IMapping { class RangeToDomain extends DomainToRange implements IBackwardMapping { - WriteGraph g; - - public RangeToDomain(WriteGraph g) { - super(g); - this.g = g; + public RangeToDomain() { + super(); } + @Override public Domain inverseGet(Range element) { @@ -237,10 +231,10 @@ public class Mapping implements IMapping { link.rangeModified = true; modifiedRangeLinks.add(link); range.put(element, link); - createDomain(g, link); + createDomain(graph, link); } else if(link.type == null) - createDomain(g, link); + createDomain(graph, link); return link.domainElement; } @@ -265,7 +259,7 @@ public class Mapping implements IMapping { @Override public synchronized Collection updateDomain(WriteGraph g) throws MappingException { LOGGER.trace("Mapping.updateDomain"); - RangeToDomain map = new RangeToDomain(g); + RangeToDomain map = new RangeToDomain(); ArrayList updated = new ArrayList(); while(!modifiedRangeLinks.isEmpty()) { LOGGER.trace(" modifiedRangeLinks.size() = " + modifiedRangeLinks.size()); @@ -293,7 +287,7 @@ public class Mapping implements IMapping { @Override public synchronized Collection updateRange(ReadGraph g) throws MappingException { LOGGER.trace("Mapping.updateRange"); - DomainToRange map = new DomainToRange(g); + DomainToRange map = new DomainToRange(); ArrayList updated = new ArrayList(); while(!modifiedDomainLinks.isEmpty()) { LOGGER.trace(" modifiedDomainLinks.size() = " + modifiedDomainLinks.size()); @@ -311,13 +305,15 @@ public class Mapping implements IMapping { if(listensDomain) { RangeUpdateRequest request = new RangeUpdateRequest(link, map, this); + boolean changes; try { - g.syncRequest(request, request); + changes = g.syncRequest(request, request) > 0; } catch (DatabaseException e) { throw new MappingException(e); } - // TODO check if really modified - updated.add(link.rangeElement); + + if (changes) + updated.add(link.rangeElement); } else if(link.type.updateRange(g, map, link.domainElement, link.rangeElement)) diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/RangeUpdateRequest.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/RangeUpdateRequest.java index b84b9c94f..d62435cd1 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/RangeUpdateRequest.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/RangeUpdateRequest.java @@ -21,7 +21,7 @@ import org.simantics.objmap.forward.IForwardMapping; import org.simantics.objmap.graph.impl.Link; -public class RangeUpdateRequest implements Read, SyncListener { +public class RangeUpdateRequest implements Read, SyncListener { Link link; /* @@ -30,27 +30,24 @@ public class RangeUpdateRequest implements Read, SyncList */ IForwardMapping map; // map==null is used to flag that request is performed once Mapping mapping; // mapping==null is used as a flag the request disposed + int counter; public RangeUpdateRequest(Link link, IForwardMapping map, Mapping mapping) { this.link = link; this.map = map; this.mapping = mapping; + this.counter = 0; } @Override - public Boolean perform(ReadGraph g) throws DatabaseException { - if(map != null) { - link.type.updateRange(g, map, link.domainElement, link.rangeElement); - map = null; - return Boolean.TRUE; - } - else if(mapping != null) { - mapping.domainModified(link); - mapping = null; - return Boolean.FALSE; - } - else - return null; + public Integer perform(ReadGraph g) throws DatabaseException { + boolean changed = false; + if (map != null) + changed = link.type.checkChanges(g, map, link.domainElement, link.rangeElement); + else if (mapping != null) + changed = link.type.checkChanges(g, mapping, link.domainElement, link.rangeElement); + + return changed ? counter + 1 : counter; } @Override @@ -63,15 +60,24 @@ public class RangeUpdateRequest implements Read, SyncList } @Override - public void execute(ReadGraph graph, Boolean result) - throws DatabaseException { + public void execute(ReadGraph graph, Integer result) + throws DatabaseException { + boolean changed = result != counter; + counter = result; + + if (map != null) { + if (changed) + link.type.updateRange(graph, map, link.domainElement, link.rangeElement); + map = null; + } + else if (mapping != null && changed) { + mapping.domainModified(link); + mapping = null; + } } @Override public boolean isDisposed() { return mapping == null || link.removed || mapping.isDisposed(); } - - - } diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementRule.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementRule.java index 9761f5555..251895ad7 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementRule.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementRule.java @@ -11,6 +11,8 @@ *******************************************************************************/ package org.simantics.objmap.graph.rules; +import java.util.Objects; + import org.simantics.db.ReadGraph; import org.simantics.db.WriteGraph; import org.simantics.objmap.backward.IBackwardMapping; @@ -61,10 +63,19 @@ public class MappedElementRule implements IBidirectionalMappingRu return rangeAccessor.set(rangeElement, mappedValue); } + @Override + public boolean checkChanges(ReadGraph g, IForwardMapping map, Domain domainElement, Range rangeElement) throws MappingException { + Domain value = domainAccessor.get(g, domainElement); + Range mappedValue = value == null ? null : map.map(g, value); + return mappedValue != rangeAccessor.get(rangeElement); + } + + @Override public void createDomain(WriteGraph g, IBackwardMapping map, Domain domainElement, Range rangeElement) throws MappingException { updateDomain(g, map, domainElement, rangeElement); }; + @Override public void createRange(ReadGraph g, IForwardMapping map, Domain domainElement, Range rangeElement) throws MappingException { updateRange(g, map, domainElement, rangeElement); }; diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementsRule.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementsRule.java index 7f3c13a10..fcc62d7b5 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementsRule.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementsRule.java @@ -13,6 +13,7 @@ package org.simantics.objmap.graph.rules; import java.util.ArrayList; import java.util.Collection; +import java.util.Objects; import org.simantics.db.ReadGraph; import org.simantics.db.WriteGraph; @@ -66,12 +67,25 @@ public class MappedElementsRule implements IBidirectionalMappingR Domain domainElement, Range rangeElement) throws MappingException { LOGGER.trace(" MappedElementsRule.updateRange"); - Collection value = domainAccessor.get(g, domainElement); + ArrayList mappedValue = getMappedValue(g, map, domainElement); + return rangeAccessor.set(rangeElement, mappedValue); + } + + @Override + public boolean checkChanges(ReadGraph g, IForwardMapping map, Domain domainElement, Range rangeElement) throws MappingException { + LOGGER.trace(" MappedElementsRule.updateRange"); + ArrayList mappedValue = getMappedValue(g, map, domainElement); + return !Objects.equals(mappedValue, rangeAccessor.get(rangeElement)); + } + + private ArrayList getMappedValue(ReadGraph g, IForwardMapping map, Domain domainElement) + throws MappingException { + Collection value = domainAccessor.get(g, domainElement); ArrayList mappedValue = new ArrayList(value.size()); for(Domain r : value) mappedValue.add(map.map(g, r));//map.get(r)); - return rangeAccessor.set(rangeElement, mappedValue); - } + return mappedValue; + } public void createDomain(WriteGraph g, IBackwardMapping map, Domain domainElement, Range rangeElement) throws MappingException { updateDomain(g, map, domainElement, rangeElement); diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/ValueRule.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/ValueRule.java index 9ba9dba11..2e2b81b19 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/ValueRule.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/ValueRule.java @@ -13,6 +13,9 @@ package org.simantics.objmap.graph.rules; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + +import java.util.Objects; + import org.simantics.db.ReadGraph; import org.simantics.db.WriteGraph; import org.simantics.objmap.backward.IBackwardMapping; @@ -57,7 +60,14 @@ public class ValueRule implements IBidirectionalMappingRule map, Domain domainElement, + Range rangeElement) throws MappingException { + Object value = rangeAccessor.get(rangeElement); + return !Objects.equals(value, domainAccessor.get(g, domainElement)); + } public void createDomain(WriteGraph g, IBackwardMapping map, Domain domainElement, Range rangeElement) throws MappingException { updateDomain(g, map, domainElement, rangeElement); diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/AdaptedLinkType.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/AdaptedLinkType.java index 9b02d5d50..b0d8d965f 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/AdaptedLinkType.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/AdaptedLinkType.java @@ -69,18 +69,27 @@ public class AdaptedLinkType implements ILinkType { } } + @Override public void createDomain(WriteGraph graph, IBackwardMapping mapping, Resource domainElement, Range rangeElement) throws MappingException { }; + @Override public void createRange(ReadGraph graph, org.simantics.objmap.forward.IForwardMapping mapping, Resource domainElement, Range rangeElement) throws MappingException { }; + @Override + public boolean checkChanges(ReadGraph g, IForwardMapping map, Resource domainElement, Range rangeElement) throws MappingException { + return false; + } + + @Override public boolean updateDomain(WriteGraph g, IBackwardMapping map, Resource domainElement, Range rangeElement) throws MappingException { return false; } + @Override public boolean updateRange(ReadGraph g, IForwardMapping map, Resource domainElement, Range rangeElement) throws MappingException { return false; } diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/SimpleLinkType.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/SimpleLinkType.java index 9ddc43716..12dd4c9c0 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/SimpleLinkType.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/SimpleLinkType.java @@ -104,6 +104,15 @@ public class SimpleLinkType implements ILinkType { updateRange(graph, mapping, domainElement, rangeElement); }; + @Override + public boolean checkChanges(ReadGraph g, IForwardMapping map, Resource domainElement, + Range rangeElement) throws MappingException { + boolean updated = false; + for(IBidirectionalMappingRule rule : rules) + updated |= rule.checkChanges(g, map, domainElement, rangeElement); + return updated; + } + public boolean updateDomain(WriteGraph g, IBackwardMapping map, Resource domainElement, Range rangeElement) throws MappingException { if(LOGGER.isTraceEnabled()) try { diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/UpdateMethodFactory.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/UpdateMethodFactory.java index a2be5fa42..c0fee3da6 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/UpdateMethodFactory.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/UpdateMethodFactory.java @@ -58,6 +58,12 @@ public class UpdateMethodFactory implements IMethodRuleFactory map, Domain domainElement, + Range rangeElement) throws MappingException { + return false; + } + public void createDomain(WriteGraph g, IBackwardMapping map, Domain domainElement, Range rangeElement) throws MappingException { updateDomain(g, map, domainElement, rangeElement); }; diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/AdaptedLinkType.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/AdaptedLinkType.java index 203863a6c..21d1d8990 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/AdaptedLinkType.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/AdaptedLinkType.java @@ -72,18 +72,27 @@ public class AdaptedLinkType implements ILinkType mapping, StructuralResource domainElement, IStructuralObject rangeElement) throws MappingException { }; + @Override public void createRange(ReadGraph graph, org.simantics.objmap.forward.IForwardMapping mapping, StructuralResource domainElement, IStructuralObject rangeElement) throws MappingException { }; + @Override + public boolean checkChanges(ReadGraph graph, IForwardMapping mapping, StructuralResource domainElement, IStructuralObject rangeElement) throws MappingException { + return false; + } + + @Override public boolean updateDomain(WriteGraph g, IBackwardMapping map, StructuralResource domainElement, IStructuralObject rangeElement) throws MappingException { return false; } + @Override public boolean updateRange(ReadGraph g, IForwardMapping map, StructuralResource domainElement, IStructuralObject rangeElement) throws MappingException { return false; } diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/SimpleLinkType.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/SimpleLinkType.java index 77b2ab094..5df6064b8 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/SimpleLinkType.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/SimpleLinkType.java @@ -154,6 +154,15 @@ public class SimpleLinkType implements ILinkType map, + StructuralResource domainElement, IStructuralObject rangeElement) throws MappingException { + boolean updated = false; + for(IBidirectionalMappingRule rule : rules) + updated |= rule.checkChanges(g, map, domainElement, rangeElement); + return updated; + } + public boolean updateDomain(WriteGraph g, IBackwardMapping map, StructuralResource domainElement, IStructuralObject rangeElement) throws MappingException { if(LOGGER.isTraceEnabled()) try { diff --git a/bundles/org.simantics.platform.ui.ontology/.classpath b/bundles/org.simantics.platform.ui.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.platform.ui.ontology/.classpath +++ b/bundles/org.simantics.platform.ui.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.platform.ui.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.platform.ui.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.platform.ui.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.platform.ui.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.platform.ui.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.platform.ui.ontology/META-INF/MANIFEST.MF index 1e8ad54e1..d46b50d04 100644 --- a/bundles/org.simantics.platform.ui.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.platform.ui.ontology/META-INF/MANIFEST.MF @@ -20,6 +20,6 @@ Require-Bundle: org.simantics.layer0, org.simantics.selectionview.ui.ontology;bundle-version="1.1.0", org.simantics.diagram.ontology;bundle-version="2.2.0", org.simantics.issues.ontology;bundle-version="1.2.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.platform.ui Automatic-Module-Name: org.simantics.platform.ui.ontology diff --git a/bundles/org.simantics.platform.ui/.classpath b/bundles/org.simantics.platform.ui/.classpath index b862a296d..e801ebfb4 100644 --- a/bundles/org.simantics.platform.ui/.classpath +++ b/bundles/org.simantics.platform.ui/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/bundles/org.simantics.platform.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.platform.ui/META-INF/MANIFEST.MF index f0e776e41..06734106e 100644 --- a/bundles/org.simantics.platform.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.platform.ui/META-INF/MANIFEST.MF @@ -5,7 +5,7 @@ Bundle-SymbolicName: org.simantics.platform.ui Bundle-Version: 1.0.0.qualifier Bundle-Vendor: Semantum Oy Automatic-Module-Name: org.simantics.platform.ui -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.ui.console;bundle-version="3.7.0", org.eclipse.ui;bundle-version="3.109.0", org.eclipse.core.jobs;bundle-version="3.9.0", diff --git a/bundles/org.simantics.project.ontology/.classpath b/bundles/org.simantics.project.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.project.ontology/.classpath +++ b/bundles/org.simantics.project.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.project.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.project.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.project.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.project.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.project.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.project.ontology/META-INF/MANIFEST.MF index 3484e0332..a3c28bc77 100644 --- a/bundles/org.simantics.project.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.project.ontology/META-INF/MANIFEST.MF @@ -9,6 +9,6 @@ Require-Bundle: org.simantics.layer0, org.simantics.layer0x.ontology;bundle-version="1.0.0", org.simantics.image2.ontology;bundle-version="1.0.0", org.simantics.action.ontology;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.project.ontology Automatic-Module-Name: org.simantics.project.ontology diff --git a/bundles/org.simantics.project/.classpath b/bundles/org.simantics.project/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.project/.classpath +++ b/bundles/org.simantics.project/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.project/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.project/.settings/org.eclipse.jdt.core.prefs index 3a2153707..7adc0fb9a 100644 --- a/bundles/org.simantics.project/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.project/.settings/org.eclipse.jdt.core.prefs @@ -1,11 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.project/META-INF/MANIFEST.MF b/bundles/org.simantics.project/META-INF/MANIFEST.MF index 1eac93e9a..3c380df33 100644 --- a/bundles/org.simantics.project/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.project/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Simantics Project Framework Bundle-SymbolicName: org.simantics.project;singleton:=true Bundle-Version: 1.0.1.qualifier Bundle-Vendor: Semantum Oy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.db.layer0;bundle-version="[0.8.0,2.0.0)", org.simantics.layer0;bundle-version="[1.0.0,2.0.0)", org.eclipse.core.runtime;bundle-version="3.4.0", diff --git a/bundles/org.simantics.scenegraph.loader/.classpath b/bundles/org.simantics.scenegraph.loader/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.scenegraph.loader/.classpath +++ b/bundles/org.simantics.scenegraph.loader/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.scenegraph.loader/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scenegraph.loader/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.scenegraph.loader/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.scenegraph.loader/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.scenegraph.loader/META-INF/MANIFEST.MF b/bundles/org.simantics.scenegraph.loader/META-INF/MANIFEST.MF index 046b06140..de512d7d0 100644 --- a/bundles/org.simantics.scenegraph.loader/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scenegraph.loader/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Scenegraph Loader Bundle-SymbolicName: org.simantics.scenegraph.loader;singleton:=true Bundle-Version: 1.0.0.qualifier Bundle-Vendor: Semantum Oy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics;bundle-version="1.0.0", org.simantics.scenegraph;bundle-version="1.1.1";visibility:=reexport, org.simantics.scenegraph.ontology;bundle-version="1.0.0", diff --git a/bundles/org.simantics.scenegraph.loader/src/org/simantics/scenegraph/loader/ScenegraphLoaderProcess.java b/bundles/org.simantics.scenegraph.loader/src/org/simantics/scenegraph/loader/ScenegraphLoaderProcess.java index e901b0cdb..20c10fa5b 100644 --- a/bundles/org.simantics.scenegraph.loader/src/org/simantics/scenegraph/loader/ScenegraphLoaderProcess.java +++ b/bundles/org.simantics.scenegraph.loader/src/org/simantics/scenegraph/loader/ScenegraphLoaderProcess.java @@ -11,7 +11,6 @@ import org.simantics.db.common.primitiverequest.PossibleResource; import org.simantics.db.common.procedure.adapter.ListenerSupport; import org.simantics.db.common.request.TernaryRead; import org.simantics.db.common.request.UnaryRead; -import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.request.ResourceVariable; import org.simantics.db.layer0.variable.Variable; @@ -19,11 +18,14 @@ import org.simantics.db.layer0.variable.VariableRepository; import org.simantics.scenegraph.INode; import org.simantics.scenegraph.ParentNode; import org.simantics.utils.datastructures.Pair; +import org.slf4j.LoggerFactory; import gnu.trove.set.hash.THashSet; public class ScenegraphLoaderProcess implements Disposable, ListenerSupport { + private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(ScenegraphLoaderProcess.class); + final private String name; final Class loaderClass; @@ -153,7 +155,7 @@ public class ScenegraphLoaderProcess implements Disposable, ListenerSupport { @Override public void exception(Throwable t) { - Logger.defaultLogError(t); + LOGGER.error("Unexpected problem encountered", t); } @Override diff --git a/bundles/org.simantics.scenegraph.ontology/.classpath b/bundles/org.simantics.scenegraph.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.scenegraph.ontology/.classpath +++ b/bundles/org.simantics.scenegraph.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.scenegraph.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scenegraph.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.scenegraph.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.scenegraph.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.scenegraph.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.scenegraph.ontology/META-INF/MANIFEST.MF index cc5443159..0b10e37b3 100644 --- a/bundles/org.simantics.scenegraph.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scenegraph.ontology/META-INF/MANIFEST.MF @@ -5,6 +5,6 @@ Bundle-SymbolicName: org.simantics.scenegraph.ontology Bundle-Version: 1.1.0.qualifier Bundle-Vendor: Semantum Oy Require-Bundle: org.simantics.layer0 -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.scenegraph.ontology Automatic-Module-Name: org.simantics.scenegraph.ontology diff --git a/bundles/org.simantics.scenegraph.profile/.classpath b/bundles/org.simantics.scenegraph.profile/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.scenegraph.profile/.classpath +++ b/bundles/org.simantics.scenegraph.profile/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.scenegraph.profile/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scenegraph.profile/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.scenegraph.profile/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.scenegraph.profile/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.scenegraph.profile/META-INF/MANIFEST.MF b/bundles/org.simantics.scenegraph.profile/META-INF/MANIFEST.MF index e032ff417..fc7ad08b6 100644 --- a/bundles/org.simantics.scenegraph.profile/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scenegraph.profile/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Scenegraph Profiles Bundle-SymbolicName: org.simantics.scenegraph.profile Bundle-Version: 1.0.0.qualifier Bundle-Vendor: Semantum Oy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.scenegraph.profile, org.simantics.scenegraph.profile.common, org.simantics.scenegraph.profile.impl;x-friends:="org.simantics.diagram", @@ -14,7 +14,7 @@ Require-Bundle: org.simantics.db.layer0;bundle-version="1.1.0", org.simantics.scenegraph;bundle-version="1.1.1", org.eclipse.core.runtime;bundle-version="3.6.0", org.simantics.diagram.ontology;bundle-version="1.1.1", - org.simantics.db.common + org.slf4j.api Bundle-ActivationPolicy: lazy Bundle-Activator: org.simantics.scenegraph.profile.impl.Activator Import-Package: org.simantics diff --git a/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/common/ObserverGroupListener.java b/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/common/ObserverGroupListener.java index 31295b9b6..10e2abe67 100644 --- a/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/common/ObserverGroupListener.java +++ b/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/common/ObserverGroupListener.java @@ -44,7 +44,7 @@ public class ObserverGroupListener implements SetListener { public void add(Resource item) { //System.out.println("Add to group(" + this + "): " + item); items.put(item, item); - observer.update(); + observer.update(style, item); } @Override @@ -52,7 +52,7 @@ public class ObserverGroupListener implements SetListener { // new Exception().printStackTrace(); //System.out.println("Remove from group(" + this + "): " + item); items.remove(item); - observer.update(); + observer.update(style, item); } @Override diff --git a/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/common/ProfileObserver.java b/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/common/ProfileObserver.java index 9d379c890..440ee2714 100644 --- a/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/common/ProfileObserver.java +++ b/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/common/ProfileObserver.java @@ -23,8 +23,8 @@ import org.simantics.db.AsyncRequestProcessor; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.common.session.SessionEventListenerAdapter; -import org.simantics.db.common.utils.Logger; import org.simantics.db.procedure.Procedure; +import org.simantics.db.service.QueryControl; import org.simantics.db.service.SessionEventSupport; import org.simantics.scenegraph.INode; import org.simantics.scenegraph.g2d.G2DSceneGraph; @@ -38,9 +38,13 @@ import org.simantics.utils.datastructures.Pair; import org.simantics.utils.datastructures.disposable.IDisposable; import org.simantics.utils.threads.IThreadWorkQueue; import org.simantics.utils.threads.ThreadUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ProfileObserver implements EvaluationContext { + private static final Logger LOGGER = LoggerFactory.getLogger(ProfileObserver.class); + private final Session session; /** @@ -58,6 +62,7 @@ public class ProfileObserver implements EvaluationContext { private volatile boolean dirty = true; private volatile boolean disposed = false; + private boolean needSynchronizedUpdates = false; private List> updates = new ArrayList<>(); private boolean updateAll; @@ -95,6 +100,7 @@ public class ProfileObserver implements EvaluationContext { this.sceneGraph = sceneGraph; this.constants.putAll(constants); this.notification = notification; + this.needSynchronizedUpdates = session.getService(QueryControl.class).getAmountOfQueryThreads() > 1; attachSessionListener(); @@ -139,8 +145,14 @@ public class ProfileObserver implements EvaluationContext { public void update(Style style, Object item) { if (DebugPolicy.DEBUG_PROFILE_OBSERVER_UPDATE) System.out.println("Profile observer marked dirty."); - - updates.add(Pair.make(style, item)); + + if (needSynchronizedUpdates) { + synchronized (updates) { + updates.add(Pair.make(style, item)); + } + } else { + updates.add(Pair.make(style, item)); + } //updateAll = true; dirty = true; } @@ -179,10 +191,25 @@ public class ProfileObserver implements EvaluationContext { e.apply(ProfileObserver.this); } updateAll = false; - updates.clear(); + if (needSynchronizedUpdates) { + synchronized (updates) { + updates.clear(); + } + } else { + updates.clear(); + } } else { - List> updatesCopy = new ArrayList<>(updates); - updates.clear(); + List> updatesCopy; + if (needSynchronizedUpdates) { + synchronized (updates) { + updatesCopy = new ArrayList<>(updates); + updates.clear(); + } + } else { + updatesCopy = new ArrayList<>(updates); + updates.clear(); + } + for (Pair update : updatesCopy) { Style style = update.first; Object item = update.second; @@ -221,7 +248,7 @@ public class ProfileObserver implements EvaluationContext { @Override public void exception(Throwable t) { - Logger.defaultLogError(t); + LOGGER.error("RuntimeProfileActiveEntries request failed", t); } }); } @@ -233,7 +260,7 @@ public class ProfileObserver implements EvaluationContext { @Override public void exception(Throwable throwable) { - Logger.defaultLogError(throwable); + LOGGER.error("Exception occurred during diagram profile observation", throwable); } @SuppressWarnings("unchecked") diff --git a/bundles/org.simantics.scenegraph.swing/.classpath b/bundles/org.simantics.scenegraph.swing/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.scenegraph.swing/.classpath +++ b/bundles/org.simantics.scenegraph.swing/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.scenegraph.swing/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scenegraph.swing/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.scenegraph.swing/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.scenegraph.swing/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.scenegraph.swing/META-INF/MANIFEST.MF b/bundles/org.simantics.scenegraph.swing/META-INF/MANIFEST.MF index e4d734b9b..258a06267 100644 --- a/bundles/org.simantics.scenegraph.swing/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scenegraph.swing/META-INF/MANIFEST.MF @@ -4,9 +4,8 @@ Bundle-Name: Swing Nodes Bundle-SymbolicName: org.simantics.scenegraph.swing Bundle-Version: 1.0.0.qualifier Bundle-Vendor: Semantum Oy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.scenegraph;bundle-version="1.1.1", - org.jfree.jcommon;bundle-version="1.0.16", org.jfree.jchart;bundle-version="1.0.13", org.eclipse.core.runtime;bundle-version="3.6.0", org.eclipse.ui;bundle-version="3.6.2", diff --git a/bundles/org.simantics.scenegraph.ui/.classpath b/bundles/org.simantics.scenegraph.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.scenegraph.ui/.classpath +++ b/bundles/org.simantics.scenegraph.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.scenegraph.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scenegraph.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.scenegraph.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.scenegraph.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.scenegraph.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.scenegraph.ui/META-INF/MANIFEST.MF index f397ca41e..c71128c8a 100644 --- a/bundles/org.simantics.scenegraph.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scenegraph.ui/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Scene Graph UI Bundle-SymbolicName: org.simantics.scenegraph.ui;singleton:=true Bundle-Version: 1.1.1.qualifier Bundle-Vendor: Semantum Oy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.core.runtime;bundle-version="3.5.0", org.eclipse.core.expressions;bundle-version="3.4.100", org.eclipse.ui;bundle-version="3.5.0", diff --git a/bundles/org.simantics.scenegraph/.classpath b/bundles/org.simantics.scenegraph/.classpath index 282b753dc..a77c387de 100644 --- a/bundles/org.simantics.scenegraph/.classpath +++ b/bundles/org.simantics.scenegraph/.classpath @@ -1,9 +1,6 @@ - - - - + diff --git a/bundles/org.simantics.scenegraph/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scenegraph/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.scenegraph/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.scenegraph/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.scenegraph/META-INF/MANIFEST.MF b/bundles/org.simantics.scenegraph/META-INF/MANIFEST.MF index f2c70f5c6..ebaffc234 100644 --- a/bundles/org.simantics.scenegraph/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scenegraph/META-INF/MANIFEST.MF @@ -8,24 +8,19 @@ Require-Bundle: gnu.trove3;bundle-version="3.0.0", org.simantics.utils.thread;bundle-version="1.0.0", org.simantics.utils.datastructures;bundle-version="1.1.0", org.jfree.jchart;bundle-version="1.0.12", - org.jfree.jcommon;bundle-version="1.0.15", org.junit;resolution:=optional, org.simantics.scl.runtime;bundle-version="0.1.4", org.simantics.databoard;bundle-version="0.6.3", com.lowagie.text;bundle-version="2.1.7";resolution:=optional, org.simantics.utils;bundle-version="1.1.0", - org.slf4j.api -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 + org.slf4j.api, + org.apache.batik;bundle-version="1.12.0";visibility:=reexport +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ClassPath: ., - lib/svgSalamander-tiny.jar, - lib/batik-parser-1.8.jar, - lib/batik-awt-util-1.8.jar, - lib/batik-util-1.8.jar + lib/svgSalamander-tiny.jar Export-Package: com.kitfox.svg, com.kitfox.svg.animation, com.kitfox.svg.xml, - org.apache.batik.ext.awt.geom, - org.apache.batik.parser, org.simantics.scenegraph, org.simantics.scenegraph.adapters, org.simantics.scenegraph.g2d, diff --git a/bundles/org.simantics.scenegraph/build.properties b/bundles/org.simantics.scenegraph/build.properties index dc6fde4b2..1fe8ef8ce 100644 --- a/bundles/org.simantics.scenegraph/build.properties +++ b/bundles/org.simantics.scenegraph/build.properties @@ -17,8 +17,5 @@ bin.includes = META-INF/,\ TROVE-README-license.txt,\ TROVE-LICENSE.txt,\ README.txt,\ - JSI-LICENSE.txt,\ - lib/batik-parser-1.8.jar,\ - lib/batik-awt-util-1.8.jar,\ - lib/batik-util-1.8.jar + JSI-LICENSE.txt diff --git a/bundles/org.simantics.scenegraph/lib/batik-awt-util-1.8.jar b/bundles/org.simantics.scenegraph/lib/batik-awt-util-1.8.jar deleted file mode 100644 index ce0be3cd0..000000000 Binary files a/bundles/org.simantics.scenegraph/lib/batik-awt-util-1.8.jar and /dev/null differ diff --git a/bundles/org.simantics.scenegraph/lib/batik-parser-1.8.jar b/bundles/org.simantics.scenegraph/lib/batik-parser-1.8.jar deleted file mode 100644 index 01108ad7c..000000000 Binary files a/bundles/org.simantics.scenegraph/lib/batik-parser-1.8.jar and /dev/null differ diff --git a/bundles/org.simantics.scenegraph/lib/batik-util-1.8.jar b/bundles/org.simantics.scenegraph/lib/batik-util-1.8.jar deleted file mode 100644 index cb1c63f19..000000000 Binary files a/bundles/org.simantics.scenegraph/lib/batik-util-1.8.jar and /dev/null differ diff --git a/bundles/org.simantics.scenegraph/lib/jcommon-1.0.16.jar b/bundles/org.simantics.scenegraph/lib/jcommon-1.0.16.jar deleted file mode 100644 index 4cd680744..000000000 Binary files a/bundles/org.simantics.scenegraph/lib/jcommon-1.0.16.jar and /dev/null differ diff --git a/bundles/org.simantics.scenegraph/lib/jfreechart-1.0.13.jar b/bundles/org.simantics.scenegraph/lib/jfreechart-1.0.13.jar deleted file mode 100644 index 83c699318..000000000 Binary files a/bundles/org.simantics.scenegraph/lib/jfreechart-1.0.13.jar and /dev/null differ diff --git a/bundles/org.simantics.scenegraph/lib/svgSalamander-tiny.jar b/bundles/org.simantics.scenegraph/lib/svgSalamander-tiny.jar index 0fede7cb0..3418b8958 100644 Binary files a/bundles/org.simantics.scenegraph/lib/svgSalamander-tiny.jar and b/bundles/org.simantics.scenegraph/lib/svgSalamander-tiny.jar differ diff --git a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/G2DParentNode.java b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/G2DParentNode.java index af8c5630d..a752e9253 100644 --- a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/G2DParentNode.java +++ b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/G2DParentNode.java @@ -349,11 +349,12 @@ public class G2DParentNode extends ParentNode implements IG2DNode, Ini Rectangle2D bounds = null; while(it.hasNext()) { IG2DNode node = it.next(); - Rectangle2D b = node.getBounds(); + Rectangle2D b = node.getBoundsInLocal(ignoreNulls); if(b == null && !ignoreNulls) return null; if(b != null) { if(!GeometryUtils.isUndefinedRectangle(b)) { + b = node.localToParent(b); if(bounds == null) { bounds = b.getFrame(); } else { diff --git a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/events/command/Commands.java b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/events/command/Commands.java index ce52912a5..89de18835 100644 --- a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/events/command/Commands.java +++ b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/events/command/Commands.java @@ -107,6 +107,7 @@ public class Commands { public static final Command FOCUS_TOOLTIP = new Command("focusTooltip"); + public static final Command COPY_AS_SVG = new Command("copyAsSVG"); public static Command showPopup(Point2D atControlPosition) { return new ShowPopup(atControlPosition); diff --git a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/ConnectionCrossingsNode.java b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/ConnectionCrossingsNode.java new file mode 100644 index 000000000..a46c4e748 --- /dev/null +++ b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/ConnectionCrossingsNode.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2020 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Semantum Oy - initial API and implementation + *******************************************************************************/ +package org.simantics.scenegraph.g2d.nodes; + +import java.awt.Graphics2D; +import java.awt.geom.Rectangle2D; + +import org.simantics.diagram.connection.rendering.ConnectionCrossings; +import org.simantics.diagram.connection.rendering.ConnectionRenderingHints; +import org.simantics.scenegraph.g2d.G2DNode; + +public class ConnectionCrossingsNode extends G2DNode { + + private static final long serialVersionUID = -696142275610396889L; + + private ConnectionCrossings crossings; + + @Override + public void render(Graphics2D g) { + crossings.reset(); + if (crossings.getWidth() > 0 && crossings.getType() != ConnectionCrossings.Type.NONE) { + g.setRenderingHint(ConnectionRenderingHints.KEY_PATH_MODIFIER, crossings); + } else { + g.setRenderingHint(ConnectionRenderingHints.KEY_PATH_MODIFIER, null); + } + } + + public void setCrossings(ConnectionCrossings crossings) { + this.crossings = crossings; + } + + @Override + public Rectangle2D getBoundsInLocal() { + return null; + } + + public ConnectionCrossings getConnectionCrossings() { + return crossings; + } +} diff --git a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/LinkNode.java b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/LinkNode.java index 50d50ecd2..aa570d6aa 100644 --- a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/LinkNode.java +++ b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/LinkNode.java @@ -131,6 +131,11 @@ public class LinkNode extends StateMaskNode { @Override public Rectangle2D getBoundsInLocal() { + return getBoundsInLocal(false); + } + + @Override + public Rectangle2D getBoundsInLocal(boolean ignoreNulls) { // Safety against cyclic cases. if (hasFlags(IN_GET_BOUNDS)) return new Rectangle2D.Double(); @@ -141,7 +146,7 @@ public class LinkNode extends StateMaskNode { setFlags(IN_GET_BOUNDS); try { - Rectangle2D bounds = n.getBoundsInLocal(); + Rectangle2D bounds = n.getBoundsInLocal(ignoreNulls); if (transform != null && !transform.isIdentity()) bounds = transform.createTransformedShape(bounds).getBounds2D(); return bounds; diff --git a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/ShapeNode2.java b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/ShapeNode2.java new file mode 100644 index 000000000..2a8b9599a --- /dev/null +++ b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/ShapeNode2.java @@ -0,0 +1,191 @@ +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.scenegraph.g2d.nodes; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Paint; +import java.awt.Shape; +import java.awt.Stroke; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; + +import org.simantics.scenegraph.g2d.G2DNode; +import org.simantics.scenegraph.utils.GeometryUtils; +import org.simantics.scenegraph.utils.InitValueSupport; + +/** + * A scene graph node that renders a specified AWT {@link Shape} by optionally + * filling or drawing it. + * + * This is similar to ShapeNode, but allows separate stroke and fill colors. + * Due to API changes, I've done separate implementation. -MLuu + * + * + * @author luukkainen + * @author J-P Laine + * @author Tuukka Lehtonen + * + */ +public class ShapeNode2 extends G2DNode implements InitValueSupport { + + private static final long serialVersionUID = -5700299566608619380L; + + protected static final Stroke DEFAULT_STROKE = new BasicStroke(2); + + protected Shape shape = null; + protected Stroke stroke = DEFAULT_STROKE; + protected Paint strokeColor = Color.BLACK; + protected Paint fillColor = null; + protected boolean scaleStroke = false; + protected boolean scaleShape = false; + + protected transient Shape dynamicShape = null; + protected transient Stroke dynamicStroke = null; + protected transient Paint dynamicStrokeColor = null; + protected transient Paint dynamicFillColor = null; + protected transient Boolean dynamicScaleStroke = null; + protected transient Boolean dynamicScaleShape = null; + + @PropertySetter("shape") + @SyncField("shape") + public void setShape(Shape shape) { + this.shape = shape; + repaint(); + } + + @PropertySetter("stroke") + @SyncField("stroke") + public void setStroke(Stroke stroke) { + this.stroke = stroke; + } + + @PropertySetter("strokeColor") + @SyncField("strokeColor") + public void setStrokeColor(Paint color) { + this.strokeColor = color; + } + + @PropertySetter("fillColor") + @SyncField("fillColor") + public void setFillColor(Paint color) { + this.fillColor = color; + } + + + @SyncField("scaleStroke") + public void setScaleStroke(boolean scaleStroke) { + this.scaleStroke = scaleStroke; + } + + @SyncField("scaleShape") + public void setScaleShape(boolean scaleShape) { + this.scaleShape = scaleShape; + } + + @Override + public void render(Graphics2D g2d) { + Shape shape = dynamicShape != null ? dynamicShape : this.shape; + if (shape == null) + return; + + AffineTransform ot = setupRender(g2d); + renderShape(g2d, shape); + if (ot != null) + g2d.setTransform(ot); + } + + /** + * @param g2d + * @return current transform + */ + protected AffineTransform setupRender(Graphics2D g2d) { + AffineTransform old = null; + if (!transform.isIdentity()) { + old = g2d.getTransform(); + g2d.transform(transform); + } + + + boolean scaleShape = Boolean.TRUE.equals(dynamicScaleShape) ? true : this.scaleShape; + if (scaleShape) { + double xs = g2d.getTransform().getScaleX(); + double ys = g2d.getTransform().getScaleY(); + g2d.scale(1/xs, 1/ys); + } + + return old; + } + + protected void renderShape(Graphics2D g2d, Shape s) { + Paint color = dynamicFillColor != null ? dynamicFillColor : this.fillColor; + if (color != null) { + g2d.setPaint(color); + g2d.fill(s); + } + + Stroke stroke = dynamicStroke != null ? dynamicStroke : this.stroke; + if (stroke != null) { + color = dynamicStrokeColor != null ? dynamicStrokeColor : this.strokeColor; + if (color != null) g2d.setPaint(color); + + boolean scaleStroke = Boolean.TRUE.equals(dynamicScaleStroke) ? true : this.scaleStroke; + if (scaleStroke && stroke instanceof BasicStroke) { + BasicStroke bs = GeometryUtils.scaleStroke(stroke, (float) (1.0 / GeometryUtils.getScale(g2d.getTransform()))); + g2d.setStroke(bs); + } else { + g2d.setStroke(stroke); + } + + g2d.draw(s); + } + } + + @Override + public Rectangle2D getBoundsInLocal() { + if(shape == null) return null; + return shape.getBounds2D(); + } + + public void setValue(String key, Object value) { + if ("shape".equals(key)) + dynamicShape = (Shape) value; + else if ("stroke".equals(key)) + dynamicStroke = (Stroke) value; + else if ("strokeColor".equals(key)) + dynamicStrokeColor = (Paint) value; + else if ("fillColor".equals(key)) + dynamicFillColor = (Paint) value; + else if ("scaleStroke".equals(key)) + dynamicScaleStroke = (Boolean) value; + else if ("scaleShape".equals(key)) + dynamicScaleShape = (Boolean) value; +// else super.setValue(key, value); + } + + @Override + public void initValues() { + dynamicShape = null; + dynamicStroke = null; + dynamicStrokeColor = null; + dynamicFillColor = null; + dynamicScaleStroke = null; + dynamicScaleShape = null; + } + + @Override + public String toString() { + return super.toString() + " [shape=" + shape + ",color=" + strokeColor + ",fill=" + fillColor +"]"; + } + +} diff --git a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/connection/RouteGraphNode.java b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/connection/RouteGraphNode.java index b0e9147f6..3c7b9bad8 100644 --- a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/connection/RouteGraphNode.java +++ b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/connection/RouteGraphNode.java @@ -288,6 +288,7 @@ public class RouteGraphNode extends G2DNode implements ISelectionPainterNode, In selectionStroke = new BasicStroke(width, BasicStroke.CAP_BUTT, stroke.getLineJoin()); } } else { + // TODO: support AggregateConnectionStyle selectionStroke = SELECTION_STROKE; } } @@ -301,24 +302,28 @@ public class RouteGraphNode extends G2DNode implements ISelectionPainterNode, In if(dynamicColor != null || dynamicStroke != null) { BasicConnectionStyle baseStyle = (BasicConnectionStyle)tryGetStyle(baseRenderer); - try { - Constructor c = baseStyle.getClass().getConstructor(Color.class, Color.class, double.class, Stroke.class, Stroke.class, double.class, double.class); - renderer = new StyledRouteGraphRenderer(c.newInstance( - dynamicColor != null ? dynamicColor : baseStyle.getLineColor(), - baseStyle.getBranchPointColor(), baseStyle.getBranchPointRadius(), - dynamicStroke != null ? dynamicStroke : baseStyle.getLineStroke(), - dynamicStroke != null ? dynamicStroke : baseStyle.getRouteLineStroke(), - baseStyle.getDegeneratedLineLength(), baseStyle.getRounding())); - } catch (Exception e) { - renderer = new StyledRouteGraphRenderer(new BasicConnectionStyle( - dynamicColor != null ? dynamicColor : baseStyle.getLineColor(), - baseStyle.getBranchPointColor(), baseStyle.getBranchPointRadius(), - dynamicStroke != null ? dynamicStroke : baseStyle.getLineStroke(), - dynamicStroke != null ? dynamicStroke : baseStyle.getRouteLineStroke(), - baseStyle.getDegeneratedLineLength(), baseStyle.getRounding())); + if (baseStyle != null) { + try { + Constructor c = baseStyle.getClass().getConstructor(Color.class, Color.class, double.class, Stroke.class, Stroke.class, double.class, double.class, double.class); + renderer = new StyledRouteGraphRenderer(c.newInstance( + dynamicColor != null ? dynamicColor : baseStyle.getLineColor(), + baseStyle.getBranchPointColor(), baseStyle.getBranchPointRadius(), + dynamicStroke != null ? dynamicStroke : baseStyle.getLineStroke(), + dynamicStroke != null ? dynamicStroke : baseStyle.getRouteLineStroke(), + baseStyle.getDegeneratedLineLength(), baseStyle.getRounding(), baseStyle.getOffset())); + } catch (Exception e) { + renderer = new StyledRouteGraphRenderer(new BasicConnectionStyle( + dynamicColor != null ? dynamicColor : baseStyle.getLineColor(), + baseStyle.getBranchPointColor(), baseStyle.getBranchPointRadius(), + dynamicStroke != null ? dynamicStroke : baseStyle.getLineStroke(), + dynamicStroke != null ? dynamicStroke : baseStyle.getRouteLineStroke(), + baseStyle.getDegeneratedLineLength(), baseStyle.getRounding(), baseStyle.getOffset())); + } + } else { + // TODO: support AggregateConnectionStyle + renderer = baseRenderer; } - } else { renderer = baseRenderer; } diff --git a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/utils/MipMapBufferedImage.java b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/utils/MipMapBufferedImage.java index d76b9ec05..7e5f09949 100644 --- a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/utils/MipMapBufferedImage.java +++ b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/utils/MipMapBufferedImage.java @@ -23,6 +23,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.kitfox.svg.SVGDiagram; /** @@ -35,6 +38,8 @@ import com.kitfox.svg.SVGDiagram; */ public class MipMapBufferedImage extends BufferedImage { + private static final Logger LOGGER = LoggerFactory.getLogger(MipMapBufferedImage.class); + /** Extra margin to the bounds reported by batik */ public static final double MARGIN_PERCENT = 3; @@ -61,6 +66,8 @@ public class MipMapBufferedImage extends BufferedImage { } private void initializeRasters() { + if (LOGGER.isDebugEnabled()) + LOGGER.debug("initializeRasters({}): diagram={}, referenceSize={}, imageBounds={}, maxres={}, minres={}", this.toString(), source, referenceSize, imageBounds, maxResolution(), minResolution()); List resolutions = new ArrayList(); if (referenceSize != null && !imageBounds.isEmpty()) { @@ -94,6 +101,9 @@ public class MipMapBufferedImage extends BufferedImage { } } + if (LOGGER.isDebugEnabled()) + LOGGER.debug("initializeRasters({}): resolutions={}", this.toString(), resolutions); + // arraylist -> array this.resolutions = new double[resolutions.size()]; for (int i=0; i - + diff --git a/bundles/org.simantics.scl.commands/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scl.commands/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.scl.commands/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.scl.commands/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.scl.commands/META-INF/MANIFEST.MF b/bundles/org.simantics.scl.commands/META-INF/MANIFEST.MF index cde9e2430..e3cafcf38 100644 --- a/bundles/org.simantics.scl.commands/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scl.commands/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: SCL Commands Bundle-SymbolicName: org.simantics.scl.commands Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.scl.commands Require-Bundle: org.simantics.db;bundle-version="1.1.0", org.simantics.scl.osgi;bundle-version="1.0.4", diff --git a/bundles/org.simantics.scl.compiler.decompiler/.classpath b/bundles/org.simantics.scl.compiler.decompiler/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.scl.compiler.decompiler/.classpath +++ b/bundles/org.simantics.scl.compiler.decompiler/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.scl.compiler.decompiler/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scl.compiler.decompiler/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.scl.compiler.decompiler/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.scl.compiler.decompiler/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.scl.compiler.decompiler/META-INF/MANIFEST.MF b/bundles/org.simantics.scl.compiler.decompiler/META-INF/MANIFEST.MF index 118ada9c4..bd89882b0 100644 --- a/bundles/org.simantics.scl.compiler.decompiler/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scl.compiler.decompiler/META-INF/MANIFEST.MF @@ -4,11 +4,8 @@ Bundle-Name: SCL bytecode decompiler Bundle-SymbolicName: org.simantics.scl.compiler.decompiler Bundle-Version: 1.0.0.qualifier Fragment-Host: org.simantics.scl.compiler;bundle-version="0.6.1" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Require-Bundle: org.jboss.windup.decompiler.procyon;bundle-version="4.0.0", - org.jboss.windup.decompiler.procyon.windup-procyon-compilertools;bundle-version="1.0.0", - org.jboss.windup.decompiler.procyon.windup-procyon-core;bundle-version="1.0.0", - org.jboss.windup.decompiler.procyon.windup-procyon-reflection;bundle-version="1.0.0", - org.jboss.windup.decompiler.api.forge-addon;bundle-version="4.0.0", - org.jboss.windup.utils.windup-utils.forge-addon;bundle-version="4.0.0" +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Require-Bundle: org.jboss.windup.decompiler.api.forge-addon;bundle-version="4.0.0", + org.bitbucket.mstrobel.procyon-compilertools;bundle-version="0.5.33", + org.bitbucket.mstrobel.procyon-core;bundle-version="0.5.33" Automatic-Module-Name: org.simantics.scl.compiler.decompiler diff --git a/bundles/org.simantics.scl.compiler/.classpath b/bundles/org.simantics.scl.compiler/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.scl.compiler/.classpath +++ b/bundles/org.simantics.scl.compiler/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.scl.compiler/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scl.compiler/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.scl.compiler/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.scl.compiler/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.scl.compiler/META-INF/MANIFEST.MF b/bundles/org.simantics.scl.compiler/META-INF/MANIFEST.MF index 70bb068b3..852603f49 100644 --- a/bundles/org.simantics.scl.compiler/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scl.compiler/META-INF/MANIFEST.MF @@ -3,14 +3,14 @@ Bundle-ManifestVersion: 2 Bundle-Name: SCL Compiler Bundle-SymbolicName: org.simantics.scl.compiler Bundle-Version: 0.6.1.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: gnu.trove3;bundle-version="3.0.0", org.simantics.scl.runtime;bundle-version="0.1.4";visibility:=reexport, org.junit;bundle-version="4.12.0";resolution:=optional, org.objectweb.asm;bundle-version="[5.0.0,8.0.0)", org.objectweb.asm.commons;bundle-version="[5.0.0,8.0.0)", org.objectweb.asm.util;bundle-version="[5.0.0,8.0.0)", - org.slf4j.api;bundle-version="1.7.2" + org.slf4j.api Export-Package: org.cojen.classfile, org.simantics.scl.compiler.commands, org.simantics.scl.compiler.common.datatypes, diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/common/exceptions/InternalCompilerError.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/common/exceptions/InternalCompilerError.java index 1c2709665..a3b646134 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/common/exceptions/InternalCompilerError.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/common/exceptions/InternalCompilerError.java @@ -22,6 +22,11 @@ public class InternalCompilerError extends RuntimeException { this.location = Locations.NO_LOCATION; } + public InternalCompilerError(String message, Throwable cause) { + super(message, cause); + this.location = Locations.NO_LOCATION; + } + public InternalCompilerError(long location, String message) { super(message); this.location = location; diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/module/repository/ModuleRepository.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/module/repository/ModuleRepository.java index 79b596908..23491235c 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/module/repository/ModuleRepository.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/module/repository/ModuleRepository.java @@ -240,6 +240,10 @@ public class ModuleRepository { return getModule(moduleName, null); } + public void update(String moduleName) { + getModuleEntry(moduleName, null).notifyAboutUpdate(); + } + public Failable getRuntimeModule(String moduleName, UpdateListener listener) { return getModuleEntry(moduleName, listener).getRuntimeModule(); } diff --git a/bundles/org.simantics.scl.data/.classpath b/bundles/org.simantics.scl.data/.classpath index 098194ca4..e801ebfb4 100644 --- a/bundles/org.simantics.scl.data/.classpath +++ b/bundles/org.simantics.scl.data/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.scl.data/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scl.data/.settings/org.eclipse.jdt.core.prefs index f42de363a..7adc0fb9a 100644 --- a/bundles/org.simantics.scl.data/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.scl.data/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.scl.data/META-INF/MANIFEST.MF b/bundles/org.simantics.scl.data/META-INF/MANIFEST.MF index eb6ba41c5..a5279445a 100644 --- a/bundles/org.simantics.scl.data/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scl.data/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Xml Bundle-SymbolicName: org.simantics.scl.data Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.scl.runtime;bundle-version="0.4.0", org.simantics.scl.osgi;bundle-version="1.0.4", org.jdom2;bundle-version="2.0.6", diff --git a/bundles/org.simantics.scl.data/scl/Data/Json.scl b/bundles/org.simantics.scl.data/scl/Data/Json.scl index cacffb01a..268b9732a 100644 --- a/bundles/org.simantics.scl.data/scl/Data/Json.scl +++ b/bundles/org.simantics.scl.data/scl/Data/Json.scl @@ -309,6 +309,30 @@ instance (Json a, Json b, Json c, Json d, Json e) => Json (a, b, c, d, e) where toJson (a, b, c, d, e) = JsonArray [toJson a, toJson b, toJson c, toJson d, toJson e] fromJson (JsonArray [a, b, c, d, e]) = (fromJson a, fromJson b, fromJson c, fromJson d, fromJson e) +instance (Json a, Json b, Json c, Json d, Json e, Json f) => Json (a, b, c, d, e, f) where + writeJson g (a, b, c, d, e, f) = do + writeStartArray g + writeJson g a + writeJson g b + writeJson g c + writeJson g d + writeJson g e + writeJson g f + writeEndArray g + readJson p = (a, b, c, d, e, f) + where + assertStartArray p + a = readNextJson p + b = readNextJson p + c = readNextJson p + d = readNextJson p + e = readNextJson p + f = readNextJson p + assertEndArray p + toJson (a, b, c, d, e, f) = JsonArray [toJson a, toJson b, toJson c, toJson d, toJson e, toJson f] + fromJson (JsonArray [a, b, c, d, e, f]) = (fromJson a, fromJson b, fromJson c, fromJson d, fromJson e, fromJson f) + + data Json = JsonString String | JsonDouble Double diff --git a/bundles/org.simantics.scl.db/.classpath b/bundles/org.simantics.scl.db/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.scl.db/.classpath +++ b/bundles/org.simantics.scl.db/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.scl.db/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scl.db/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.scl.db/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.scl.db/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.scl.db/META-INF/MANIFEST.MF b/bundles/org.simantics.scl.db/META-INF/MANIFEST.MF index 8d826cfa3..81af84419 100644 --- a/bundles/org.simantics.scl.db/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scl.db/META-INF/MANIFEST.MF @@ -13,8 +13,8 @@ Require-Bundle: org.eclipse.core.runtime, org.simantics.application, org.simantics.db.management, org.simantics.layer0.utils, - org.slf4j.api;bundle-version="1.7.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 + org.slf4j.api +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-Vendor: VTT Technical Research Centre of Finland Export-Package: org.simantics.scl.db Automatic-Module-Name: org.simantics.scl.db diff --git a/bundles/org.simantics.scl.expressions/.classpath b/bundles/org.simantics.scl.expressions/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.scl.expressions/.classpath +++ b/bundles/org.simantics.scl.expressions/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.scl.expressions/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scl.expressions/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.scl.expressions/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.scl.expressions/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.scl.expressions/META-INF/MANIFEST.MF b/bundles/org.simantics.scl.expressions/META-INF/MANIFEST.MF index 394f82df2..59c5852fe 100644 --- a/bundles/org.simantics.scl.expressions/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scl.expressions/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: SCL Expressions support Bundle-SymbolicName: org.simantics.scl.expressions Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.scl.compiler;bundle-version="0.1.0", org.simantics.databoard;bundle-version="0.6.5" Export-Package: org.simantics.scl.expressions, diff --git a/bundles/org.simantics.scl.osgi/.classpath b/bundles/org.simantics.scl.osgi/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.scl.osgi/.classpath +++ b/bundles/org.simantics.scl.osgi/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.scl.osgi/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scl.osgi/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.scl.osgi/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.scl.osgi/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.scl.osgi/META-INF/MANIFEST.MF b/bundles/org.simantics.scl.osgi/META-INF/MANIFEST.MF index 6c9dec184..2b6dc004f 100644 --- a/bundles/org.simantics.scl.osgi/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scl.osgi/META-INF/MANIFEST.MF @@ -9,7 +9,7 @@ Require-Bundle: org.eclipse.core.runtime, org.simantics.scl.compiler;bundle-version="0.6.0";visibility:=reexport, org.slf4j.api Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.scl.osgi, org.simantics.scl.osgi.internal, org.simantics.scl.osgi.issues diff --git a/bundles/org.simantics.scl.osgi/src/org/simantics/scl/osgi/internal/OsgiJavaReferenceValidatorFactory.java b/bundles/org.simantics.scl.osgi/src/org/simantics/scl/osgi/internal/OsgiJavaReferenceValidatorFactory.java index 2f3c869b4..69a724e9f 100644 --- a/bundles/org.simantics.scl.osgi/src/org/simantics/scl/osgi/internal/OsgiJavaReferenceValidatorFactory.java +++ b/bundles/org.simantics.scl.osgi/src/org/simantics/scl/osgi/internal/OsgiJavaReferenceValidatorFactory.java @@ -33,7 +33,7 @@ public class OsgiJavaReferenceValidatorFactory implements JavaReferenceValidator try { bundle.start(); } catch (BundleException e) { - throw new InternalCompilerError("Couldn't activate bundle " + bundle.getSymbolicName() + ". Bundle state is " + BundleUtils.resolveBundleState(bundle)); + throw new InternalCompilerError("Couldn't activate bundle " + bundle.getSymbolicName() + ". Bundle state is " + BundleUtils.resolveBundleState(bundle), e); } wiring = bundle.adapt(BundleWiring.class); } diff --git a/bundles/org.simantics.scl.reflection/.classpath b/bundles/org.simantics.scl.reflection/.classpath index 8a3b30d04..6248f62f7 100644 --- a/bundles/org.simantics.scl.reflection/.classpath +++ b/bundles/org.simantics.scl.reflection/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.scl.reflection/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scl.reflection/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.scl.reflection/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.scl.reflection/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.scl.reflection/META-INF/MANIFEST.MF b/bundles/org.simantics.scl.reflection/META-INF/MANIFEST.MF index 9597daf76..99407f549 100644 --- a/bundles/org.simantics.scl.reflection/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scl.reflection/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Reflection Bundle-SymbolicName: org.simantics.scl.reflection;singleton:=true Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.scl.compiler;bundle-version="0.1.0";visibility:=reexport, org.simantics.scl.runtime;bundle-version="0.1.4", gnu.trove3;bundle-version="3.0.0", diff --git a/bundles/org.simantics.scl.rest/.classpath b/bundles/org.simantics.scl.rest/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.scl.rest/.classpath +++ b/bundles/org.simantics.scl.rest/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.scl.rest/META-INF/MANIFEST.MF b/bundles/org.simantics.scl.rest/META-INF/MANIFEST.MF index e950c170f..7e382bfee 100644 --- a/bundles/org.simantics.scl.rest/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scl.rest/META-INF/MANIFEST.MF @@ -4,17 +4,15 @@ Bundle-Name: Simantics SCL REST-Server Bundle-SymbolicName: org.simantics.scl.rest Bundle-Version: 1.0.0.qualifier Bundle-Activator: org.simantics.scl.rest.Activator -Require-Bundle: org.eclipse.core.runtime, - org.glassfish.jersey.core.jersey-server, - javax.ws.rs-api, +Require-Bundle: org.glassfish.jersey.core.jersey-server, org.simantics.scl.compiler, org.simantics.scl.osgi, - org.eclipse.jetty.servlet, org.glassfish.jersey.containers.jersey-container-servlet-core, javax.servlet-api, - org.eclipse.jetty.server, - org.eclipse.jetty.util, - org.eclipse.jetty.io, + org.eclipse.jetty.servlet;bundle-version="9.4.24", + org.eclipse.jetty.server;bundle-version="9.4.24", + org.eclipse.jetty.util;bundle-version="9.4.24", + org.eclipse.jetty.io;bundle-version="9.4.24", com.fasterxml.jackson.core.jackson-core;bundle-version="2.8.8", com.fasterxml.jackson.core.jackson-annotations;bundle-version="2.8.0", com.fasterxml.jackson.core.jackson-databind;bundle-version="2.8.8", @@ -24,7 +22,9 @@ Require-Bundle: org.eclipse.core.runtime, org.jvnet.mimepull;bundle-version="1.9.6", org.glassfish.jersey.core.jersey-client, org.glassfish.jersey.core.jersey-common;bundle-version="2.25.1", - org.simantics.scl.runtime -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 + org.simantics.scl.runtime, + org.eclipse.osgi;bundle-version="3.15.100", + jakarta.ws.rs-api;bundle-version="2.1.6" +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Automatic-Module-Name: org.simantics.scl.rest diff --git a/bundles/org.simantics.scl.runtime/.classpath b/bundles/org.simantics.scl.runtime/.classpath index 5c2ab66a9..1b7bf7a96 100644 --- a/bundles/org.simantics.scl.runtime/.classpath +++ b/bundles/org.simantics.scl.runtime/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.scl.runtime/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scl.runtime/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.scl.runtime/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.scl.runtime/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.scl.runtime/META-INF/MANIFEST.MF b/bundles/org.simantics.scl.runtime/META-INF/MANIFEST.MF index 0cb8969b4..4d092f2fe 100644 --- a/bundles/org.simantics.scl.runtime/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scl.runtime/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: SCL Runtime Bundle-SymbolicName: org.simantics.scl.runtime;singleton:=true Bundle-Version: 0.4.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.scl.runtime, org.simantics.scl.runtime.chr, org.simantics.scl.runtime.collection, @@ -25,5 +25,5 @@ Export-Package: org.simantics.scl.runtime, Require-Bundle: org.junit;bundle-version="4.12.0";resolution:=optional, gnu.trove3;bundle-version="3.0.0", org.simantics.databoard;bundle-version="0.6.5";visibility:=reexport, - org.slf4j.api;bundle-version="1.7.20" + org.slf4j.api Automatic-Module-Name: org.simantics.scl.runtime diff --git a/bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/exceptions/CheckedFunctionException.java b/bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/exceptions/CheckedFunctionException.java new file mode 100644 index 000000000..2601728f2 --- /dev/null +++ b/bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/exceptions/CheckedFunctionException.java @@ -0,0 +1,11 @@ +package org.simantics.scl.runtime.exceptions; + +public class CheckedFunctionException extends RuntimeException { + + private static final long serialVersionUID = 6314226787099140449L; + + public CheckedFunctionException(Exception cause) { + super(cause); + } + +} diff --git a/bundles/org.simantics.scl.tutorial/.classpath b/bundles/org.simantics.scl.tutorial/.classpath index 49e77f4e0..bc3587db4 100644 --- a/bundles/org.simantics.scl.tutorial/.classpath +++ b/bundles/org.simantics.scl.tutorial/.classpath @@ -1,6 +1,6 @@ - - - - - - + + + + + + diff --git a/bundles/org.simantics.scl.tutorial/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scl.tutorial/.settings/org.eclipse.jdt.core.prefs index 11f6e462d..7adc0fb9a 100644 --- a/bundles/org.simantics.scl.tutorial/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.scl.tutorial/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.scl.tutorial/META-INF/MANIFEST.MF b/bundles/org.simantics.scl.tutorial/META-INF/MANIFEST.MF index f1c87134e..3fc00d4a5 100644 --- a/bundles/org.simantics.scl.tutorial/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scl.tutorial/META-INF/MANIFEST.MF @@ -3,4 +3,4 @@ Bundle-ManifestVersion: 2 Bundle-Name: Tutorial Bundle-SymbolicName: org.simantics.scl.tutorial Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-RequiredExecutionEnvironment: JavaSE-11 diff --git a/bundles/org.simantics.scl.ui/.classpath b/bundles/org.simantics.scl.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.scl.ui/.classpath +++ b/bundles/org.simantics.scl.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.scl.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scl.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.scl.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.scl.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.scl.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.scl.ui/META-INF/MANIFEST.MF index e0a561c81..0441e0f63 100644 --- a/bundles/org.simantics.scl.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.scl.ui/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: SCL UI Bundle-SymbolicName: org.simantics.scl.ui;singleton:=true Bundle-Version: 0.5.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.ui.editors;bundle-version="3.6.0", org.eclipse.core.resources;bundle-version="3.6.0", org.eclipse.ui;bundle-version="3.6.0", diff --git a/bundles/org.simantics.scl.ui/plugin.xml b/bundles/org.simantics.scl.ui/plugin.xml index b7d5c9fb2..ac4489d2e 100644 --- a/bundles/org.simantics.scl.ui/plugin.xml +++ b/bundles/org.simantics.scl.ui/plugin.xml @@ -142,30 +142,6 @@ - - - - - - - - - - = 0 && (Character.isJavaIdentifierPart(currentText.charAt(offset)) && !Character.isWhitespace(currentText.charAt(offset)))) - length--; - - int nameSpaceBeginRange = currentText.lastIndexOf(".", caretEndRange - 1); //$NON-NLS-1$ - if (nameSpaceBeginRange > length) - length = nameSpaceBeginRange; - int endRange = currentText.length(); - if (caretEndRange < endRange) - endRange = caretEndRange; - text.setSelection(length, endRange); + int replacementOffset = findPrefixMatchOffset(currentText, caretOffset, contents); + +// System.out.println("text: " + currentText); +// System.out.println("proposal to fill: " + contents); +// System.out.format("longest match of proposed contents found from text @ offset %d: \"%s[%s]%s\"%n", +// replacementOffset, +// currentText.substring(0, replacementOffset), +// currentText.substring(replacementOffset, caretOffset), +// currentText.substring(caretOffset)); + + // The text between [replaceOffset, caretOffset) will be replaced with `contents` + text.setSelection(replacementOffset, caretOffset); text.insert(contents); - // calculate the initial count of letters that was typed when the proposal was accepted to insert the caret - // at the right position - int proposalFirstLettersCount = endRange - (length); - text.setCaretOffset(caretEndRange + cursorPosition - proposalFirstLettersCount); + text.setSelection(replacementOffset + contents.length()); + } + + /** + * Find offset of longest prefix match of match in + * text ending at offset endOffset. + * + * Example: + *
+	 * ...  res (=text)
+	 * resource (=match)
+	 *  resourc
+	 *   resour
+	 *    resou
+	 *     reso
+	 *      res match! return endOffset - 3
+	 * 
+ * + * @param text the text from which to find the match + * @param endOffset endOffset until which to search for the longest match + * @param match the text to prefix-match + * @return + */ + private static int findPrefixMatchOffset(String text, int endOffset, String match) { + for (int i = match.length(); i >= 0; --i) { + if (text.regionMatches(true, endOffset - i, match, 0, i)) + return endOffset - i; + } + return 0; } /* diff --git a/bundles/org.simantics.selectionview.ontology/.classpath b/bundles/org.simantics.selectionview.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.selectionview.ontology/.classpath +++ b/bundles/org.simantics.selectionview.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.selectionview.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.selectionview.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.selectionview.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.selectionview.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.selectionview.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.selectionview.ontology/META-INF/MANIFEST.MF index 0f9205972..353d917d8 100644 --- a/bundles/org.simantics.selectionview.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.selectionview.ontology/META-INF/MANIFEST.MF @@ -6,6 +6,6 @@ Bundle-Version: 1.2.0.qualifier Bundle-Vendor: Semantum Oy Require-Bundle: org.simantics.layer0, org.simantics.layer0x.ontology;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.selectionview Automatic-Module-Name: org.simantics.selectionview.ontology diff --git a/bundles/org.simantics.selectionview.ui.ontology/.classpath b/bundles/org.simantics.selectionview.ui.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.selectionview.ui.ontology/.classpath +++ b/bundles/org.simantics.selectionview.ui.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.selectionview.ui.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.selectionview.ui.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.selectionview.ui.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.selectionview.ui.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.selectionview.ui.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.selectionview.ui.ontology/META-INF/MANIFEST.MF index c92716c61..5fd730466 100644 --- a/bundles/org.simantics.selectionview.ui.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.selectionview.ui.ontology/META-INF/MANIFEST.MF @@ -13,6 +13,6 @@ Require-Bundle: org.eclipse.ui, org.simantics.views.ontology;bundle-version="1.1.0", org.simantics.viewpoint.ontology;bundle-version="1.0.0", org.simantics.selectionview.ontology;bundle-version="1.2.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Automatic-Module-Name: org.simantics.selectionview.ui.ontology diff --git a/bundles/org.simantics.selectionview/.classpath b/bundles/org.simantics.selectionview/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.selectionview/.classpath +++ b/bundles/org.simantics.selectionview/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.selectionview/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.selectionview/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.selectionview/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.selectionview/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.selectionview/META-INF/MANIFEST.MF b/bundles/org.simantics.selectionview/META-INF/MANIFEST.MF index 74ace5a40..2a0715673 100644 --- a/bundles/org.simantics.selectionview/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.selectionview/META-INF/MANIFEST.MF @@ -23,7 +23,7 @@ Require-Bundle: org.eclipse.ui, org.simantics.modeling;bundle-version="1.1.1", org.simantics.scenegraph.ontology;bundle-version="1.0.0", org.slf4j.api -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.selectionview Automatic-Module-Name: org.simantics.selectionview diff --git a/bundles/org.simantics.silk.ontology/.classpath b/bundles/org.simantics.silk.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.silk.ontology/.classpath +++ b/bundles/org.simantics.silk.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.silk.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.silk.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.silk.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.silk.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.silk.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.silk.ontology/META-INF/MANIFEST.MF index 9e96d4ecc..409a32d94 100644 --- a/bundles/org.simantics.silk.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.silk.ontology/META-INF/MANIFEST.MF @@ -6,6 +6,6 @@ Bundle-Version: 1.1.0.qualifier Bundle-Vendor: Semantum Oy Require-Bundle: org.simantics.layer0, org.simantics.image2.ontology;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.silk Automatic-Module-Name: org.simantics.silk.ontology diff --git a/bundles/org.simantics.simulation.ontology/.classpath b/bundles/org.simantics.simulation.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.simulation.ontology/.classpath +++ b/bundles/org.simantics.simulation.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.simulation.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.simulation.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.simulation.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.simulation.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.simulation.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.simulation.ontology/META-INF/MANIFEST.MF index 1a6c81fff..4be09242b 100644 --- a/bundles/org.simantics.simulation.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.simulation.ontology/META-INF/MANIFEST.MF @@ -5,6 +5,6 @@ Bundle-SymbolicName: org.simantics.simulation.ontology Bundle-Version: 1.1.0.qualifier Require-Bundle: org.simantics.layer0, org.simantics.layer0x.ontology;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.simulation.ontology Automatic-Module-Name: org.simantics.simulation.ontology diff --git a/bundles/org.simantics.simulation.sequences/.classpath b/bundles/org.simantics.simulation.sequences/.classpath index 8a3b30d04..6248f62f7 100644 --- a/bundles/org.simantics.simulation.sequences/.classpath +++ b/bundles/org.simantics.simulation.sequences/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.simulation.sequences/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.simulation.sequences/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.simulation.sequences/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.simulation.sequences/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.simulation.sequences/META-INF/MANIFEST.MF b/bundles/org.simantics.simulation.sequences/META-INF/MANIFEST.MF index 7ecc4b3a0..00f45d43d 100644 --- a/bundles/org.simantics.simulation.sequences/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.simulation.sequences/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Sequences Bundle-SymbolicName: org.simantics.simulation.sequences Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.junit;bundle-version="4.12.0";resolution:=optional, org.simantics.scl.osgi;bundle-version="1.0.4", gnu.trove3;bundle-version="3.0.3" diff --git a/bundles/org.simantics.simulation.ui/.classpath b/bundles/org.simantics.simulation.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.simulation.ui/.classpath +++ b/bundles/org.simantics.simulation.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.simulation.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.simulation.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.simulation.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.simulation.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.simulation.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.simulation.ui/META-INF/MANIFEST.MF index 7bada8706..48b50e164 100644 --- a/bundles/org.simantics.simulation.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.simulation.ui/META-INF/MANIFEST.MF @@ -23,8 +23,9 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.osgi.services, org.eclipse.e4.core.services;bundle-version="2.0.0", org.eclipse.e4.ui.di, - org.eclipse.e4.core.di.extensions;bundle-version="0.13.0" + org.eclipse.e4.core.di.extensions;bundle-version="0.13.0", + jakarta.annotation-api;bundle-version="1.3.5" Import-Package: javax.inject -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Automatic-Module-Name: org.simantics.simulation.ui diff --git a/bundles/org.simantics.simulation/.classpath b/bundles/org.simantics.simulation/.classpath index 84688be67..a43bb09e7 100644 --- a/bundles/org.simantics.simulation/.classpath +++ b/bundles/org.simantics.simulation/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.simulation/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.simulation/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.simulation/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.simulation/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.simulation/META-INF/MANIFEST.MF b/bundles/org.simantics.simulation/META-INF/MANIFEST.MF index 06a61d2b9..8bc3d9af5 100644 --- a/bundles/org.simantics.simulation/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.simulation/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Simulation Plug-in Bundle-SymbolicName: org.simantics.simulation;singleton:=true Bundle-Version: 1.1.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.ui;bundle-version="1.0.0", org.simantics.project;bundle-version="1.0.0", org.simantics;bundle-version="1.0.0";visibility:=reexport, @@ -13,7 +13,7 @@ Require-Bundle: org.simantics.ui;bundle-version="1.0.0", org.simantics.fastlz;bundle-version="1.2.1", org.apache.commons.compress;bundle-version="1.7.0", org.simantics.lz4;bundle-version="1.3.0", - org.slf4j.api;bundle-version="1.7.0" + org.slf4j.api Export-Package: org.simantics.simulation, org.simantics.simulation.data, org.simantics.simulation.experiment, diff --git a/bundles/org.simantics.simulation/src/org/simantics/simulation/data/DatasourceAdapter.java b/bundles/org.simantics.simulation/src/org/simantics/simulation/data/DatasourceAdapter.java index 1ee543f4c..34fbb587d 100644 --- a/bundles/org.simantics.simulation/src/org/simantics/simulation/data/DatasourceAdapter.java +++ b/bundles/org.simantics.simulation/src/org/simantics/simulation/data/DatasourceAdapter.java @@ -19,8 +19,6 @@ import java.util.Set; import java.util.concurrent.Executor; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -import java.util.logging.Level; -import java.util.logging.Logger; import org.simantics.databoard.Bindings; import org.simantics.databoard.accessor.error.AccessorException; @@ -32,6 +30,8 @@ import org.simantics.history.HistoryException; import org.simantics.history.util.subscription.SubscriptionItem; import org.simantics.simulation.data.Datasource.DatasourceListener; import org.simantics.utils.datastructures.Triple; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This adapter reads data from Datasource and writes to an open Subscription. @@ -41,7 +41,7 @@ import org.simantics.utils.datastructures.Triple; */ public class DatasourceAdapter implements DatasourceListener { - protected Logger logger = Logger.getLogger( DatasourceAdapter.class.toString() ); + protected Logger logger = LoggerFactory.getLogger( DatasourceAdapter.class ); protected Collector session; protected boolean loaded = false; protected List handles = new ArrayList(); @@ -139,7 +139,7 @@ public class DatasourceAdapter implements DatasourceListener { result.add(Triple.make(key, binding, value)); } catch (AccessorException e) { if (failedIds.add(key)) - logger.log(Level.SEVERE, e.toString(), e); + logger.error(e.toString(), e); continue; } } @@ -172,20 +172,20 @@ public class DatasourceAdapter implements DatasourceListener { value = handle.getValue(source); } catch (AccessorException e) { if (failedIds.add(key)) - logger.log(Level.SEVERE, e.toString(), e); + logger.error(e.toString(), e); continue; } Binding binding = handle.binding(); try { session.setValue( key, binding, value ); } catch (HistoryException e) { - logger.log(Level.SEVERE, e.toString(), e); + logger.error(e.toString(), e); } } else { Binding binding = bindings.get(i); if (binding != null) { session.setValue( key, binding, value ); - } + } } } @@ -193,11 +193,11 @@ public class DatasourceAdapter implements DatasourceListener { try { session.endStep(); } catch (HistoryException e) { - logger.log(Level.SEVERE, e.toString(), e); + logger.error(e.toString(), e); } } } catch (HistoryException e) { - logger.log(Level.SEVERE, e.toString(), e); + logger.error(e.toString(), e); } finally { stepLock.unlock(); } @@ -207,6 +207,5 @@ public class DatasourceAdapter implements DatasourceListener { public Executor getExecutor() { return null; } - } diff --git a/bundles/org.simantics.simulation/src/org/simantics/simulation/export/CSVItemsQuery.java b/bundles/org.simantics.simulation/src/org/simantics/simulation/export/CSVItemsQuery.java index a39f2e736..6ce6a50cf 100644 --- a/bundles/org.simantics.simulation/src/org/simantics/simulation/export/CSVItemsQuery.java +++ b/bundles/org.simantics.simulation/src/org/simantics/simulation/export/CSVItemsQuery.java @@ -77,7 +77,10 @@ public class CSVItemsQuery implements Read> { // Resource experiment = graph.syncRequest(new PossibleExperiment(subscriptionItem)); // String runIdentifier = ""; // experiment.getIdentifier(); - + + item.groupItemId = graph.getPossibleRelatedValue(subscriptionItem, L0.HasName, Bindings.STRING); + if (item.groupItemId == null) continue; + item.variableReference = rvi.toPossibleString(graph, configuration); if (item.variableReference == null) continue; @@ -118,6 +121,7 @@ public class CSVItemsQuery implements Read> { public static class CSVItem { public String modelUri; public String label; + public String groupItemId; public String variableReference; public String unit; } diff --git a/bundles/org.simantics.simulation/src/org/simantics/simulation/export/ExportSubscriptionCSV.java b/bundles/org.simantics.simulation/src/org/simantics/simulation/export/ExportSubscriptionCSV.java index 07954660e..9abae29d2 100644 --- a/bundles/org.simantics.simulation/src/org/simantics/simulation/export/ExportSubscriptionCSV.java +++ b/bundles/org.simantics.simulation/src/org/simantics/simulation/export/ExportSubscriptionCSV.java @@ -97,7 +97,7 @@ public class ExportSubscriptionCSV extends ExperimentExportClass implements Expo labelBuilder.append(")"); } - List historyItems = im.search("variableId", item.variableReference); + List historyItems = im.search("groupItemId", item.groupItemId, "variableId", item.variableReference); Collections.sort(historyItems, SamplingFormat.INTERVAL_COMPARATOR); if (items.isEmpty()) continue; Bean config = historyItems.get(0); diff --git a/bundles/org.simantics.simulation/src/org/simantics/simulation/history/HistoryUtil.java b/bundles/org.simantics.simulation/src/org/simantics/simulation/history/HistoryUtil.java index 343adefc8..6719cf63b 100644 --- a/bundles/org.simantics.simulation/src/org/simantics/simulation/history/HistoryUtil.java +++ b/bundles/org.simantics.simulation/src/org/simantics/simulation/history/HistoryUtil.java @@ -664,7 +664,7 @@ public class HistoryUtil { */ public static HistoryImportResult importHistoryArchive(HistoryManager history, Path path) throws IOException, HistoryException { HistoryImportResult result = new HistoryImportResult(); - try (RandomAccessBinary rab = new BinaryFile(path.toFile())) { + try (RandomAccessBinary rab = new BinaryFile(path.toFile(), "r")) { importHistoryArchive(history, rab, result); return result; } catch (IOException e) { diff --git a/bundles/org.simantics.simulator.toolkit.db/.classpath b/bundles/org.simantics.simulator.toolkit.db/.classpath index b862a296d..e801ebfb4 100644 --- a/bundles/org.simantics.simulator.toolkit.db/.classpath +++ b/bundles/org.simantics.simulator.toolkit.db/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/bundles/org.simantics.simulator.toolkit.db/META-INF/MANIFEST.MF b/bundles/org.simantics.simulator.toolkit.db/META-INF/MANIFEST.MF index b9b735d66..1a8578c03 100644 --- a/bundles/org.simantics.simulator.toolkit.db/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.simulator.toolkit.db/META-INF/MANIFEST.MF @@ -3,10 +3,10 @@ Bundle-ManifestVersion: 2 Bundle-Name: Simulator Toolkit for DB Bundle-SymbolicName: org.simantics.simulator.toolkit.db Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.simulator.toolkit;bundle-version="1.0.0";visibility:=reexport, org.simantics.db.layer0;bundle-version="1.1.0", - org.slf4j.api;bundle-version="1.7.25" + org.slf4j.api Export-Package: org.simantics.simulator.toolkit.db Bundle-Vendor: Semantum Oy Automatic-Module-Name: org.simantics.simulator.toolkit.db diff --git a/bundles/org.simantics.simulator.toolkit/.classpath b/bundles/org.simantics.simulator.toolkit/.classpath index b862a296d..e801ebfb4 100644 --- a/bundles/org.simantics.simulator.toolkit/.classpath +++ b/bundles/org.simantics.simulator.toolkit/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/bundles/org.simantics.simulator.toolkit/META-INF/MANIFEST.MF b/bundles/org.simantics.simulator.toolkit/META-INF/MANIFEST.MF index 1053c9637..eb5c147c0 100644 --- a/bundles/org.simantics.simulator.toolkit/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.simulator.toolkit/META-INF/MANIFEST.MF @@ -3,11 +3,11 @@ Bundle-ManifestVersion: 2 Bundle-Name: Local Simulator Toolkit Bundle-SymbolicName: org.simantics.simulator.toolkit Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.simulator.variable;bundle-version="1.0.0";visibility:=reexport, org.simantics.simulator;bundle-version="1.0.0";visibility:=reexport, gnu.trove3;bundle-version="3.0.3", - org.slf4j.api;bundle-version="1.7.25", + org.slf4j.api, org.simantics.simulation.sequences;bundle-version="1.0.0";visibility:=reexport, org.eclipse.core.runtime, org.simantics.databoard;bundle-version="0.6.6", diff --git a/bundles/org.simantics.simulator.toolkit/src/org/simantics/simulator/toolkit/StandardNodeManager.java b/bundles/org.simantics.simulator.toolkit/src/org/simantics/simulator/toolkit/StandardNodeManager.java index 402f3884d..e09b3136e 100644 --- a/bundles/org.simantics.simulator.toolkit/src/org/simantics/simulator/toolkit/StandardNodeManager.java +++ b/bundles/org.simantics.simulator.toolkit/src/org/simantics/simulator/toolkit/StandardNodeManager.java @@ -194,7 +194,10 @@ public class StandardNodeManager - + diff --git a/bundles/org.simantics.simulator.variable/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.simulator.variable/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.simulator.variable/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.simulator.variable/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.simulator.variable/META-INF/MANIFEST.MF b/bundles/org.simantics.simulator.variable/META-INF/MANIFEST.MF index 92ad56a8e..d19e58d4c 100644 --- a/bundles/org.simantics.simulator.variable/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.simulator.variable/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Simulator Variable Interface Bundle-SymbolicName: org.simantics.simulator.variable Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.databoard;bundle-version="0.6.5" Export-Package: org.simantics.simulator.variable, org.simantics.simulator.variable.exceptions, diff --git a/bundles/org.simantics.simulator.variable/src/org/simantics/simulator/variable/NodeManager.java b/bundles/org.simantics.simulator.variable/src/org/simantics/simulator/variable/NodeManager.java index 345aff81f..27bf8c51b 100644 --- a/bundles/org.simantics.simulator.variable/src/org/simantics/simulator/variable/NodeManager.java +++ b/bundles/org.simantics.simulator.variable/src/org/simantics/simulator/variable/NodeManager.java @@ -36,112 +36,114 @@ import org.simantics.simulator.variable.exceptions.NotInRealmException; */ public interface NodeManager { - // --- Do not require a realm access --- - - /** - * The realm of the node manager. Almost all other methods - * of this class must be called inside this realm. - */ - Realm getRealm(); - - /** - * Returns the name of the node. This method does not require - * that caller is in realm. - */ - String getName(Node node); - - /** - * Adds a listener to a certain node. The new listener is called as - * soon as possible (for example before simulator takes the next simulation - * step). After the first call, it is called always the node value - * or structure may have changed. This can be called outside of the realm. - */ - void addNodeListener(Node node, Runnable listener); - - /** - * Removes previously added listener. This can be called outside of - * the realm. - */ - void removeNodeListener(Node node, Runnable listener); - - // --- Require a realm access --- - - /** - * @return {@code null} if node cannot be found, otherwise a node with the given path - * @throws InvalidPathException if the path is not in a valid path format - * @throws NotInRealmException if not synchronized to the realm - */ - Node getNode(String path) throws NodeManagerException; - /** - * @return {@code null} if node cannot be found, otherwise a child node with the given name - * @throws NotInRealmException if not synchronized to the realm - */ - Node getChild(Node node, String name) throws NodeManagerException; - Node getProperty(Node node, String name) throws NodeManagerException; - List getChildNames(Node node) throws NodeManagerException; - List getPropertyNames(Node node) throws NodeManagerException; - List getChildren(Node node) throws NodeManagerException; - List getProperties(Node node) throws NodeManagerException; - - /** - * @throws NoValueException if the node has no value (and therefore no datatype) - * @throws NotInRealmException if not synchronized to the realm - */ - Datatype getDatatype(Node node) throws NodeManagerException; - /** - * @throws NoValueException if the node has no value - * @throws BindingException if the value can not be bound to the given binding - * @throws NotInRealmException if not synchronized to the realm - */ - Object getValue(Node node, Binding binding) throws NodeManagerException, BindingException; - /** - * A variant of {@link #getValue(Object, Binding)} that uses - * a binding chosen by the node manager. - */ - Variant getValue(Node node) throws NodeManagerException; - /** - * @throws NoSuchNodeException if the property does not exist - * @throws NoValueException if the property has no value - * @throws NotInRealmException if not synchronized to the realm - * @throws BindingException if the value can not be bound to the given binding - */ - Object getValue(Node node, String property, Binding binding) throws NodeManagerException, BindingException; - /** - * A variant of {@link #getValue(Object, String, Binding)} that uses - * a binding chosen by the node manager. - */ - Variant getValue(Node node, String property) throws NodeManagerException; - - /** - * @throws BindingException if the value can not be bound to the given binding - * @throws NoValueException if the property has no value that could be assigned - * @throws NotInRealmException if not synchronized to the realm - */ - void setValue(Node node, Object value, Binding binding) throws NodeManagerException, BindingException; - /** - * @throws BindingException if the value can not be bound to the given binding - * @throws NoSuchNodeException if the property does not exist - * @throws NoValueException if the property has no value that could be assigned - * @throws NotInRealmException if not synchronized to the realm - */ - void setValue(Node node, String property, Object value, Binding binding) throws NodeManagerException, BindingException; - - /** - * Asks the full URI of a property node. The parent of the property is also given as a parameter. - * This is an optional method, NodeManager does not have to implement it for all nodes. - */ + public static final Variant PENDING_NODE_VALUE = new Variant(); + + // --- Do not require a realm access --- + + /** + * The realm of the node manager. Almost all other methods + * of this class must be called inside this realm. + */ + Realm getRealm(); + + /** + * Returns the name of the node. This method does not require + * that caller is in realm. + */ + String getName(Node node); + + /** + * Adds a listener to a certain node. The new listener is called as + * soon as possible (for example before simulator takes the next simulation + * step). After the first call, it is called always the node value + * or structure may have changed. This can be called outside of the realm. + */ + void addNodeListener(Node node, Runnable listener); + + /** + * Removes previously added listener. This can be called outside of + * the realm. + */ + void removeNodeListener(Node node, Runnable listener); + + // --- Require a realm access --- + + /** + * @return {@code null} if node cannot be found, otherwise a node with the given path + * @throws InvalidPathException if the path is not in a valid path format + * @throws NotInRealmException if not synchronized to the realm + */ + Node getNode(String path) throws NodeManagerException; + /** + * @return {@code null} if node cannot be found, otherwise a child node with the given name + * @throws NotInRealmException if not synchronized to the realm + */ + Node getChild(Node node, String name) throws NodeManagerException; + Node getProperty(Node node, String name) throws NodeManagerException; + List getChildNames(Node node) throws NodeManagerException; + List getPropertyNames(Node node) throws NodeManagerException; + List getChildren(Node node) throws NodeManagerException; + List getProperties(Node node) throws NodeManagerException; + + /** + * @throws NoValueException if the node has no value (and therefore no datatype) + * @throws NotInRealmException if not synchronized to the realm + */ + Datatype getDatatype(Node node) throws NodeManagerException; + /** + * @throws NoValueException if the node has no value + * @throws BindingException if the value can not be bound to the given binding + * @throws NotInRealmException if not synchronized to the realm + */ + Object getValue(Node node, Binding binding) throws NodeManagerException, BindingException; + /** + * A variant of {@link #getValue(Object, Binding)} that uses + * a binding chosen by the node manager. + */ + Variant getValue(Node node) throws NodeManagerException; + /** + * @throws NoSuchNodeException if the property does not exist + * @throws NoValueException if the property has no value + * @throws NotInRealmException if not synchronized to the realm + * @throws BindingException if the value can not be bound to the given binding + */ + Object getValue(Node node, String property, Binding binding) throws NodeManagerException, BindingException; + /** + * A variant of {@link #getValue(Object, String, Binding)} that uses + * a binding chosen by the node manager. + */ + Variant getValue(Node node, String property) throws NodeManagerException; + + /** + * @throws BindingException if the value can not be bound to the given binding + * @throws NoValueException if the property has no value that could be assigned + * @throws NotInRealmException if not synchronized to the realm + */ + void setValue(Node node, Object value, Binding binding) throws NodeManagerException, BindingException; + /** + * @throws BindingException if the value can not be bound to the given binding + * @throws NoSuchNodeException if the property does not exist + * @throws NoValueException if the property has no value that could be assigned + * @throws NotInRealmException if not synchronized to the realm + */ + void setValue(Node node, String property, Object value, Binding binding) throws NodeManagerException, BindingException; + + /** + * Asks the full URI of a property node. The parent of the property is also given as a parameter. + * This is an optional method, NodeManager does not have to implement it for all nodes. + */ String getPropertyURI(Node parent, Node property); - /** - * Asks for the classifications of a property node. - * This is an optional method, NodeManager does not have to implement it for all nodes. - * A default implementation should just return {@link Collections#emptySet()}. - * Classifications can be any strings, however a recommended interpretation is to return - * the URIs of the primary ontological types that this node corresponds to. - * - * @param node the node to classify - * @return classifications of the node, empty set if the node has no classifications - */ - Set getClassifications(Node node) throws NodeManagerException; + /** + * Asks for the classifications of a property node. + * This is an optional method, NodeManager does not have to implement it for all nodes. + * A default implementation should just return {@link Collections#emptySet()}. + * Classifications can be any strings, however a recommended interpretation is to return + * the URIs of the primary ontological types that this node corresponds to. + * + * @param node the node to classify + * @return classifications of the node, empty set if the node has no classifications + */ + Set getClassifications(Node node) throws NodeManagerException; } \ No newline at end of file diff --git a/bundles/org.simantics.simulator/.classpath b/bundles/org.simantics.simulator/.classpath index b862a296d..e801ebfb4 100644 --- a/bundles/org.simantics.simulator/.classpath +++ b/bundles/org.simantics.simulator/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/bundles/org.simantics.simulator/META-INF/MANIFEST.MF b/bundles/org.simantics.simulator/META-INF/MANIFEST.MF index 0bbebef43..6bd37757c 100644 --- a/bundles/org.simantics.simulator/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.simulator/META-INF/MANIFEST.MF @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2 Bundle-Name: Simulator Bundle-SymbolicName: org.simantics.simulator Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Require-Bundle: org.slf4j.api;bundle-version="1.7.25", +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Require-Bundle: org.slf4j.api, org.eclipse.core.runtime, org.simantics.databoard;bundle-version="0.6.6" Export-Package: org.simantics.simulator diff --git a/bundles/org.simantics.softwareconfiguration.ontology/.classpath b/bundles/org.simantics.softwareconfiguration.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.softwareconfiguration.ontology/.classpath +++ b/bundles/org.simantics.softwareconfiguration.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.softwareconfiguration.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.softwareconfiguration.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.softwareconfiguration.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.softwareconfiguration.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.softwareconfiguration.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.softwareconfiguration.ontology/META-INF/MANIFEST.MF index d47cbfae2..cf50cf94b 100644 --- a/bundles/org.simantics.softwareconfiguration.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.softwareconfiguration.ontology/META-INF/MANIFEST.MF @@ -5,6 +5,6 @@ Bundle-SymbolicName: org.simantics.softwareconfiguration.ontology Bundle-Version: 1.1.0.qualifier Require-Bundle: org.simantics.layer0, org.simantics.action.ontology;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.layer0 Automatic-Module-Name: org.simantics.softwareconfiguration.ontology diff --git a/bundles/org.simantics.spreadsheet.common/.classpath b/bundles/org.simantics.spreadsheet.common/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.spreadsheet.common/.classpath +++ b/bundles/org.simantics.spreadsheet.common/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.spreadsheet.common/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.spreadsheet.common/.settings/org.eclipse.jdt.core.prefs index fb4492746..415c943cc 100644 --- a/bundles/org.simantics.spreadsheet.common/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.spreadsheet.common/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,7 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore @@ -12,6 +12,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled @@ -41,6 +42,7 @@ org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled @@ -66,4 +68,5 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.spreadsheet.common/META-INF/MANIFEST.MF b/bundles/org.simantics.spreadsheet.common/META-INF/MANIFEST.MF index 8d195df0c..3e2330afe 100644 --- a/bundles/org.simantics.spreadsheet.common/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.spreadsheet.common/META-INF/MANIFEST.MF @@ -3,10 +3,9 @@ Bundle-ManifestVersion: 2 Bundle-Name: Spreadsheet Common Bundle-SymbolicName: org.simantics.spreadsheet.common Bundle-Version: 1.1.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.utils.datastructures;bundle-version="1.0.0", org.simantics.utils.ui;bundle-version="1.0.0", - org.apache.log4j;bundle-version="1.2.15", org.simantics.spreadsheet;bundle-version="1.1.0", org.simantics.db.layer0;bundle-version="1.1.0", org.simantics.scl.runtime;bundle-version="0.1.2", diff --git a/bundles/org.simantics.spreadsheet.fileimport/.classpath b/bundles/org.simantics.spreadsheet.fileimport/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.spreadsheet.fileimport/.classpath +++ b/bundles/org.simantics.spreadsheet.fileimport/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.spreadsheet.fileimport/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.spreadsheet.fileimport/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.spreadsheet.fileimport/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.spreadsheet.fileimport/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.spreadsheet.fileimport/META-INF/MANIFEST.MF b/bundles/org.simantics.spreadsheet.fileimport/META-INF/MANIFEST.MF index d3ef37118..45df70454 100644 --- a/bundles/org.simantics.spreadsheet.fileimport/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.spreadsheet.fileimport/META-INF/MANIFEST.MF @@ -9,7 +9,7 @@ Require-Bundle: org.eclipse.core.runtime, org.simantics.db, org.simantics.spreadsheet.graph, org.simantics -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/component.xml Bundle-Vendor: Semantum Oy diff --git a/bundles/org.simantics.spreadsheet.graph/.classpath b/bundles/org.simantics.spreadsheet.graph/.classpath index 66e731026..ce277ead8 100644 --- a/bundles/org.simantics.spreadsheet.graph/.classpath +++ b/bundles/org.simantics.spreadsheet.graph/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.spreadsheet.graph/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.spreadsheet.graph/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.spreadsheet.graph/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.spreadsheet.graph/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.spreadsheet.graph/META-INF/MANIFEST.MF b/bundles/org.simantics.spreadsheet.graph/META-INF/MANIFEST.MF index 4972e5078..9c4a2011f 100644 --- a/bundles/org.simantics.spreadsheet.graph/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.spreadsheet.graph/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Spreadsheet Database Binding Bundle-SymbolicName: org.simantics.spreadsheet.graph;singleton:=true Bundle-Version: 1.1.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.layer0.utils, org.simantics.ui;bundle-version="1.0.0", org.simantics.layer0;bundle-version="1.0.0", @@ -29,7 +29,7 @@ Require-Bundle: org.simantics.layer0.utils, org.eclipse.e4.core.contexts, org.eclipse.e4.ui.di, org.simantics.browsing.ui.swt, - org.slf4j.api;bundle-version="1.7.20", + org.slf4j.api, org.simantics.simulator.toolkit;bundle-version="1.0.0", org.simantics.simulator.toolkit.db;bundle-version="1.0.0" Export-Package: org.apache.commons.math3.stat.regression, diff --git a/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetGraphUtils.java b/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetGraphUtils.java index 3938e478b..a2d2141f7 100644 --- a/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetGraphUtils.java +++ b/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetGraphUtils.java @@ -12,8 +12,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import javax.xml.soap.Node; - import org.simantics.Simantics; import org.simantics.databoard.Bindings; import org.simantics.databoard.binding.mutable.Variant; @@ -728,7 +726,7 @@ public class SpreadsheetGraphUtils { public static SpreadsheetBook spreadsheetBook(Variable variable) { if(variable instanceof StandardGraphChildVariable) { - VariableNode node = ((StandardGraphChildVariable)variable).node; + VariableNode node = ((StandardGraphChildVariable)variable).node; if(node != null) { if(node.node instanceof SpreadsheetBook) return (SpreadsheetBook) node.node; diff --git a/bundles/org.simantics.spreadsheet.ontology/.classpath b/bundles/org.simantics.spreadsheet.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.spreadsheet.ontology/.classpath +++ b/bundles/org.simantics.spreadsheet.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.spreadsheet.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.spreadsheet.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.spreadsheet.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.spreadsheet.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.spreadsheet.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.spreadsheet.ontology/META-INF/MANIFEST.MF index 154122455..22606b513 100644 --- a/bundles/org.simantics.spreadsheet.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.spreadsheet.ontology/META-INF/MANIFEST.MF @@ -12,6 +12,6 @@ Require-Bundle: org.simantics.layer0, org.simantics.simulation.ontology;bundle-version="1.1.0", org.simantics.datatypes.ontology;bundle-version="1.1.0", org.simantics.selectionview.ontology;bundle-version="1.2.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.spreadsheet.resource Automatic-Module-Name: org.simantics.spreadsheet.ontology diff --git a/bundles/org.simantics.spreadsheet.ui/.classpath b/bundles/org.simantics.spreadsheet.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.spreadsheet.ui/.classpath +++ b/bundles/org.simantics.spreadsheet.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.spreadsheet.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.spreadsheet.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.spreadsheet.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.spreadsheet.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.spreadsheet.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.spreadsheet.ui/META-INF/MANIFEST.MF index 1faf40bb3..df9e6b1dd 100644 --- a/bundles/org.simantics.spreadsheet.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.spreadsheet.ui/META-INF/MANIFEST.MF @@ -27,7 +27,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.e4.core.contexts, org.eclipse.e4.ui.di Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.spreadsheet.ui, org.simantics.spreadsheet.ui.editor Bundle-Vendor: Semantum Oy diff --git a/bundles/org.simantics.spreadsheet/.classpath b/bundles/org.simantics.spreadsheet/.classpath index b862a296d..e801ebfb4 100644 --- a/bundles/org.simantics.spreadsheet/.classpath +++ b/bundles/org.simantics.spreadsheet/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/bundles/org.simantics.spreadsheet/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.spreadsheet/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.spreadsheet/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.spreadsheet/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.spreadsheet/META-INF/MANIFEST.MF b/bundles/org.simantics.spreadsheet/META-INF/MANIFEST.MF index 2bbd595f7..105f5c3cf 100644 --- a/bundles/org.simantics.spreadsheet/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.spreadsheet/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Spreadsheet Bundle-SymbolicName: org.simantics.spreadsheet Bundle-Version: 1.1.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.spreadsheet, org.simantics.spreadsheet.cell.handler, org.simantics.spreadsheet.event.model, @@ -23,6 +23,6 @@ Require-Bundle: org.simantics.utils.datastructures;bundle-version="1.0.0", org.simantics.simulator.toolkit;bundle-version="1.0.0", org.simantics.structural.synchronization;bundle-version="1.0.0", org.apache.poi, - org.slf4j.api;bundle-version="1.7.25" + org.slf4j.api Bundle-Vendor: VTT Technical Research Centre of Finland Automatic-Module-Name: org.simantics.spreadsheet diff --git a/bundles/org.simantics.structural.ontology/.classpath b/bundles/org.simantics.structural.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.structural.ontology/.classpath +++ b/bundles/org.simantics.structural.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.structural.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.structural.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.structural.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.structural.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.structural.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.structural.ontology/META-INF/MANIFEST.MF index b8aff1cb4..918cce972 100644 --- a/bundles/org.simantics.structural.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.structural.ontology/META-INF/MANIFEST.MF @@ -8,7 +8,7 @@ Require-Bundle: org.simantics.layer0, org.simantics.simulation.ontology;bundle-version="1.1.0", org.simantics.issues.ontology;bundle-version="1.2.0", org.simantics.datatypes.ontology;bundle-version="1.1.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.structural.stubs Bundle-Vendor: VTT Technical Research Centre of Finland Automatic-Module-Name: org.simantics.structural.ontology diff --git a/bundles/org.simantics.structural.synchronization.client/.classpath b/bundles/org.simantics.structural.synchronization.client/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.structural.synchronization.client/.classpath +++ b/bundles/org.simantics.structural.synchronization.client/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.structural.synchronization.client/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.structural.synchronization.client/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.structural.synchronization.client/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.structural.synchronization.client/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.structural.synchronization.client/META-INF/MANIFEST.MF b/bundles/org.simantics.structural.synchronization.client/META-INF/MANIFEST.MF index ba77d3e37..b922360d4 100644 --- a/bundles/org.simantics.structural.synchronization.client/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.structural.synchronization.client/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Synchronization Client Bundle-SymbolicName: org.simantics.structural.synchronization.client Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.databoard;bundle-version="0.6.5", org.simantics.db.layer0;bundle-version="1.1.0", org.simantics.structural.ontology;bundle-version="1.2.0", diff --git a/bundles/org.simantics.structural.synchronization/.classpath b/bundles/org.simantics.structural.synchronization/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.structural.synchronization/.classpath +++ b/bundles/org.simantics.structural.synchronization/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.structural.synchronization/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.structural.synchronization/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.structural.synchronization/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.structural.synchronization/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.structural.synchronization/META-INF/MANIFEST.MF b/bundles/org.simantics.structural.synchronization/META-INF/MANIFEST.MF index 5cf82d1f1..fe5bd373e 100644 --- a/bundles/org.simantics.structural.synchronization/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.structural.synchronization/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Synchronization Bundle-SymbolicName: org.simantics.structural.synchronization;singleton:=true Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.structural.synchronization.base, org.simantics.structural.synchronization.protocol, org.simantics.structural.synchronization.utils diff --git a/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java index 095640c4a..5f8334398 100644 --- a/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java +++ b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java @@ -56,6 +56,13 @@ public abstract class SynchronizationEventHandlerBase */ THashSet potentiallyUpdatedComponents = new THashSet<>(); + /** + * Is this potentially an undo/redo-related synchronization? + * + * Default is true for backwards compatibility. + */ + protected boolean isUndo = true; + public SynchronizationEventHandlerBase(Solver solver, ReferenceResolverBase resolver, SolverNameUtil nameUtil, ComponentFactory componentFactory, ModuleUpdaterFactoryBase moduleUpdaterFactory, MappingBase mapping) { this.solver = solver; @@ -66,6 +73,19 @@ public abstract class SynchronizationEventHandlerBase this.resolver = resolver; } + /** + * Mark the undo/redo status of this handler. + * + * Set 'isUndo' to false when processing a normal synchronization and true when + * processing an undo/redo. + * + * When 'isUndo' is false, loading of component solver state from the state undo context + * is skipped for added components. + */ + public void setAsUndo(boolean isUndo) { + this.isUndo = isUndo; + } + @Override public void beginSynchronization() { if(TRACE_EVENTS) { @@ -311,14 +331,16 @@ public abstract class SynchronizationEventHandlerBase else { component.attached = false; context.setModuleName(nameUtil.getFreshName(parentSolverComponentName, name)); - context.addPostUpdateAction(new Runnable() { - @Override - public void run() { - context.stateLoadedFromUndo = mapping.undoContext.loadState(solver, - context.component.componentId, - context.component.uid); - } - }); + if (isUndo) { + context.addPostUpdateAction(new Runnable() { + @Override + public void run() { + context.stateLoadedFromUndo = mapping.undoContext.loadState(solver, + context.component.componentId, + context.component.uid); + } + }); + } updater.create(context, properties, connections); solverComponentNameToComponent.put(context.getModuleName(), component); } diff --git a/bundles/org.simantics.structural.ui/.classpath b/bundles/org.simantics.structural.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.structural.ui/.classpath +++ b/bundles/org.simantics.structural.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.structural.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.structural.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.structural.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.structural.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.structural.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.structural.ui/META-INF/MANIFEST.MF index e6ec6a050..ada7b22b2 100644 --- a/bundles/org.simantics.structural.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.structural.ui/META-INF/MANIFEST.MF @@ -18,7 +18,7 @@ Require-Bundle: org.simantics.structural2;bundle-version="1.0.0", org.simantics.browsing.ui.platform;bundle-version="1.1.0", org.simantics.modeling.ontology;bundle-version="1.0.0";visibility:=reexport Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.structural.ui.menuContributions, org.simantics.structural.ui.modelBrowser, org.simantics.structural.ui.modelBrowser.contributions, diff --git a/bundles/org.simantics.structural2/.classpath b/bundles/org.simantics.structural2/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.structural2/.classpath +++ b/bundles/org.simantics.structural2/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.structural2/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.structural2/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.structural2/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.structural2/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.structural2/META-INF/MANIFEST.MF b/bundles/org.simantics.structural2/META-INF/MANIFEST.MF index 1e43cc4c1..ff13395cc 100644 --- a/bundles/org.simantics.structural2/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.structural2/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Structural Modeling vol 2 Bundle-SymbolicName: org.simantics.structural2;singleton:=true Bundle-Version: 1.1.1.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.structural.ontology;bundle-version="1.0.0", org.simantics.modeling.ontology;bundle-version="1.2.0", org.simantics.layer0.utils;bundle-version="0.8.0", @@ -11,7 +11,7 @@ Require-Bundle: org.simantics.structural.ontology;bundle-version="1.0.0", org.simantics.simulator.variable;bundle-version="1.0.0", org.simantics.scl.osgi;bundle-version="1.0.0", org.simantics;bundle-version="1.0.0", - org.slf4j.api;bundle-version="1.7.25" + org.slf4j.api Export-Package: org.simantics.structural2, org.simantics.structural2.modelingRules, org.simantics.structural2.procedural, diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/Functions.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/Functions.java index e43007637..e9bb272d3 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/Functions.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/Functions.java @@ -635,8 +635,8 @@ public class Functions { @Override public Map getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { - - Resource type = context.getPossibleType(graph); + StructuralResource2 STR = StructuralResource2.getInstance(graph); + Resource type = context.getPossibleType(graph, STR.Component); if(type == null) return null; StructuralComponentClass clazz = StructuralComponentClass.get(graph, type); @@ -653,7 +653,6 @@ public class Functions { } return map; } else if (StructuralComponentClass.DEFINED.equals(clazz)) { - StructuralResource2 STR = StructuralResource2.getInstance(graph); Resource def = graph.getSingleObject(type, STR.IsDefinedBy); Map children = graph.syncRequest(new UnescapedChildMapOfResource(def), TransientCacheListener.instance()); return StandardChildDomainChildren.getStandardChildDomainChildVariables(graph, context, children, map); diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/queries/GetComponentLocation.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/queries/GetComponentLocation.java index df6e1598c..e109f59e8 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/queries/GetComponentLocation.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/queries/GetComponentLocation.java @@ -66,10 +66,16 @@ public class GetComponentLocation extends UnaryRead Variable firstRepresentedParent = findFirstParentWithRepresentation(graph, parameter, STR); if (firstRepresentedParent == null) return null; - Resource realParentComposite = graph.getPossibleObject(firstRepresentedParent.getRepresents(graph), L0.PartOf); - if (realParentComposite == null) - return null; - isInsideStructure = graph.hasStatement(realParentComposite, STR.Defines); + Resource representedParent = firstRepresentedParent.getRepresents(graph); + Resource representedParentType = graph.getPossibleType(representedParent, STR.Component); + if (representedParentType != null && graph.isInstanceOf(representedParentType, STR.ProceduralComponentType)) { + isInsideStructure = !parameter.equals(firstRepresentedParent); + } else { + Resource realParentComposite = graph.getPossibleObject(representedParent, L0.PartOf); + if (realParentComposite == null) + return null; + isInsideStructure = graph.hasStatement(realParentComposite, STR.Defines); + } Variable firstParentComposite = findFirstParentComposite(graph, firstRepresentedParent, STR); if (firstParentComposite != null) { diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/AbstractCompileStructuralValueRequest.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/AbstractCompileStructuralValueRequest.java index fce1abaa2..5e8538a69 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/AbstractCompileStructuralValueRequest.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/AbstractCompileStructuralValueRequest.java @@ -9,10 +9,10 @@ import org.simantics.db.Resource; import org.simantics.db.common.procedure.adapter.TransientCacheListener; import org.simantics.db.common.request.PossibleIndexRoot; import org.simantics.db.common.request.ResourceRead2; +import org.simantics.db.common.request.RuntimeEnvironmentRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.scl.AbstractExpressionCompilationContext; import org.simantics.db.layer0.scl.AbstractExpressionCompilationRequest; -import org.simantics.db.layer0.util.RuntimeEnvironmentRequest; import org.simantics.db.layer0.util.RuntimeEnvironmentRequest2; import org.simantics.layer0.Layer0; import org.simantics.scl.compiler.elaboration.expressions.EApply; diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/procedural/ProceduralComponentTypeCompilationContextRequest.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/procedural/ProceduralComponentTypeCompilationContextRequest.java index 50a905e82..1e3647905 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/procedural/ProceduralComponentTypeCompilationContextRequest.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/procedural/ProceduralComponentTypeCompilationContextRequest.java @@ -8,7 +8,7 @@ import org.simantics.db.common.procedure.adapter.TransientCacheListener; import org.simantics.db.common.request.IndexRoot; import org.simantics.db.common.request.UnaryRead; import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.util.RuntimeEnvironmentRequest; +import org.simantics.db.layer0.util.RuntimeEnvironmentRequest2; import org.simantics.scl.compiler.environment.specification.EnvironmentSpecification; import org.simantics.scl.compiler.runtime.RuntimeEnvironment; import org.simantics.structural2.scl.ComponentTypeProperty; @@ -25,7 +25,7 @@ public class ProceduralComponentTypeCompilationContextRequest extends UnaryRead< public ProceduralComponentTypeCompilationContext perform(ReadGraph graph) throws DatabaseException { Resource indexRoot = graph.syncRequest(new IndexRoot(parameter)); - RuntimeEnvironment runtimeEnvironment = graph.syncRequest(new RuntimeEnvironmentRequest(indexRoot) { + RuntimeEnvironment runtimeEnvironment = graph.syncRequest(new RuntimeEnvironmentRequest2(parameter, indexRoot) { @Override protected void fillEnvironmentSpecification( EnvironmentSpecification environmentSpecification) { diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/utils/StructuralUtils.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/utils/StructuralUtils.java index e27d92f29..aac19a7f1 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/utils/StructuralUtils.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/utils/StructuralUtils.java @@ -308,11 +308,13 @@ public class StructuralUtils { } public static boolean isImmutable(ReadGraph graph, Resource r) throws DatabaseException { + // Marking a resource L0.readOnly also makes it immutable + if (graph.isImmutable(r) || Layer0Utils.isMarkedReadOnly(graph, r)) + return true; StructuralResource2 STR = StructuralResource2.getInstance(graph); Resource uc = graph.syncRequest(new PossibleTypedParent(r, STR.ComponentType)); - return graph.isImmutable(r) - // Anything under a published or locked user component is published as well - || (uc != null && (Layer0Utils.isPublished(graph, uc) + return // Anything under a published or locked user component is published as well + (uc != null && (Layer0Utils.isPublished(graph, uc) || graph.hasStatement(uc, STR.ComponentType_Locked))) // Anything under a published container (shared library) is published as well || Layer0Utils.isContainerPublished(graph, r) diff --git a/bundles/org.simantics.team.ui/.classpath b/bundles/org.simantics.team.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.team.ui/.classpath +++ b/bundles/org.simantics.team.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.team.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.team.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.team.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.team.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.team.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.team.ui/META-INF/MANIFEST.MF index 334c4ab02..a52e7bbd7 100644 --- a/bundles/org.simantics.team.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.team.ui/META-INF/MANIFEST.MF @@ -19,6 +19,6 @@ Require-Bundle: org.eclipse.ui, org.eclipse.equinox.frameworkadmin.equinox;bundle-version="1.0.300", org.simantics.application;bundle-version="1.1.0" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-Vendor: VTT Technical Research Centre of Finland Automatic-Module-Name: org.simantics.team.ui diff --git a/bundles/org.simantics.tests.modelled.ontology/.classpath b/bundles/org.simantics.tests.modelled.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.tests.modelled.ontology/.classpath +++ b/bundles/org.simantics.tests.modelled.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.tests.modelled.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.tests.modelled.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.tests.modelled.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.tests.modelled.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.tests.modelled.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.tests.modelled.ontology/META-INF/MANIFEST.MF index ee1d78171..0a062fd85 100644 --- a/bundles/org.simantics.tests.modelled.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.tests.modelled.ontology/META-INF/MANIFEST.MF @@ -6,7 +6,7 @@ Bundle-Version: 1.0.0.qualifier Require-Bundle: org.simantics.layer0, org.simantics.selectionview.ontology;bundle-version="1.2.0", org.simantics.modeling.ontology;bundle-version="1.2.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.tests.modelled.ontology Bundle-Vendor: Semantum Oy Automatic-Module-Name: org.simantics.tests.modelled.ontology diff --git a/bundles/org.simantics.tests.modelled.ui.ontology/.classpath b/bundles/org.simantics.tests.modelled.ui.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.tests.modelled.ui.ontology/.classpath +++ b/bundles/org.simantics.tests.modelled.ui.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.tests.modelled.ui.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.tests.modelled.ui.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.tests.modelled.ui.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.tests.modelled.ui.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.tests.modelled.ui.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.tests.modelled.ui.ontology/META-INF/MANIFEST.MF index 5d84c6eef..ff0286c9b 100644 --- a/bundles/org.simantics.tests.modelled.ui.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.tests.modelled.ui.ontology/META-INF/MANIFEST.MF @@ -10,7 +10,7 @@ Require-Bundle: org.simantics.layer0, org.simantics.modeling.ontology;bundle-version="1.2.0", org.simantics.silk.ontology;bundle-version="1.1.0", org.simantics.image2.ontology;bundle-version="1.2.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-Vendor: Semantum Oy Export-Package: org.simantics.tests.modelled.ui.ontology Automatic-Module-Name: org.simantics.tests.modelled.ui.ontology diff --git a/bundles/org.simantics.tests.modelled.ui/.classpath b/bundles/org.simantics.tests.modelled.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.tests.modelled.ui/.classpath +++ b/bundles/org.simantics.tests.modelled.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.tests.modelled.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.tests.modelled.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.tests.modelled.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.tests.modelled.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.tests.modelled.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.tests.modelled.ui/META-INF/MANIFEST.MF index 24f324cfb..7ea5fac37 100644 --- a/bundles/org.simantics.tests.modelled.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.tests.modelled.ui/META-INF/MANIFEST.MF @@ -17,8 +17,9 @@ Require-Bundle: org.eclipse.ui, org.eclipse.e4.ui.model.workbench, org.simantics.scl.osgi, org.simantics.browsing.ui.model, - org.slf4j.api -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 + org.slf4j.api, + jakarta.annotation-api;bundle-version="1.3.5" +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Bundle-Vendor: Semantum Oy Automatic-Module-Name: org.simantics.tests.modelled.ui diff --git a/bundles/org.simantics.tests.modelled.ui/scl/Simantics/TestsUI.scl b/bundles/org.simantics.tests.modelled.ui/scl/Simantics/TestsUI.scl index 0b99fe784..169f37e2a 100644 --- a/bundles/org.simantics.tests.modelled.ui/scl/Simantics/TestsUI.scl +++ b/bundles/org.simantics.tests.modelled.ui/scl/Simantics/TestsUI.scl @@ -7,7 +7,7 @@ createSTSTestAction res = do importJava "org.simantics.tests.modelled.ui.TestsUIUtils" where runSTSTestAction :: Resource -> () - ignoreSTSTestAction :: [Resource] -> () + ignoreSTSTestAction :: Resource -> () createSTSSuiteAction :: Resource -> () createSTSSuiteAction res = do diff --git a/bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/TestsUIUtils.java b/bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/TestsUIUtils.java index b24f445e2..648d48969 100644 --- a/bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/TestsUIUtils.java +++ b/bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/TestsUIUtils.java @@ -1,7 +1,6 @@ package org.simantics.tests.modelled.ui; import java.io.IOException; -import java.util.List; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.simantics.Simantics; @@ -27,15 +26,13 @@ public class TestsUIUtils { view.execute(); } - public static void ignoreSTSTestAction(List tests) throws DatabaseException { + public static void ignoreSTSTestAction(Resource test) throws DatabaseException { Simantics.getSession().syncRequest(new Write() { @Override public void perform(WriteGraph graph) throws DatabaseException { TestsResource TESTS = TestsResource.getInstance(graph); - for (Resource test : tests) { - graph.claimLiteral(test, TESTS.ignore, true, Bindings.BOOLEAN); - } + graph.claimLiteral(test, TESTS.ignore, true, Bindings.BOOLEAN); } }); } diff --git a/bundles/org.simantics.tests.modelled/.classpath b/bundles/org.simantics.tests.modelled/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.tests.modelled/.classpath +++ b/bundles/org.simantics.tests.modelled/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.tests.modelled/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.tests.modelled/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.tests.modelled/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.tests.modelled/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.tests.modelled/META-INF/MANIFEST.MF b/bundles/org.simantics.tests.modelled/META-INF/MANIFEST.MF index 19c437b0e..3d4953c6e 100644 --- a/bundles/org.simantics.tests.modelled/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.tests.modelled/META-INF/MANIFEST.MF @@ -12,7 +12,7 @@ Require-Bundle: org.simantics.tests.modelled.ontology, org.slf4j.api, org.simantics.db.testing, org.simantics.debug.browser;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.tests.modelled, org.simantics.tests.modelled.junit, diff --git a/bundles/org.simantics.threadlog/.classpath b/bundles/org.simantics.threadlog/.classpath index cb285791c..e6f2f43f3 100644 --- a/bundles/org.simantics.threadlog/.classpath +++ b/bundles/org.simantics.threadlog/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.threadlog/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.threadlog/.settings/org.eclipse.jdt.core.prefs index 7c19c1fc3..7adc0fb9a 100644 --- a/bundles/org.simantics.threadlog/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.threadlog/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,10 @@ -#Fri Oct 30 22:48:46 EET 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.threadlog/META-INF/MANIFEST.MF b/bundles/org.simantics.threadlog/META-INF/MANIFEST.MF index fae2ac821..8750d6431 100644 --- a/bundles/org.simantics.threadlog/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.threadlog/META-INF/MANIFEST.MF @@ -7,6 +7,6 @@ Bundle-Activator: org.simantics.threadlog.internal.Activator Require-Bundle: org.eclipse.core.runtime, gnu.trove3 Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.threadlog Automatic-Module-Name: org.simantics.threadlog diff --git a/bundles/org.simantics.trend/.classpath b/bundles/org.simantics.trend/.classpath index 9cea2c448..45437d5a7 100644 --- a/bundles/org.simantics.trend/.classpath +++ b/bundles/org.simantics.trend/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.trend/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.trend/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.trend/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.trend/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.trend/META-INF/MANIFEST.MF b/bundles/org.simantics.trend/META-INF/MANIFEST.MF index 9b1daad02..42771b048 100644 --- a/bundles/org.simantics.trend/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.trend/META-INF/MANIFEST.MF @@ -13,7 +13,7 @@ Require-Bundle: org.eclipse.core.runtime, com.lowagie.text;bundle-version="2.1.5";resolution:=optional, org.slf4j.api Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.trend, org.simantics.trend.configuration, org.simantics.trend.impl, diff --git a/bundles/org.simantics.trend/src/org/simantics/trend/impl/HorizRuler.java b/bundles/org.simantics.trend/src/org/simantics/trend/impl/HorizRuler.java index a70949d5e..708a32efc 100644 --- a/bundles/org.simantics.trend/src/org/simantics/trend/impl/HorizRuler.java +++ b/bundles/org.simantics.trend/src/org/simantics/trend/impl/HorizRuler.java @@ -284,6 +284,14 @@ public class HorizRuler extends TrendGraphicalNode { return (end-from) / getWidth(); } + /** + * @return the current starting sample time calculated from all visible chart + * items. + */ + public double getItemFromTime() { + return iFrom; + } + /** * @return the current ending sample time calculated from all visible chart * items. diff --git a/bundles/org.simantics.ui.workspace.tracker/.classpath b/bundles/org.simantics.ui.workspace.tracker/.classpath index b862a296d..e801ebfb4 100644 --- a/bundles/org.simantics.ui.workspace.tracker/.classpath +++ b/bundles/org.simantics.ui.workspace.tracker/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/bundles/org.simantics.ui.workspace.tracker/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.ui.workspace.tracker/.settings/org.eclipse.jdt.core.prefs index 295926d96..7adc0fb9a 100644 --- a/bundles/org.simantics.ui.workspace.tracker/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.ui.workspace.tracker/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.ui.workspace.tracker/META-INF/MANIFEST.MF b/bundles/org.simantics.ui.workspace.tracker/META-INF/MANIFEST.MF index 555873256..76ebb9cc4 100644 --- a/bundles/org.simantics.ui.workspace.tracker/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.ui.workspace.tracker/META-INF/MANIFEST.MF @@ -15,13 +15,13 @@ Require-Bundle: javax.inject, org.simantics.filesystem.services, org.slf4j.api, org.eclipse.e4.ui.model.workbench, + org.eclipse.e4.ui.workbench, org.eclipse.ui.workbench, org.eclipse.ui, - org.eclipse.e4.core.contexts -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Import-Package: javax.annotation;version="1.2.0", - javax.inject;version="1.0.0", - org.eclipse.e4.ui.workbench.modeling + org.eclipse.e4.core.contexts, + jakarta.annotation-api +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Import-Package: javax.inject Bundle-ActivationPolicy: lazy Export-Package: org.simantics.ui.workspace.tracker Automatic-Module-Name: org.simantics.ui.workspace.tracker diff --git a/bundles/org.simantics.ui/.classpath b/bundles/org.simantics.ui/.classpath index 95b68dcc6..cbb66231b 100644 --- a/bundles/org.simantics.ui/.classpath +++ b/bundles/org.simantics.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.ui/.settings/org.eclipse.jdt.core.prefs index a698e5967..7adc0fb9a 100644 --- a/bundles/org.simantics.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,12 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.ui/META-INF/MANIFEST.MF index 2842b50b7..dab3c9ab9 100644 --- a/bundles/org.simantics.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.ui/META-INF/MANIFEST.MF @@ -30,7 +30,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.e4.ui.di, org.eclipse.e4.ui.bindings, org.simantics.modeling.ontology;bundle-version="1.2.0", - org.slf4j.api + org.slf4j.api, + jakarta.annotation-api;bundle-version="1.3.5" Bundle-ActivationPolicy: lazy Import-Package: javax.inject Export-Package: org.simantics.ui, @@ -57,5 +58,5 @@ Export-Package: org.simantics.ui, org.simantics.ui.workbench.preferences Bundle-ClassPath: . Bundle-Activator: org.simantics.ui.internal.Activator -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.simantics.ui diff --git a/bundles/org.simantics.user.ontology/.classpath b/bundles/org.simantics.user.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.user.ontology/.classpath +++ b/bundles/org.simantics.user.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.user.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.user.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.user.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.user.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.user.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.user.ontology/META-INF/MANIFEST.MF index f4545cf14..e32551f98 100644 --- a/bundles/org.simantics.user.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.user.ontology/META-INF/MANIFEST.MF @@ -5,6 +5,6 @@ Bundle-SymbolicName: org.simantics.user.ontology Bundle-Version: 1.1.0.qualifier Require-Bundle: org.simantics.layer0, org.simantics.layer0x.ontology;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.user Automatic-Module-Name: org.simantics.user.ontology diff --git a/bundles/org.simantics.utils.datastructures/.classpath b/bundles/org.simantics.utils.datastructures/.classpath index 21329daa4..83e26c9bf 100644 --- a/bundles/org.simantics.utils.datastructures/.classpath +++ b/bundles/org.simantics.utils.datastructures/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.utils.datastructures/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.utils.datastructures/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.utils.datastructures/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.utils.datastructures/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.utils.datastructures/META-INF/MANIFEST.MF b/bundles/org.simantics.utils.datastructures/META-INF/MANIFEST.MF index 1b012d999..0ac866e13 100644 --- a/bundles/org.simantics.utils.datastructures/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.utils.datastructures/META-INF/MANIFEST.MF @@ -20,8 +20,7 @@ Require-Bundle: org.simantics.utils.thread;bundle-version="1.0.0";visibility:=re org.simantics.utils;bundle-version="1.0.0", gnu.trove3;bundle-version="3.0.0", org.simantics.databoard;bundle-version="0.6.5";resolution:=optional, - org.slf4j.api;bundle-version="1.7.25", - org.eclipse.collections.eclipse-collections;bundle-version="9.2.0", - org.eclipse.collections.eclipse-collections-api;bundle-version="9.2.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 + org.slf4j.api, + org.eclipse.collections +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.simantics.utils.datastructures diff --git a/bundles/org.simantics.utils.thread.swt/.classpath b/bundles/org.simantics.utils.thread.swt/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.utils.thread.swt/.classpath +++ b/bundles/org.simantics.utils.thread.swt/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.utils.thread.swt/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.utils.thread.swt/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.utils.thread.swt/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.utils.thread.swt/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.utils.thread.swt/META-INF/MANIFEST.MF b/bundles/org.simantics.utils.thread.swt/META-INF/MANIFEST.MF index 7c14f5b12..2f026f482 100644 --- a/bundles/org.simantics.utils.thread.swt/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.utils.thread.swt/META-INF/MANIFEST.MF @@ -7,5 +7,5 @@ Bundle-Vendor: VTT Technical Research Centre of Finland Require-Bundle: org.simantics.utils.thread;visibility:=reexport, org.eclipse.swt Export-Package: org.simantics.utils.threads -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.simantics.utils.thread.swt diff --git a/bundles/org.simantics.utils.thread/.classpath b/bundles/org.simantics.utils.thread/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.utils.thread/.classpath +++ b/bundles/org.simantics.utils.thread/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.utils.thread/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.utils.thread/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.utils.thread/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.utils.thread/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.utils.thread/META-INF/MANIFEST.MF b/bundles/org.simantics.utils.thread/META-INF/MANIFEST.MF index 7028157f6..a200f5fa0 100644 --- a/bundles/org.simantics.utils.thread/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.utils.thread/META-INF/MANIFEST.MF @@ -6,6 +6,6 @@ Bundle-Version: 1.1.0.qualifier Export-Package: org.simantics.utils.threads, org.simantics.utils.threads.logger Bundle-Vendor: VTT Technical Research Centre of Finland -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.slf4j.api Automatic-Module-Name: org.simantics.utils.thread diff --git a/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/AWTThread.java b/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/AWTThread.java index 3b9d5b258..a5683be49 100644 --- a/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/AWTThread.java +++ b/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/AWTThread.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * Copyright (c) 2007, 2020 Association for Decentralized Information Management * in Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,6 +8,7 @@ * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation + * Semantum Oy - gitlab #522 - removed reflection hack *******************************************************************************/ /* * @@ -16,8 +17,6 @@ package org.simantics.utils.threads; import java.awt.EventQueue; -import java.awt.Toolkit; -import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.util.List; import java.util.concurrent.AbstractExecutorService; @@ -36,36 +35,10 @@ public class AWTThread extends AbstractExecutorService implements IThreadWorkQue return INSTANCE; } - Field dispatchThread; - - AWTThread() { - dispatchThread = getDispatchThreadField(); - } - - private Field getDispatchThreadField() - { - try { - Field f = EventQueue.class.getDeclaredField("dispatchThread"); - f.setAccessible(true); - return f; - } catch (SecurityException e) { - throw new RuntimeException(e); - } catch (NoSuchFieldException e) { - throw new RuntimeException(e); - } - } - @Override public Thread asyncExec(Runnable runnable) { - EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue(); EventQueue.invokeLater(runnable); - try { - return (Thread) dispatchThread.get(eq); - } catch (IllegalArgumentException e1) { - throw new RuntimeException(e1); - } catch (IllegalAccessException e1) { - throw new RuntimeException(e1); - } + return null; } @Override @@ -93,14 +66,7 @@ public class AWTThread extends AbstractExecutorService implements IThreadWorkQue @Override public Thread getThread() { - EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue(); - try { - return (Thread) dispatchThread.get(eq); - } catch (IllegalArgumentException e1) { - throw new RuntimeException(e1); - } catch (IllegalAccessException e1) { - throw new RuntimeException(e1); - } + return null; } public String toString() { @@ -135,6 +101,6 @@ public class AWTThread extends AbstractExecutorService implements IThreadWorkQue public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { return false; - } + } } diff --git a/bundles/org.simantics.utils.ui.workbench/.classpath b/bundles/org.simantics.utils.ui.workbench/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.utils.ui.workbench/.classpath +++ b/bundles/org.simantics.utils.ui.workbench/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.utils.ui.workbench/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.utils.ui.workbench/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.utils.ui.workbench/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.utils.ui.workbench/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.utils.ui.workbench/META-INF/MANIFEST.MF b/bundles/org.simantics.utils.ui.workbench/META-INF/MANIFEST.MF index b6999573f..edcaa8943 100644 --- a/bundles/org.simantics.utils.ui.workbench/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.utils.ui.workbench/META-INF/MANIFEST.MF @@ -16,5 +16,5 @@ Export-Package: org.simantics.utils.ui.workbench, org.simantics.utils.ui.workbench.saving, org.simantics.utils.ui.workbench.ui Bundle-ClassPath: . -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.simantics.utils.ui.workbench diff --git a/bundles/org.simantics.utils.ui/.classpath b/bundles/org.simantics.utils.ui/.classpath index 21329daa4..83e26c9bf 100644 --- a/bundles/org.simantics.utils.ui/.classpath +++ b/bundles/org.simantics.utils.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.utils.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.utils.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.utils.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.utils.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.utils.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.utils.ui/META-INF/MANIFEST.MF index 53dcc1171..9fd5c289d 100644 --- a/bundles/org.simantics.utils.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.utils.ui/META-INF/MANIFEST.MF @@ -26,5 +26,5 @@ Export-Package: org.simantics.utils.ui, Bundle-ClassPath: . Bundle-ActivationPolicy: lazy Bundle-Activator: org.simantics.utils.ui.internal.Activator -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.simantics.utils.ui diff --git a/bundles/org.simantics.utils/.classpath b/bundles/org.simantics.utils/.classpath index 21329daa4..83e26c9bf 100644 --- a/bundles/org.simantics.utils/.classpath +++ b/bundles/org.simantics.utils/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.utils/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.utils/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.utils/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.utils/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.utils/META-INF/MANIFEST.MF b/bundles/org.simantics.utils/META-INF/MANIFEST.MF index 9abadd88e..2a7a76a1f 100644 --- a/bundles/org.simantics.utils/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.utils/META-INF/MANIFEST.MF @@ -15,6 +15,6 @@ Export-Package: org.simantics.utils, Bundle-ClassPath: . Require-Bundle: org.junit;bundle-version="4.12.0";resolution:=optional, org.simantics.databoard;bundle-version="0.6.2", - org.slf4j.api;bundle-version="1.7.20" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 + org.slf4j.api +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.simantics.utils diff --git a/bundles/org.simantics.viewpoint.ontology/.classpath b/bundles/org.simantics.viewpoint.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.viewpoint.ontology/.classpath +++ b/bundles/org.simantics.viewpoint.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.viewpoint.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.viewpoint.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.viewpoint.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.viewpoint.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.viewpoint.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.viewpoint.ontology/META-INF/MANIFEST.MF index 7116eb720..6d4fd81ac 100644 --- a/bundles/org.simantics.viewpoint.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.viewpoint.ontology/META-INF/MANIFEST.MF @@ -7,6 +7,6 @@ Require-Bundle: org.simantics.layer0, org.simantics.color.ontology;bundle-version="1.0.0", org.simantics.action.ontology;bundle-version="1.0.0", org.simantics.image2.ontology;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.viewpoint.ontology Automatic-Module-Name: org.simantics.viewpoint.ontology diff --git a/bundles/org.simantics.views.ontology/.classpath b/bundles/org.simantics.views.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.views.ontology/.classpath +++ b/bundles/org.simantics.views.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.views.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.views.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.views.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.views.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.views.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.views.ontology/META-INF/MANIFEST.MF index c2f875be0..981ad74fc 100644 --- a/bundles/org.simantics.views.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.views.ontology/META-INF/MANIFEST.MF @@ -8,7 +8,7 @@ Require-Bundle: org.simantics.layer0, org.simantics.layer0x.ontology;bundle-version="1.0.0", org.simantics.scenegraph.ontology;bundle-version="1.0.0", org.simantics.selectionview.ontology;bundle-version="1.1.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.views.ontology Bundle-Vendor: Semantum Oy Automatic-Module-Name: org.simantics.views.ontology diff --git a/bundles/org.simantics.views.swt.client/.classpath b/bundles/org.simantics.views.swt.client/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.views.swt.client/.classpath +++ b/bundles/org.simantics.views.swt.client/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.views.swt.client/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.views.swt.client/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.views.swt.client/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.views.swt.client/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.views.swt.client/META-INF/MANIFEST.MF b/bundles/org.simantics.views.swt.client/META-INF/MANIFEST.MF index 8b5ee402a..3ab911b72 100644 --- a/bundles/org.simantics.views.swt.client/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.views.swt.client/META-INF/MANIFEST.MF @@ -19,7 +19,7 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.mylyn.wikitext;bundle-version="3.0.6", org.eclipse.mylyn.wikitext.mediawiki;bundle-version="3.0.6" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.views.swt.client.base, org.simantics.views.swt.client.impl Bundle-Vendor: Semantum Oy diff --git a/bundles/org.simantics.views.swt/.classpath b/bundles/org.simantics.views.swt/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.views.swt/.classpath +++ b/bundles/org.simantics.views.swt/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.views.swt/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.views.swt/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.views.swt/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.views.swt/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.views.swt/META-INF/MANIFEST.MF b/bundles/org.simantics.views.swt/META-INF/MANIFEST.MF index f90a7a7dd..ba1504f0f 100644 --- a/bundles/org.simantics.views.swt/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.views.swt/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Modelled SWT View Loaders Bundle-SymbolicName: org.simantics.views.swt Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.simantics.browsing.ui.swt;bundle-version="1.1.0";visibility:=reexport, org.simantics.db.management;bundle-version="1.1.0", org.simantics.views.ontology;bundle-version="1.0.0", @@ -17,7 +17,7 @@ Require-Bundle: org.simantics.browsing.ui.swt;bundle-version="1.1.0";visibility: org.simantics.scenegraph.loader;bundle-version="1.0.0";visibility:=reexport, org.simantics.scenegraph.ontology;bundle-version="1.0.0", org.simantics.utils.thread.swt;bundle-version="1.1.0", - org.slf4j.api;bundle-version="1.7.25" + org.slf4j.api Export-Package: org.simantics.views.swt Bundle-Activator: org.simantics.views.swt.Activator Bundle-Vendor: Semantum Oy diff --git a/bundles/org.simantics.views.text.ontology/.classpath b/bundles/org.simantics.views.text.ontology/.classpath index b862a296d..e801ebfb4 100644 --- a/bundles/org.simantics.views.text.ontology/.classpath +++ b/bundles/org.simantics.views.text.ontology/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/bundles/org.simantics.views.text.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.views.text.ontology/.settings/org.eclipse.jdt.core.prefs index 295926d96..7adc0fb9a 100644 --- a/bundles/org.simantics.views.text.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.views.text.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.views.text.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.views.text.ontology/META-INF/MANIFEST.MF index 2a0792592..495539ff1 100644 --- a/bundles/org.simantics.views.text.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.views.text.ontology/META-INF/MANIFEST.MF @@ -6,5 +6,5 @@ Bundle-Version: 1.0.0.qualifier Bundle-Vendor: Semantum Oy Require-Bundle: org.simantics.layer0, org.simantics.views.ontology;bundle-version="1.2.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.simantics.views.text.ontology diff --git a/bundles/org.simantics.views.text/.classpath b/bundles/org.simantics.views.text/.classpath index b862a296d..e801ebfb4 100644 --- a/bundles/org.simantics.views.text/.classpath +++ b/bundles/org.simantics.views.text/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/bundles/org.simantics.views.text/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.views.text/.settings/org.eclipse.jdt.core.prefs index 295926d96..7adc0fb9a 100644 --- a/bundles/org.simantics.views.text/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.views.text/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.views.text/META-INF/MANIFEST.MF b/bundles/org.simantics.views.text/META-INF/MANIFEST.MF index 868c24a90..a53a3c6cd 100644 --- a/bundles/org.simantics.views.text/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.views.text/META-INF/MANIFEST.MF @@ -16,6 +16,6 @@ Require-Bundle: org.eclipse.ui, org.eclipse.mylyn.wikitext.mediawiki;bundle-version="3.0.6", org.eclipse.mylyn.wikitext.ui;bundle-version="3.0.6", org.eclipse.mylyn.wikitext.mediawiki.ui;bundle-version="3.0.6" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Automatic-Module-Name: org.simantics.views.text diff --git a/bundles/org.simantics.views/.classpath b/bundles/org.simantics.views/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.views/.classpath +++ b/bundles/org.simantics.views/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.views/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.views/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.views/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.views/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.views/META-INF/MANIFEST.MF b/bundles/org.simantics.views/META-INF/MANIFEST.MF index 6ff07c9da..82c6edbef 100644 --- a/bundles/org.simantics.views/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.views/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Views Bundle-SymbolicName: org.simantics.views;singleton:=true Bundle-Version: 1.1.0.qualifier Bundle-Vendor: Semantum Oy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.views Require-Bundle: org.simantics.views.ontology;bundle-version="1.0.0", org.eclipse.core.runtime;bundle-version="3.6.0", diff --git a/bundles/org.simantics.wiki.ui/.classpath b/bundles/org.simantics.wiki.ui/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.wiki.ui/.classpath +++ b/bundles/org.simantics.wiki.ui/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.wiki.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.wiki.ui/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.wiki.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.wiki.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.wiki.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.wiki.ui/META-INF/MANIFEST.MF index 460bda717..144382aac 100644 --- a/bundles/org.simantics.wiki.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.wiki.ui/META-INF/MANIFEST.MF @@ -19,7 +19,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.mylyn.wikitext;bundle-version="3.0.6", org.eclipse.mylyn.wikitext.mediawiki;bundle-version="3.0.6" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.wiki.ui, org.simantics.wiki.ui.editor, org.simantics.wiki.ui.language diff --git a/bundles/org.simantics.workbench.ontology/.classpath b/bundles/org.simantics.workbench.ontology/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.workbench.ontology/.classpath +++ b/bundles/org.simantics.workbench.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.workbench.ontology/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.workbench.ontology/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.workbench.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.workbench.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.workbench.ontology/META-INF/MANIFEST.MF b/bundles/org.simantics.workbench.ontology/META-INF/MANIFEST.MF index 53c2632b3..e3d072c69 100644 --- a/bundles/org.simantics.workbench.ontology/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.workbench.ontology/META-INF/MANIFEST.MF @@ -7,6 +7,6 @@ Bundle-Vendor: Semantum Oy Require-Bundle: org.simantics.layer0, org.simantics.project.ontology;bundle-version="1.0.0", org.simantics.layer0x.ontology;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.workbench.ontology Automatic-Module-Name: org.simantics.workbench.ontology diff --git a/bundles/org.simantics.workbench.search.impl/.classpath b/bundles/org.simantics.workbench.search.impl/.classpath new file mode 100644 index 000000000..e801ebfb4 --- /dev/null +++ b/bundles/org.simantics.workbench.search.impl/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/bundles/org.simantics.workbench.search.impl/.project b/bundles/org.simantics.workbench.search.impl/.project new file mode 100644 index 000000000..a13c54bdf --- /dev/null +++ b/bundles/org.simantics.workbench.search.impl/.project @@ -0,0 +1,28 @@ + + + org.simantics.workbench.search.impl + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/bundles/org.simantics.workbench.search.impl/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.workbench.search.impl/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7adc0fb9a --- /dev/null +++ b/bundles/org.simantics.workbench.search.impl/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,10 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.workbench.search.impl/META-INF/MANIFEST.MF b/bundles/org.simantics.workbench.search.impl/META-INF/MANIFEST.MF new file mode 100644 index 000000000..6e627466f --- /dev/null +++ b/bundles/org.simantics.workbench.search.impl/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Workbench Search Service Implementation +Bundle-SymbolicName: org.simantics.workbench.search.impl;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.simantics.workbench.search.impl.Activator +Bundle-Vendor: Semantum Oy +Require-Bundle: org.eclipse.ui, + org.eclipse.core.expressions, + org.simantics.ui, + org.simantics.editors, + org.simantics.workbench.search, + org.simantics.workbench.ontology, + org.slf4j.api, + freemarker +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Automatic-Module-Name: org.simantics.workbench.search.impl +Bundle-ActivationPolicy: lazy diff --git a/bundles/org.simantics.workbench.search.impl/build.properties b/bundles/org.simantics.workbench.search.impl/build.properties new file mode 100644 index 000000000..e9863e281 --- /dev/null +++ b/bundles/org.simantics.workbench.search.impl/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml diff --git a/bundles/org.simantics.workbench.search.impl/plugin.xml b/bundles/org.simantics.workbench.search.impl/plugin.xml new file mode 100644 index 000000000..8105d766d --- /dev/null +++ b/bundles/org.simantics.workbench.search.impl/plugin.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/Activator.java b/bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/Activator.java new file mode 100644 index 000000000..cfb68524c --- /dev/null +++ b/bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/Activator.java @@ -0,0 +1,44 @@ +package org.simantics.workbench.search.impl; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.simantics.workbench.search.impl"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/ActiveModelsListener.java b/bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/ActiveModelsListener.java similarity index 94% rename from bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/ActiveModelsListener.java rename to bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/ActiveModelsListener.java index f855524d0..38ca54770 100644 --- a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/ActiveModelsListener.java +++ b/bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/ActiveModelsListener.java @@ -9,7 +9,7 @@ * Contributors: * Semantum Oy - initial API and implementation *******************************************************************************/ -package org.simantics.workbench.internal.contributions.search; +package org.simantics.workbench.search.impl; import java.util.Collection; import java.util.HashSet; @@ -19,7 +19,6 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.simantics.db.Resource; import org.simantics.db.common.procedure.adapter.DisposableListener; -import org.simantics.workbench.internal.Activator; /** * @author Tuukka Lehtonen diff --git a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/BrowserView.java b/bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/BrowserView.java similarity index 99% rename from bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/BrowserView.java rename to bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/BrowserView.java index 01d015de5..0e3c6eb21 100644 --- a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/BrowserView.java +++ b/bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/BrowserView.java @@ -10,7 +10,7 @@ * VTT Technical Research Centre of Finland - initial API and implementation * Semantum Oy *******************************************************************************/ -package org.simantics.workbench.internal.contributions.search; +package org.simantics.workbench.search.impl; import java.net.URL; diff --git a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/NestableSearchService.java b/bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/NestableSearchService.java similarity index 87% rename from bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/NestableSearchService.java rename to bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/NestableSearchService.java index fd40eedb2..76fd5c74f 100644 --- a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/NestableSearchService.java +++ b/bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/NestableSearchService.java @@ -1,4 +1,4 @@ -package org.simantics.workbench.internal.contributions.search; +package org.simantics.workbench.search.impl; import org.eclipse.core.expressions.Expression; import org.eclipse.ui.internal.services.INestable; diff --git a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/SearchServiceFactory.java b/bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/SearchServiceFactory.java similarity index 93% rename from bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/SearchServiceFactory.java rename to bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/SearchServiceFactory.java index ab386699c..5ad172941 100644 --- a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/SearchServiceFactory.java +++ b/bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/SearchServiceFactory.java @@ -1,4 +1,4 @@ -package org.simantics.workbench.internal.contributions.search; +package org.simantics.workbench.search.impl; import org.eclipse.core.expressions.Expression; @@ -12,9 +12,9 @@ import org.eclipse.ui.services.AbstractServiceFactory; import org.eclipse.ui.services.IServiceLocator; import org.simantics.workbench.search.ISearchService; +@SuppressWarnings("restriction") public class SearchServiceFactory extends AbstractServiceFactory { - @SuppressWarnings("rawtypes") @Override public Object create(Class serviceInterface, IServiceLocator parentLocator, @@ -27,7 +27,8 @@ public class SearchServiceFactory extends AbstractServiceFactory { if (wb == null) { return null; } - + + @SuppressWarnings("unchecked") Object parent = parentLocator.getService(serviceInterface); if (parent == null) { return new SearchServiceImpl(); @@ -42,7 +43,7 @@ public class SearchServiceFactory extends AbstractServiceFactory { Expression parentExp = ((SlaveSearchService) parent).getDefaultExpression(); return new NestableSearchService((ISearchService)parent, parentExp); } - + Expression exp = new ActivePartExpression(site.getPart()); return new SlaveSearchService((ISearchService)parent, exp); } diff --git a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/SearchServiceImpl.java b/bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/SearchServiceImpl.java similarity index 98% rename from bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/SearchServiceImpl.java rename to bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/SearchServiceImpl.java index 733bebddf..19c574547 100644 --- a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/SearchServiceImpl.java +++ b/bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/SearchServiceImpl.java @@ -1,4 +1,4 @@ -package org.simantics.workbench.internal.contributions.search; +package org.simantics.workbench.search.impl; import java.io.File; import java.io.IOException; @@ -61,7 +61,6 @@ import org.simantics.utils.datastructures.Pair; import org.simantics.utils.ui.ErrorLogger; import org.simantics.utils.ui.ExceptionUtils; import org.simantics.utils.ui.workbench.WorkbenchUtils; -import org.simantics.workbench.internal.Activator; import org.simantics.workbench.ontology.WorkbenchResource; import org.simantics.workbench.search.ISearchService; import org.simantics.workbench.search.QueryResult; @@ -621,9 +620,9 @@ public class SearchServiceImpl implements ISearchService{ try { return Searching.generatePage(graph, searchEngines,query, maxResults, searchResults); } catch (IOException e) { - Activator.logError("I/O problem while generating search result page.", e); + Activator.getDefault().getLog().error("I/O problem while generating search result page.", e); } catch (TemplateException e) { - Activator.logError("Template definition problem in search result page generation. Please inform the developers.", e); + Activator.getDefault().getLog().error("Template definition problem in search result page generation. Please inform the developers.", e); } return null; } diff --git a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/SlaveSearchService.java b/bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/SlaveSearchService.java similarity index 91% rename from bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/SlaveSearchService.java rename to bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/SlaveSearchService.java index ae1ff1ee0..aaae1154f 100644 --- a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/search/SlaveSearchService.java +++ b/bundles/org.simantics.workbench.search.impl/src/org/simantics/workbench/search/impl/SlaveSearchService.java @@ -1,4 +1,4 @@ -package org.simantics.workbench.internal.contributions.search; +package org.simantics.workbench.search.impl; import org.eclipse.core.expressions.Expression; import org.simantics.workbench.search.ISearchService; diff --git a/bundles/org.simantics.workbench.search/.classpath b/bundles/org.simantics.workbench.search/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics.workbench.search/.classpath +++ b/bundles/org.simantics.workbench.search/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics.workbench.search/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.workbench.search/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics.workbench.search/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.workbench.search/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.workbench.search/META-INF/MANIFEST.MF b/bundles/org.simantics.workbench.search/META-INF/MANIFEST.MF index 8d66e4668..399d33231 100644 --- a/bundles/org.simantics.workbench.search/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.workbench.search/META-INF/MANIFEST.MF @@ -5,13 +5,10 @@ Bundle-SymbolicName: org.simantics.workbench.search Bundle-Version: 1.5.0.qualifier Bundle-Activator: org.simantics.workbench.search.Activator Bundle-Vendor: Semantum Oy -Require-Bundle: org.eclipse.core.runtime, - org.eclipse.core.expressions;bundle-version="3.4.300", - org.simantics.workbench.ontology;bundle-version="1.0.0", - org.simantics.db.layer0;bundle-version="1.1.0", - org.simantics;bundle-version="1.0.0", - freemarker;bundle-version="2.3.16";visibility:=reexport -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.simantics;bundle-version="1.0.0", + freemarker;bundle-version="2.3.16", + org.slf4j.api;bundle-version="1.7.30" +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics.workbench.search Automatic-Module-Name: org.simantics.workbench.search diff --git a/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/DependenciesSearchFunction.java b/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/DependenciesSearchFunction.java index ffbfc5f62..d270124f1 100644 --- a/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/DependenciesSearchFunction.java +++ b/bundles/org.simantics.workbench.search/src/org/simantics/workbench/search/DependenciesSearchFunction.java @@ -17,11 +17,12 @@ import java.util.Map; import org.eclipse.core.runtime.IProgressMonitor; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; -import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.genericrelation.Dependencies; import org.simantics.operation.Layer0X; import org.simantics.scl.runtime.function.FunctionImpl5; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * dependenciesSearchFunction: @@ -31,6 +32,8 @@ import org.simantics.scl.runtime.function.FunctionImpl5; */ public class DependenciesSearchFunction extends FunctionImpl5 { + private static final Logger LOGGER = LoggerFactory.getLogger(DependenciesSearchFunction.class); + @Override public SearchResult apply(IProgressMonitor monitor, ReadGraph graph, Resource model, SearchQuery query, Integer maxResults) { try { @@ -41,7 +44,7 @@ public class DependenciesSearchFunction extends FunctionImpl5 - + diff --git a/bundles/org.simantics.workbench/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.workbench/.settings/org.eclipse.jdt.core.prefs index 5f0d41e96..088eb3624 100644 --- a/bundles/org.simantics.workbench/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics.workbench/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,7 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore @@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled @@ -36,6 +37,7 @@ org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled @@ -58,4 +60,5 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics.workbench/META-INF/MANIFEST.MF b/bundles/org.simantics.workbench/META-INF/MANIFEST.MF index 968c1f344..63709cc6f 100644 --- a/bundles/org.simantics.workbench/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.workbench/META-INF/MANIFEST.MF @@ -9,43 +9,24 @@ Bundle-Localization: plugin Export-Package: org.simantics.workbench, org.simantics.workbench.internal, org.simantics.workbench.internal.contributions.search -Require-Bundle: com.ibm.icu, - org.eclipse.core.runtime, - org.eclipse.core.resources, +Require-Bundle: org.eclipse.core.resources, org.eclipse.core.filesystem, org.eclipse.core.net, - org.eclipse.ui;visibility:=reexport, org.eclipse.ui.ide, org.eclipse.ui.cheatsheets, org.simantics.application, - org.simantics.ui, - org.simantics.db.layer0;bundle-version="0.8.0", - org.simantics.project;bundle-version="1.0.0", org.simantics.db.indexing;bundle-version="0.8.0", - org.eclipse.equinox.p2.metadata;bundle-version="2.0.0", - org.simantics.graph;bundle-version="1.0.0", - org.simantics.layer0;bundle-version="1.0.0", - org.simantics.graph.db;bundle-version="1.0.0", - org.simantics.editors;bundle-version="1.0.0", - org.simantics;bundle-version="1.0.0";visibility:=reexport, - org.simantics.workbench.ontology;bundle-version="1.0.0", org.simantics.workbench.search;bundle-version="1.5.0", - org.simantics.views.swt;bundle-version="1.0.0";visibility:=reexport, org.simantics.modeling.ui;bundle-version="1.1.1";visibility:=reexport, - org.simantics.issues.common;bundle-version="1.1.0";visibility:=reexport, - org.simantics.simulation.ui;bundle-version="1.1.0";visibility:=reexport, - org.simantics.scenegraph.profile;bundle-version="1.0.0";visibility:=reexport, - org.simantics.browsing.ui.model;bundle-version="1.0.0";visibility:=reexport, - org.eclipse.ui.workbench, org.eclipse.e4.ui.workbench;bundle-version="1.3.0", org.eclipse.e4.ui.model.workbench;bundle-version="1.1.100.v20150407-1430", org.eclipse.e4.core.di;bundle-version="1.5.0", - org.eclipse.e4.ui.di;bundle-version="1.1.0", org.eclipse.e4.core.contexts, org.eclipse.e4.ui.services, - org.slf4j.api;bundle-version="1.7.20" + org.slf4j.api, + jakarta.annotation-api;bundle-version="1.3.5" Import-Package: javax.inject -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Bundle-ClassPath: . Automatic-Module-Name: org.simantics.workbench diff --git a/bundles/org.simantics/.classpath b/bundles/org.simantics/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.simantics/.classpath +++ b/bundles/org.simantics/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.simantics/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/bundles/org.simantics/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.simantics/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.simantics/META-INF/MANIFEST.MF b/bundles/org.simantics/META-INF/MANIFEST.MF index 1a1102e20..4829d00c5 100644 --- a/bundles/org.simantics/META-INF/MANIFEST.MF +++ b/bundles/org.simantics/META-INF/MANIFEST.MF @@ -11,7 +11,6 @@ Require-Bundle: org.eclipse.core.runtime;visibility:=reexport, org.simantics.project;bundle-version="1.0.1";visibility:=reexport, org.simantics.graph.db;bundle-version="1.1.5", org.eclipse.equinox.p2.metadata;bundle-version="2.0.0", - org.apache.log4j;bundle-version="1.2.15", org.simantics.layer0.utils;bundle-version="1.1.0", org.simantics.application;bundle-version="1.1.0", org.simantics.db.indexing;bundle-version="1.1.0", @@ -21,7 +20,7 @@ Require-Bundle: org.eclipse.core.runtime;visibility:=reexport, org.simantics.db.procore;bundle-version="1.1.0", org.slf4j.api, org.ini4j;bundle-version="0.5.4" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Export-Package: org.simantics, org.simantics.internal;x-friends:="org.simantics.modeling,org.simantics.ui", diff --git a/bundles/org.simantics/src/org/simantics/LogManager.java b/bundles/org.simantics/src/org/simantics/LogManager.java deleted file mode 100644 index 4274002c6..000000000 --- a/bundles/org.simantics/src/org/simantics/LogManager.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics; - -import java.util.Properties; - -import org.apache.log4j.Hierarchy; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; -import org.apache.log4j.PropertyConfigurator; -import org.apache.log4j.spi.LoggerFactory; -import org.apache.log4j.spi.RootLogger; - -/** - * This class encapsulates a Log4J Hierarchy and centralizes all Logger access. - */ -public class LogManager { - - private Hierarchy hierarchy; - - /** - * Creates a new LogManager. Saves the log and state location. - * Creates a new Hierarchy and add a new EventListener to it. - * Configure the hierarchy with the properties passed. Add this object to - * the list of active log managers. - * - * @param properties log configuration properties - */ - public LogManager(Properties properties) { - this.hierarchy = new Hierarchy(new RootLogger(Level.DEBUG)); - new PropertyConfigurator().doConfigure(properties, this.hierarchy); - } - - /** - * Checks if this PluginLogManager is disabled for this level. - * - * @param level level value - * @return boolean true if it is disabled - */ - public boolean isDisabled(int level) { - return this.hierarchy.isDisabled(level); - } - - /** - * Enable logging for logging requests with level l or higher. By default - * all levels are enabled. - * - * @param level level object - */ - public void setThreshold(Level level) { - this.hierarchy.setThreshold(level); - } - - /** - * The string version of setThreshold(Level level) - * - * @param level level string - */ - public void setThreshold(String level) { - this.hierarchy.setThreshold(level); - } - - /** - * Get the repository-wide threshold. - * - * @return Level - */ - public Level getThreshold() { - return this.hierarchy.getThreshold(); - } - - /** - * Returns a new logger instance named as the first parameter using the - * default factory. If a logger of that name already exists, then it will be - * returned. Otherwise, a new logger will be instantiated and then linked - * with its existing ancestors as well as children. - * - * @param clazz the class to get the logger for - * @return Logger - */ - public Logger getLogger(Class clazz) { - return this.hierarchy.getLogger(clazz.getName()); - } - - /** - * Returns a new logger instance named as the first parameter using the - * default factory. If a logger of that name already exists, then it will be - * returned. Otherwise, a new logger will be instantiated and then linked - * with its existing ancestors as well as children. - * - * @param name logger name - * @return Logger - */ - public Logger getLogger(String name) { - return this.hierarchy.getLogger(name); - } - - /** - * The same as getLogger(String name) but using a factory instance instead - * of a default factory. - * - * @param name logger name - * @param factory factory instance - * @return Logger - */ - public Logger getLogger(String name, LoggerFactory factory) { - return this.hierarchy.getLogger(name, factory); - } - - /** - * Returns the root of this hierarchy. - * - * @return Logger - */ - public Logger getRootLogger() { - return this.hierarchy.getRootLogger(); - } - - /** - * Checks if this logger exists. - * - * @return Logger - */ - public Logger exists(String name) { - return this.hierarchy.exists(name); - } - - /** - * Disposes the logger hierarchy - */ - public void shutdown() { - this.hierarchy.shutdown(); - } - - /** - * Resets configuration values to its defaults. - */ - public void resetConfiguration() { - this.hierarchy.resetConfiguration(); - } - -} \ No newline at end of file diff --git a/bundles/org.simantics/src/org/simantics/Simantics.java b/bundles/org.simantics/src/org/simantics/Simantics.java index cbe17e940..35808bd92 100644 --- a/bundles/org.simantics/src/org/simantics/Simantics.java +++ b/bundles/org.simantics/src/org/simantics/Simantics.java @@ -44,6 +44,7 @@ import org.simantics.db.management.SessionContextProvider; import org.simantics.db.management.SingleSessionContextProviderSource; import org.simantics.db.request.ReadInterface; import org.simantics.db.request.WriteInterface; +import org.simantics.db.service.XSupport; import org.simantics.internal.FileServiceImpl; import org.simantics.layer0.Layer0; import org.simantics.project.IProject; @@ -467,6 +468,14 @@ public class Simantics { } } + public static void saveQueries(Session session) { + try { + XSupport xs = session.getService(XSupport.class); + xs.saveQueries(); + } catch (Exception e) { + LOGGER.error("Saving database queries failed.", e); + } + } @SuppressWarnings({ "unchecked", "rawtypes" }) public static T applySCL(String module, String function, Object ... args) throws DatabaseException { diff --git a/bundles/org.simantics/src/org/simantics/SimanticsPlatform.java b/bundles/org.simantics/src/org/simantics/SimanticsPlatform.java index 730e4e887..aa0b503da 100644 --- a/bundles/org.simantics/src/org/simantics/SimanticsPlatform.java +++ b/bundles/org.simantics/src/org/simantics/SimanticsPlatform.java @@ -21,7 +21,6 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -392,6 +391,8 @@ public class SimanticsPlatform implements LifecycleListener { throw new PlatformException("Reinstalling Database, NOT IMPLEMENTED"); } + boolean serviceModeEntered = false; + if (ontologyPolicy == OntologyRecoveryPolicy.Merge) { message = "Merging ontology changes"; monitor.subTask(message); @@ -450,6 +451,14 @@ public class SimanticsPlatform implements LifecycleListener { session.getService(XSupport.class).setServiceMode(true, createImmutable); + // Flush all queries once to allow even immutable request results to be invalidated + // because ontology installation affects immutable content and queries related to + // immutable content would not get invalidated at all otherwise. + if (!serviceModeEntered) { + serviceModeEntered = true; + session.getService(QueryControl.class).flush(); + } + // Install TG log.log(new Status(IStatus.INFO, Activator.PLUGIN_ID, "Installing "+tg.toString()+" - "+tg.getName())); ImportResult result = TransferableGraphs.importGraph1(session, new TGTransferableGraphSource(tg.getGraph()), advisor, null); @@ -500,6 +509,11 @@ public class SimanticsPlatform implements LifecycleListener { } } session.getService(XSupport.class).setServiceMode(false, false); + if (serviceModeEntered) { + // Flush all queries to ensure that queries that should now + // be immutable are not left as mutable in the query cache. + session.getService(QueryControl.class).flush(); + } } message = "Ontologies synchronized"; monitor.subTask(message); @@ -998,6 +1012,11 @@ public class SimanticsPlatform implements LifecycleListener { } catch (Throwable t) { LOGGER.error("Failed to flush index caches.", t); } + + if("true".equals(System.getProperty("org.simantics.db.persistQueries"))) { + progress.subTask("Saving Queries"); + Simantics.saveQueries(s); + } } progress.subTask("Close Database Session"); diff --git a/bundles/pom.xml b/bundles/pom.xml index 59e88c12b..3b5df7150 100644 --- a/bundles/pom.xml +++ b/bundles/pom.xml @@ -133,6 +133,8 @@ org.simantics.graph.db org.simantics.graphfile org.simantics.graphfile.ontology + org.simantics.graphfile.ui + org.simantics.graphfile.ui.ontology org.simantics.graphviz org.simantics.graphviz.ui org.simantics.gnuplot @@ -247,6 +249,7 @@ org.simantics.workbench org.simantics.workbench.ontology org.simantics.workbench.search + org.simantics.workbench.search.impl winterwell.markdown diff --git a/bundles/winterwell.markdown/.classpath b/bundles/winterwell.markdown/.classpath index cf4ff31b9..f11bdd484 100644 --- a/bundles/winterwell.markdown/.classpath +++ b/bundles/winterwell.markdown/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/winterwell.markdown/META-INF/MANIFEST.MF b/bundles/winterwell.markdown/META-INF/MANIFEST.MF index 83cfa91dc..89e0b928b 100644 --- a/bundles/winterwell.markdown/META-INF/MANIFEST.MF +++ b/bundles/winterwell.markdown/META-INF/MANIFEST.MF @@ -14,7 +14,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.jface, org.eclipse.swt, org.eclipse.ui.workbench -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Import-Package: org.eclipse.core.internal.resources, org.eclipse.jface.text, diff --git a/features/hdf.hdf5.feature/feature.xml b/features/hdf.hdf5.feature/feature.xml index a1a1b3177..7808093a6 100644 --- a/features/hdf.hdf5.feature/feature.xml +++ b/features/hdf.hdf5.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/features/org.jfree.feature/feature.xml b/features/org.jfree.feature/feature.xml index 1afb8a6f3..64d7a8066 100644 --- a/features/org.jfree.feature/feature.xml +++ b/features/org.jfree.feature/feature.xml @@ -88,11 +88,4 @@ If the Library as you received it specifies that a proxy can decide whether futu version="0.0.0" unpack="false"/> - - diff --git a/features/org.simantics.data.feature/feature.xml b/features/org.simantics.data.feature/feature.xml index 86408f00a..daf0be719 100644 --- a/features/org.simantics.data.feature/feature.xml +++ b/features/org.simantics.data.feature/feature.xml @@ -36,7 +36,7 @@ unpack="false"/> + + diff --git a/features/org.simantics.desktop.product.feature/feature.xml b/features/org.simantics.desktop.product.feature/feature.xml index 59c224643..7cc275b35 100644 --- a/features/org.simantics.desktop.product.feature/feature.xml +++ b/features/org.simantics.desktop.product.feature/feature.xml @@ -36,4 +36,25 @@ version="0.0.0" unpack="false"/> + + + + + + diff --git a/features/org.simantics.g2d.feature/feature.xml b/features/org.simantics.g2d.feature/feature.xml index 1f262aca3..fdb6644f4 100644 --- a/features/org.simantics.g2d.feature/feature.xml +++ b/features/org.simantics.g2d.feature/feature.xml @@ -40,6 +40,10 @@ id="org.jfree" version="0.0.0"/> + + + version="0.0.0"/> - - - - diff --git a/features/org.simantics.help.feature/feature.xml b/features/org.simantics.help.feature/feature.xml index 658c26f6c..66eeffaff 100644 --- a/features/org.simantics.help.feature/feature.xml +++ b/features/org.simantics.help.feature/feature.xml @@ -59,13 +59,6 @@ version="0.0.0" unpack="false"/> - - + + diff --git a/features/org.simantics.history.rest.feature/feature.xml b/features/org.simantics.history.rest.feature/feature.xml index 33dd73ef6..b5cd3f73d 100644 --- a/features/org.simantics.history.rest.feature/feature.xml +++ b/features/org.simantics.history.rest.feature/feature.xml @@ -40,7 +40,7 @@ unpack="false"/> - - - - - - - - - - - - + + - - + + - - - - - - - - - - - - @@ -351,4 +351,11 @@ version="0.0.0" unpack="false"/> + + diff --git a/features/org.simantics.ui.workbench.feature/feature.xml b/features/org.simantics.ui.workbench.feature/feature.xml index 72baed8b3..cf4ecfaad 100644 --- a/features/org.simantics.ui.workbench.feature/feature.xml +++ b/features/org.simantics.ui.workbench.feature/feature.xml @@ -264,21 +264,21 @@ unpack="false"/> + + - - - - + + + + diff --git a/license.html b/license.html index cac8ec5bb..3d60be467 100644 --- a/license.html +++ b/license.html @@ -105,20 +105,6 @@ worth mentioning is ACE - Adaptive Communications Environment - - BSD 3-Clause License (http://www.cs.wustl.edu/~schmidt/ACE-copying.html) - -
Copyright (c) 2000-2005 INRIA, France Telecom
- - - JZlib - - BSD 3-Clause License (http://www.jcraft.com/jzlib/LICENSE.txt) - -
Copyright (c) 2000,2001,2002,2003,2004 ymnk, JCraft,Inc.
- - Batik (org.apache.batik) Apache Software License 2.0 @@ -148,7 +134,7 @@ All rights reserved. 1.2.3 - JSON (JSON_libraries) + Gson Apache Software License 2.0 @@ -169,14 +155,14 @@ All rights reserved. - JCommon, JFreeChart +JFreeChart LGPL - GNU Trove (gnu.trove2, gnu.trove3) + GNU Trove (gnu.trove3) LGPL @@ -254,7 +240,7 @@ Copyright (c) 2011-2016, Yann Collet EPL - 9.2.0 + 10.2.0 fastutil: Fast & compact type-specific collections for Java @@ -285,11 +271,12 @@ Copyright (c) 2011-2016, Yann Collet 21.0 - Aries + ANTLR v3 - Apache Software License 2.0 + BSD 3-Clause License (http://www.antlr3.org/license.html) - + 3.5.2 +
Copyright (c) 2010 Terence Parr
Apache Commons Codec @@ -341,13 +328,6 @@ Copyright (c) 2011-2016, Yann Collet 3.6.1 - Apache HttpClient 3 - - Apache Software License 2.0 - - 3.1.0 - - Apache POI Apache Software License 2.0 @@ -355,14 +335,6 @@ Copyright (c) 2011-2016, Yann Collet 3.15 - ANTLR v3 - - BSD 3-Clause License (http://www.antlr3.org/license.html) - - 3.5.2 -
Copyright (c) 2010 Terence Parr
- - Apache Lucene Core Apache Software License 2.0 @@ -384,6 +356,13 @@ Copyright (c) 2011-2016, Yann Collet 2.6.0, only needed by Apache POI + Aries + + Apache Software License 2.0 + + + + curvesapi BSD 3-Clause License (https://github.com/virtuald/curvesapi/blob/master/license.txt), Apache Software License 2.0 diff --git a/releng/org.simantics.desktop.rcp.product/simantics-desktop.product b/releng/org.simantics.desktop.rcp.product/simantics-desktop.product index b7df7f22e..55b537f94 100644 --- a/releng/org.simantics.desktop.rcp.product/simantics-desktop.product +++ b/releng/org.simantics.desktop.rcp.product/simantics-desktop.product @@ -1,7 +1,7 @@ - + @@ -42,7 +42,6 @@ org.eclipse.e4.ui.css.theme.e4_classic - org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 @@ -55,7 +54,7 @@ org.eclipse.e4.ui.css.theme.e4_classic - + diff --git a/releng/org.simantics.sdk.build.p2.site/pom.xml b/releng/org.simantics.sdk.build.p2.site/pom.xml index d4e66227b..4d84e674f 100644 --- a/releng/org.simantics.sdk.build.p2.site/pom.xml +++ b/releng/org.simantics.sdk.build.p2.site/pom.xml @@ -11,23 +11,66 @@ 2.1.7.b1 3.5.2 + 1.14 4.9.0 4.9.0.b0003 org.apache.lucene4 - 1.1.6 + 1.2.0 2.0.6 2.0.6.b0001 - 2.8.8 + 2.10.2 + 2.10.2.b0001 3.1.0 - 2.25.1 - 1.7.25 - 1.7.25.b001 - 1.21.0 - 1.21.0 - 3.7.1 - 1.10 - 9.2.0 - 2.6.2 + 2.1.6 + 1.2.1 + 1.2.1.b0001 + + 2.1.6.b0005 + 2.30.1 + + 2.30.1.b0008 + 1.5.0 + 1.7.30 + 1.7.30 + 1.27.2 + 1.27.2 + 3.11.4 + 1.11 + 2.8.1 + 1.5.0 + 2.4.0 + 0.5.4 + 4.4 + 1.20 + 1.6 + 2.6 + 1.2 + 1.4 + 3.6.1 + 2.0.19 + 2.0.19 + 2.0.19 + 1.2.17 + 3.0.7 + 8.3.1 + 3.0.3 + 2.3.29 + 2.1.7 + 1.7.12 + 4.1.0 + 4.5.2 + 1.2.3 + 0.5.1 + 1.0.0 + 4.0.2 + 1.2.3 + 4.3.0.Final + 1.12.2 + 1.25 + 9.4.24.v20191120 + 4.1.45.Final + 1.0 + 0.8.3 @@ -182,7 +225,7 @@ - org.jfree:jfreechart:1.0.19 + org.jfree:jfreechart:${jfreechart.version} true org.jfree.jchart @@ -199,7 +242,7 @@ --> - net.sf.supercsv:super-csv:2.4.0 + net.sf.supercsv:super-csv:${supercsv.version} true true @@ -207,25 +250,21 @@ - org.ini4j:ini4j:0.5.4 + org.ini4j:ini4j:${ini4j.version} true - commons-codec:commons-codec:1.10 - true - - - commons-collections:commons-collections:3.2.2 + commons-codec:commons-codec:${commons-codec.version} true - org.apache.commons:commons-collections4:4.1 + org.apache.commons:commons-collections4:${commons-collections.version} true - org.apache.commons:commons-compress:1.18 + org.apache.commons:commons-compress:${commons-compress.version} true true @@ -233,33 +272,37 @@ - commons-lang:commons-lang:2.6 + org.apache.commons:commons-csv:${commons-csv.version} + true + + + commons-lang:commons-lang:${commons-lang.version} true - commons-logging:commons-logging:1.2 + commons-logging:commons-logging:${commons-logging.version} true - commons-io:commons-io:1.4 + commons-io:commons-io:${commons-io.version} true - org.apache.commons:commons-math3:3.6.1 + org.apache.commons:commons-math3:${commons-math.version} true - org.apache.pdfbox:pdfbox:2.0.3 + org.apache.pdfbox:pdfbox:${pdfbox.version} true - org.apache.pdfbox:fontbox:2.0.3 + org.apache.pdfbox:fontbox:${fontbox.version} true - org.apache.pdfbox:xmpbox:2.0.3 + org.apache.pdfbox:xmpbox:${xmpbox.version} true @@ -274,7 +317,7 @@ --> - log4j:log4j:1.2.17 + log4j:log4j:${log4j.version} true true @@ -282,34 +325,18 @@ - net.sf.ucanaccess:ucanaccess:3.0.7 + net.sf.ucanaccess:ucanaccess:${ucanaccess.version} true net.ucanaccess - it.unimi.dsi:fastutil:7.2.1 + it.unimi.dsi:fastutil:${fastutil.version} true - org.eclipse.collections:eclipse-collections-api:${eclipse.collections.version} - true - true - - org.eclipse.collections.* - - - - org.eclipse.collections:eclipse-collections:${eclipse.collections.version} - true - - org.eclipse.collections.eclipse-collections-api;bundle-version="${eclipse.collections.version}" - !org.eclipse.*,!sun.misc.*,*;resolution:=optional - - - - net.sf.trove4j:trove4j:3.0.3 + net.sf.trove4j:trove4j:${trove4j.version} true GNU Trove 3 @@ -317,7 +344,7 @@ - org.freemarker:freemarker:2.3.23 + org.freemarker:freemarker:${freemarker.version} true true @@ -325,7 +352,7 @@ - com.lowagie:itext:2.1.7 + com.lowagie:itext:${itext.version} true com.lowagie.text @@ -333,25 +360,7 @@ - org.mozilla:rhino:1.7.7.1 - true - - - - net.java.dev.jna:jna:4.1.0 - true - - - - net.java.dev.jna:jna-platform:4.1.0 - true - - - net.java.dev.jna:jna:4.3.0 - true - - - net.java.dev.jna:jna-platform:4.3.0 + org.mozilla:rhino:${rhino.version} true @@ -427,67 +436,212 @@ - ch.qos.logback:logback-classic:1.2.3 + ch.qos.logback:logback-classic:${logback-classic.version} true true - com.koloboke:koloboke-compile:0.5.1 + com.koloboke:koloboke-compile:${koloboke-compile.version} true - com.koloboke:koloboke-impl-common-jdk8:1.0.0 + com.koloboke:koloboke-impl-common-jdk8:${koloboke-impl-common-jdk8.version} true - com.esotericsoftware:kryo:4.0.0 + com.esotericsoftware:kryo:${kryo.version} true - org.apache.aries.spifly:org.apache.aries.spifly.dynamic.bundle:1.2.3 + org.apache.aries.spifly:org.apache.aries.spifly.dynamic.bundle:${org.apache.aries.spifly.dynamic.bundle.version} true + + jakarta.activation:jakarta.activation-api:${jakarta.activation-api.version} + true + true + + ${jakarta.activation-api.version.actual} + *;resolution:=optional + + + + jakarta.ws.rs:jakarta.ws.rs-api:${jakarta.version} + true + true + + ${jakarta.version.actual} + + jakarta.xml.bind-api + + !javax.*,*;resolution:=optional + + javax.ws.rs;version="${jakarta.version}", + javax.ws.rs.core;version="${jakarta.version}", + javax.ws.rs.ext;version="${jakarta.version}", + javax.ws.rs.client;version="${jakarta.version}", + javax.ws.rs.container;version="${jakarta.version}", + javax.ws.rs.sse;version="${jakarta.version}" + + + + + org.glassfish.jersey.core:jersey-common:${jersey.version} + true + true + + ${jersey.version.actual} + + *;resolution:=optional + + org.glassfish.jersey.*;version="${jersey.version}" + + + org.glassfish.jersey.core:jersey-server:${jersey.version} true + true + + ${jersey.version.actual} + + *;resolution:=optional + org.glassfish.jersey.core:jersey-client:${jersey.version} true + true + + ${jersey.version.actual} + + *;resolution:=optional + + org.glassfish.jersey.media:jersey-media-multipart:${jersey.version} true + + + + + org.glassfish.jersey.ext:jersey-entity-filtering:${jersey.version} + true + true + + ${jersey.version.actual} + + *;resolution:=optional + org.glassfish.jersey.media:jersey-media-json-jackson:${jersey.version} true + true com.fasterxml.jackson.* + + ${jersey.version.actual} + + *;resolution:=optional + org.glassfish.jersey.containers:jersey-container-servlet-core:${jersey.version} true + true + + ${jersey.version.actual} + + *;resolution:=optional + - org.jboss.windup.decompiler:decompiler-procyon:4.0.0.Beta1 + org.glassfish.jersey.inject:jersey-hk2:${jersey.version} true + true + + ${jersey.version.actual} + + *;resolution:=optional + - org.jsoup:jsoup:1.11.3 + org.jboss.windup.decompiler:decompiler-procyon:${decompiler-procyon.version} true - org.yaml:snakeyaml:1.23 + org.jsoup:jsoup:${jsoup.version} true - org.eclipse.jetty:jetty-servlets:9.4.5.v20170502 + org.yaml:snakeyaml:${snakeyaml.version} true - org.eclipse.jetty:jetty-server:9.4.5.v20170502 + org.eclipse.jetty:jetty-servlets:${jetty945.version} true @@ -496,6 +650,9 @@ - io.netty:netty-buffer:4.1.35.Final + io.netty:netty-buffer:${netty.version} true true - io.netty:netty-codec:4.1.35.Final + io.netty:netty-codec:${netty.version} true true - io.netty:netty-codec-http:4.1.35.Final + io.netty:netty-codec-http:${netty.version} true true - io.netty:netty-codec-http2:4.1.35.Final + io.netty:netty-codec-http2:${netty.version} true true - io.netty:netty-codec-socks:4.1.35.Final + io.netty:netty-codec-socks:${netty.version} true true - io.netty:netty-common:4.1.35.Final + io.netty:netty-common:${netty.version} true true - io.netty:netty-handler:4.1.35.Final + io.netty:netty-handler:${netty.version} true true - io.netty:netty-handler-proxy:4.1.35.Final + io.netty:netty-handler-proxy:${netty.version} true true - io.netty:netty-resolver:4.1.35.Final + io.netty:netty-resolver:${netty.version} true true - io.netty:netty-transport:4.1.35.Final + io.netty:netty-transport:${netty.version} true true - com.impossibl.pgjdbc-ng:pgjdbc-ng:0.7.1 + com.impossibl.pgjdbc-ng:pgjdbc-ng:${pgjdbc-ng.version} true false @@ -636,7 +793,11 @@ - net.jcip:jcip-annotations:1.0 + net.jcip:jcip-annotations:${jcip-annotations.version} + true + + + com.influxdb:influxdb-client-java:${influxdb.client.version} true diff --git a/releng/org.simantics.sdk.build.targetdefinition/README.md b/releng/org.simantics.sdk.build.targetdefinition/README.md index f5b19fd73..4b1730d71 100644 --- a/releng/org.simantics.sdk.build.targetdefinition/README.md +++ b/releng/org.simantics.sdk.build.targetdefinition/README.md @@ -3,7 +3,9 @@ Simantics 1.31.0 migrated to Eclipse 4.7 Oxygen platform. At the same time [Obeo's Target Platform Definition DSL and Generator tool](https://github.com/mbarbero/fr.obeo.releng.targetplatform) -was taken into use for target platform definition. +was taken into use for target platform definition. Later on the tool was moved to Eclipse +CBI (Common Build Infrastructure) as [Target Platform Definition DSL and Generator](https://github.com/eclipse-cbi/targetplatform-dsl) +which is what we are using right now. Please read the detailed installation and basic use instructions from the tool's website. @@ -47,4 +49,11 @@ This greatly simplifies target definition by removing duplication from the their publishing them online per platform branch is also highly useful. On the other hand legacy Buckminster builds can source `.target` files from a URL, which is why publishing them online -per platform branch is useful. \ No newline at end of file +per platform branch is useful. + +## Building .target files from the command line + +There is an example of how to do this with Maven at [build/pom.xml)(build/pom.xml). +Essentially it sources the TPD tool and its required Eclipse parts from public P2 +repositories and uses `tycho-eclipserun-plugin` to run the *tpd converter application* +to convert the `.tpd` file given as argument via `-Dtpd=tpd-path`. diff --git a/releng/org.simantics.sdk.build.targetdefinition/build/.gitignore b/releng/org.simantics.sdk.build.targetdefinition/build/.gitignore new file mode 100644 index 000000000..ebfaccf3c --- /dev/null +++ b/releng/org.simantics.sdk.build.targetdefinition/build/.gitignore @@ -0,0 +1,2 @@ +target +workspace \ No newline at end of file diff --git a/releng/org.simantics.sdk.build.targetdefinition/build/pom.xml b/releng/org.simantics.sdk.build.targetdefinition/build/pom.xml new file mode 100644 index 000000000..cc70d3556 --- /dev/null +++ b/releng/org.simantics.sdk.build.targetdefinition/build/pom.xml @@ -0,0 +1,69 @@ + + + 4.0.0 + + org.simantics + org.simantics.sdk.build.targetdefinition.build + 1.0.0-SNAPSHOT + pom + + + 1.5.0 + 1.5.0 + 2019-12 + http://www.simantics.org/update/${platform-version-name} + http://www.simantics.org/update/cbi/tpd/3.0.0-SNAPSHOT/ + org.eclipse.cbi.targetplatform.tpd.converter + org.eclipse.cbi.targetplatform-feature + + ../simantics.tpd + + + + + + org.eclipse.tycho.extras + tycho-eclipserun-plugin + ${tycho-extras-version} + + + + ${platform-version-name} + p2 + ${platform.repository.p2} + + + targetplatform + p2 + ${targetPlatform.repository.p2} + + + -consoleLog -application ${targetPlatform.application.name} ${tpd} + + + + ${targetPlatform.application.feature} + eclipse-feature + + + org.eclipse.equinox.p2.sdk + eclipse-feature + + + + + + + eclipse-run + + + validate + + + + + + + \ No newline at end of file diff --git a/releng/org.simantics.sdk.build.targetdefinition/org.simantics.sdk.build.targetdefinition.target b/releng/org.simantics.sdk.build.targetdefinition/org.simantics.sdk.build.targetdefinition.target index 64ab6dc3b..6500ce550 100644 --- a/releng/org.simantics.sdk.build.targetdefinition/org.simantics.sdk.build.targetdefinition.target +++ b/releng/org.simantics.sdk.build.targetdefinition/org.simantics.sdk.build.targetdefinition.target @@ -1,7 +1,7 @@ - + @@ -38,6 +38,16 @@ + + + + + + + + + + @@ -157,6 +167,11 @@ + + + + + @@ -168,40 +183,44 @@ - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -210,49 +229,45 @@ - - - - - - + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - + + + + + + @@ -260,14 +275,14 @@ - - - - + + - - + + + + @@ -288,107 +303,97 @@ - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + diff --git a/releng/org.simantics.sdk.build.targetdefinition/org.simantics.sdk.build.targetdefinition.tpd b/releng/org.simantics.sdk.build.targetdefinition/org.simantics.sdk.build.targetdefinition.tpd index 8bca4a7d7..7494c7981 100644 --- a/releng/org.simantics.sdk.build.targetdefinition/org.simantics.sdk.build.targetdefinition.tpd +++ b/releng/org.simantics.sdk.build.targetdefinition/org.simantics.sdk.build.targetdefinition.tpd @@ -39,6 +39,16 @@ location "http://www.simantics.org/update/2019-12/" { org.eclipse.emf.sdk.feature.group org.eclipse.epp.mpc.feature.group org.eclipse.epp.mpc.source.feature.group + org.eclipse.jetty.continuation + org.eclipse.jetty.continuation.source + org.eclipse.jetty.http + org.eclipse.jetty.http.source + org.eclipse.jetty.io + org.eclipse.jetty.io.source + org.eclipse.jetty.server + org.eclipse.jetty.server.source + org.eclipse.jetty.util + org.eclipse.jetty.util.source org.eclipse.mylyn.wikitext_feature.feature.group org.eclipse.mylyn.wikitext.ant.source org.eclipse.mylyn.wikitext.mediawiki.source @@ -158,7 +168,12 @@ location "http://www.simantics.org/update/nebula/releases/2.2.0/incubation/" { org.eclipse.nebula.examples.incubation.feature.feature.group } -location "http://www.simantics.org/download/master/external-components/maven" { +location "http://www.simantics.org/update/collections/10.2.0/repository/" { + org.eclipse.collections.feature.feature.group + org.eclipse.collections.feature.source.feature.group +} + +location "http://www.simantics.org/download/master/external-components/maven/" { bouncycastle.bcmail-jdk14 bouncycastle.bcprov-jdk14 ch.qos.logback.classic @@ -203,6 +218,10 @@ location "http://www.simantics.org/download/master/external-components/maven" { com.fasterxml.woodstox.woodstox-core.source com.healthmarketscience.jackcess com.healthmarketscience.jackcess.source + com.influxdb.client-core + com.influxdb.client-core.source + com.influxdb.client-java + com.influxdb.client-java.source com.koloboke.api-jdk8 com.koloboke.api-jdk8.source com.koloboke.compile @@ -211,10 +230,6 @@ location "http://www.simantics.org/download/master/external-components/maven" { com.koloboke.impl-common-jdk8.source com.lowagie.text com.lowagie.text.source - com.sun.jna - com.sun.jna.platform - com.sun.jna.platform.source - com.sun.jna.source freemarker freemarker.source gnu.trove3 @@ -246,14 +261,14 @@ location "http://www.simantics.org/download/master/external-components/maven" { it.unimi.dsi.fastutil it.unimi.dsi.fastutil.source jakarta-regexp - javassist - javassist.source javax.servlet-api javax.servlet-api.source - javax.validation.api - javax.validation.api.source - javax.ws.rs-api - javax.ws.rs-api.source + jakarta.xml.bind-api + jakarta.xml.bind-api.source + jakarta.validation.jakarta.validation-api + jakarta.validation.jakarta.validation-api.source + jakarta.ws.rs-api + jakarta.ws.rs-api.source net.jcip.annotations net.jcip.annotations.source net.ucanaccess @@ -261,14 +276,14 @@ location "http://www.simantics.org/download/master/external-components/maven" { org.antlr.runtime org.antlr.runtime.source org.apache.aries.spifly.dynamic.bundle - org.apache.commons.codec - org.apache.commons.codec.source - org.apache.commons.collections - org.apache.commons.collections.source + org.apache.commons.commons-codec + org.apache.commons.commons-codec.source org.apache.commons.collections4 org.apache.commons.collections4.source org.apache.commons.compress org.apache.commons.compress.source + org.apache.commons.csv + org.apache.commons.csv.source org.apache.commons.io org.apache.commons.io.source org.apache.commons.lang @@ -301,22 +316,8 @@ location "http://www.simantics.org/download/master/external-components/maven" { org.bouncycastle.bcprov-jdk14.source org.bouncycastle.bctsp-jdk14 org.bouncycastle.bctsp-jdk14.source - org.eclipse.collections.eclipse-collections-api - org.eclipse.collections.eclipse-collections-api.source - org.eclipse.collections.eclipse-collections - org.eclipse.collections.eclipse-collections.source - org.eclipse.jetty.continuation - org.eclipse.jetty.continuation.source - org.eclipse.jetty.http - org.eclipse.jetty.http.source - org.eclipse.jetty.io - org.eclipse.jetty.io.source - org.eclipse.jetty.server - org.eclipse.jetty.server.source org.eclipse.jetty.servlets org.eclipse.jetty.servlets.source - org.eclipse.jetty.util - org.eclipse.jetty.util.source com.github.benmanes.caffeine com.github.benmanes.caffeine.source org.glassfish.hk2.api @@ -327,10 +328,12 @@ location "http://www.simantics.org/download/master/external-components/maven" { org.glassfish.hk2.osgi-resource-locator.source org.glassfish.hk2.utils org.glassfish.hk2.utils.source - org.glassfish.jersey.bundles.repackaged.jersey-guava - org.glassfish.jersey.bundles.repackaged.jersey-guava.source + //org.glassfish.jersey.bundles.repackaged.jersey-guava + //org.glassfish.jersey.bundles.repackaged.jersey-guava.source org.glassfish.hk2.external.aopalliance-repackaged org.glassfish.hk2.external.aopalliance-repackaged.source + org.glassfish.hk2.external.jakarta.inject + org.glassfish.hk2.external.jakarta.inject.source org.glassfish.jersey.core.jersey-client org.glassfish.jersey.core.jersey-client.source org.glassfish.jersey.core.jersey-common @@ -345,6 +348,8 @@ location "http://www.simantics.org/download/master/external-components/maven" { org.glassfish.jersey.media.jersey-media-multipart.source org.glassfish.jersey.containers.jersey-container-servlet-core org.glassfish.jersey.containers.jersey-container-servlet-core.source + org.glassfish.jersey.inject.jersey-hk2 + org.glassfish.jersey.inject.jersey-hk2.source org.hsqldb.hsqldb org.hsqldb.hsqldb.source org.ini4j @@ -353,22 +358,24 @@ location "http://www.simantics.org/download/master/external-components/maven" { org.jboss.windup.decompiler.api.forge-addon.source org.jboss.windup.decompiler.procyon org.jboss.windup.decompiler.procyon.source - org.jboss.windup.decompiler.procyon.windup-procyon-compilertools - org.jboss.windup.decompiler.procyon.windup-procyon-compilertools.source - org.jboss.windup.decompiler.procyon.windup-procyon-core - org.jboss.windup.decompiler.procyon.windup-procyon-core.source - org.jboss.windup.decompiler.procyon.windup-procyon-reflection - org.jboss.windup.decompiler.procyon.windup-procyon-reflection.source + org.bitbucket.mstrobel.procyon-compilertools + org.bitbucket.mstrobel.procyon-compilertools.source + org.bitbucket.mstrobel.procyon-core + org.bitbucket.mstrobel.procyon-core.source org.jboss.windup.utils.windup-utils.forge-addon org.jboss.windup.utils.windup-utils.forge-addon.source + javassist + javassist.source + jakarta.activation-api + jakarta.activation-api.source + jakarta.annotation-api + jakarta.annotation-api.source jaxen jaxen.source org.jdom2 org.jdom2.source org.jfree.jchart org.jfree.jchart.source - org.jfree.jcommon - org.jfree.jcommon.source org.jsoup org.jsoup.source org.jvnet.mimepull @@ -385,8 +392,8 @@ location "http://www.simantics.org/download/master/external-components/maven" { org.yaml.snakeyaml.source org.zeroturnaround.zt-exec org.zeroturnaround.zt-exec.source - pgjdbc-ng - pgjdbc-ng.source + com.impossibl.pgjdbc-ng + com.impossibl.pgjdbc-ng.source stax2-api stax2-api.source } diff --git a/releng/org.simantics.sdk.build.targetdefinition/pom.xml b/releng/org.simantics.sdk.build.targetdefinition/pom.xml index de8c9bb70..dddbfc2ea 100644 --- a/releng/org.simantics.sdk.build.targetdefinition/pom.xml +++ b/releng/org.simantics.sdk.build.targetdefinition/pom.xml @@ -13,4 +13,4 @@ org.simantics.root.releng 1.0.0-SNAPSHOT - \ No newline at end of file + \ No newline at end of file diff --git a/releng/org.simantics.sdk.build.targetdefinition/simantics.target b/releng/org.simantics.sdk.build.targetdefinition/simantics.target index 67ce33201..2e8f54c2d 100644 --- a/releng/org.simantics.sdk.build.targetdefinition/simantics.target +++ b/releng/org.simantics.sdk.build.targetdefinition/simantics.target @@ -1,7 +1,7 @@ - + @@ -38,6 +38,16 @@ + + + + + + + + + + @@ -157,6 +167,11 @@ + + + + + @@ -168,40 +183,44 @@ - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -210,49 +229,45 @@ - - - - - - + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - + + + + + + @@ -260,14 +275,14 @@ - - - - + + - - + + + + @@ -288,107 +303,97 @@ - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + diff --git a/releng/org.simantics.sdk.build.targetdefinition/simantics.tpd b/releng/org.simantics.sdk.build.targetdefinition/simantics.tpd index 1d7588e26..f607a133f 100644 --- a/releng/org.simantics.sdk.build.targetdefinition/simantics.tpd +++ b/releng/org.simantics.sdk.build.targetdefinition/simantics.tpd @@ -1,8 +1,8 @@ -target "Simantics 1.43.0" +target "Simantics 1.44.0" with source allEnvironments -include "http://www.simantics.org/download/master/org.simantics.sdk.build.targetdefinition.tpd" +include "./org.simantics.sdk.build.targetdefinition.tpd" location "http://www.simantics.org/download/master/sdk" { org.simantics.sdk.feature.group lazy diff --git a/releng/org.simantics.sdk.repository/pom.xml b/releng/org.simantics.sdk.repository/pom.xml index c636acba4..42fd442e8 100644 --- a/releng/org.simantics.sdk.repository/pom.xml +++ b/releng/org.simantics.sdk.repository/pom.xml @@ -2,7 +2,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.simantics.sdk.repository - 1.43.0-SNAPSHOT + 1.44.0-SNAPSHOT eclipse-repository diff --git a/releng/org.simantics.tycho.configuration/pom.xml b/releng/org.simantics.tycho.configuration/pom.xml index da8b7254d..cfa99b7ba 100644 --- a/releng/org.simantics.tycho.configuration/pom.xml +++ b/releng/org.simantics.tycho.configuration/pom.xml @@ -8,8 +8,10 @@ pom - 1.5.0 - 1.5.0 + 11 + 11 + 1.6.0 + 1.6.0 UTF-8 diff --git a/settings.xml b/settings.xml deleted file mode 100644 index 1aabd4d98..000000000 --- a/settings.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - graph-builder-snapshot - graph-builder - graph-builder - - - - diff --git a/tests/org.simantics.db.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.simantics.db.tests/.settings/org.eclipse.jdt.core.prefs index 3a2153707..7adc0fb9a 100644 --- a/tests/org.simantics.db.tests/.settings/org.eclipse.jdt.core.prefs +++ b/tests/org.simantics.db.tests/.settings/org.eclipse.jdt.core.prefs @@ -1,11 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/tests/org.simantics.db.tests/META-INF/MANIFEST.MF b/tests/org.simantics.db.tests/META-INF/MANIFEST.MF index 0247fb635..1d2330566 100644 --- a/tests/org.simantics.db.tests/META-INF/MANIFEST.MF +++ b/tests/org.simantics.db.tests/META-INF/MANIFEST.MF @@ -13,7 +13,6 @@ Require-Bundle: org.eclipse.core.runtime, org.simantics.db.management;bundle-version="0.8.0", gnu.trove3;bundle-version="3.0.3", org.simantics.fastlz;bundle-version="1.0.0", - org.apache.log4j;bundle-version="1.2.15", org.simantics.db.impl;bundle-version="0.8.0", org.simantics.db.layer0;bundle-version="0.8.0", org.simantics.project;bundle-version="1.0.1", @@ -25,7 +24,7 @@ Require-Bundle: org.eclipse.core.runtime, org.simantics.db.testing;bundle-version="1.0.0";visibility:=reexport, org.simantics.datatypes.ontology;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.simantics.db.tests.common, org.simantics.db.tests.suite Automatic-Module-Name: org.simantics.db.tests diff --git a/tests/org.simantics.db.tests/build-installer.xml b/tests/org.simantics.db.tests/build-installer.xml index 05804fb84..80b7f7b9d 100644 --- a/tests/org.simantics.db.tests/build-installer.xml +++ b/tests/org.simantics.db.tests/build-installer.xml @@ -21,12 +21,11 @@ - - - + + @@ -35,10 +34,6 @@ - - - - diff --git a/tests/org.simantics.db.tests/build.xml b/tests/org.simantics.db.tests/build.xml index da0a86faa..4c6a1daf9 100644 --- a/tests/org.simantics.db.tests/build.xml +++ b/tests/org.simantics.db.tests/build.xml @@ -135,7 +135,6 @@ - diff --git a/tests/org.simantics.db.tests/launch/RegressionTestsPlugin.launch b/tests/org.simantics.db.tests/launch/RegressionTestsPlugin.launch index cb98442a6..484db5564 100644 --- a/tests/org.simantics.db.tests/launch/RegressionTestsPlugin.launch +++ b/tests/org.simantics.db.tests/launch/RegressionTestsPlugin.launch @@ -60,7 +60,7 @@ - + diff --git a/tests/org.simantics.db.tests/launch/RegressionTestsPlugin2.launch b/tests/org.simantics.db.tests/launch/RegressionTestsPlugin2.launch index 306635d31..74c1f77b3 100644 --- a/tests/org.simantics.db.tests/launch/RegressionTestsPlugin2.launch +++ b/tests/org.simantics.db.tests/launch/RegressionTestsPlugin2.launch @@ -60,7 +60,7 @@ - + diff --git a/tests/org.simantics.db.tests/launch/RegressionTestsPlugin64.launch b/tests/org.simantics.db.tests/launch/RegressionTestsPlugin64.launch index d7bdd406e..d0bd9bb6c 100644 --- a/tests/org.simantics.db.tests/launch/RegressionTestsPlugin64.launch +++ b/tests/org.simantics.db.tests/launch/RegressionTestsPlugin64.launch @@ -60,7 +60,7 @@ - + diff --git a/tests/org.simantics.db.tests/launch/TempTestsPlugin.launch b/tests/org.simantics.db.tests/launch/TempTestsPlugin.launch index 485bc8fb8..bc1440108 100644 --- a/tests/org.simantics.db.tests/launch/TempTestsPlugin.launch +++ b/tests/org.simantics.db.tests/launch/TempTestsPlugin.launch @@ -40,7 +40,7 @@ - + diff --git a/tests/org.simantics.scl.compiler.tests/.classpath b/tests/org.simantics.scl.compiler.tests/.classpath index eca7bdba8..e801ebfb4 100644 --- a/tests/org.simantics.scl.compiler.tests/.classpath +++ b/tests/org.simantics.scl.compiler.tests/.classpath @@ -1,6 +1,6 @@ - + diff --git a/tests/org.simantics.scl.compiler.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.simantics.scl.compiler.tests/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/tests/org.simantics.scl.compiler.tests/.settings/org.eclipse.jdt.core.prefs +++ b/tests/org.simantics.scl.compiler.tests/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/tests/org.simantics.scl.compiler.tests/META-INF/MANIFEST.MF b/tests/org.simantics.scl.compiler.tests/META-INF/MANIFEST.MF index d21946107..678f28e7b 100644 --- a/tests/org.simantics.scl.compiler.tests/META-INF/MANIFEST.MF +++ b/tests/org.simantics.scl.compiler.tests/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Tests Bundle-SymbolicName: org.simantics.scl.compiler.tests Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.junit;bundle-version="4.12.0", org.simantics.scl.compiler;bundle-version="0.5.0", gnu.trove3, @@ -11,7 +11,6 @@ Require-Bundle: org.junit;bundle-version="4.12.0", org.objectweb.asm.util, ch.qos.logback.classic;bundle-version="1.1.7", ch.qos.logback.core;bundle-version="1.1.7", - org.apache.commons.collections;bundle-version="3.2.2", org.eclipse.equinox.ds;bundle-version="1.4.300", org.slf4j.api Automatic-Module-Name: org.simantics.scl.compiler.tests diff --git a/tests/org.simantics.scl.osgi.tests/.classpath b/tests/org.simantics.scl.osgi.tests/.classpath index eca7bdba8..e801ebfb4 100644 --- a/tests/org.simantics.scl.osgi.tests/.classpath +++ b/tests/org.simantics.scl.osgi.tests/.classpath @@ -1,6 +1,6 @@ - + diff --git a/tests/org.simantics.scl.osgi.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.simantics.scl.osgi.tests/.settings/org.eclipse.jdt.core.prefs index 0c68a61dc..7adc0fb9a 100644 --- a/tests/org.simantics.scl.osgi.tests/.settings/org.eclipse.jdt.core.prefs +++ b/tests/org.simantics.scl.osgi.tests/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/tests/org.simantics.scl.osgi.tests/META-INF/MANIFEST.MF b/tests/org.simantics.scl.osgi.tests/META-INF/MANIFEST.MF index 2773e93bd..f4787aef9 100644 --- a/tests/org.simantics.scl.osgi.tests/META-INF/MANIFEST.MF +++ b/tests/org.simantics.scl.osgi.tests/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Tests Bundle-SymbolicName: org.simantics.scl.osgi.tests Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.junit;bundle-version="4.12.0", org.simantics.scl.compiler;bundle-version="0.5.0", org.simantics.scl.osgi;bundle-version="1.0.4", diff --git a/tests/org.simantics.tests.integration/.classpath b/tests/org.simantics.tests.integration/.classpath index 4058b66fe..1e56295b3 100644 --- a/tests/org.simantics.tests.integration/.classpath +++ b/tests/org.simantics.tests.integration/.classpath @@ -1,7 +1,7 @@ + path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11" /> diff --git a/tests/org.simantics.tests.integration/META-INF/MANIFEST.MF b/tests/org.simantics.tests.integration/META-INF/MANIFEST.MF index bfbaa85ae..881f9d2be 100644 --- a/tests/org.simantics.tests.integration/META-INF/MANIFEST.MF +++ b/tests/org.simantics.tests.integration/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Simantics Integration STS Bundle-SymbolicName: org.simantics.tests.integration Bundle-Version: 1.0.0.qualifier Bundle-Vendor: Semantum Oy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.osgi, org.junit, org.simantics.tests.modelled,