+ return field.getFormattedValue();
+ }
+
+ @Override
+ public boolean isPropertySet(Object id) {
+ return false;
+ }
+
+ @Override
+ public void resetPropertyValue(Object id) {
+ }
+
+ @Override
+ public void setPropertyValue(Object id, Object value) {
+ }
+ }
+
+ private 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$
+
+ final private ITmfSourceLookup fSourceLookup;
+
+ public SourceLookupPropertySource(ITmfSourceLookup lookup) {
+ fSourceLookup = lookup;
+ }
+
+ @Override
+ public Object getEditableValue() {
+ if (fSourceLookup.getCallsite() != null) {
+ return fSourceLookup.getCallsite().toString();
+ }
+ return null;
+ }
+
+ @Override
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ List<IPropertyDescriptor> descriptors= new ArrayList<IPropertyDescriptor>();
+ if (fSourceLookup.getCallsite() != 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 (fSourceLookup.getCallsite().getFunctionName() != null) {
+ descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_FUNCTION_NAME, NAME_FUNCTION_NAME));
+ }
+ }
+ return descriptors.toArray(new IPropertyDescriptor[0]);
+ }
+
+ @Override
+ public Object getPropertyValue(Object id) {
+ if (id.equals(ID_FILE_NAME)) {
+ return fSourceLookup.getCallsite().getFileName();
+ } else if (id.equals(ID_FUNCTION_NAME)) {
+ return fSourceLookup.getCallsite().getFunctionName();
+ } else if (id.equals(ID_LINE_NUMBER)) {
+ return Long.valueOf(fSourceLookup.getCallsite().getLineNumber());
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isPropertySet(Object id) {
+ return false;
+ }
+
+ @Override
+ public void resetPropertyValue(Object id) {
+
+ }
+
+ @Override
+ public void setPropertyValue(Object id, Object value) {
+ }
+ }
+
+ private class CustomAttributePropertySource implements IPropertySource {
+
+ private final ITmfCustomAttributes event;
+
+ public CustomAttributePropertySource(ITmfCustomAttributes event) {
+ this.event = event;
+ }
+
+ @Override
+ public Object getEditableValue() {
+ return EMPTY_STRING;
+ }
+
+ @Override
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ List<IPropertyDescriptor> descriptors = new ArrayList<IPropertyDescriptor>();
+
+ for (String customAttribute : event.listCustomAttributes()) {
+ descriptors.add(new ReadOnlyTextPropertyDescriptor(customAttribute, customAttribute));
+ }
+
+ return descriptors.toArray(new IPropertyDescriptor[0]);
+ }
+
+ @Override
+ public Object getPropertyValue(Object id) {
+ return event.getCustomAttribute((String) id);