]> gerrit.simantics Code Review - simantics/interop.git/commitdiff
Show disabled items in change management UI 62/3762/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Wed, 8 Jan 2020 12:43:33 +0000 (14:43 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Wed, 8 Jan 2020 12:43:33 +0000 (14:43 +0200)
gitlab #19

Change-Id: I79e79918a8c1f37ce93c9733aae28f368a5cdc5b

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

index 2c7f1ce03b0c000499dbc285accf7083b0c83a83..efe67a76d96a66360baf7959e40d5def3c7a9da3 100644 (file)
@@ -89,6 +89,7 @@ public abstract class ModelUpdateEditor extends Composite implements WarningList
        private Color containsColor;
        private Color deletedColor;
        private Color addedColor;
+       private Color disabledColor;
 
        private ModelUpdate update;
        
@@ -105,6 +106,7 @@ public abstract class ModelUpdateEditor extends Composite implements WarningList
                containsColor = new Color(parent.getDisplay(), new RGB(255,255,220));
                deletedColor = new Color(parent.getDisplay(), new RGB(255,220,220));
                addedColor = new Color(parent.getDisplay(), new RGB(220,255,220));
+               disabledColor = new Color(parent.getDisplay(), new RGB(128,128,128));
                
                this.setLayout(new GridLayout(1,false));
                
@@ -375,7 +377,7 @@ public abstract class ModelUpdateEditor extends Composite implements WarningList
                                                        selectedStructure.remove(n);
                                                }
                                                changeBrowser.setChecked(n, sel);
-                                               changeBrowser.setGrayed(n, false);
+                                               changeBrowser.setGrayed(n, !op.enabled());
                                        }
                                }
                        } else {
@@ -559,6 +561,29 @@ public abstract class ModelUpdateEditor extends Composite implements WarningList
                        else
                                return unchecked;
                }
+               
+               @Override
+               public Color getForeground(Object element) {
+                       PropertyChange pc = (PropertyChange)element;
+                       if (!pc.enabled())
+                               return disabledColor;
+                       return null;
+               }
+       }
+       
+       protected abstract class PropertyChangeLabelProvider extends ColumnLabelProvider {
+               
+               public PropertyChangeLabelProvider() {
+                       
+               }
+               
+               @Override
+               public Color getForeground(Object element) {
+                       PropertyChange pc = (PropertyChange)element;
+                       if (!pc.enabled())
+                               return disabledColor;
+                       return null;
+               }
        }
        
        private class UpdateNodeLabelProvider extends ColumnLabelProvider {
@@ -617,6 +642,14 @@ public abstract class ModelUpdateEditor extends Composite implements WarningList
                                return addedColor;
                        return null;            
                }
+               
+               @Override
+               public Color getForeground(Object element) {
+                       final UpdateNode node = (UpdateNode)element;
+                       if (node.getOp() != null && !node.getOp().enabled())
+                               return disabledColor;
+                       return null;
+               }
        }
        
        private class SelectionEditingSupport extends EditingSupport {