diff --git a/ch.qos.logback.beagle/src/ch/qos/logback/beagle/util/LayoutDataHelper.java b/ch.qos.logback.beagle/src/ch/qos/logback/beagle/util/LayoutDataHelper.java new file mode 100755 index 0000000..4be47f4 --- /dev/null +++ b/ch.qos.logback.beagle/src/ch/qos/logback/beagle/util/LayoutDataHelper.java @@ -0,0 +1,93 @@ +/** + * Logback-beagle: The logback Console Plugin for Eclipse + * Copyright (C) 2006-2012, QOS.ch. All rights reserved. + * + * This program and the accompanying materials are licensed under + * either the terms of the Eclipse Public License v1.0 as published by + * the Eclipse Foundation. + */ +package ch.qos.logback.beagle.util; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.widgets.Control; + +public class LayoutDataHelper { + + FormData formData; + final Control control; + + public static LayoutDataHelper make(Control control) { + return new LayoutDataHelper(control); + } + + public static LayoutDataHelper make(Control control, int width, int height) { + return new LayoutDataHelper(control, width, height); + } + + + public LayoutDataHelper(Control control) { + this.control = control; + formData = new FormData(); + } + + public LayoutDataHelper(Control control, int width, int height) { + this.control = control; + formData = new FormData(width, height); + } + + // relative to the control's parent ------------------------------- + public LayoutDataHelper bottom(int offset) { + formData.bottom = new FormAttachment(100, offset); + return this; + } + + public LayoutDataHelper left(int offset) { + formData.left = new FormAttachment(0, offset); + return this; + } + + public LayoutDataHelper top(int offset) { + formData.top = new FormAttachment(0, offset); + return this; + } + + + public LayoutDataHelper right(int offset) { + formData.right = new FormAttachment(100, offset); + return this; + } + + // relative to aControl, a control passed as parameter ------------------------------ + + public LayoutDataHelper rightOf(Control aControl, int offset) { + formData.left = new FormAttachment(aControl, offset, SWT.RIGHT); + return this; + } + + public LayoutDataHelper leftOf(Control aControl, int offset) { + formData.right = new FormAttachment(aControl, offset, SWT.LEFT); + return this; + } + + public LayoutDataHelper above(Control aControl, int offset) { + formData.bottom = new FormAttachment(aControl, offset, SWT.TOP); + return this; + } + + public LayoutDataHelper below(Control aControl, int offset) { + formData.top = new FormAttachment(aControl, offset, SWT.BOTTOM); + return this; + } + + + public FormData getFormData() { + return formData; + } + + public void set() { + control.setLayoutData(formData); + } + +} diff --git a/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/TableMediator.java b/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/TableMediator.java index 4ab5fd7..d66952b 100644 --- a/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/TableMediator.java +++ b/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/TableMediator.java @@ -13,8 +13,6 @@ import org.eclipse.nebula.widgets.grid.Grid; import org.eclipse.nebula.widgets.grid.GridColumn; import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Menu; @@ -26,6 +24,7 @@ import ch.qos.logback.beagle.menu.MenuBuilder; import ch.qos.logback.beagle.preferences.BeaglePreferencesChangeListenter; import ch.qos.logback.beagle.preferences.BeaglePreferencesPage; +import ch.qos.logback.beagle.util.LayoutDataHelper; import ch.qos.logback.beagle.util.MetricsUtil; import ch.qos.logback.beagle.util.ResourceUtil; import ch.qos.logback.beagle.view.listener.ColumnControlListener; @@ -42,77 +41,73 @@ public class TableMediator { - static final int OFFSET_FROM_BUTTOM = -5; + static final int OFFSET_FROM_BUTTOM = -10; - - public Grid grid; + final Grid grid; public ClassicTISBuffer classicTISBuffer; public BeaglePreferencesChangeListenter preferencesChangeListenter; + final Composite parent; - public ConverterFacade converterFacade = new ConverterFacade(); + ConverterFacade converterFacade = new ConverterFacade(); private LoggerContext loggerContext = new LoggerContext(); + Label timeDifferenceLabel; + Label totalEventsLabel; + ToolItem unfreezeToolItem; public TableMediator(Composite parent) { this.parent = parent; + this.timeDifferenceLabel = new Label(parent, SWT.LEFT); + this.totalEventsLabel = new Label(parent, SWT.LEFT); + this.grid = new Grid(parent, SWT.VIRTUAL | SWT.H_SCROLL | SWT.V_SCROLL + | SWT.MULTI | SWT.BORDER); + init(); } private void init() { loggerContext.setName("beagle"); - grid = new Grid(parent, SWT.VIRTUAL | SWT.H_SCROLL | SWT.V_SCROLL - | SWT.MULTI | SWT.BORDER); grid.setFont(ResourceUtil.FONT); int charHeight = MetricsUtil.computeCharHeight(grid); int charWidth = MetricsUtil.computeCharWidth(grid); - FormData formData; - formData = new FormData(Constants.ICON_SIZE, Constants.ICON_SIZE); - formData.left = new FormAttachment(0, charWidth); - formData.bottom = new FormAttachment(100, OFFSET_FROM_BUTTOM); + + LayoutDataHelper.make(this.totalEventsLabel, 12 * charWidth, charHeight) + .left(charWidth).bottom(OFFSET_FROM_BUTTOM).set(); + this.totalEventsLabel.setText("0 events"); + + Label separator0Label = new Label(parent, SWT.SEPARATOR | SWT.VERTICAL); + LayoutDataHelper.make(separator0Label, charWidth, charHeight) + .bottom(OFFSET_FROM_BUTTOM).rightOf(this.totalEventsLabel, 10).set(); - formData = new FormData(30 * charWidth, charHeight); - Label diffCueLabel = new Label(parent, SWT.LEFT); - formData.bottom = new FormAttachment(100, OFFSET_FROM_BUTTOM); - diffCueLabel.setLayoutData(formData); - diffCueLabel.setText(""); + LayoutDataHelper.make(timeDifferenceLabel, 12 * charWidth, charHeight) + .bottom(OFFSET_FROM_BUTTOM).rightOf(separator0Label, 10).set(); ToolBar toolbar = new ToolBar(parent, SWT.HORIZONTAL); - formData = new FormData(); - formData.right = new FormAttachment(100, -5); - formData.bottom = new FormAttachment(100, OFFSET_FROM_BUTTOM); - - // formData.right = new FormAttachment(100, -5); - // formData.top = new FormAttachment(0, 5); - toolbar.setLayoutData(formData); - ToolItem unfreezeToolItem = new ToolItem(toolbar, SWT.PUSH); - unfreezeToolItem.setEnabled(false); - unfreezeToolItem.setImage(ResourceUtil - .getImage(ResourceUtil.RELEASE_SCROLL_LOCK_IMG_KEY)); - unfreezeToolItem.setToolTipText("release scroll lock"); + LayoutDataHelper.make(toolbar).right(-5).bottom(-5).set(); - formData = new FormData(); - formData.top = new FormAttachment(0, 5); - formData.left = new FormAttachment(0, 5); - formData.right = new FormAttachment(100, -5); - formData.bottom = new FormAttachment(toolbar, -5); + this.unfreezeToolItem = new ToolItem(toolbar, SWT.PUSH); + this.unfreezeToolItem.setEnabled(false); + this.unfreezeToolItem.setImage(ResourceUtil + .getImage(ResourceUtil.RELEASE_SCROLL_LOCK_IMG_KEY)); + this.unfreezeToolItem.setToolTipText("release scroll lock"); - grid.setLayoutData(formData); + LayoutDataHelper.make(grid).top(5).left(5).right(-5).above(toolbar, -1) + .set(); grid.setHeaderVisible(true); grid.setLinesVisible(false); grid.setAutoHeight(true); grid.addControlListener(new TableControlListener(charWidth)); - + initConverterFacade(); - + int bufSize = getPreferredBufferSize(); - classicTISBuffer = new ClassicTISBuffer(converterFacade, grid, bufSize); + classicTISBuffer = new ClassicTISBuffer(this, bufSize); createColumns(); - classicTISBuffer.diffCue = diffCueLabel; grid.pack(); - + preferencesChangeListenter = new BeaglePreferencesChangeListenter(this); // when the table is cleared classicTISBuffer's handleEvent method will @@ -121,20 +116,20 @@ private void init() { grid.addDisposeListener(classicTISBuffer); UnfreezeToolItemListener unfreezeButtonListener = new UnfreezeToolItemListener( - classicTISBuffer); + this); unfreezeToolItem.addSelectionListener(unfreezeButtonListener); TableItemSelectionListener tableItemSelectionListener = new TableItemSelectionListener( - grid, classicTISBuffer, unfreezeToolItem, unfreezeButtonListener); + this, unfreezeToolItem); grid.addSelectionListener(tableItemSelectionListener); TableSelectionViaMouseMovements myMouseListener = new TableSelectionViaMouseMovements( - classicTISBuffer); + this); grid.addMouseMoveListener(myMouseListener); grid.addMouseListener(myMouseListener); grid.addMouseTrackListener(myMouseListener); - grid.addMouseMoveListener(new TimeDifferenceMouseListener(classicTISBuffer)); + grid.addMouseMoveListener(new TimeDifferenceMouseListener(this)); Menu menu = MenuBuilder.buildMenu(classicTISBuffer); MenuBuilder.addOnMenuSelectionAction(menu, classicTISBuffer); @@ -142,19 +137,22 @@ private void init() { grid.setItemCount(0); } + public Grid getGrid() { + return grid; + } + public void setBufferSize(int size) { classicTISBuffer.setBufferSize(size); } - void disposeOfExistingColumns() { - for(GridColumn column: grid.getColumns()) { + for (GridColumn column : grid.getColumns()) { column.dispose(); } } - + public void patternChange(String newPattern) { - if(newPattern != null) { + if (newPattern != null) { converterFacade.setPattern(newPattern); converterFacade.start(); grid.removeAll(); @@ -163,7 +161,7 @@ public void patternChange(String newPattern) { classicTISBuffer.rebuildEmptyGrid(); } } - + int getPreferredBufferSize() { int result = BeaglePreferencesPage.BUFFER_SIZE_PREFERENCE_DEFAULT_VALUE; if (Activator.INSTANCE != null) { @@ -204,7 +202,6 @@ public void createColumns() { } } - private void initConverterFacade() { converterFacade.setContext(loggerContext); String pattern = BeaglePreferencesPage.PATTERN_PREFERENCE_DEFAULT_VALUE; @@ -216,5 +213,16 @@ private void initConverterFacade() { converterFacade.start(); } + public void setTimeDifferenceLabelText(String str) { + timeDifferenceLabel.setText(str); + } + + public void setTotalEventsLabelText(String str) { + totalEventsLabel.setText(str); + } + + public ConverterFacade getConverterFacade() { + return converterFacade; + } } diff --git a/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/listener/TableItemSelectionListener.java b/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/listener/TableItemSelectionListener.java index fbabbf1..583eb59 100644 --- a/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/listener/TableItemSelectionListener.java +++ b/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/listener/TableItemSelectionListener.java @@ -8,27 +8,24 @@ */ package ch.qos.logback.beagle.view.listener; -import org.eclipse.nebula.widgets.grid.Grid; import org.eclipse.nebula.widgets.grid.GridItem; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.widgets.ToolItem; +import ch.qos.logback.beagle.view.TableMediator; import ch.qos.logback.beagle.visual.ClassicTISBuffer; public class TableItemSelectionListener implements SelectionListener { - Grid grid; ClassicTISBuffer classicTISBuffer; GridItem lastSelection; ToolItem unfreezeButton; - + final TableMediator tableMediator; - public TableItemSelectionListener(Grid table, - ClassicTISBuffer visualElementBuffer, ToolItem unfreezeButton, - UnfreezeToolItemListener unfreezeButtonListener) { - this.grid = table; - this.classicTISBuffer = visualElementBuffer; + public TableItemSelectionListener(TableMediator tableMediator, + ToolItem unfreezeButton) { + this.tableMediator = tableMediator; this.unfreezeButton = unfreezeButton; } @@ -39,14 +36,14 @@ public void widgetDefaultSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { - GridItem currentlySelectedTI = (GridItem) e.item; - if(currentlySelectedTI == null) + GridItem currentlySelectedGridItem = (GridItem) e.item; + if(currentlySelectedGridItem == null) return; - classicTISBuffer.setScrollingEnabled(false); + tableMediator.classicTISBuffer.setScrollingEnabled(false); unfreezeButton.setEnabled(true); - lastSelection = currentlySelectedTI; - classicTISBuffer.clearCues(); + lastSelection = currentlySelectedGridItem; + tableMediator.setTimeDifferenceLabelText(""); } } diff --git a/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/listener/TableSelectionViaMouseMovements.java b/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/listener/TableSelectionViaMouseMovements.java index af13edd..35df5e0 100644 --- a/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/listener/TableSelectionViaMouseMovements.java +++ b/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/listener/TableSelectionViaMouseMovements.java @@ -18,20 +18,20 @@ import ch.qos.logback.beagle.util.MouseEventUtil; import ch.qos.logback.beagle.util.SelectionUtil; import ch.qos.logback.beagle.view.SelectionScroller; -import ch.qos.logback.beagle.visual.ClassicTISBuffer; +import ch.qos.logback.beagle.view.TableMediator; public class TableSelectionViaMouseMovements implements MouseListener, MouseMoveListener, MouseTrackListener { + TableMediator tableMediator; final Grid table; - final ClassicTISBuffer classicTISBuffer; int anchorIndex = Constants.NA; int lastIndex = Constants.NA; SelectionScroller scroller; - public TableSelectionViaMouseMovements(ClassicTISBuffer classicTISBuffer) { - this.classicTISBuffer = classicTISBuffer; - this.table = classicTISBuffer.grid; + public TableSelectionViaMouseMovements(TableMediator tableMediator) { + this.tableMediator = tableMediator; + this.table = tableMediator.getGrid(); } @Override @@ -42,8 +42,7 @@ public void mouseDoubleClick(MouseEvent e) { int[] currentSelectionIndices = table.getSelectionIndices(); if(currentSelectionIndices.length == 1) { if(currentSelectionIndices[0] == clickedIndex) { - System.out.println("********* unlocked scroll"); - classicTISBuffer.setScrollingEnabled(true); + tableMediator.classicTISBuffer.setScrollingEnabled(true); // TODO disable the scroll toolitem } } @@ -56,11 +55,9 @@ public void mouseDown(MouseEvent e) { return; } anchorIndex = result; - //System.out.println("mouseDown anchorIndex " + anchorIndex); } void disableScroller() { - //System.out.println("disabling scroller"); table.setCapture(false); table.getDisplay().timerExec(-1, scroller); scroller = null; @@ -98,7 +95,7 @@ public void mouseMove(MouseEvent e) { } if (table.getSelectionCount() > 1) { - classicTISBuffer.clearCues(); + tableMediator.setTimeDifferenceLabelText(""); } lastIndex = currentIndex; @@ -113,14 +110,11 @@ void doSelect(int x, int y) { @Override public void mouseExit(MouseEvent e) { - //MouseEventUtil.dump("************** mouseExit event ***********", e); - if (MouseEventUtil.isButtonHeldDown(e)) { if (scroller != null) { - //System.out.println("xxxxxxxxxxx already in capture mode"); return; } - //System.out.println("********* entering capture mode"); + // entering capture mode SelectionScroller.Direction direction = e.y < 0 ? SelectionScroller.Direction.UP : SelectionScroller.Direction.DOWN; table.setCapture(true); diff --git a/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/listener/TimeDifferenceMouseListener.java b/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/listener/TimeDifferenceMouseListener.java index bba4ed6..119e852 100644 --- a/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/listener/TimeDifferenceMouseListener.java +++ b/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/listener/TimeDifferenceMouseListener.java @@ -11,62 +11,63 @@ import org.eclipse.nebula.widgets.grid.Grid; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.MouseMoveListener; -import org.eclipse.swt.widgets.Label; import ch.qos.logback.beagle.Constants; import ch.qos.logback.beagle.util.MouseEventUtil; -import ch.qos.logback.beagle.visual.ClassicTISBuffer; +import ch.qos.logback.beagle.view.TableMediator; import ch.qos.logback.beagle.visual.ITableItemStub; import ch.qos.logback.beagle.visual.LoggingEventTIS; public class TimeDifferenceMouseListener implements MouseMoveListener { - final Grid table; - final ClassicTISBuffer visualElementBuffer; - final Label diffCue; - - public TimeDifferenceMouseListener(ClassicTISBuffer visualElementBuffer) { - this.visualElementBuffer = visualElementBuffer; - this.table = visualElementBuffer.grid; - this.diffCue = visualElementBuffer.diffCue; + TableMediator tableMediator; + Grid grid; + + public TimeDifferenceMouseListener(TableMediator tableMediator) { + this.tableMediator = tableMediator; + this.grid = tableMediator.getGrid(); } - private void updateLabel(int selIndex, int otherIndex) { - ITableItemStub selVE = visualElementBuffer.get(selIndex); - ITableItemStub otherVE = visualElementBuffer.get(otherIndex); - if (!(selVE instanceof LoggingEventTIS)) { - return; - } - if (!(otherVE instanceof LoggingEventTIS)) { - return; - } - LoggingEventTIS selLE = (LoggingEventTIS) selVE; - LoggingEventTIS otherLE = (LoggingEventTIS) otherVE; - - long diff = otherLE.getILoggingEvent().getTimeStamp() - - selLE.getILoggingEvent().getTimeStamp(); - diffCue.setText(diff + " ms"); - } @Override public void mouseMove(MouseEvent e) { + // it does not make sense to measure time differemce of the mouse botton + // is held down if (MouseEventUtil.isButtonHeldDown(e)) { return; } - int selectionCount = table.getSelectionCount(); + // we can't measure the time difference for multiple selections + int selectionCount = grid.getSelectionCount(); if (selectionCount != 1) { return; } - int otherIndex = MouseEventUtil.computeIndex(table, e); + int otherIndex = MouseEventUtil.computeIndex(tableMediator.getGrid(), e); if (otherIndex == Constants.NA) { return; } - int selectionIndex = table.getSelectionIndex(); - updateLabel(selectionIndex, otherIndex); + int selectionIndex = grid.getSelectionIndex(); + updateTimeDifferenceLabel(selectionIndex, otherIndex); } + private void updateTimeDifferenceLabel(int selectedIndex, int mouseOverIndex) { + ITableItemStub selectedTIS = tableMediator.classicTISBuffer.get(selectedIndex); + ITableItemStub mouseOverTIS = tableMediator.classicTISBuffer.get(mouseOverIndex); + if (!(selectedTIS instanceof LoggingEventTIS)) { + return; + } + if (!(mouseOverTIS instanceof LoggingEventTIS)) { + return; + } + LoggingEventTIS selectedLETIS = (LoggingEventTIS) selectedTIS; + LoggingEventTIS mouseOverLETIS = (LoggingEventTIS) mouseOverTIS; + + long diff = mouseOverLETIS.getILoggingEvent().getTimeStamp() + - selectedLETIS.getILoggingEvent().getTimeStamp(); + + tableMediator.setTimeDifferenceLabelText(diff + " ms"); + } } diff --git a/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/listener/UnfreezeToolItemListener.java b/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/listener/UnfreezeToolItemListener.java index 3d0c082..e85e166 100644 --- a/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/listener/UnfreezeToolItemListener.java +++ b/ch.qos.logback.beagle/src/ch/qos/logback/beagle/view/listener/UnfreezeToolItemListener.java @@ -12,23 +12,23 @@ import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.widgets.ToolItem; -import ch.qos.logback.beagle.visual.ClassicTISBuffer; +import ch.qos.logback.beagle.view.TableMediator; public class UnfreezeToolItemListener implements SelectionListener { - final ClassicTISBuffer classicTISBuffer; - - public UnfreezeToolItemListener(ClassicTISBuffer classicTISBuffer) { - this.classicTISBuffer = classicTISBuffer; + final TableMediator tableMediator; + + public UnfreezeToolItemListener(TableMediator tableMediator) { + this.tableMediator = tableMediator; } @Override public void widgetSelected(SelectionEvent event) { ToolItem toolItem = (ToolItem) event.widget; toolItem.setEnabled(false); - classicTISBuffer.grid.deselectAll(); - classicTISBuffer.setScrollingEnabled(true); - classicTISBuffer.clearCues(); + tableMediator.getGrid().deselectAll(); + tableMediator.classicTISBuffer.setScrollingEnabled(true); + tableMediator.setTimeDifferenceLabelText(""); } @Override diff --git a/ch.qos.logback.beagle/src/ch/qos/logback/beagle/visual/ClassicTISBuffer.java b/ch.qos.logback.beagle/src/ch/qos/logback/beagle/visual/ClassicTISBuffer.java index 06db57a..1e7fe0a 100644 --- a/ch.qos.logback.beagle/src/ch/qos/logback/beagle/visual/ClassicTISBuffer.java +++ b/ch.qos.logback.beagle/src/ch/qos/logback/beagle/visual/ClassicTISBuffer.java @@ -20,11 +20,11 @@ import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import ch.qos.logback.beagle.util.ResourceUtil; import ch.qos.logback.beagle.view.ConverterFacade; +import ch.qos.logback.beagle.view.TableMediator; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.IThrowableProxy; @@ -36,25 +36,24 @@ public class ClassicTISBuffer implements ITableItemStubBuffer, List tisList = Collections .synchronizedList(new ArrayList()); - int count = 0; + private int lineCount = 0; - public final Grid grid; + private TableMediator tableMediator; + private final Grid grid; private final ConverterFacade converterFacade; - final Display display; - - boolean scrollingEnabled = true; - volatile boolean disposed = false; - - public Label diffCue; + private final Display display; + private boolean scrollingEnabled = true; + private volatile boolean disposed = false; private int bufferSize; private int dropSize; - public ClassicTISBuffer(ConverterFacade head, Grid grid, int bufferSize) { - this.grid = grid; + public ClassicTISBuffer(TableMediator tableMediator, int bufferSize) { + this.tableMediator = tableMediator; + this.grid = tableMediator.getGrid(); this.display = grid.getDisplay(); - this.converterFacade = head; + this.converterFacade = tableMediator.getConverterFacade(); this.bufferSize = bufferSize; this.dropSize = computeDropSize(bufferSize); } @@ -104,9 +103,9 @@ public void handleEvent(Event event) { */ private void loggingEventToVisualElement(List tisList, ILoggingEvent event) { - count++; + lineCount++; Color c = null; - if (count % 2 == 0) { + if (lineCount % 2 == 0) { c = ResourceUtil.GRAY; } tisList.add(new LoggingEventTIS(converterFacade, event, c)); @@ -188,16 +187,16 @@ public void add(final List loggingEventList) { for (ILoggingEvent iLoggingEvent : loggingEventList) { loggingEventToVisualElement(visualElementList, iLoggingEvent); } - addVisualElements(visualElementList); + addGridItemStubs(visualElementList); } public void add(final ILoggingEvent iLoggingEvent) { List visualElementList = new ArrayList(); loggingEventToVisualElement(visualElementList, iLoggingEvent); - addVisualElements(visualElementList); + addGridItemStubs(visualElementList); } - private void addVisualElements(final List newTISList) { + private void addGridItemStubs(final List newTISList) { if (disposed) return; @@ -223,10 +222,6 @@ public int size() { return tisList.size(); } - public void clearCues() { - diffCue.setText(""); - } - public ITableItemStub get(int index) { if (index >= tisList.size()) { return null; @@ -252,6 +247,7 @@ public void setScrollingEnabled(boolean scrollingEnabled) { this.scrollingEnabled = scrollingEnabled; } + // called by display.syncExec!! private void addNewItemStubsToGrid(List aTISList) { if (disposed || aTISList.size() == 0) { return; @@ -265,6 +261,9 @@ private void addNewItemStubsToGrid(List aTISList) { tis.populate(lastGridItem); } + tableMediator.setTotalEventsLabelText(tisList.size() +" events"); + + if (isScrollingEnabled()) { grid.showItem(lastGridItem); }