package org.eclipse.tracecompass.tmf.ui.viewers.events;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.tracecompass.tmf.core.filter.ITmfFilter;
import org.eclipse.tracecompass.tmf.core.filter.model.ITmfFilterTreeNode;
import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterAndNode;
+import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterMatchesAspectNode;
import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterMatchesNode;
import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterNode;
import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest.ExecutionType;
/** Rank */
String RANK = "$rank"; //$NON-NLS-1$
- /** Field ID */
- String FIELD_ID = "$field_id"; //$NON-NLS-1$
-
/** Bookmark indicator */
String BOOKMARK = "$bookmark"; //$NON-NLS-1$
+
+ /** Event aspect represented by this column */
+ String ASPECT = "$aspect"; //$NON-NLS-1$
}
/**
builder.add(new TmfEventFieldAspect(fieldName, fieldName));
}
}
- @SuppressWarnings("null")
- @NonNull Iterable<ITmfEventAspect> ret = builder.build();
- return ret;
+ return checkNotNull(builder.build());
}
/**
TableColumn column = fTable.newTableColumn(SWT.LEFT);
column.setText(col.getHeaderName());
column.setToolTipText(col.getHeaderTooltip());
- column.setData(Key.FIELD_ID, col.getFilterFieldId());
+ column.setData(Key.ASPECT, col.getEventAspect());
column.pack();
if (col instanceof TmfMarginColumn) {
column.setResizable(false);
context.addVariable(ExportToTextCommandHandler.TMF_EVENT_TABLE_COLUMNS_ID, exportColumns);
handlerService.executeCommandInContext(cmd, null, context);
- } catch (ExecutionException e) {
- displayException(e);
- } catch (NotDefinedException e) {
- displayException(e);
- } catch (NotEnabledException e) {
- displayException(e);
- } catch (NotHandledException e) {
+ } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) {
displayException(e);
}
}
*/
protected void setItemData(final TableItem item, final ITmfEvent event, final long rank) {
String[] itemStrings = getItemStrings(fColumns, event);
+
+ // Get the actual ITmfEvent from the CachedEvent
+ ITmfEvent tmfEvent = event;
+ if (event instanceof CachedEvent) {
+ tmfEvent = ((CachedEvent) event).event;
+ }
item.setText(itemStrings);
- item.setData(event);
- item.setData(Key.TIMESTAMP, new TmfTimestamp(event.getTimestamp()));
+ item.setData(tmfEvent);
+ item.setData(Key.TIMESTAMP, new TmfTimestamp(tmfEvent.getTimestamp()));
item.setData(Key.RANK, rank);
final Collection<Long> markerIds = fBookmarksMap.get(rank);
boolean searchNoMatch = false;
final ITmfFilter searchFilter = (ITmfFilter) fTable.getData(Key.SEARCH_OBJ);
if (searchFilter != null) {
- if (searchFilter.matches(event)) {
+ if (searchFilter.matches(tmfEvent)) {
searchMatch = true;
} else {
searchNoMatch = true;
}
}
- final ColorSetting colorSetting = ColorSettingsManager.getColorSetting(event);
+ final ColorSetting colorSetting = ColorSettingsManager.getColorSetting(tmfEvent);
if (searchNoMatch) {
item.setForeground(colorSetting.getDimmedForegroundColor());
item.setBackground(colorSetting.getDimmedBackgroundColor());
tableEditor.getEditor().dispose();
return false;
}
- final TmfFilterMatchesNode filter = new TmfFilterMatchesNode(null);
- String fieldId = (String) column.getData(Key.FIELD_ID);
- if (fieldId == null) {
- fieldId = column.getText();
- }
- filter.setField(fieldId);
+ final TmfFilterMatchesAspectNode filter = new TmfFilterMatchesAspectNode(null);
+ ITmfEventAspect aspect = (ITmfEventAspect) column.getData(Key.ASPECT);
+ filter.setEventAspect(aspect);
filter.setRegex(regex);
column.setData(objKey, filter);
column.setData(txtKey, regex);
public String getHelpText() {
return EMPTY_STRING;
}
-
- @Override
- public String getFilterId() {
- return null;
- }
};
/**