updateUi();
}
private Control createResultsTabControl(Composite parent) {
SashHighlightForm sashForm = new SashHighlightForm(parent, SWT.VERTICAL);
sashForm.setSashWidth(6);
ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
Color sashColor = colorRegistry.get("org.eclipse.ui.workbench.ACTIVE_TAB_HIGHLIGHT_START");
sashForm.setSashBackground(sashColor);
sashForm.setSashForeground(sashColor);
Composite cmpRequired = new Composite(sashForm, SWT.NONE);
cmpRequired.setLayout(new GridLayout(2, false));
Label lblRequired = new Label(cmpRequired, SWT.NONE);
lblRequired.setText("Required Resources");
ToolBar requiredToolbar = new ToolBar(cmpRequired, SWT.FLAT | SWT.HORIZONTAL);
requiredToolbar.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, false));
requiredMaximiser = new SashFormPanelMaximiser(sashForm);
requiredMaximiser.createToolItem(cmpRequired, requiredToolbar);
Table tblRequired = new Table(cmpRequired, SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL);
GridData gd_tblRequired = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
gd_tblRequired.minimumHeight = 50;
gd_tblRequired.heightHint = 100;
tblRequired.setLayoutData(gd_tblRequired);
requiredViewer = new TableViewer(tblRequired);
requiredViewer.setContentProvider(ArrayContentProvider.getInstance());
requiredViewer.setLabelProvider(new ResourceLabelProvider());
requiredViewer.setSorter(new BundleSorter());
requiredViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection sel = (IStructuredSelection) event.getSelection();
Resource resource = (Resource) sel.getFirstElement();
reasonsContentProvider.setOptional(false);
reasonsContentProvider.setResolution(result.getResourceWirings());
reasonsViewer.setInput(resource);
reasonsViewer.expandToLevel(2);
}
});
Composite cmpOptional = new Composite(sashForm, SWT.NONE);
cmpOptional.setLayout(new GridLayout(2, false));
Label lblOptional = new Label(cmpOptional, SWT.NONE);
lblOptional.setText("Optional Resources");
lblOptional.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
ToolBar optionalToolbar = new ToolBar(cmpOptional, SWT.FLAT | SWT.HORIZONTAL);
optionalToolbar.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, false));
optionalMaximiser = new SashFormPanelMaximiser(sashForm);
optionalMaximiser.createToolItem(cmpOptional, optionalToolbar);
Table tblOptional = new Table(cmpOptional, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION | SWT.H_SCROLL);
tblOptional.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
optionalViewer = new CheckboxTableViewer(tblOptional);
optionalViewer.setContentProvider(ArrayContentProvider.getInstance());
optionalViewer.setLabelProvider(new ResourceLabelProvider());
optionalViewer.setSorter(new BundleSorter());
optionalViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
Resource resource = (Resource) event.getElement();
if (event.getChecked()) {
checkedOptional.add(resource);
} else {
checkedOptional.remove(resource);
}
updateUi();
}
});
Composite cmpOptionalButtons = new Composite(cmpOptional, SWT.NONE);
cmpOptionalButtons.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
GridLayout gl_cmpOptionalButtons = new GridLayout(3, false);
gl_cmpOptionalButtons.marginHeight = 0;
gl_cmpOptionalButtons.marginWidth = 0;
cmpOptionalButtons.setLayout(gl_cmpOptionalButtons);
btnAddResolveOptional = new Button(cmpOptionalButtons, SWT.NONE);
btnAddResolveOptional.setEnabled(false);
btnAddResolveOptional.setText("Add and Resolve");
btnAddResolveOptional.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doAddResolve();
}
});
btnAddResolveOptional.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false));
Button btnAllOptional = new Button(cmpOptionalButtons, SWT.NONE);
btnAllOptional.setText("Select All");
btnAllOptional.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
/*
* TODO checkedOptional.clear(); if (result != null) checkedOptional.addAll(result.getOptional());
* optionalViewer.setCheckedElements(checkedOptional.toArray()); updateUi();
*/
}
});
btnAllOptional.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
Button btnClearOptional = new Button(cmpOptionalButtons, SWT.NONE);
btnClearOptional.setText("Clear All");
btnClearOptional.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
checkedOptional.clear();
optionalViewer.setCheckedElements(checkedOptional.toArray());
updateUi();
}
});
btnClearOptional.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
Composite cmpReason = new Composite(sashForm, SWT.NONE);
Label lblReason = new Label(cmpReason, SWT.NONE);
lblReason.setText("Reasons");
cmpReason.setLayout(new GridLayout(1, false));
Tree tblReasons = new Tree(cmpReason, SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL);
tblReasons.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
reasonsViewer = new TreeViewer(tblReasons);
reasonsViewer.setContentProvider(reasonsContentProvider);
reasonsViewer.setLabelProvider(new ResolutionTreeLabelProvider());
sashForm.setWeights(new int[] {
3, 3, 1
});
return sashForm;
}