Search in sources :

Example 1 with FilterPanelPart

use of org.bndtools.utils.swt.FilterPanelPart in project bndtools by bndtools.

the class ProjectListControl method createFilter.

private void createFilter(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginHeight = gridLayout.marginWidth = 0;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    composite.setLayout(gridLayout);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.grabExcessHorizontalSpace = true;
    composite.setLayoutData(gridData);
    FilterPanelPart filterPart = new FilterPanelPart(Activator.getDefault().getScheduler());
    filterPart.createControl(composite, 0, 0);
    filterPart.addPropertyChangeListener(new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            String filter = (String) event.getNewValue();
            updatedFilter(filter);
        }
    });
    ToolBar toolbar = new ToolBar(composite, SWT.FLAT);
    ToolItem tiCheckAll = new ToolItem(toolbar, SWT.FLAT);
    tiCheckAll.setImage(Activator.getImageDescriptor("icons/check_all.gif").createImage());
    tiCheckAll.setToolTipText(Messages.checkAll);
    tiCheckAll.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Object[] objs = contentProvider.getElements(null);
            for (Object obj : objs) {
                ProjectDiff diff = (ProjectDiff) obj;
                diff.setRelease(true);
            }
            tableViewer.refresh();
        }
    });
    ToolItem tiUncheckAll = new ToolItem(toolbar, SWT.FLAT);
    tiUncheckAll.setImage(Activator.getImageDescriptor("icons/uncheck_all.gif").createImage());
    tiUncheckAll.setToolTipText(Messages.uncheckAll);
    tiUncheckAll.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Object[] objs = contentProvider.getElements(null);
            for (Object obj : objs) {
                ProjectDiff diff = (ProjectDiff) obj;
                diff.setRelease(false);
            }
            tableViewer.refresh();
        }
    });
}
Also used : FilterPanelPart(org.bndtools.utils.swt.FilterPanelPart) PropertyChangeEvent(java.beans.PropertyChangeEvent) ProjectDiff(bndtools.release.ProjectDiff) Composite(org.eclipse.swt.widgets.Composite) PropertyChangeListener(java.beans.PropertyChangeListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ToolItem(org.eclipse.swt.widgets.ToolItem)

Aggregations

ProjectDiff (bndtools.release.ProjectDiff)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 FilterPanelPart (org.bndtools.utils.swt.FilterPanelPart)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 ToolBar (org.eclipse.swt.widgets.ToolBar)1 ToolItem (org.eclipse.swt.widgets.ToolItem)1