import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
import org.eclipse.tracecompass.tmf.core.signal.TmfTraceUpdatedSignal;
import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
private final class ColumnMovedListener extends 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) {
GC gc = event.gc;
Color background = item.getBackground(event.index);
/*
- * Paint the background if it is not the default system color.
- * In Windows, if you let the widget draw the background, it
- * will not show the item's background color if the item is
- * selected or hot. If there are no style ranges and the item
- * background is the default system color, we do not want to
- * paint it or otherwise we would override the platform theme
- * (e.g. alternating colors).
+ * Paint the background if it is not the default system color. In
+ * Windows, if you let the widget draw the background, it will not
+ * show the item's background color if the item is selected or hot.
+ * If there are no style ranges and the item background is the
+ * default system color, we do not want to paint it or otherwise we
+ * would override the platform theme (e.g. alternating colors).
*/
if (styleRanges != null || !background.equals(item.getParent().getBackground())) {
// we will paint the table item's background
/*
* 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.
+ * 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;
/*
* 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.
+ * expects coordinates relative to an origin that includes the
+ * table header.
*/
int y = event.y;
if (IS_LINUX) {
* The events table search/filter/data keys
*
* @author Patrick Tasse
- * @noimplement This interface only contains Event Table specific
- * static definitions.
+ * @noimplement This interface only contains Event Table specific static
+ * definitions.
*/
public interface Key {
}
@Deprecated
- private static @NonNull Iterable<ITmfEventAspect> convertFromColumnData(
+ private static @NonNull Iterable<ITmfEventAspect<?>> convertFromColumnData(
org.eclipse.tracecompass.tmf.ui.widgets.virtualtable.ColumnData[] columnData) {
- ImmutableList.Builder<ITmfEventAspect> builder = new ImmutableList.Builder<>();
+ ImmutableList.Builder<ITmfEventAspect<?>> builder = new ImmutableList.Builder<>();
for (org.eclipse.tracecompass.tmf.ui.widgets.virtualtable.ColumnData col : columnData) {
String fieldName = col.header;
if (fieldName != null) {
* </p>
*/
public TmfEventsTable(final Composite parent, int cacheSize,
- @NonNull Iterable<ITmfEventAspect> aspects) {
+ @NonNull Iterable<ITmfEventAspect<?>> aspects) {
super("TmfEventsTable"); //$NON-NLS-1$
fComposite = new Composite(parent, SWT.NONE);
fTable.setLinesVisible(true);
// Setup the columns
- for (ITmfEventAspect aspect : aspects) {
+ for (ITmfEventAspect<?> aspect : aspects) {
if (aspect != null) {
fColumns.add(new TmfEventTableColumn(aspect));
}
fRawViewer.setVisible(false);
createPopupMenu();
+
+ fComposite.addDisposeListener((e) -> {
+ internalDispose();
+ });
}
/**
*/
IMarker marker = null;
final ArrayList<IFile> files = new ArrayList<>();
+ IPath p = new Path(trimmedPath);
ResourcesPlugin.getWorkspace().getRoot().accept(new IResourceVisitor() {
@Override
public boolean visit(IResource resource) throws CoreException {
- if (resource instanceof IFile && resource.getFullPath().toString().endsWith(trimmedPath)) {
+ if (resource instanceof IFile && resource.getFullPath().toString().endsWith(p.lastSegment())) {
files.add((IFile) resource);
}
return true;
@Override
public void dispose() {
+ fComposite.dispose();
+ }
+
+ private void internalDispose() {
stopSearchThread();
stopFilterThread();
PlatformUI.getWorkbench().getThemeManager().removePropertyChangeListener(this);
ColorSettingsManager.removeColorSettingsListener(this);
- fComposite.dispose();
+ fCache.clear();
if ((fTrace != null) && fDisposeOnClose) {
fTrace.dispose();
}
fResourceManager.dispose();
- fRawViewer.dispose();
if (fRawViewerPopupMenuManager != null) {
fRawViewerPopupMenuManager.dispose();
}
}
item.setText(itemStrings);
item.setData(tmfEvent);
- item.setData(Key.TIMESTAMP, new TmfTimestamp(tmfEvent.getTimestamp()));
+ item.setData(Key.TIMESTAMP, tmfEvent.getTimestamp());
item.setData(Key.RANK, rank);
final Collection<Long> markerIds = fBookmarksMap.get(rank);
return false;
}
final TmfFilterMatchesNode filter = new TmfFilterMatchesNode(null);
- ITmfEventAspect aspect = (ITmfEventAspect) column.getData(Key.ASPECT);
+ ITmfEventAspect<?> aspect = (ITmfEventAspect<?>) column.getData(Key.ASPECT);
filter.setEventAspect(aspect);
filter.setRegex(regex);
column.setData(Key.SEARCH_OBJ, filter);
/**
* Pack the columns.
+ *
+ * @return
+ * Whether or not a pack was done in this call. Otherwise, it was already done by a
+ * previous call
+ *
+ * @since 2.0
*/
- protected void packColumns() {
+ protected boolean packColumns() {
if (fPackDone) {
- return;
+ return false;
}
fTable.setRedraw(false);
try {
fTable.setRedraw(true);
}
fPackDone = true;
+ return true;
}
private void packMarginColumn() {
/**
* Returns true if the column is a visible event column.
*
- * @param column the column
- * @return false if the column is the margin column or hidden, true otherwise
+ * @param column
+ * the column
+ * @return false if the column is the margin column or hidden, true
+ * otherwise
*/
private static boolean isVisibleEventColumn(TableColumn column) {
if (column.getData(Key.ASPECT) == TmfMarginColumn.MARGIN_ASPECT) {
bookmark.setAttribute(IMarker.MESSAGE, message.toString());
bookmark.setAttribute(IMarker.LOCATION, location);
bookmark.setAttribute(ITmfMarker.MARKER_RANK, rank.toString());
- bookmark.setAttribute(ITmfMarker.MARKER_TIME, Long.toString(new TmfNanoTimestamp(timestamp).getValue()));
+ bookmark.setAttribute(ITmfMarker.MARKER_TIME, Long.toString(timestamp.toNanos()));
bookmark.setAttribute(ITmfMarker.MARKER_COLOR, dialog.getColorValue().toString());
id[0] = bookmark.getId();
}
try {
String timeString = marker.getAttribute(ITmfMarker.MARKER_TIME, (String) null);
long time = Long.parseLong(timeString);
- tsBegin = new TmfNanoTimestamp(time);
+ tsBegin = TmfTimestamp.fromNanos(time);
String durationString = marker.getAttribute(ITmfMarker.MARKER_DURATION, (String) null);
long duration = Long.parseLong(durationString);
- tsEnd = new TmfNanoTimestamp(time + duration);
+ tsEnd = TmfTimestamp.fromNanos(time + duration);
} catch (NumberFormatException e) {
/* ignored */
}
final TmfEventRequest subRequest = new TmfEventRequest(ITmfEvent.class,
TmfTimeRange.ETERNITY, 0, 1, ExecutionType.FOREGROUND) {
- TmfTimestamp ts = new TmfTimestamp(signal.getBeginTime());
- TmfTimestamp tf = new TmfTimestamp(signal.getEndTime());
+ ITmfTimestamp ts = signal.getBeginTime();
+ ITmfTimestamp tf = signal.getEndTime();
@Override
public void handleSuccess() {
contextEnd = fTrace.seekEvent(te);
rankEnd = contextEnd.getRank();
contextEnd.dispose();
- /* To include all events at the begin time, seek at the next nanosecond and then use the previous rank */
+ /*
+ * To include all events at the begin time, seek at the
+ * next nanosecond and then use the previous rank
+ */
tb = timestampBegin.normalize(1, ITmfTimestamp.NANOSECOND_SCALE);
if (tb.compareTo(fTrace.getEndTime()) <= 0) {
contextBegin = fTrace.seekEvent(tb);
rankBegin = ITmfContext.UNKNOWN_RANK;
}
rankBegin = (rankBegin == ITmfContext.UNKNOWN_RANK ? fTrace.getNbEvents() : rankBegin) - 1;
- /* If no events in selection range, select only the next event */
+ /*
+ * If no events in selection range, select only the next
+ * event
+ */
rankBegin = rankBegin >= rankEnd ? rankBegin : rankEnd;
} else {
tb = timestampBegin;
contextBegin = fTrace.seekEvent(tb);
rankBegin = contextBegin.getRank();
contextBegin.dispose();
- /* To include all events at the end time, seek at the next nanosecond and then use the previous rank */
+ /*
+ * To include all events at the end time, seek at the
+ * next nanosecond and then use the previous rank
+ */
te = timestampEnd.normalize(1, ITmfTimestamp.NANOSECOND_SCALE);
if (te.compareTo(fTrace.getEndTime()) <= 0) {
contextEnd = fTrace.seekEvent(te);
rankEnd = ITmfContext.UNKNOWN_RANK;
}
rankEnd = (rankEnd == ITmfContext.UNKNOWN_RANK ? fTrace.getNbEvents() : rankEnd) - 1;
- /* If no events in selection range, select only the next event */
+ /*
+ * If no events in selection range, select only the next
+ * event
+ */
rankEnd = rankEnd >= rankBegin ? rankEnd : rankBegin;
}
return new Pair<>(Long.valueOf(rankBegin), Long.valueOf(rankEnd));
*/
private static final class TmfMarginColumn extends TmfEventTableColumn {
- private static final @NonNull ITmfEventAspect MARGIN_ASPECT = new ITmfEventAspect() {
+ private static final @NonNull ITmfEventAspect<String> MARGIN_ASPECT =
+ new ITmfEventAspect<String>() {
@Override
public String getName() {