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);
}
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);
}
}
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);
}
}
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();
}
});
}
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();
}
Aggregations