1 package net.mograsim.plugin.tables.mi;
3 import org.eclipse.jface.viewers.TableViewer;
4 import org.eclipse.jface.viewers.Viewer;
6 import net.mograsim.machine.mi.MicroInstructionMemory;
7 import net.mograsim.machine.mi.MicroInstructionMemory.ActiveMicroInstructionChangedListener;
9 public class ActiveInstructionPreviewContentProvider implements InstructionTableContentProvider, ActiveMicroInstructionChangedListener
11 private TableViewer viewer;
12 private MicroInstructionMemory memory;
13 private InstructionTableRow activeRow;
15 public ActiveInstructionPreviewContentProvider(TableViewer viewer)
18 viewer.setItemCount(1);
22 public void activeMicroInstructionChanged(long address)
24 this.activeRow = new InstructionTableRow(address, memory);
29 public void update(long address)
35 public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
38 ((MicroInstructionMemory) oldInput).deregisterActiveMicroInstructionChangedListener(this);
40 memory = (MicroInstructionMemory) newInput;
43 activeMicroInstructionChanged(0);
44 memory.registerActiveMicroInstructionChangedListener(this);
49 public void updateElement(int index)
51 viewer.replace(activeRow, index);