Search in sources :

Example 1 with SharedScrolledComposite

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;
}
Also used : SharedScrolledComposite(org.eclipse.ui.forms.widgets.SharedScrolledComposite) GridLayout(org.eclipse.swt.layout.GridLayout) CompositeValidator(org.springsource.ide.eclipse.commons.livexp.core.CompositeValidator) Composite(org.eclipse.swt.widgets.Composite) SharedScrolledComposite(org.eclipse.ui.forms.widgets.SharedScrolledComposite) GridData(org.eclipse.swt.layout.GridData)

Example 2 with SharedScrolledComposite

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();
    }
}
Also used : SharedScrolledComposite(org.eclipse.ui.forms.widgets.SharedScrolledComposite) GridLayout(org.eclipse.swt.layout.GridLayout) CompositeValidator(org.springsource.ide.eclipse.commons.livexp.core.CompositeValidator) PaintEvent(org.eclipse.swt.events.PaintEvent) Composite(org.eclipse.swt.widgets.Composite) SharedScrolledComposite(org.eclipse.ui.forms.widgets.SharedScrolledComposite) PaintListener(org.eclipse.swt.events.PaintListener)

Aggregations

GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 SharedScrolledComposite (org.eclipse.ui.forms.widgets.SharedScrolledComposite)2 CompositeValidator (org.springsource.ide.eclipse.commons.livexp.core.CompositeValidator)2 PaintEvent (org.eclipse.swt.events.PaintEvent)1 PaintListener (org.eclipse.swt.events.PaintListener)1 GridData (org.eclipse.swt.layout.GridData)1