analysis: Fix sonar warnings in CFV column sorting code
authorBernd Hufmann <Bernd.Hufmann@ericsson.com>
Mon, 25 Jan 2016 15:13:17 +0000 (10:13 -0500)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Tue, 26 Jan 2016 17:13:11 +0000 (12:13 -0500)
Change-Id: I4f4bb7e367946e9b9acb46414962722eb156eb87
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/65105
Reviewed-by: Hudson CI
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/analysis/os/linux/ui/views/controlflow/ControlFlowView.java
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/controlflow/ControlFlowColumnComparators.java

index 99dc269f6f5caed7af99f1f4d8e835831d10cad6..714f9b8871edafc83623a816749a0ce91a1c504f 100644 (file)
@@ -94,6 +94,8 @@ public class ControlFlowView extends AbstractStateSystemTimeGraphView {
 
     private static final Comparator<ITimeGraphEntry>[] COLUMN_COMPARATORS;
 
+    private static final int INITIAL_SORT_COLUMN_INDEX = 3;
+
     static {
         ImmutableList.Builder<Comparator<ITimeGraphEntry>> builder = ImmutableList.builder();
         builder.add(ControlFlowColumnComparators.PROCESS_NAME_COLUMN_COMPARATOR)
@@ -114,7 +116,7 @@ public class ControlFlowView extends AbstractStateSystemTimeGraphView {
      */
     public ControlFlowView() {
         super(ID, new ControlFlowPresentationProvider());
-        setTreeColumns(COLUMN_NAMES, COLUMN_COMPARATORS, 3);
+        setTreeColumns(COLUMN_NAMES, COLUMN_COMPARATORS, INITIAL_SORT_COLUMN_INDEX);
         setTreeLabelProvider(new ControlFlowTreeLabelProvider());
         setFilterColumns(FILTER_COLUMN_NAMES);
         setFilterLabelProvider(new ControlFlowFilterLabelProvider());
index 3bcc4105673500a6a891d41682384935e3154039..4d147258dab768a980747124cdf6143f2ec8b1e9 100644 (file)
@@ -28,11 +28,16 @@ import com.google.common.collect.ImmutableList;
  */
 public final class ControlFlowColumnComparators {
 
+    /**
+     * Default constructor
+     */
+    private ControlFlowColumnComparators() {}
+
     /**
      * Process Name comparator. This compares first the trace, then the process name, then the
      * birth time, then the TID finally the parent TID.
      */
-    public static ITimeGraphEntryComparator PROCESS_NAME_COLUMN_COMPARATOR = new ITimeGraphEntryComparator() {
+    public static final ITimeGraphEntryComparator PROCESS_NAME_COLUMN_COMPARATOR = new ITimeGraphEntryComparator() {
         private final List<Comparator<ITimeGraphEntry>> SECONDARY_COMPARATORS = init();
         private int fDirection = SWT.DOWN;
 
@@ -66,7 +71,7 @@ public final class ControlFlowColumnComparators {
      * Process TID comparator. This compares first the trace, then the process TID, then the
      * birth time, then the process name finally the parent TID.
      */
-    public static ITimeGraphEntryComparator TID_COLUMN_COMPARATOR = new ITimeGraphEntryComparator() {
+    public static final ITimeGraphEntryComparator TID_COLUMN_COMPARATOR = new ITimeGraphEntryComparator() {
 
         private final List<Comparator<ITimeGraphEntry>> SECONDARY_COMPARATORS = init();
         private int fDirection = SWT.DOWN;
@@ -102,7 +107,7 @@ public final class ControlFlowColumnComparators {
      * Process PTID comparator. This compares first the trace, then the process
      * parent TID, then the birth time, then the process name finally the TID.
      */
-    public static ITimeGraphEntryComparator PTID_COLUMN_COMPARATOR = new ITimeGraphEntryComparator() {
+    public static final ITimeGraphEntryComparator PTID_COLUMN_COMPARATOR = new ITimeGraphEntryComparator() {
 
         private final List<Comparator<ITimeGraphEntry>> SECONDARY_COMPARATORS = init();
         private int fDirection = SWT.DOWN;
@@ -136,7 +141,7 @@ public final class ControlFlowColumnComparators {
      * Process birth time comparator. This compares first the trace, then the
      * birth time, then the process name, then the TID finally the parent TID.
      */
-    public static ITimeGraphEntryComparator BIRTH_TIME_COLUMN_COMPARATOR = new ITimeGraphEntryComparator() {
+    public static final ITimeGraphEntryComparator BIRTH_TIME_COLUMN_COMPARATOR = new ITimeGraphEntryComparator() {
         private final List<Comparator<ITimeGraphEntry>> SECONDARY_COMPARATORS = init();
         private int fDirection = SWT.DOWN;
 
@@ -171,7 +176,7 @@ public final class ControlFlowColumnComparators {
      * time, the process name, the process TID and finally the process's parent
      * TID.
      */
-    public static ITimeGraphEntryComparator TRACE_COLUMN_COMPARATOR = new ITimeGraphEntryComparator() {
+    public static final ITimeGraphEntryComparator TRACE_COLUMN_COMPARATOR = new ITimeGraphEntryComparator() {
         private final List<Comparator<ITimeGraphEntry>> SECONDARY_COMPARATORS = init();
         private int fDirection = SWT.DOWN;
 
This page took 0.028172 seconds and 5 git commands to generate.