From dea2f95092ad8d682b356cdd39e8c1c4a0db9b2c Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Mon, 12 Oct 2020 14:26:19 +0300 Subject: [PATCH] Disable editable style from columns other than "Enabled" gitlab #101 Change-Id: I5142a8b615881f97cf2dea24aa86485cf4b43ef8 --- .../network/ui/techtype/table/TechTypeTable.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/techtype/table/TechTypeTable.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/techtype/table/TechTypeTable.java index fa0a1acb..a8db44c7 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/techtype/table/TechTypeTable.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/techtype/table/TechTypeTable.java @@ -8,7 +8,6 @@ import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.Set; -import java.util.function.Consumer; import java.util.stream.Collectors; import org.eclipse.jface.layout.GridDataFactory; @@ -17,8 +16,8 @@ import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration; import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes; import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration; +import org.eclipse.nebula.widgets.nattable.config.EditableRule; import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; -import org.eclipse.nebula.widgets.nattable.config.IEditableRule; import org.eclipse.nebula.widgets.nattable.copy.command.CopyDataCommandHandler; import org.eclipse.nebula.widgets.nattable.data.IDataProvider; import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; @@ -268,7 +267,12 @@ public class TechTypeTable extends Composite { cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_RED); configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, - IEditableRule.ALWAYS_EDITABLE); + new EditableRule() { + @Override + public boolean isEditable(int columnIndex, int rowIndex) { + return columnIndex == 0; + } + }); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, -- 2.47.1