"icons/elcl16/search_match.gif"); //$NON-NLS-1$
private static final Image SEARCH_MATCH_BOOKMARK_IMAGE = Activator.getDefault().getImageFromPath(
"icons/elcl16/search_match_bookmark.gif"); //$NON-NLS-1$
- private static final Image FILTER_IMAGE = Activator.getDefault()
- .getImageFromPath("icons/elcl16/filter_items.gif"); //$NON-NLS-1$
+ private static final Image FILTER_IMAGE = Activator.getDefault().getImageFromPath("icons/elcl16/filter_items.gif"); //$NON-NLS-1$
private static final Image STOP_IMAGE = Activator.getDefault().getImageFromPath("icons/elcl16/stop.gif"); //$NON-NLS-1$
private static final String SEARCH_HINT = Messages.TmfEventsTable_SearchHint;
private static final String FILTER_HINT = Messages.TmfEventsTable_FilterHint;
/** Event aspect represented by this column */
String ASPECT = "$aspect"; //$NON-NLS-1$
- /** Table item list of style ranges
- * @since 1.0*/
+ /**
+ * Table item list of style ranges
+ *
+ * @since 1.0
+ */
String STYLE_RANGES = "$style_ranges"; //$NON-NLS-1$
}
private final Object fSearchSyncObj = new Object();
/**
- * List of selection change listeners (element type: <code>ISelectionChangedListener</code>).
+ * List of selection change listeners (element type:
+ * <code>ISelectionChangedListener</code>).
*
* @see #fireSelectionChanged
*/
final org.eclipse.tracecompass.tmf.ui.widgets.virtualtable.ColumnData[] columnData) {
/*
* We'll do a "best-effort" to keep trace types still using this API to
- * keep working, by defining a TmfEventTableColumn for each
- * ColumnData they passed.
+ * keep working, by defining a TmfEventTableColumn for each ColumnData
+ * they passed.
*/
this(parent, cacheSize, convertFromColumnData(columnData));
}
}
column.addControlListener(new ControlAdapter() {
/*
- * Make sure that the margin column is always first
- * and keep the column order variable up to date.
+ * Make sure that the margin column is always first and keep the
+ * column order variable up to date.
*/
@Override
public void controlMoved(ControlEvent e) {
setFilterStatusRowItemData(item);
return;
}
- index = index - 1; // -1 for top filter status row
+ /* -1 for top filter status row */
+ index = index - 1;
}
final CachedEvent cachedEvent = fCache.getEvent(index);
}
});
- final Listener tooltipListener = new Listener () {
+ final Listener tooltipListener = new Listener() {
Shell tooltipShell = null;
+
@Override
public void handleEvent(final Event event) {
switch (event.type) {
- case SWT.MouseHover:
- final TableItem item = fTable.getItem(new Point(event.x, event.y));
- if (item == null) {
- return;
- }
- final Long rank = (Long) item.getData(Key.RANK);
- if (rank == null) {
- return;
- }
- final String tooltipText = (String) item.getData(Key.BOOKMARK);
- final Rectangle bounds = item.getImageBounds(0);
- bounds.width = BOOKMARK_IMAGE.getBounds().width;
- if (!bounds.contains(event.x,event.y)) {
- return;
- }
- if ((tooltipShell != null) && !tooltipShell.isDisposed()) {
- tooltipShell.dispose();
- }
- tooltipShell = new Shell(fTable.getShell(), SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
- tooltipShell.setBackground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- final FillLayout layout = new FillLayout();
- layout.marginWidth = 2;
- tooltipShell.setLayout(layout);
- final Label label = new Label(tooltipShell, SWT.WRAP);
- String text = rank.toString() + (tooltipText != null ? ": " + tooltipText : EMPTY_STRING); //$NON-NLS-1$
- label.setForeground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- label.setBackground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- label.setText(text);
- label.addListener(SWT.MouseExit, this);
- label.addListener(SWT.MouseDown, this);
- label.addListener(SWT.MouseWheel, this);
- final Point size = tooltipShell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- /*
- * Bug in Linux. The coordinates of the event have an origin that excludes the table header but
- * the method toDisplay() expects coordinates relative to an origin that includes the table header.
- */
- int y = event.y;
- if (IS_LINUX) {
- y += fTable.getHeaderHeight();
- }
- Point pt = fTable.toDisplay(event.x, y);
- pt.x += BOOKMARK_IMAGE.getBounds().width;
- pt.y += item.getBounds().height;
- tooltipShell.setBounds(pt.x, pt.y, size.x, size.y);
- tooltipShell.setVisible(true);
- break;
- case SWT.Dispose:
- case SWT.KeyDown:
- case SWT.MouseMove:
- case SWT.MouseExit:
- case SWT.MouseDown:
- case SWT.MouseWheel:
- if (tooltipShell != null) {
- tooltipShell.dispose();
- tooltipShell = null;
- }
- break;
- default:
- break;
+ case SWT.MouseHover:
+ final TableItem item = fTable.getItem(new Point(event.x, event.y));
+ if (item == null) {
+ return;
+ }
+ final Long rank = (Long) item.getData(Key.RANK);
+ if (rank == null) {
+ return;
+ }
+ final String tooltipText = (String) item.getData(Key.BOOKMARK);
+ final Rectangle bounds = item.getImageBounds(0);
+ bounds.width = BOOKMARK_IMAGE.getBounds().width;
+ if (!bounds.contains(event.x, event.y)) {
+ return;
+ }
+ if ((tooltipShell != null) && !tooltipShell.isDisposed()) {
+ tooltipShell.dispose();
+ }
+ tooltipShell = new Shell(fTable.getShell(), SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
+ tooltipShell.setBackground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ final FillLayout layout = new FillLayout();
+ layout.marginWidth = 2;
+ tooltipShell.setLayout(layout);
+ final Label label = new Label(tooltipShell, SWT.WRAP);
+ String text = rank.toString() + (tooltipText != null ? ": " + tooltipText : EMPTY_STRING); //$NON-NLS-1$
+ label.setForeground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
+ label.setBackground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ label.setText(text);
+ label.addListener(SWT.MouseExit, this);
+ label.addListener(SWT.MouseDown, this);
+ label.addListener(SWT.MouseWheel, this);
+ final Point size = tooltipShell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ /*
+ * Bug in Linux. The coordinates of the event have an origin
+ * that excludes the table header but the method toDisplay()
+ * expects coordinates relative to an origin that includes
+ * the table header.
+ */
+ int y = event.y;
+ if (IS_LINUX) {
+ y += fTable.getHeaderHeight();
+ }
+ Point pt = fTable.toDisplay(event.x, y);
+ pt.x += BOOKMARK_IMAGE.getBounds().width;
+ pt.y += item.getBounds().height;
+ tooltipShell.setBounds(pt.x, pt.y, size.x, size.y);
+ tooltipShell.setVisible(true);
+ break;
+ case SWT.Dispose:
+ case SWT.KeyDown:
+ case SWT.MouseMove:
+ case SWT.MouseExit:
+ case SWT.MouseDown:
+ case SWT.MouseWheel:
+ if (tooltipShell != null) {
+ tooltipShell.dispose();
+ tooltipShell = null;
+ }
+ break;
+ default:
+ break;
}
}
};
}
/*
- * We will paint the table item's foreground. In Windows, if you paint
- * the background but let the widget draw the foreground, it will
- * override your background, unless the item is selected or hot.
+ * We will paint the table item's foreground. In Windows, if you
+ * paint the background but let the widget draw the foreground,
+ * it will override your background, unless the item is selected
+ * or hot.
*/
event.detail &= ~SWT.FOREGROUND;
final long rank = (Long) e.data;
int index = (int) rank;
if (fTable.getData(Key.FILTER_OBJ) != null) {
- index = fCache.getFilteredEventIndex(rank) + 1; // +1 for top filter status row
+ // +1 for top filter status row
+ index = fCache.getFilteredEventIndex(rank) + 1;
}
- fTable.setSelection(index + 1); // +1 for header row
+ // +1 for header row
+ fTable.setSelection(index + 1);
fSelectedRank = rank;
updateStatusLine(null);
} else if (e.data instanceof ITmfLocation) {
- // DOES NOT WORK: rank undefined in context from seekLocation()
- // ITmfLocation<?> location = (ITmfLocation<?>) e.data;
- // TmfContext context = fTrace.seekLocation(location);
- // fTable.setSelection((int) context.getRank());
+ /**
+ * DOES NOT WORK: rank undefined in context from
+ * seekLocation() <code>
+ * ITmfLocation<?> location = (ITmfLocation<?>) e.data;
+ * TmfContext context = fTrace.seekLocation(location);
+ * fTable.setSelection((int) context.getRank());
+ * </code>
+ */
return;
} else {
return;
marker.setAttribute(IMarker.LINE_NUMBER, Long.valueOf(cs.getLineNumber()).intValue());
IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), marker);
marker.delete();
- } else if (files.size() == 0){
+ } else if (files.size() == 0) {
displayException(new FileNotFoundException('\'' + cs.toString() + '\'' + '\n' + Messages.TmfEventsTable_OpenSourceCodeNotFound));
}
} catch (CoreException e) {
IDE.openEditor(activePage, marker, OpenStrategy.activateOnOpen());
marker.delete();
- }
- catch (CoreException e) {
+ } catch (CoreException e) {
displayException(e);
}
} else {
}
}
- // only show collapse filter if at least one trace can be collapsed
+ /*
+ * Only show collapse filter if at least one trace can be
+ * collapsed.
+ */
boolean isCollapsible = false;
if (fTrace != null) {
for (ITmfTrace trace : TmfTraceManager.getTraceSet(fTrace)) {
- Class <? extends ITmfEvent> eventClass = trace.getEventType();
+ Class<? extends ITmfEvent> eventClass = trace.getEventType();
isCollapsible = ITmfCollapsibleEvent.class.isAssignableFrom(eventClass);
if (isCollapsible) {
break;
fRawViewer.setMenu(menu);
}
-
/**
* Append an item to the event table's pop-up menu.
*
* shouldn't be called anymore.
*/
@Deprecated
- protected void setColumnHeaders(final org.eclipse.tracecompass.tmf.ui.widgets.virtualtable.ColumnData [] columnData) {
+ protected void setColumnHeaders(final org.eclipse.tracecompass.tmf.ui.widgets.virtualtable.ColumnData[] columnData) {
/* No-op */
}
txtKey = Key.FILTER_TXT;
}
- // The control that will be the editor must be a child of the Table
+ /*
+ * The control that will be the editor must be a child of
+ * the Table
+ */
final Text newEditor = (Text) fTable.createTableEditorControl(Text.class);
final String headerString = (String) column.getData(txtKey);
if (headerString != null) {
updateHeader(newEditor.getText());
applyHeader();
- // Set focus on the table so that the next carriage return goes to the next result
+ /*
+ * Set focus on the table so that the next
+ * carriage return goes to the next result
+ */
TmfEventsTable.this.getTable().setFocus();
} else if (e.character == SWT.ESC) {
tableEditor.getEditor().dispose();
fCache.applyFilter(filter);
fTable.clearAll();
fTable.setData(Key.FILTER_OBJ, filter);
- fTable.setItemCount(3); // +1 for header row, +2 for top and bottom filter status rows
+ /* +1 for header row, +2 for top and bottom filter status rows */
+ fTable.setItemCount(3);
startFilterThread();
fireFilterApplied(filter);
}
}
fTable.setData(Key.FILTER_OBJ, null);
if (fTrace != null) {
- fTable.setItemCount((int) fTrace.getNbEvents() + 1); // +1 for header row
+ /* +1 for header row */
+ fTable.setItemCount((int) fTrace.getNbEvents() + 1);
} else {
- fTable.setItemCount(1); // +1 for header row
+ /* +1 for header row */
+ fTable.setItemCount(1);
}
fFilterMatchCount = 0;
fFilterCheckCount = 0;
if (fSelectedRank >= 0) {
- fTable.setSelection((int) fSelectedRank + 1); // +1 for header row
+ /* +1 for header row */
+ fTable.setSelection((int) fSelectedRank + 1);
} else {
fTable.setSelection(0);
}
if (fTable.isDisposed()) {
return;
}
- fTable.setItemCount((int) fFilterMatchCount + 3); // +1 for header row, +2 for top and bottom filter status rows
+ /*
+ * +1 for header row, +2 for top and bottom filter status
+ * rows
+ */
+ fTable.setItemCount((int) fFilterMatchCount + 3);
fTable.refresh();
synchronized (syncObj) {
refreshBusy = false;
final int selectionIndex = fTable.getSelectionIndex();
int startIndex;
if (selectionIndex > 0) {
- startIndex = selectionIndex; // -1 for header row, +1 for next event
+ /* -1 for header row, +1 for next event */
+ startIndex = selectionIndex;
} else {
- // header row is selected, start at top event
- startIndex = Math.max(0, fTable.getTopIndex() - 1); // -1 for header row
+ /*
+ * header row is selected, start at top event
+ */
+ /* -1 for header row */
+ startIndex = Math.max(0, fTable.getTopIndex() - 1);
}
final ITmfFilterTreeNode eventFilter = (ITmfFilterTreeNode) fTable.getData(Key.FILTER_OBJ);
if (eventFilter != null) {
- startIndex = Math.max(0, startIndex - 1); // -1 for top filter status row
+ // -1 for top filter status row
+ startIndex = Math.max(0, startIndex - 1);
}
fSearchThread = new SearchThread(searchFilter, eventFilter, startIndex, fSelectedRank, Direction.FORWARD);
fSearchThread.schedule();
final int selectionIndex = fTable.getSelectionIndex();
int startIndex;
if (selectionIndex > 0) {
- startIndex = selectionIndex - 2; // -1 for header row, -1 for previous event
+ /* -1 for header row, -1 for previous event */
+ startIndex = selectionIndex - 2;
} else {
- // header row is selected, start at precedent of top event
- startIndex = fTable.getTopIndex() - 2; // -1 for header row, -1 for previous event
+ /*
+ * Header row is selected, start at precedent of top event
+ */
+ /* -1 for header row, -1 for previous event */
+ startIndex = fTable.getTopIndex() - 2;
}
final ITmfFilterTreeNode eventFilter = (ITmfFilterTreeNode) fTable.getData(Key.FILTER_OBJ);
if (eventFilter != null) {
- startIndex = startIndex - 1; // -1 for top filter status row
+ /* -1 for top filter status row */
+ startIndex = startIndex - 1;
}
fSearchThread = new SearchThread(searchFilter, eventFilter, startIndex, fSelectedRank, Direction.BACKWARD);
fSearchThread.schedule();
final Display display = Display.getDefault();
if (startIndex < 0) {
rank = (int) fTrace.getNbEvents() - 1;
- } else if (startIndex >= (fTable.getItemCount() - (eventFilter == null ? 1 : 3))) { // -1 for header row, -2 for top and bottom filter status rows
+ /*
+ * -1 for header row, -3 for header and top and bottom filter
+ * status rows
+ */
+ } else if (startIndex >= (fTable.getItemCount() - (eventFilter == null ? 1 : 3))) {
rank = 0;
} else {
int idx = startIndex;
if (eventFilter != null) {
index = fCache.getFilteredEventIndex(foundRank);
}
- final int selection = index + 1 + (eventFilter != null ? +1 : 0); // +1 for header row, +1 for top filter status row
+ /* +1 for header row, +1 for top filter status row */
+ final int selection = index + 1 + (eventFilter != null ? +1 : 0);
display.asyncExec(new Runnable() {
@Override
* Create the resources.
*/
private void createResources() {
- fGrayColor = fResourceManager.createColor(ColorUtil.blend(fTable.getBackground().getRGB(), fTable
- .getForeground().getRGB()));
+ fGrayColor = fResourceManager.createColor(ColorUtil.blend(fTable.getBackground().getRGB(), fTable.getForeground().getRGB()));
fGreenColor = fTable.getDisplay().getSystemColor(SWT.COLOR_DARK_GREEN);
}
fPackDone = true;
}
-
private void packMarginColumn() {
TableColumn[] columns = fTable.getColumns();
if (columns.length > 0) {
private void packSingleColumn(int i, final TableColumn column) {
final int headerWidth = column.getWidth();
column.pack();
- // Workaround for Linux which doesn't consider the image width of
- // search/filter row in TableColumn.pack() after having executed
- // TableItem.setImage((Image)null) for other rows than search/filter row.
+ /*
+ * Workaround for Linux which doesn't consider the image width of
+ * search/filter row in TableColumn.pack() after having executed
+ * TableItem.setImage(null) for other rows than search/filter row.
+ */
boolean isCollapseFilter = fTable.getData(Key.FILTER_OBJ) instanceof TmfCollapseFilter;
if (IS_LINUX && (i == 0) && isCollapseFilter) {
column.setWidth(column.getWidth() + SEARCH_IMAGE.getBounds().width);
for (TmfEventTableColumn column : columns) {
ITmfEvent passedEvent = event;
if (!(column instanceof TmfMarginColumn) && (event instanceof CachedEvent)) {
- // Make sure that the event object from the trace is passed
- // to all columns but the TmfMarginColumn
+ /*
+ * Make sure that the event object from the trace is passed
+ * to all columns but the TmfMarginColumn
+ */
passedEvent = ((CachedEvent) event).event;
}
if (passedEvent == null) {
}
/**
- * Returns an array of zero-relative integers that map
- * the creation order of the receiver's columns to the
- * order in which they are currently being displayed.
+ * Returns an array of zero-relative integers that map the creation order of
+ * the receiver's columns to the order in which they are currently being
+ * displayed.
* <p>
- * Specifically, the indices of the returned array represent
- * the current visual order of the columns, and the contents
- * of the array represent the creation order of the columns.
+ * Specifically, the indices of the returned array represent the current
+ * visual order of the columns, and the contents of the array represent the
+ * creation order of the columns.
*
* @return the current visual order of the receiver's columns
* @since 1.0
}
/**
- * Sets the order that the columns in the receiver should
- * be displayed in to the given argument which is described
- * in terms of the zero-relative ordering of when the columns
- * were added.
+ * Sets the order that the columns in the receiver should be displayed in to
+ * the given argument which is described in terms of the zero-relative
+ * ordering of when the columns were added.
* <p>
- * Specifically, the contents of the array represent the
- * original position of each column at the time its creation.
+ * Specifically, the contents of the array represent the original position
+ * of each column at the time its creation.
*
- * @param order the new order to display the columns
+ * @param order
+ * the new order to display the columns
* @since 1.0
*/
public void setColumnOrder(int[] order) {
if (fTrace != null) {
if (!fTable.isDisposed() && (fTrace != null)) {
if (fTable.getData(Key.FILTER_OBJ) == null) {
- fTable.setItemCount((int) fTrace.getNbEvents() + 1); // +1 for header row
+ // +1 for header row
+ fTable.setItemCount((int) fTrace.getNbEvents() + 1);
} else {
stopFilterThread();
fFilterMatchCount = 0;
fFilterCheckCount = 0;
- fTable.setItemCount(3); // +1 for header row, +2 for top and bottom filter status rows
+ /*
+ * +1 for header row, +2 for top and bottom filter
+ * status rows
+ */
+ fTable.setItemCount(3);
startFilterThread();
}
}
* Assign the status line manager
*
* @param statusLineManager
- * The status line manager, or null to disable status line messages
+ * The status line manager, or null to disable status line
+ * messages
*/
public void setStatusLineManager(IStatusLineManager statusLineManager) {
if (fStatusLineManager != null && statusLineManager == null) {
}
/**
- * Notifies any selection changed listeners that the viewer's selection has changed.
- * Only listeners registered at the time this method is called are notified.
+ * Notifies any selection changed listeners that the viewer's selection has
+ * changed. Only listeners registered at the time this method is called are
+ * notified.
*
- * @param event a selection changed event
+ * @param event
+ * a selection changed event
*
* @see ISelectionChangedListener#selectionChanged
*/
if (rank != -1) {
int index = rank;
if (fTable.getData(Key.FILTER_OBJ) != null) {
- index = fCache.getFilteredEventIndex(rank) + 1; // +1 for top filter status row
+ // +1 for top filter status row
+ index = fCache.getFilteredEventIndex(rank) + 1;
} else if (rank >= fTable.getItemCount()) {
fPendingGotoRank = rank;
}
public void run() {
if (!fTable.isDisposed() && (fTrace != null)) {
if (fTable.getData(Key.FILTER_OBJ) == null) {
- fTable.setItemCount((int) fTrace.getNbEvents() + 1); // +1 for header row
- if ((fPendingGotoRank != -1) && ((fPendingGotoRank + 1) < fTable.getItemCount())) { // +1 for header row
- fTable.setSelection((int) fPendingGotoRank + 1); // +1 for header row
+ /* +1 for header row */
+ fTable.setItemCount((int) fTrace.getNbEvents() + 1);
+ /* +1 for header row */
+ if ((fPendingGotoRank != -1) && ((fPendingGotoRank + 1) < fTable.getItemCount())) {
+ /* +1 for header row */
+ fTable.setSelection((int) fPendingGotoRank + 1);
fPendingGotoRank = -1;
updateStatusLine(null);
}
public void selectionRangeUpdated(final TmfSelectionRangeUpdatedSignal signal) {
if ((signal.getSource() != this) && (fTrace != null) && (!fTable.isDisposed())) {
- // Create a request for one event that will be queued after other ongoing requests. When this request is completed
- // do the work to select the actual event with the timestamp specified in the signal. This procedure prevents
- // the method fTrace.getRank() from interfering and delaying ongoing requests.
+ /*
+ * Create a request for one event that will be queued after other
+ * ongoing requests. When this request is completed do the work to
+ * select the actual event with the timestamp specified in the
+ * signal. This procedure prevents the method fTrace.getRank() from
+ * interfering and delaying ongoing requests.
+ */
final TmfEventRequest subRequest = new TmfEventRequest(ITmfEvent.class,
TmfTimeRange.ETERNITY, 0, 1, ExecutionType.FOREGROUND) {
return;
}
- // Verify if the event is within the trace range and adjust if necessary
+ /*
+ * Verify if the event is within the trace range and adjust
+ * if necessary
+ */
ITmfTimestamp timestamp = ts;
if (timestamp.compareTo(fTrace.getStartTime()) == -1) {
timestamp = fTrace.getStartTime();
return;
}
if (fTable.getData(Key.FILTER_OBJ) != null) {
- index = fCache.getFilteredEventIndex(rank) + 1; // +1 for top filter status row
+ /* +1 for top filter status row */
+ index = fCache.getFilteredEventIndex(rank) + 1;
}
- fTable.setSelection(index + 1); // +1 for header row
+ /* +1 for header row */
+ fTable.setSelection(index + 1);
fRawViewer.selectAndReveal(rank);
updateStatusLine(null);
}
/**
* Display an exception in a message box
*
- * @param e the exception
+ * @param e
+ * the exception
*/
private static void displayException(final Exception e) {
final MessageBox mb = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());