]> gerrit.simantics Code Review - simantics/interop.git/commitdiff
Prevent changing custom value after the change has been applied 89/3789/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 16 Jan 2020 11:30:11 +0000 (13:30 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 16 Jan 2020 11:30:11 +0000 (13:30 +0200)
Hide check icon for applied property changes.

gitlab #18

Change-Id: I52001e7acf098aa61591d93605c780543b68f29e

org.simantics.interop.update/src/org/simantics/interop/update/editor/ModelUpdateEditor.java
org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java

index efe67a76d96a66360baf7959e40d5def3c7a9da3..ea14039eecb0bbe3fc1c65f5c45cdf8a6c225d60 100644 (file)
@@ -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
index de28055996ef41f8c1ed7368fd5d6fffb6ccc651..b9555484e51481a5d733b41b742cee68a541a562 100644 (file)
@@ -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;
        }