Search in sources :

Example 1 with IDataSetFilter

use of org.eclipse.linuxtools.systemtap.graphing.core.filters.IDataSetFilter in project linuxtools by eclipse.

the class DataGrid method initMenus.

private Menu initMenus() {
    Menu menu = new Menu(table.getShell(), SWT.POP_UP);
    Menu formatMenu = new Menu(menu);
    formatMenuItem = new MenuItem(menu, SWT.CASCADE);
    // $NON-NLS-1$
    formatMenuItem.setText(Localization.getString("DataGrid.FormatAs"));
    formatMenuItem.setMenu(formatMenu);
    filterMenu = new Menu(menu);
    MenuItem item = new MenuItem(menu, SWT.CASCADE);
    // $NON-NLS-1$
    item.setText(Localization.getString("DataGrid.AddFilter"));
    item.addSelectionListener(new AddFilterSelection());
    removeFiltersMenuItem = new MenuItem(menu, SWT.CASCADE);
    // $NON-NLS-1$
    removeFiltersMenuItem.setText(Localization.getString("DataGrid.RemoveFilter"));
    removeFiltersMenuItem.setMenu(filterMenu);
    IDataSetFilter[] filters = filteredDataSet.getFilters();
    if (filters != null && filters.length > 0) {
        for (int i = 0; i < filters.length; i++) {
            item = new MenuItem(filterMenu, SWT.CASCADE);
            item.setText(AvailableFilterTypes.getFilterName(filters[i].getID()));
            item.setData(filters[i]);
            item.addSelectionListener(new RemoveFilterSelection());
        }
    } else {
        removeFiltersMenuItem.setEnabled(false);
    }
    autoResizeMenuItem = new MenuItem(menu, SWT.CHECK);
    // $NON-NLS-1$
    autoResizeMenuItem.setText(Localization.getString("DataGrid.AutoResize"));
    autoResizeMenuItem.setSelection(prefs.getBoolean(GraphingPreferenceConstants.P_AUTO_RESIZE));
    jumpToEntryMenuItem = new MenuItem(menu, SWT.CHECK);
    // $NON-NLS-1$
    jumpToEntryMenuItem.setText(Localization.getString("DataGrid.JumpToEntry"));
    jumpToEntryMenuItem.setSelection(prefs.getBoolean(GraphingPreferenceConstants.P_JUMP_NEW_TABLE_ENTRY));
    for (int i = 0; i < IFormattingStyles.FORMAT_TITLES.length; i++) {
        item = new MenuItem(formatMenu, SWT.RADIO);
        item.setText(IFormattingStyles.FORMAT_TITLES[i]);
        item.addSelectionListener(new MenuFormatSelection());
    }
    formatMenuItem.setEnabled(filteredDataSet.getRowCount() > 0);
    formatMenu.addMenuListener(new FormatMenuListener());
    return menu;
}
Also used : MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) Point(org.eclipse.swt.graphics.Point) IDataSetFilter(org.eclipse.linuxtools.systemtap.graphing.core.filters.IDataSetFilter)

Example 2 with IDataSetFilter

use of org.eclipse.linuxtools.systemtap.graphing.core.filters.IDataSetFilter in project linuxtools by eclipse.

the class FilteredRowDataSetTest method testGetFilters.

@Test
public void testGetFilters() {
    assertEquals(0, fdata.getFilters().length);
    RangeFilter filter1 = new RangeFilter(0, 3, 5, RangeFilter.INCLUSIVE | RangeFilter.INSIDE_BOUNDS);
    SortFilter filter2 = new SortFilter(2, SortFilter.ASCENDING);
    fdata.addFilter(filter1);
    fdata.addFilter(filter2);
    IDataSetFilter[] filters = fdata.getFilters();
    assertEquals(2, filters.length);
}
Also used : SortFilter(org.eclipse.linuxtools.systemtap.graphing.core.filters.SortFilter) RangeFilter(org.eclipse.linuxtools.systemtap.graphing.core.filters.RangeFilter) IDataSetFilter(org.eclipse.linuxtools.systemtap.graphing.core.filters.IDataSetFilter) Test(org.junit.Test)

Example 3 with IDataSetFilter

use of org.eclipse.linuxtools.systemtap.graphing.core.filters.IDataSetFilter in project linuxtools by eclipse.

the class FilteredTableDataSetTest method testGetFilters.

@Test
public void testGetFilters() {
    assertEquals(0, dataSet.getFilters().length);
    RangeFilter filter1 = new RangeFilter(0, 3, 5, RangeFilter.INCLUSIVE | RangeFilter.INSIDE_BOUNDS);
    SortFilter filter2 = new SortFilter(2, SortFilter.ASCENDING);
    dataSet.addFilter(filter1);
    dataSet.addFilter(filter2);
    IDataSetFilter[] filters = dataSet.getFilters();
    assertEquals(2, filters.length);
}
Also used : SortFilter(org.eclipse.linuxtools.systemtap.graphing.core.filters.SortFilter) RangeFilter(org.eclipse.linuxtools.systemtap.graphing.core.filters.RangeFilter) IDataSetFilter(org.eclipse.linuxtools.systemtap.graphing.core.filters.IDataSetFilter) Test(org.junit.Test)

Aggregations

IDataSetFilter (org.eclipse.linuxtools.systemtap.graphing.core.filters.IDataSetFilter)3 RangeFilter (org.eclipse.linuxtools.systemtap.graphing.core.filters.RangeFilter)2 SortFilter (org.eclipse.linuxtools.systemtap.graphing.core.filters.SortFilter)2 Test (org.junit.Test)2 Point (org.eclipse.swt.graphics.Point)1 Menu (org.eclipse.swt.widgets.Menu)1 MenuItem (org.eclipse.swt.widgets.MenuItem)1