From 3eb713f4790896fbb3b71028a03b946a3d12dbd0 Mon Sep 17 00:00:00 2001 From: Fabian Stemmler Date: Wed, 25 Sep 2019 10:40:35 +0200 Subject: [PATCH] =?utf8?q?Switched=20BooleanEditingSupport=20back=20to=20?= =?utf8?q?=C2=B4CheckBoxCellEditor?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../plugin/tables/mi/BooleanEditingSupport.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/BooleanEditingSupport.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/BooleanEditingSupport.java index 8cdaae27..8fbfe392 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/BooleanEditingSupport.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/BooleanEditingSupport.java @@ -1,10 +1,9 @@ package net.mograsim.plugin.tables.mi; import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ComboBoxCellEditor; +import org.eclipse.jface.viewers.CheckboxCellEditor; import org.eclipse.jface.viewers.EditingSupport; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; import net.mograsim.logic.core.types.Bit; import net.mograsim.machine.mi.MicroInstruction; @@ -15,7 +14,7 @@ import net.mograsim.machine.mi.parameters.Mnemonic; public class BooleanEditingSupport extends EditingSupport { - private final ComboBoxCellEditor editor; + private final CellEditor editor; private final BooleanClassification boolClass; private final TableViewer viewer; private final int index; @@ -25,10 +24,7 @@ public class BooleanEditingSupport extends EditingSupport super(viewer); this.viewer = viewer; this.boolClass = (BooleanClassification) definition.getParameterClassification(index); - editor = new ComboBoxCellEditor(viewer.getTable(), boolClass.getStringValues(), SWT.READ_ONLY); - editor.setActivationStyle( - ComboBoxCellEditor.DROP_DOWN_ON_TRAVERSE_ACTIVATION | ComboBoxCellEditor.DROP_DOWN_ON_PROGRAMMATIC_ACTIVATION - | ComboBoxCellEditor.DROP_DOWN_ON_MOUSE_ACTIVATION | ComboBoxCellEditor.DROP_DOWN_ON_KEY_ACTIVATION); + editor = new CheckboxCellEditor(viewer.getTable()); this.index = index; } @@ -49,7 +45,7 @@ public class BooleanEditingSupport extends EditingSupport { InstructionTableRow row = (InstructionTableRow) element; // true is 0 because the true value comes first in the combo box - return row.data.getCell(row.address).getParameter(index).getValue().getMSBit(0).equals(Bit.ONE) ? 0 : 1; + return row.data.getCell(row.address).getParameter(index).getValue().getMSBit(0).equals(Bit.ONE); } @Override @@ -58,9 +54,8 @@ public class BooleanEditingSupport extends EditingSupport InstructionTableRow row = (InstructionTableRow) element; MicroInstructionParameter[] params = row.data.getCell(row.address).getParameters(); // true is 0 because the true value comes first in the combo box - Mnemonic newParam = boolClass.get(value.equals(0) ? true : false); - if (newParam.equals(params[index])) - return; + Mnemonic newParam = boolClass.get((Boolean) value); + params[index] = newParam; row.data.setCell(row.address, MicroInstruction.create(params)); viewer.update(element, null); -- 2.17.1