use of org.eclipse.ui.forms.widgets.SharedScrolledComposite in project eclipse-integration-commons by spring-projects.
the class DialogWithSections method createDialogArea.
protected Control createDialogArea(Composite parent) {
// readSettings();
scroller = new SharedScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL) {
};
scroller.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
// GridDataFactory.fillDefaults()/*.grab(true, true)*/.applyTo(scroller);
// scroller.setWidthHint(500); // Avoid excessively wide dialogs
// Display display = Display.getCurrent();
// Color blue = display.getSystemColor(SWT.COLOR_BLUE);
// scroller.setBackground(blue);
scroller.setExpandHorizontal(true);
scroller.setExpandVertical(true);
Composite page = new Composite(scroller, SWT.NONE);
applyDialogFont(page);
GridLayout layout = new GridLayout(1, false);
layout.marginHeight = 12;
layout.marginWidth = 12;
page.setLayout(layout);
validator = new CompositeValidator();
for (PageSection section : getSections()) {
section.createContents(page);
validator.addChild(section.getValidator());
}
validator.addListener(this);
page.pack(true);
scroller.setContent(page);
return parent;
}
use of org.eclipse.ui.forms.widgets.SharedScrolledComposite in project eclipse-integration-commons by spring-projects.
the class WizardPageWithSections method createControl.
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl(Composite parent) {
GridDataFactory.fillDefaults().grab(true, true).applyTo(parent);
scroller = new SharedScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL) {
};
// scroller.setWidthHint(500); // Avoid excessively wide dialogs
// Display display = Display.getCurrent();
// Color blue = display.getSystemColor(SWT.COLOR_BLUE);
// scroller.setBackground(blue);
scroller.setExpandHorizontal(true);
scroller.setExpandVertical(true);
page = new Composite(scroller, SWT.NONE);
GridLayout layout = new GridLayout(1, false);
layout.marginHeight = 12;
layout.marginWidth = 12;
page.setLayout(layout);
validator = new CompositeValidator();
for (PageSection section : getSections()) {
section.createContents(page);
validator.addChild(section.getValidator());
}
validator.addListener(this);
Dialog.applyDialogFont(page);
page.pack(true);
// scroller.setMinSize(page.getSize());
// scroller.setSize(page.getSize());
scroller.setContent(page);
setControl(scroller);
page.addPaintListener(new PaintListener() {
// This is a bit yuck. But don't know a better way to 'reflow' the page the first time
// it gets shown. And if we don't do that, then there are often layout issues.
// See for example: https://www.pivotaltracker.com/story/show/130209913
@Override
public void paintControl(PaintEvent e) {
page.removePaintListener(this);
reflow();
}
});
if (getContainer().getCurrentPage() != null) {
// Otherwise an NPE will ensue when updating buttons. Buttons depend on current page so that is logical.
getContainer().updateButtons();
getContainer().updateMessage();
}
}
Aggregations