setTreeColumns(COLUMN_NAMES);
setTreeLabelProvider(new ControlFlowTreeLabelProvider());
setFilterColumns(FILTER_COLUMN_NAMES);
+ setFilterLabelProvider(new ControlFlowFilterLabelProvider());
setEntryComparator(new ControlFlowEntryComparator());
}
}
+ 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
// ------------------------------------------------------------------------
/** 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
// ------------------------------------------------------------------------
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
*
combo.setTreeLabelProvider(fLabelProvider);
combo.setTreeColumns(fColumns);
combo.setFilterContentProvider(new TreeContentProvider());
- combo.setFilterLabelProvider(new TreeLabelProvider());
+ combo.setFilterLabelProvider(fFilterLabelProvider);
combo.setFilterColumns(fFilterColumns);
}
*/
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());
}
}