Search in sources :

Example 1 with ProjectDiff

use of bndtools.release.ProjectDiff in project bndtools by bndtools.

the class ProjectListControl method createTableLayout.

private void createTableLayout(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    // Add TableColumnLayout
    TableColumnLayout layout = new TableColumnLayout();
    composite.setLayout(layout);
    // Instantiate TableViewer
    projects = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    projects.setHeaderVisible(true);
    projects.setLinesVisible(true);
    projects.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            selectionListener.widgetSelected(e);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            selectionListener.widgetDefaultSelected(e);
        }
    });
    tableViewer = new CheckboxTableViewer(projects);
    tableViewer.setUseHashlookup(true);
    // Project
    TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.LEFT);
    TableColumn tableCol = tableViewerColumn.getColumn();
    layout.setColumnData(tableCol, new ColumnWeightData(60, 100, true));
    tableCol.setText(Messages.project1);
    // Repository
    tableViewerColumn = new TableViewerColumn(tableViewer, SWT.LEFT);
    tableCol = tableViewerColumn.getColumn();
    layout.setColumnData(tableCol, new ColumnWeightData(26, 80, true));
    tableCol.setText(Messages.repository);
    tableViewerColumn.setEditingSupport(new InlineComboEditingSupport(tableViewer));
    // Bundles
    tableViewerColumn = new TableViewerColumn(tableViewer, SWT.CENTER);
    tableCol = tableViewerColumn.getColumn();
    layout.setColumnData(tableCol, new ColumnWeightData(14, 35, true));
    tableCol.setText(Messages.bundles);
    contentProvider = new ContentProvider();
    tableViewer.setContentProvider(contentProvider);
    tableViewer.setLabelProvider(new TableLabelProvider());
    tableViewer.setColumnProperties(columnNames);
    tableViewer.setCheckStateProvider(new ICheckStateProvider() {

        @Override
        public boolean isGrayed(Object element) {
            return false;
        }

        @Override
        public boolean isChecked(Object element) {
            ProjectDiff diff = (ProjectDiff) element;
            return diff.isRelease();
        }
    });
    projects.pack();
    TableSortingEnabler.applyTableColumnSorting(tableViewer);
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) Table(org.eclipse.swt.widgets.Table) ProjectDiff(bndtools.release.ProjectDiff) Composite(org.eclipse.swt.widgets.Composite) ICheckStateProvider(org.eclipse.jface.viewers.ICheckStateProvider) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) IColumnContentProvider(bndtools.release.ui.TableSortingEnabler.IColumnContentProvider) ITableLabelProvider(org.eclipse.jface.viewers.ITableLabelProvider) TableColumn(org.eclipse.swt.widgets.TableColumn) TableColumnLayout(org.eclipse.jface.layout.TableColumnLayout) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 2 with ProjectDiff

use of bndtools.release.ProjectDiff in project bndtools by bndtools.

the class WorkspaceReleaseDialog method widgetSelected.

@Override
public void widgetSelected(SelectionEvent e) {
    if (e.item == null || e.item.isDisposed()) {
        return;
    }
    ProjectDiff projectDiff = (ProjectDiff) ((TableItem) e.item).getData();
    if (projectDiff != null) {
        if (e.detail > 0) {
            int checkedIndex = -1;
            TableItem[] items = projectListControl.getTable().getItems();
            for (int i = 0; i < items.length; i++) {
                if (items[i] == e.item) {
                    checkedIndex = i;
                    break;
                }
            }
            TableItem ti = projectListControl.getTable().getItem(checkedIndex);
            boolean checked = ti.getChecked();
            projectDiff.setRelease(checked);
            if (checkedIndex > -1) {
                projectListControl.getTable().deselectAll();
                projectListControl.setSelected(checkedIndex);
            }
        }
        bundleRelease.setInput(projectDiff.getBaselines());
        bundleRelease.setVisible(true);
    } else {
        bundleRelease.setVisible(false);
    }
}
Also used : ProjectDiff(bndtools.release.ProjectDiff) TableItem(org.eclipse.swt.widgets.TableItem) Point(org.eclipse.swt.graphics.Point)

Example 3 with ProjectDiff

use of bndtools.release.ProjectDiff in project bndtools by bndtools.

the class WorkspaceReleaseDialog method setSelected.

public void setSelected(int index) {
    ProjectDiff projectDiff = null;
    if (projectDiffs.size() > 0) {
        projectListControl.setSelected(index);
        projectDiff = projectDiffs.get(index);
    }
    if (projectDiff != null) {
        bundleRelease.setInput(projectDiff.getBaselines());
        bundleRelease.setVisible(true);
    } else {
        bundleRelease.setVisible(false);
    }
}
Also used : ProjectDiff(bndtools.release.ProjectDiff)

Example 4 with ProjectDiff

use of bndtools.release.ProjectDiff 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() {

        @Override
        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)

Example 5 with ProjectDiff

use of bndtools.release.ProjectDiff in project bndtools by bndtools.

the class WorkspaceReleaseDialog method okPressed.

@Override
protected void okPressed() {
    if (bundleRelease.getReleaseOption() == null) {
        for (ProjectDiff diff : projectDiffs) {
            if (diff.isRelease()) {
                Activator.message(Messages.releaseOptionMustBeSpecified);
                return;
            }
        }
    }
    releaseOption = bundleRelease.getReleaseOption();
    if (releaseOption != ReleaseOption.RELEASE) {
        // Find bundles with macros as Bundle-Version:
        List<MacroInfo> bsns = ReleaseHelper.getBsnsWithBundleVersionMacro(projectDiffs);
        if (bsns.size() > 0) {
            StringBuilder sb = new StringBuilder();
            sb.append(Messages.macrosWillBeOverwritten1);
            sb.append("\n\n");
            for (MacroInfo info : bsns) {
                sb.append("\t");
                sb.append(info.projectDiff.getProject().getName());
                if (!info.projectDiff.getProject().getName().equals(info.bsn)) {
                    sb.append(" (");
                    sb.append(info.bsn);
                    sb.append(")");
                }
                sb.append("    ");
                sb.append(info.macro);
                sb.append("\n");
            }
            sb.append("\n");
            sb.append(Messages.macrosWillBeOverwritten2);
            if (!Activator.confirmationMessage(sb.toString())) {
                return;
            }
        }
    }
    super.okPressed();
}
Also used : ProjectDiff(bndtools.release.ProjectDiff) MacroInfo(bndtools.release.ReleaseHelper.MacroInfo)

Aggregations

ProjectDiff (bndtools.release.ProjectDiff)5 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 GridData (org.eclipse.swt.layout.GridData)2 Composite (org.eclipse.swt.widgets.Composite)2 MacroInfo (bndtools.release.ReleaseHelper.MacroInfo)1 IColumnContentProvider (bndtools.release.ui.TableSortingEnabler.IColumnContentProvider)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 FilterPanelPart (org.bndtools.utils.swt.FilterPanelPart)1 TableColumnLayout (org.eclipse.jface.layout.TableColumnLayout)1 CheckboxTableViewer (org.eclipse.jface.viewers.CheckboxTableViewer)1 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)1 ICheckStateProvider (org.eclipse.jface.viewers.ICheckStateProvider)1 IStructuredContentProvider (org.eclipse.jface.viewers.IStructuredContentProvider)1 ITableLabelProvider (org.eclipse.jface.viewers.ITableLabelProvider)1 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 Point (org.eclipse.swt.graphics.Point)1 GridLayout (org.eclipse.swt.layout.GridLayout)1