public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { this.tableViewer = (TableViewer) viewer; if (changes != null) { changes.removeMemoryListener(); // range.getEntry().getDomain().removeWriteListener(this); decoderProvider.reset(); } range = (MemoryRange) newInput; changes = null; if (range != null) { changes = new MemoryRangeChanges(range); changes.attachMemoryListener(); // range.getEntry().getDomain().addWriteListener(this); decoderProvider.addRange(range.getAddress(), range.getSize()); // clear tableViewer.setItemCount(0); tableViewer.refresh(); updateRange(); } else { decoderProvider.reset(); tableViewer.setItemCount(0); tableViewer.refresh(true); } }
public void refresh() { changes.fetchChanges(); if (changes.isTouched(range.getAddress(), range.getSize())) { decoderProvider.updateRange(changes.getChangeSet()); updateRange(); } }
public void updateElement(int index) { if (range == null) return; /* //System.out.println(index); int addr = index * chunkSize; DecodedRow row = (DecodedRow) tableViewer.getElementAt(index); if (row == null) { Pair<Object, Integer> info = decoderProvider.decode(addr,chunkSize); row = new DecodedRow(addr, range, info.first, info.second); } */ DecodedRow row = (DecodedRow) tableViewer.getElementAt(index); if (row != null) { IDecodedContent content = row.getContent(); if (changes.isTouched(content.getAddr(), content.getSize())) { row = null; } } if (row == null) { IDecodedContent content = decoderProvider.decodeItem(index + firstIndex); byte[] bytes = new byte[content.getSize()]; for (int i = 0; i < bytes.length; i++) bytes[i] = range.getEntry().flatReadByte(content.getAddr() + i); row = new DecodedRow(content, bytes); } tableViewer.replace(row, index); }
public int startAddress() { return memoryRange.startAddress(); }
public int endAddress() { return memoryRange.endAddress(); }
private synchronized void updateRange() { firstIndex = decoderProvider.getFirstItemIndex(range.getAddress()); tableViewer.setItemCount(decoderProvider.getItemCount(range.getAddress(), range.getSize())); tableViewer.refresh(); }