use of org.eclipse.ui.forms.widgets.FormToolkit in project bndtools by bndtools.
the class WorkspacePage method createFormContent.
@Override
protected void createFormContent(IManagedForm managedForm) {
managedForm.setInput(model);
FormToolkit tk = managedForm.getToolkit();
ScrolledForm form = managedForm.getForm();
form.setText("Workspace Config");
tk.decorateFormHeading(form.getForm());
form.getForm().addMessageHyperlinkListener(new MessageHyperlinkAdapter(getEditor()));
// Create controls
Composite body = form.getBody();
WorkspaceMainPart linksPart = new WorkspaceMainPart(mainBuildFile, body, tk, Section.TITLE_BAR | Section.EXPANDED | Section.DESCRIPTION);
managedForm.addPart(linksPart);
PluginPathPart pluginPathPart = new PluginPathPart(body, tk, Section.TITLE_BAR | Section.EXPANDED | Section.DESCRIPTION | Section.TWISTIE);
managedForm.addPart(pluginPathPart);
pluginsPart = new PluginsPart(body, tk, Section.TITLE_BAR | Section.EXPANDED | Section.DESCRIPTION | Section.TWISTIE);
managedForm.addPart(pluginsPart);
// Layout
GridLayout layout = new GridLayout(1, false);
body.setLayout(layout);
linksPart.getSection().setLayoutData(PageLayoutUtils.createCollapsed());
pluginPathPart.getSection().setLayoutData(PageLayoutUtils.createExpanded());
pluginPathPart.getSection().addExpansionListener(new ResizeExpansionAdapter(pluginPathPart.getSection()));
pluginsPart.getSection().setLayoutData(PageLayoutUtils.createExpanded());
pluginsPart.getSection().addExpansionListener(new ResizeExpansionAdapter(pluginsPart.getSection()));
}
use of org.eclipse.ui.forms.widgets.FormToolkit in project bndtools by bndtools.
the class BundleContentPage method createRightPanel.
void createRightPanel(IManagedForm mform, final Composite parent) {
FormToolkit toolkit = mform.getToolkit();
BundleCalculatedImportsPart importsPart = new BundleCalculatedImportsPart(parent, toolkit, Section.TITLE_BAR | Section.EXPANDED);
mform.addPart(importsPart);
importPatternListPart = new ImportPatternsListPart(parent, toolkit, Section.TITLE_BAR | Section.TWISTIE);
mform.addPart(importPatternListPart);
GridLayout layout;
GridData gd;
layout = new GridLayout();
parent.setLayout(layout);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.widthHint = 100;
gd.heightHint = 200;
importsPart.getSection().setLayoutData(gd);
gd = new GridData(SWT.FILL, SWT.FILL, true, false);
importPatternListPart.getSection().setLayoutData(gd);
}
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());
}
use of org.eclipse.ui.forms.widgets.FormToolkit in project Palladio-Editors-Sirius by PalladioSimulator.
the class DescriptionBox method createControl.
public void createControl(Composite parent) {
toolkit = new FormToolkit(parent.getDisplay());
int borderStyle = toolkit.getBorderStyle() == SWT.BORDER ? SWT.NULL : SWT.BORDER;
container = new Composite(parent, borderStyle);
FillLayout flayout = new FillLayout();
flayout.marginWidth = 1;
flayout.marginHeight = 1;
container.setLayout(flayout);
formText = new ScrolledFormText(container, SWT.V_SCROLL | SWT.H_SCROLL, false);
if (borderStyle == SWT.NULL) {
formText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
toolkit.paintBordersFor(container);
}
FormText ftext = toolkit.createFormText(formText, false);
formText.setFormText(ftext);
formText.setExpandHorizontal(true);
formText.setExpandVertical(true);
formText.setBackground(toolkit.getColors().getBackground());
formText.setForeground(toolkit.getColors().getForeground());
ftext.marginWidth = 2;
ftext.marginHeight = 2;
ftext.setHyperlinkSettings(toolkit.getHyperlinkGroup());
formText.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
if (toolkit != null) {
toolkit.dispose();
toolkit = null;
}
}
});
if (text != null)
formText.setText(text);
}
Aggregations