From 0403f09aa2c8b17a99acdd6f82d893bc1cdf88fb Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Thu, 16 Jan 2020 13:30:11 +0200 Subject: [PATCH] Prevent changing custom value after the change has been applied Hide check icon for applied property changes. gitlab #18 Change-Id: I52001e7acf098aa61591d93605c780543b68f29e --- .../simantics/interop/update/editor/ModelUpdateEditor.java | 5 +++++ .../org/simantics/interop/update/model/PropertyChange.java | 3 +++ 2 files changed, 8 insertions(+) diff --git a/org.simantics.interop.update/src/org/simantics/interop/update/editor/ModelUpdateEditor.java b/org.simantics.interop.update/src/org/simantics/interop/update/editor/ModelUpdateEditor.java index efe67a7..ea14039 100644 --- a/org.simantics.interop.update/src/org/simantics/interop/update/editor/ModelUpdateEditor.java +++ b/org.simantics.interop.update/src/org/simantics/interop/update/editor/ModelUpdateEditor.java @@ -100,6 +100,7 @@ public abstract class ModelUpdateEditor extends Composite implements WarningList super(parent,SWT.NONE); checked = manager.createImage(Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/tick.png")); unchecked = manager.createImage(Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/cross.png")); + unchecked = manager.createImage(Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/cross.png")); warning = manager.createImage(Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/error.png")); @@ -427,6 +428,8 @@ public abstract class ModelUpdateEditor extends Composite implements WarningList protected void setInputs() { changeViewer.setInput(update.getUpdateList().getChanges()); changeBrowser.setInput(update.getUpdateTree()); + updateAllButton.setEnabled(true); + updateSelectedButton.setEnabled(true); } private void applyAll() { @@ -556,6 +559,8 @@ public abstract class ModelUpdateEditor extends Composite implements WarningList if (update == null || !update.isInit()) return null; PropertyChange pc = (PropertyChange)element; + if (pc.applied()) + return null; if (pc.selected()) return checked; else diff --git a/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java b/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java index de28055..b955548 100644 --- a/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java +++ b/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java @@ -206,6 +206,9 @@ public class PropertyChange { } public void setCustomValue(Object customValue) { + if (applied) { + throw new RuntimeException("Cannot change already applied value"); + } this.customValue = customValue; } -- 2.47.1