tmf: Bug 426468: Wrong filter label provider in Control Flow view
authorPatrick Tasse <patrick.tasse@gmail.com>
Thu, 23 Jan 2014 17:00:17 +0000 (12:00 -0500)
committerPatrick Tasse <patrick.tasse@gmail.com>
Mon, 27 Jan 2014 18:24:18 +0000 (13:24 -0500)
Change-Id: I328db35ffdcb8f872a3277eb309472fd311aab97
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/21005
Tested-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
IP-Clean: Matthew Khouzam <matthew.khouzam@ericsson.com>

org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java

index adf51cce29bda5a721373c054e153cd722ce1fd0..2ac5ec527e0a63345092f53af5bb4426a088b2cc 100644 (file)
@@ -94,6 +94,7 @@ public class ControlFlowView extends AbstractTimeGraphView {
         setTreeColumns(COLUMN_NAMES);
         setTreeLabelProvider(new ControlFlowTreeLabelProvider());
         setFilterColumns(FILTER_COLUMN_NAMES);
+        setFilterLabelProvider(new ControlFlowFilterLabelProvider());
         setEntryComparator(new ControlFlowEntryComparator());
     }
 
@@ -195,6 +196,22 @@ public class ControlFlowView extends AbstractTimeGraphView {
 
     }
 
+    private static class ControlFlowFilterLabelProvider extends TreeLabelProvider {
+
+        @Override
+        public String getColumnText(Object element, int columnIndex) {
+            ControlFlowEntry entry = (ControlFlowEntry) element;
+
+            if (columnIndex == 0) {
+                return entry.getName();
+            } else if (columnIndex == 1) {
+                return Integer.toString(entry.getThreadId());
+            }
+            return ""; //$NON-NLS-1$
+        }
+
+    }
+
     // ------------------------------------------------------------------------
     // Internal
     // ------------------------------------------------------------------------
index 3769b469774e0ea303d2587e239cf4ff28f37e5c..c690ed48bf9256ddf6f851958923a73f647de45e 100644 (file)
@@ -148,6 +148,9 @@ public abstract class AbstractTimeGraphView extends TmfView {
     /** The filter column label array, or null if filter is not used */
     private String[] fFilterColumns;
 
+    /** The filter label provider, or null if filter is not used */
+    private TreeLabelProvider fFilterLabelProvider;
+
     // ------------------------------------------------------------------------
     // Classes
     // ------------------------------------------------------------------------
@@ -553,6 +556,19 @@ public abstract class AbstractTimeGraphView extends TmfView {
         fFilterColumns = filterColumns;
     }
 
+    /**
+     * Sets the filter label provider.
+     * This should be called from the constructor.
+     *
+     * @param labelProvider
+     *            The filter label provider
+     *
+     * @since 3.0
+     */
+    protected void setFilterLabelProvider(final TreeLabelProvider labelProvider) {
+        fFilterLabelProvider = labelProvider;
+    }
+
     /**
      * Gets the display width
      *
@@ -703,7 +719,7 @@ public abstract class AbstractTimeGraphView extends TmfView {
             combo.setTreeLabelProvider(fLabelProvider);
             combo.setTreeColumns(fColumns);
             combo.setFilterContentProvider(new TreeContentProvider());
-            combo.setFilterLabelProvider(new TreeLabelProvider());
+            combo.setFilterLabelProvider(fFilterLabelProvider);
             combo.setFilterColumns(fFilterColumns);
         }
 
@@ -1081,7 +1097,7 @@ public abstract class AbstractTimeGraphView extends TmfView {
      */
     protected void fillLocalToolBar(IToolBarManager manager) {
         if (fTimeGraphWrapper instanceof TimeGraphComboWrapper) {
-            if (fFilterColumns.length > 0) {
+            if (fFilterColumns != null && fFilterLabelProvider != null && fFilterColumns.length > 0) {
                 manager.add(((TimeGraphComboWrapper) fTimeGraphWrapper).getShowFilterAction());
             }
         }
This page took 0.028454 seconds and 5 git commands to generate.