From: Marko Luukkainen Date: Wed, 8 Jan 2020 12:43:33 +0000 (+0200) Subject: Show disabled items in change management UI X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F62%2F3762%2F1;p=simantics%2Finterop.git Show disabled items in change management UI gitlab #19 Change-Id: I79e79918a8c1f37ce93c9733aae28f368a5cdc5b --- 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 2c7f1ce..efe67a7 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 @@ -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 {