X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=plugins%2Fnet.mograsim.plugin.core%2Fsrc%2Fnet%2Fmograsim%2Fplugin%2Ftables%2Fmi%2FBooleanEditingSupport.java;h=3c0a61240967a0afdd1866d13b4ff2022c22410b;hb=648fc6e69e09fe4467cb6bac47934be1a7dcf0d6;hp=8cdaae277491c2391a1a7dbd68a28d72cb04aac3;hpb=424226156a244e05c560248efeabdf6f8eccc181;p=Mograsim.git 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..3c0a6124 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,12 +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.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; import net.mograsim.machine.mi.MicroInstructionDefinition; import net.mograsim.machine.mi.parameters.BooleanClassification; @@ -15,7 +12,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 +22,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 CyclingCellEditor(viewer.getTable(), boolClass.size());// new CheckboxCellEditor(viewer.getTable()); this.index = index; } @@ -49,7 +43,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 ((Mnemonic) row.data.getCell(row.address).getParameter(index)).ordinal(); } @Override @@ -58,9 +52,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((Integer) value); + params[index] = newParam; row.data.setCell(row.address, MicroInstruction.create(params)); viewer.update(element, null);