use of org.eclipse.ui.forms.widgets.FormToolkit in project bndtools by bndtools.
the class BundleContentPage method createLeftPanel.
void createLeftPanel(IManagedForm mform, Composite parent) {
FormToolkit toolkit = mform.getToolkit();
GeneralInfoPart infoPart = new GeneralInfoPart(parent, toolkit, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
mform.addPart(infoPart);
privPkgsPart = new PrivatePackagesPart(parent, toolkit, Section.TITLE_BAR | Section.EXPANDED);
mform.addPart(privPkgsPart);
exportPatternListPart = new ExportPatternsListPart(parent, toolkit, Section.TITLE_BAR | Section.EXPANDED);
mform.addPart(exportPatternListPart);
// LAYOUT
GridData gd;
GridLayout layout;
layout = new GridLayout(1, false);
parent.setLayout(layout);
gd = new GridData(SWT.FILL, SWT.FILL, true, false);
infoPart.getSection().setLayoutData(gd);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
privPkgsPart.getSection().setLayoutData(gd);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
exportPatternListPart.getSection().setLayoutData(gd);
}
use of org.eclipse.ui.forms.widgets.FormToolkit in project bndtools by bndtools.
the class ResolutionSuccessPanel method createControl.
public void createControl(Composite parent) {
FormToolkit toolkit = new FormToolkit(parent.getDisplay());
composite = toolkit.createComposite(parent);
GridLayout layout = new GridLayout(1, false);
composite.setLayout(layout);
SashForm form = new SashForm(composite, SWT.VERTICAL);
form.setLayout(new GridLayout(1, false));
form.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
GridData gd;
Section sectRequired = toolkit.createSection(form, Section.TITLE_BAR | Section.EXPANDED);
sectRequired.setText("Required Resources");
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.widthHint = 200;
gd.heightHint = 150;
sectRequired.setLayoutData(gd);
Table tblRequired = toolkit.createTable(sectRequired, SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
sectRequired.setClient(tblRequired);
requiredViewer = new TableViewer(tblRequired);
requiredViewer.setContentProvider(ArrayContentProvider.getInstance());
requiredViewer.setLabelProvider(new ResourceLabelProvider());
requiredViewer.setSorter(new BundleSorter());
requiredViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection sel = (IStructuredSelection) event.getSelection();
Resource resource = (Resource) sel.getFirstElement();
reasonsContentProvider.setOptional(false);
if (result != null)
reasonsContentProvider.setResolution(result.getResourceWirings());
reasonsViewer.setInput(resource);
reasonsViewer.expandToLevel(2);
}
});
sectOptional = toolkit.createSection(form, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
sectOptional.setText("Optional Resources");
Composite cmpOptional = toolkit.createComposite(sectOptional);
sectOptional.setClient(cmpOptional);
cmpOptional.setLayout(new GridLayout(2, false));
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.widthHint = 200;
gd.heightHint = 150;
sectOptional.setLayoutData(gd);
Table tblOptional = toolkit.createTable(cmpOptional, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
tblOptional.setLayoutData(gd);
optionalViewer = new CheckboxTableViewer(tblOptional);
optionalViewer.setContentProvider(ArrayContentProvider.getInstance());
optionalViewer.setLabelProvider(new ResourceLabelProvider());
optionalViewer.setSorter(new BundleSorter());
optionalViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection sel = (IStructuredSelection) event.getSelection();
doOptionalReasonUpdate((Resource) sel.getFirstElement());
}
});
optionalViewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
Resource resource = (Resource) event.getElement();
if (!addedOptionals.containsKey(resource)) {
if (event.getChecked()) {
checkedOptional.add(resource);
} else {
checkedOptional.remove(resource);
}
}
presenter.updateButtons();
updateResolveOptionalButton();
optionalViewer.setSelection(new ISelection() {
@Override
public boolean isEmpty() {
return true;
}
});
doOptionalReasonUpdate(resource);
}
});
Composite cmpOptionalButtons = toolkit.createComposite(cmpOptional);
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 = toolkit.createButton(cmpOptionalButtons, "Update and Resolve", SWT.NONE);
btnAddResolveOptional.setEnabled(false);
btnAddResolveOptional.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doAddResolve();
}
});
btnAddResolveOptional.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false));
Button btnAllOptional = toolkit.createButton(cmpOptionalButtons, "Select All", SWT.NONE);
btnAllOptional.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
optionalViewer.setAllChecked(true);
checkedOptional.clear();
for (Object object : optionalViewer.getCheckedElements()) {
if (!addedOptionals.containsKey(object)) {
checkedOptional.add((Resource) object);
}
}
presenter.updateButtons();
updateResolveOptionalButton();
}
});
btnAllOptional.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
Button btnClearOptional = toolkit.createButton(cmpOptionalButtons, "Clear All", SWT.NONE);
btnClearOptional.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
optionalViewer.setAllChecked(false);
checkedOptional.clear();
presenter.updateButtons();
updateResolveOptionalButton();
}
});
btnClearOptional.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
Section sectReason = toolkit.createSection(form, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
sectReason.setText("Reasons");
Tree tblReasons = new Tree(sectReason, SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
sectReason.setClient(tblReasons);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.widthHint = 200;
gd.heightHint = 150;
sectReason.setLayoutData(gd);
reasonsViewer = new TreeViewer(tblReasons);
reasonsViewer.setContentProvider(reasonsContentProvider);
reasonsViewer.setLabelProvider(new ResolutionTreeLabelProvider());
}
Aggregations