]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Merge "Update structure and value cache when refreshing variable"
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 20 Nov 2018 09:11:35 +0000 (09:11 +0000)
committerGerrit Code Review <gerrit2@simantics>
Tue, 20 Nov 2018 09:11:35 +0000 (09:11 +0000)
24 files changed:
bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerImpl.java
bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java
bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/utils/AsyncUtils.java
bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetGraphUtils.java
bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetSessionManager.java
bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/synchronization/LineUpdater.java
bundles/org.simantics.structural.synchronization.client/META-INF/MANIFEST.MF
bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/ContinuousSynchronizationJob.java [moved from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/ContinuousSynchronizationJob.java with 97% similarity]
bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/StructuralChangeFlattener.java [moved from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/StructuralChangeFlattener.java with 99% similarity]
bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/Synchronizer.java [moved from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/Synchronizer.java with 99% similarity]
bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/UpdateComponentUids.java [moved from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/UpdateComponentUids.java with 98% similarity]
bundles/org.simantics.structural.synchronization/META-INF/MANIFEST.MF
bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/CommandBuilder.java [moved from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/CommandBuilder.java with 100% similarity]
bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ConnectionUpdateRule.java [moved from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ConnectionUpdateRule.java with 100% similarity]
bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ModuleCallback.java [moved from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleCallback.java with 100% similarity]
bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ModuleUpdateContext.java [moved from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleUpdateContext.java with 100% similarity]
bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ModuleUpdaterBase.java [moved from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleUpdaterBase.java with 100% similarity]
bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ModuleUpdaterFactoryBase.java [moved from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleUpdaterFactoryBase.java with 78% similarity]
bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/PropertyUpdateRule.java [moved from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/PropertyUpdateRule.java with 100% similarity]
bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ReferenceResolverBase.java [moved from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ReferenceResolverBase.java with 100% similarity]
bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/SolverNameUtil.java [moved from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/SolverNameUtil.java with 100% similarity]
bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java [moved from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java with 99% similarity]
bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/internal/Policy.java [moved from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/internal/Policy.java with 100% similarity]
bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/protocol/AbstractSynchronizationEventHandler.java [moved from bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base2/AbstractSynchronizationEventHandler.java with 96% similarity]

index df4860d42145551c2fd59c428ae7c749763a5a3d..e90ae5eeecf78dee9d9bd0f6a74084e116d83af9 100644 (file)
@@ -173,6 +173,8 @@ import org.simantics.utils.ui.SWTUtils;
 import org.simantics.utils.ui.jface.BasePostSelectionProvider;
 import org.simantics.utils.ui.widgets.VetoingEventHandler;
 import org.simantics.utils.ui.workbench.WorkbenchUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import gnu.trove.map.hash.THashMap;
 import gnu.trove.procedure.TObjectProcedure;
@@ -185,6 +187,8 @@ import gnu.trove.set.hash.THashSet;
  */
 class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, GraphExplorer /*, IPostSelectionProvider*/ {
 
+    private static final Logger LOGGER = LoggerFactory.getLogger(GraphExplorerImpl.class);
+
        private static class GraphExplorerPostSelectionProvider implements IPostSelectionProvider {
                
                private GraphExplorerImpl ge;
@@ -1553,10 +1557,14 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
 
         OpenStrategy os = new OpenStrategy(tree);
         os.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
-            resetSelectionFromWidget();
+            ISelection s = resetSelectionFromWidget();
+            if (s != null) {
+                LOGGER.trace("Fire selection change: {}", s);
+                selectionProvider.fireSelection(s);
+            }
         }));
         os.addPostSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
-            //System.out.println("OPENSTRATEGY: post selection changed: " + e);
+            LOGGER.trace("Fire post-selection change: {}", selectionProvider.getSelection());
             resetSelectionFromWidgetAndFirePostSelection(true);
         }));
 
index ef2fb5d66cbeff9faa4f5458dc91955be12fea98..d3fd1cca9b9314cf4933c78d331fe22f349d85be 100644 (file)
@@ -93,9 +93,16 @@ public class SCLScenegraph {
        private static final String MAIN_SECTION = "main";
        private static final String SELECTION_SECTION = "selection";
        private static final String SELECTION_MASK_SECTION = "selectionMask";
-       
+
        private static final String[] ALL_SECTIONS = { MAIN_SECTION, SELECTION_SECTION, SELECTION_MASK_SECTION };
 
+       // Changed from 0.001 to 0.0001 to prevent creation of huge BufferedImage's when
+       // generating PDF from SVG. If SVG contains any transparency then Batik uses
+       // bitmap-rendering which remarkably slows things down
+       // See org.apache.batik.gvt.AbstractGraphicsNode.paint(Graphics2D) where decisions are made
+       // if AlphaComposite should be painted 
+       private static final String OPACITY = "0.0001";
+
        @Deprecated
        public static ICanvasSceneGraphProvider getICanvasSceneGraphProvider(Resource model, Resource diagram, String diagramRVI) throws DatabaseException, InterruptedException {
                ICanvasSceneGraphProvider provider = DiagramNodeUtil.loadSceneGraphProvider(model, diagram, diagramRVI);
@@ -793,7 +800,7 @@ public class SCLScenegraph {
                 String key = getKey((ConnectionNode) node);
                 parentBuilder.append(MAIN_SECTION, "\n<g class=\"connection\" id=\"" + key + "\">");
                 parentBuilder.append(SELECTION_SECTION, "\n<g style=\"visibility:hidden\" class=\"selection\" id=\"" + key + "\">");
-                parentBuilder.append(SELECTION_MASK_SECTION, "\n<g class=\"selectionMask\" opacity=\"0.001\" id=\"" + key + "\">");
+                parentBuilder.append(SELECTION_MASK_SECTION, "\n<g class=\"selectionMask\" opacity=\"" + OPACITY + "\" id=\"" + key + "\">");
                 
                 Element doc = renderSVGNode(svgGenerator, (IG2DNode)node);
                 String svg = printSVGDocument(doc);
@@ -841,7 +848,7 @@ public class SCLScenegraph {
                     Rectangle2D rect = n.getRect();
                     // NaN
                     if(rect.getHeight() == rect.getHeight() && rect.getWidth() == rect.getWidth()) {
-                           parentBuilder2.append(SELECTION_MASK_SECTION,"<rect style=\"fill:#fff\" opacity=\"0.001\"");
+                           parentBuilder2.append(SELECTION_MASK_SECTION,"<rect style=\"fill:#fff\" opacity=\"" + OPACITY + "\"");
                            parentBuilder2.append(SELECTION_MASK_SECTION," x=\"" + rect.getX() + "\" y=\"" + rect.getY() + "\"");
                            parentBuilder2.append(SELECTION_MASK_SECTION," width=\"" + rect.getWidth() + "\" height=\"" + rect.getHeight() + "\"");
                            parentBuilder2.append(SELECTION_MASK_SECTION,"></rect>");
index fcab99c20ae632f4b26320bdafecf66fbd46334b..d771a821e8e65329134ebd8af37af7779b21866a 100644 (file)
@@ -2,7 +2,6 @@ package org.simantics.scl.runtime.utils;
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.Callable;
@@ -55,7 +54,7 @@ public class AsyncUtils {
 
     @SuppressWarnings({ "rawtypes", "unchecked" })
     public static List<Object> pmap(Function f, List<Object> l) {
-        return Arrays.asList(l.parallelStream().map(a -> f.apply(a)).toArray());
+        return l.parallelStream().map(f::apply).collect(Collectors.toList());
     }
 
     @SuppressWarnings({ "rawtypes", "unchecked" })
index 297ac9dc9fffe17f2afd48fdd6d4dd9b0913e879..032acfcfce722809848b8fceeeac10bb9bd19800 100644 (file)
@@ -38,7 +38,7 @@ import org.simantics.spreadsheet.Range;
 import org.simantics.spreadsheet.graph.synchronization.SpreadsheetSynchronizationEventHandler;
 import org.simantics.spreadsheet.resource.SpreadsheetResource;
 import org.simantics.spreadsheet.util.SpreadsheetUtils;
-import org.simantics.structural.synchronization.Synchronizer;
+import org.simantics.structural.synchronization.client.Synchronizer;
 
 import gnu.trove.iterator.TObjectIntIterator;
 import gnu.trove.map.hash.TObjectIntHashMap;
index f50463ef009f93d55bdf4dc74375c44b57d656cf..ec8935f285ced8713f9614c9fca87f6ecdce9329 100644 (file)
@@ -23,7 +23,7 @@ import org.simantics.simulator.toolkit.db.StandardVariableSessionManager;
 import org.simantics.spreadsheet.graph.formula.SpreadsheetEvaluationEnvironment;
 import org.simantics.spreadsheet.graph.synchronization.SpreadsheetSynchronizationEventHandler;
 import org.simantics.spreadsheet.resource.SpreadsheetResource;
-import org.simantics.structural.synchronization.Synchronizer;
+import org.simantics.structural.synchronization.client.Synchronizer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
index baa0851b2503006182b9cb53cc055329cfdc8fe1..18f0bfbc5da7ec20225c7d097a47042c45527447 100644 (file)
@@ -10,7 +10,6 @@ import org.simantics.structural.synchronization.base.CommandBuilder;
 import org.simantics.structural.synchronization.base.ModuleUpdateContext;
 import org.simantics.structural.synchronization.base.ModuleUpdaterBase;
 import org.simantics.structural.synchronization.base.PropertyUpdateRule;
-import org.simantics.structural.synchronization.utils.Solver;
 
 public class LineUpdater extends ModuleUpdaterBase<SheetLineComponent> {
        
index 6fe0a79e03f0419884ee264600c5259cbc6a3075..ba77d3e370a8e9a69b6211e0251f42b932fae8e8 100644 (file)
@@ -13,6 +13,5 @@ Require-Bundle: org.simantics.databoard;bundle-version="0.6.5",
  org.simantics.datatypes.ontology;bundle-version="1.1.0",
  org.simantics.structural.synchronization;bundle-version="1.0.0";visibility:=reexport,
  org.slf4j.api
-Export-Package: org.simantics.structural.synchronization,
- org.simantics.structural.synchronization.base
+Export-Package: org.simantics.structural.synchronization.client
 Automatic-Module-Name: org.simantics.structural.synchronization.client
index 63d4a68326133b93bdade3b2ef1956229677a254..5cf82d1f1d3a89772c2a760ed22c91c61c016a97 100644 (file)
@@ -4,7 +4,7 @@ Bundle-Name: Synchronization
 Bundle-SymbolicName: org.simantics.structural.synchronization;singleton:=true
 Bundle-Version: 1.0.0.qualifier
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Export-Package: org.simantics.structural.synchronization.base2,
+Export-Package: org.simantics.structural.synchronization.base,
  org.simantics.structural.synchronization.protocol,
  org.simantics.structural.synchronization.utils
 Require-Bundle: org.simantics.databoard;bundle-version="0.6.5",
@@ -1,13 +1,13 @@
 package org.simantics.structural.synchronization.base;
 
-import gnu.trove.map.hash.THashMap;
-
 import java.util.ArrayList;
 
 import org.simantics.databoard.binding.mutable.Variant;
 import org.simantics.structural.synchronization.utils.ComponentBase;
 import org.simantics.structural.synchronization.utils.Solver;
 
+import gnu.trove.map.hash.THashMap;
+
 public class ModuleUpdateContext<T extends ComponentBase<T>> {
 
     private ModuleUpdaterBase<T> updater;
@@ -1,7 +1,5 @@
 package org.simantics.structural.synchronization.base;
 
-import gnu.trove.map.hash.THashMap;
-
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
@@ -11,6 +9,8 @@ import org.simantics.structural.synchronization.protocol.Connection;
 import org.simantics.structural.synchronization.protocol.SerializedVariable;
 import org.simantics.structural.synchronization.utils.ComponentBase;
 
+import gnu.trove.map.hash.THashMap;
+
 abstract public class ModuleUpdaterBase<T extends ComponentBase<T>> {
 
     public String moduleType;
@@ -1,11 +1,9 @@
 package org.simantics.structural.synchronization.base;
 
-import org.simantics.db.exception.DatabaseException;
 import org.simantics.structural.synchronization.utils.ComponentBase;
 
-
 public interface ModuleUpdaterFactoryBase<T extends ComponentBase<T>> {
 
-    public ModuleUpdaterBase<T> createUpdater(String id) throws DatabaseException;
+    public ModuleUpdaterBase<T> createUpdater(String id) throws Exception;
 
 }
@@ -1,8 +1,5 @@
 package org.simantics.structural.synchronization.base;
 
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.procedure.TObjectObjectProcedure;
-
 import java.util.ArrayList;
 import java.util.Collections;
 
@@ -12,6 +9,9 @@ import org.simantics.structural.synchronization.utils.ComponentBase;
 import org.simantics.structural.synchronization.utils.Solver;
 import org.slf4j.Logger;
 
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.procedure.TObjectObjectProcedure;
+
 abstract public class ReferenceResolverBase<T extends ComponentBase<T>> {
        
     protected SynchronizationEventHandler eventHandler;
@@ -8,7 +8,6 @@ import java.util.Queue;
 
 import org.simantics.databoard.Bindings;
 import org.simantics.databoard.adapter.AdaptException;
-import org.simantics.db.exception.DatabaseException;
 import org.simantics.structural.synchronization.internal.Policy;
 import org.simantics.structural.synchronization.protocol.ChildInfo;
 import org.simantics.structural.synchronization.protocol.Connection;
@@ -379,7 +378,7 @@ public abstract class SynchronizationEventHandlerBase<T extends ComponentBase<T>
             ModuleUpdaterBase<T> updater;
             try {
                 updater = moduleUpdaterFactory.createUpdater(id);
-            } catch (DatabaseException e) {
+            } catch (Exception e) {
                 throw new RuntimeException(e);
             }
             if(updater == null)
@@ -1,4 +1,4 @@
-package org.simantics.structural.synchronization.base2;
+package org.simantics.structural.synchronization.protocol;
 
 import gnu.trove.map.hash.THashMap;
 import gnu.trove.set.hash.THashSet;
@@ -8,11 +8,6 @@ import java.util.Collection;
 import java.util.Map;
 
 import org.simantics.databoard.util.URIStringUtils;
-import org.simantics.structural.synchronization.protocol.ChildInfo;
-import org.simantics.structural.synchronization.protocol.Connection;
-import org.simantics.structural.synchronization.protocol.SerializedVariable;
-import org.simantics.structural.synchronization.protocol.SynchronizationEventHandler;
-import org.simantics.structural.synchronization.protocol.SynchronizationException;
 
 /**
  * <p>A partial implementation of SynchronizationEventHandler that contains all generic