package org.eclipse.tracecompass.tmf.ui.viewers.events;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString;
+
import java.util.ArrayList;
import java.util.List;
private ITmfEvent fEvent;
- private class TimestampPropertySource implements IPropertySource {
+ private static class TimestampPropertySource implements IPropertySource {
private static final String ID_TIMESTAMP_VALUE = "timestamp_value"; //$NON-NLS-1$
private static final String ID_TIMESTAMP_SCALE = "timestamp_scale"; //$NON-NLS-1$
private static final String NAME_TIMESTAMP_VALUE = "value"; //$NON-NLS-1$
}
}
- private class ContentPropertySource implements IPropertySource {
+ private static class ContentPropertySource implements IPropertySource {
private ITmfEventField fContent;
public ContentPropertySource(ITmfEventField content) {
}
}
- private class SourceLookupPropertySource implements IPropertySource {
+ private static class SourceLookupPropertySource implements IPropertySource {
private static final String ID_FILE_NAME = "callsite_file"; //$NON-NLS-1$
- private static final String ID_FUNCTION_NAME = "callsite_function"; //$NON-NLS-1$
private static final String ID_LINE_NUMBER = "callsite_line"; //$NON-NLS-1$
private static final String NAME_FILE_NAME = "File"; //$NON-NLS-1$
- private static final String NAME_FUNCTION_NAME = "Function"; //$NON-NLS-1$
private static final String NAME_LINE_NUMBER = "Line"; //$NON-NLS-1$
private final ITmfSourceLookup fSourceLookup;
if (cs != null) {
descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_FILE_NAME, NAME_FILE_NAME));
descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_LINE_NUMBER, NAME_LINE_NUMBER));
- // only display function if available
- if (cs.getFunctionName() != null) {
- descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_FUNCTION_NAME, NAME_FUNCTION_NAME));
- }
}
return descriptors.toArray(new IPropertyDescriptor[0]);
}
@Override
- public Object getPropertyValue(Object id) {
+ public String getPropertyValue(Object id) {
ITmfCallsite cs = fSourceLookup.getCallsite();
if (cs == null) {
/*
switch ((String) id) {
case ID_FILE_NAME:
return cs.getFileName();
- case ID_FUNCTION_NAME:
- return cs.getFunctionName();
case ID_LINE_NUMBER:
- return Long.valueOf(cs.getLineNumber());
+ return nullToEmptyString(cs.getLineNo());
default:
return null;
}
@Override
public Object getPropertyValue(Object id) {
+ if (!(id instanceof String)) {
+ return null;
+ }
return event.getCustomAttribute((String) id);
}
/* Display custom attributes, if available */
if (fEvent instanceof ITmfCustomAttributes) {
ITmfCustomAttributes event = (ITmfCustomAttributes) fEvent;
- if (event.listCustomAttributes() != null && !event.listCustomAttributes().isEmpty()) {
+ if (!event.listCustomAttributes().isEmpty()) {
descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_CUSTOM_ATTRIBUTE, NAME_CUSTOM_ATTRIBUTES));
}
}