DESCRIPTION

tmf: Don't use ITmfEventField in TmfEventsTable

TmfEventsTable used ITmfEventFields to transfer what it calls
the "fields" of an event row in the table. These are simple Strings
at their heart though, ITmfEventField is used for event payloads only.

This removes many unnecessary object creations.

Change-Id: Ieb82651c6dc7b54505e24a1c21cfa3222a193bbf
Signed-off-by: Braxton Mccarthy xxx@xxx.xxx


COMMENTS

author: Braxton Mccarthy
date: 2014-05-08 18:28:03.000000000

Uploaded patch set 1.

-------------------------------------
author: Luciana Barry
date: 2014-05-08 19:37:59.000000000

Patch Set 1: Code-Review-1

(3 comments)

Line:1856, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java -> How about getItemText() or getItemStrings()? More in line with TableItem.setText(String[] strings). I just find a bit unclear what concept 'entries' refers to.

Line:1860, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java -> There's no need for a collection here, why not just return a String[] ?

Line:199, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/parsers/custom/CustomEvent.java -> This synchronization is useless unless we also synchronize the method processData(). If the method is actually called by simultaneous threads, we could have a NullPointerException on fData.

-------------------------------------
author: Brenden Conley
date: 2014-05-08 20:15:43.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/6921/

-------------------------------------
author: Brenden Conley
date: 2014-05-08 20:56:55.000000000

Patch Set 1: Verified+1

Build Successful 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/6921/ : SUCCESS

-------------------------------------
author: Braxton Mccarthy
date: 2014-05-08 22:12:25.000000000

Patch Set 1:

(3 comments)

Thanks for the quick review!

Line:1856, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java -> ok, yeah getItemStrings() sounds good.

Line:1860, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java -> Returning arrays[] in API is bad design in general, because it forces a specific implementation (it'd be like returning an ArrayList). And it doesn't allow subclasses to restrict to more specific data structures to get special functionality.

Even List here is pushing it, Collection/Iterable would be enough for the need.

However Eclipse's SWT API seems to be in love with the notion of returning and taking [] arrays as parameters... And I admit the sole purpose of this method here is to pass the returned values to .setText(). We can probably live with String[]

(Interesting post on how Java 8 will make our life a tad better: http://eclipsesource.com/blogs/2014/03/24/how-to-use-swt-with-java-8/ )

Line:199, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/parsers/custom/CustomEvent.java -> Yeah, good point. I'll add a synchronized around the other spot that uses fColumnData.

At first I wanted to change fColumnData here to not use TmfEventField either, but I didn't want to change too much in one patch ;)

-------------------------------------
