Example usage for org.eclipse.jface.databinding.dialog DialogPageSupport create

List of usage examples for org.eclipse.jface.databinding.dialog DialogPageSupport create

Introduction

In this page you can find the example usage for org.eclipse.jface.databinding.dialog DialogPageSupport create.

Prototype

public static DialogPageSupport create(DialogPage dialogPage, DataBindingContext dbc) 

Source Link

Document

Connect the validation result from the given data binding context to the given dialog page.

Usage

From source file:org.eclipse.mylyn.commons.repositories.ui.RepositoryLocationPart.java

License:Open Source License

public Control createContents(Composite parent) {
    bindingContext = new DataBindingContext();
    WizardPage wizardPage = getContainer(WizardPage.class);
    if (wizardPage != null) {
        WizardPageSupport.create(wizardPage, bindingContext);
    } else {//  w  w w .j  av  a 2s. com
        DialogPage page = getContainer(DialogPage.class);
        if (page != null) {
            DialogPageSupport.create(page, bindingContext);
        }
    }
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayoutFactory.swtDefaults().numColumns(3).applyTo(composite);

    createServerSection(composite);
    createUserSection(composite);

    Control control = createAdditionalContents(composite);
    if (control != null) {
        int minHeight = control.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
        GridDataFactory.fillDefaults().grab(true, true).minSize(SWT.DEFAULT, minHeight).span(3, 1)
                .applyTo(control);
    }

    if (needsHttpAuth() || needsCertificateAuth() || needsProxy() || needsAdditionalSections()) {
        final ResizingSectionComposite sectionComposite = new ResizingSectionComposite(composite, SWT.NONE);
        composite.addListener(SWT.Resize, new Listener() {
            public void handleEvent(Event event) {
                sectionComposite.updateLayout();
            }
        });
        GridDataFactory.fillDefaults().grab(true, true).span(3, 1).applyTo(sectionComposite);

        if (needsHttpAuth()) {
            createHttpAuthSection(sectionComposite);
        }
        if (needsCertificateAuth()) {
            createCertificateAuthSection(sectionComposite);
        }
        if (needsProxy()) {
            createProxySection(sectionComposite);
        }
        createSections(sectionComposite);
    }

    //      Button validateButton = new Button(composite, SWT.PUSH);
    //      validateButton.setText("Validate");
    //      validateButton.addSelectionListener(new SelectionAdapter() {
    //         @Override
    //         public void widgetSelected(SelectionEvent e) {
    //            validate();
    //         }
    //      });

    return composite;
}

From source file:org.eclipse.mylyn.commons.ui.team.RepositoryLocationPart.java

License:Open Source License

public Control createContents(Composite parent) {
    bindingContext = new DataBindingContext();
    WizardPage wizardPage = getContainer(WizardPage.class);
    if (wizardPage != null) {
        WizardPageSupport.create(wizardPage, bindingContext);
    } else {//from  w ww  .  j a va  2s  . c  om
        DialogPage page = getContainer(DialogPage.class);
        if (page != null) {
            DialogPageSupport.create(page, bindingContext);
        }
    }
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayoutFactory.swtDefaults().numColumns(3).applyTo(composite);

    //      Composite this = new Composite(parent, SWT.NULL);
    //      Layout layout = new FillLayout();
    //      this.setLayout(layout);

    createServerSection(composite);
    createUserSection(composite);

    Control control = createAdditionalContents(composite);
    if (control != null) {
        GridDataFactory.fillDefaults().grab(true, true).span(3, 1).applyTo(control);
    }

    if (needsHttpAuth() || needsProxy() || needsAdditionalSections()) {
        SectionComposite sectionComposite = new SectionComposite(composite, SWT.NONE);
        GridDataFactory.fillDefaults().grab(true, true).span(3, 1).applyTo(sectionComposite);

        if (needsHttpAuth()) {
            createHttpAuthSection(sectionComposite);
        }
        if (needsProxy()) {
            createProxySection(sectionComposite);
        }
        createSections(sectionComposite);
    }

    //      Button validateButton = new Button(composite, SWT.PUSH);
    //      validateButton.setText("Validate");
    //      validateButton.addSelectionListener(new SelectionAdapter() {
    //         @Override
    //         public void widgetSelected(SelectionEvent e) {
    //            validate();
    //         }
    //      });

    return composite;
}