tmf: Clean up tmf.ui.project.model
authorAlexandre Montplaisir <alexmonthy@efficios.com>
Tue, 23 Feb 2016 23:27:50 +0000 (18:27 -0500)
committerAlexandre Montplaisir <alexmonthy@efficios.com>
Wed, 2 Mar 2016 19:08:59 +0000 (14:08 -0500)
commitb3e4798c7979aeea3a2834059ee14f42f4a4512a
treed10038b47ae8e43bf6c1ef9320613b8aaedfb5e8
parent16801c72d947260f2c9e16afe569704773645c01
tmf: Clean up tmf.ui.project.model

Cleanup the ITmfProjectModelElement hierarchy:

* Make all fields in the abstract class private, replace accesses with
  the getter methods.
  This also has the advantage of giving us the right type, for elements
  that override for example the getResource() return type.

* Make refreshChildren() abstract, the great majority of the
  implementations should handle it. It's easy to "forget" to override
  a method, while you can't forget an abstract method.

* Remove addChild() and removeChild() from the interface. Ideally
  these should be only called by the owners themselves.

* The "parent.addChild(this)" pattern is quite bad. It muddles the
  ownership, and calls "this" in a constructor, which is bad practice.
  Have the parents add the child to themselves after they create it.

* Implement hasChildren() as a default interface method.

* Have getChildren() return an ImmutableList copy of the original
  list. Callers shouldn't be modifying it!

Change-Id: Ie2e8129bef447ecbdce9add0e8cf9bd28ba36783
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Reviewed-on: https://git.eclipse.org/r/67387
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-by: Hudson CI
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/ITmfProjectModelElement.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfAnalysisElement.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfAnalysisOutputElement.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfCommonProjectElement.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfExperimentElement.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfExperimentFolder.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfProjectElement.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfProjectModelElement.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfTraceElement.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfTraceFolder.java
This page took 0.040726 seconds and 5 git commands to generate.