From: Reino Ruusu Date: Mon, 12 Oct 2020 11:26:19 +0000 (+0300) Subject: Disable editable style from columns other than "Enabled" X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=5d228b079e641a4ab51540441fc307dcf0b942af;p=simantics%2Fdistrict.git Disable editable style from columns other than "Enabled" gitlab #101 Change-Id: I5142a8b615881f97cf2dea24aa86485cf4b43ef8 (cherry picked from commit dea2f95092ad8d682b356cdd39e8c1c4a0db9b2c) --- 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,