From 28be4d3512adbf9cb2c2af1ddb479a9820f860c0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hannu=20Niemist=C3=B6?= Date: Mon, 2 Jan 2017 17:14:57 +0200 Subject: [PATCH] Support for typed subprocesses Added a method to test if there are pending removals. [PRIVATE-12928] Change-Id: I5bf94202209714af0163ef95b61b874a14db0aa8 --- .../org/simantics/spreadsheet/graph/SpreadsheetBook.java | 2 +- .../structural/synchronization/base/MappingBase.java | 4 ++++ .../synchronization/base/ModuleUpdaterBase.java | 1 + .../simantics/structural/synchronization/base/Solver.java | 2 +- .../base/SynchronizationEventHandlerBase.java | 8 ++++---- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetBook.java b/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetBook.java index b41e9c754..277b10cb0 100644 --- a/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetBook.java +++ b/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetBook.java @@ -316,7 +316,7 @@ public class SpreadsheetBook implements SpreadsheetElement> { configurationByUid.clear(); pendingRemoval.clear(); } + + public boolean hasPendingRemovals() { + return !pendingRemoval.isEmpty(); + } } diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleUpdaterBase.java b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleUpdaterBase.java index a3edea09e..9ec63c061 100644 --- a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleUpdaterBase.java +++ b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleUpdaterBase.java @@ -19,6 +19,7 @@ abstract public class ModuleUpdaterBase> { new THashMap>(); public boolean isUserComponent; public boolean isComposite; + public String subprocessType; public ModuleUpdaterBase(String moduleType) { this.moduleType = moduleType; diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/Solver.java b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/Solver.java index a4d19283a..6bda54418 100644 --- a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/Solver.java +++ b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/Solver.java @@ -8,7 +8,7 @@ public interface Solver { public void remove(int id); - public void addSubprocess(String name); + public void addSubprocess(String name, String subprocessType); public void includeSubprocess(String parentName, String subprocessName); public T getConcreteSolver(); diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java index d2eb50f22..94bfbf896 100644 --- a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java +++ b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java @@ -1,8 +1,5 @@ package org.simantics.structural.synchronization.base; -import gnu.trove.map.hash.THashMap; -import gnu.trove.set.hash.THashSet; - import java.util.ArrayDeque; import java.util.Collection; import java.util.Collections; @@ -19,6 +16,9 @@ import org.simantics.structural.synchronization.protocol.SerializedVariable; import org.simantics.structural.synchronization.protocol.SynchronizationEventHandler; import org.simantics.structural.synchronization.protocol.SynchronizationException; +import gnu.trove.map.hash.THashMap; +import gnu.trove.set.hash.THashSet; + /** * Handles synchronization events by updating the simulator designated by the * provided {@link Solver} instance. @@ -186,7 +186,7 @@ public abstract class SynchronizationEventHandlerBase parentSolverComponentName, getSubprocessName(name, properties)); try { - solver.addSubprocess(subprocessName); + solver.addSubprocess(subprocessName, updater.subprocessType); } catch(Exception e) { reportProblem("Exception while adding subprocess.", e); } -- 2.43.2