DESCRIPTION

TMF: Consolidate some view code into the AbstractTimeGraphView

This new view is a base view for all views using the TimeGraphCombo widget.
As a first step, the lttng2 kernel Control flow view and Resources view have
been modified to extend this abstract view.

Mostly all of the interface management code (build thread, zoom thread, signal
handling, etc) is in the base class.  Final views need only implement to code
to fill the entries' list and events.

This patch includes:
- The abstract view class that all new time graph views may extend.  The default
   weight of each sash can be set in the child view.
- A TimeGraphEntry class that can be used as is if the view does not require
  extra data of its entries
- Modification of the TimeEvent class to add a value to it.
- Added a ITimeGraphDrawingHelper interface to pass to the presentation
  providers to help them get the information they need to know where to draw
  some things (see ResourcesPresentationProvider)

It is a first step before adding new features to the time graph views.  Some
more abstraction may need to be done as well as other reorganizing of the
code.

Also updated for the 2.1 API, added a ITimeGraphPresentationProvider2 interface
to avoid API breakage.

Change-Id: I73c9f1b4bf8ec265f1b02804fa7f819bd2b8dd7a
Signed-off-by: Aryana Jones xxx@xxx.xxx


COMMENTS

author: Braxton Mccarthy
date: 2013-06-25 17:24:11.000000000

Uploaded patch set 10.

-------------------------------------
author: Brenden Conley
date: 2013-06-25 17:24:17.000000000

Patch Set 10:

Build Started https://hudson.eclipse.org/sandbox/job/linuxtools/2759/

-------------------------------------
author: Annalise Jimenez
date: 2013-06-25 17:27:30.000000000

Patch Set 10: Code-Review+1

-------------------------------------
author: Brenden Conley
date: 2013-06-25 17:38:59.000000000

Patch Set 10: Verified+1

Build Successful 

https://hudson.eclipse.org/sandbox/job/linuxtools/2759/ : SUCCESS

-------------------------------------
author: Braxton Mccarthy
date: 2013-06-25 18:18:04.000000000

Patch Set 10: Code-Review-1

(30 comments)

some comments, looking good!

Line:34, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/ITmfTimeGraphDrawingHelper.java -> preemptive Sonar warning: the public modifier here is redundant, since we are in a interface it's by definition public.

Line:53, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowPresentationProvider.java -> was more readable with the spaces

Line:64, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesPresentationProvider.java -> I'd argue that it was more readable with the extra spaces

Line:54, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java -> "private static final"

Line:58, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java -> idem

Line:62, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java -> { 15, 85 };

Line:88, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java -> should be defined as a List. (but not super duper important since it's not a class field)

Line:11, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/ITimeGraphPresentationProvider.java -> hmm, I don't see that change :P

Line:3, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java -> Keep this on the same line, or it will break the releng scripts.

Might be worth moving to "Inter Corporation and others" and adding the Ericsson and Polytechnique besides the names below.

Line:218, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java -> space after (cast)

Line:43, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeGraphEntry.java -> fields should be private, with protected getters/setters if needed.

Line:178, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeGraphEntry.java -> It's unsafe to store lists directly (whoever has the reference can still modify the list afterwards). Perhaps it'd be worth making fEventList final, and have this method do a .clear() and shallow-copy the list contents over.

Line:188, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeGraphEntry.java -> same here

Line:40, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesEntry.java -> could be final?

Line:63, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> "private static final"

Line:71, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> idem

Line:129, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> Should use static final variables instead of 0, 1, 2, 3, like TID_COL, PTID_COL etc.

Line:116, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphCombo.java -> { 1, 1 };

ctrl+shift+f will fix it. Could be final too I think?

Also, it's fine for existing code, but for new code we should try to use Javadoc-style comments for fields too, like:
 /** Default weight of each part of the sash */

it'll be a tad more useful in the IDE.

Line:88, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java -> Could use a /** Javadoc-style comment */

Line:94, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java -> fields should private, with more permissive getters/setters as required

Line:102, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java -> also, the definition should be the interface type
  ... Map<something> = new HashMap<something>

You can probably use List instead of ArrayList too. I think.

Line:105, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java -> "private final"

also Map

Line:108, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java -> You can put one-line Javadoc comment on, well, one line.

Line:2, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/ITimeGraphPresentationProvider2.java -> could be just 2013. Could have only Poly too for now ;)

Line:20, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/ITimeGraphPresentationProvider2.java -> Not sure if xxx@xxx.xxx tag is very useful... I don't know why we're using it

Line:32, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/ITimeGraphPresentationProvider2.java -> no need for public modifier in interfaces

Line:2, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeEvent.java -> You could add Poly here

Line:34, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeEvent.java -> empty line

Line:36, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphPresentationProvider.java -> field should be private

Line:37, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphPresentationProvider.java -> "private final"

-------------------------------------
author: Annalise Jimenez
date: 2013-06-25 19:48:35.000000000

Patch Set 10: -Code-Review

(1 comment)

New patch coming up!

Line:88, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java -> Actually, if I do so, I'd need to cast it before cloning it below.  So for an internal variable, I'd leave it like this, more efficient than casting I think.

-------------------------------------
author: Braxton Mccarthy
date: 2013-06-25 22:02:14.000000000

Patch Set 10:

(5 comments)

Line:115, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java -> same

Line:120, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java -> same

Line:132, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java -> see the comment below about the comparator, it can apply to fWeight too.

Line:136, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java -> The comparator should not change over the lifetime of the object right? Shouldn't it be passed at the constructor then (and be final)? (also private)

Line:151, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java -> Could you change these to protected methods, which would simply return Messages.blah blah.  Just to keep Sonar happy ;)

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