Example usage for org.eclipse.jface.databinding.wizard WizardPageSupport create

List of usage examples for org.eclipse.jface.databinding.wizard WizardPageSupport create

Introduction

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

Prototype

public static WizardPageSupport create(WizardPage wizardPage, DataBindingContext dbc) 

Source Link

Document

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

Usage

From source file:com.ebmwebsourcing.petals.services.su.wizards.pages.SimpleFeatureListSuWizardPage.java

License:Open Source License

@Override
public void createControl(Composite parent) {
    this.dbc = new DataBindingContext();
    WizardPageSupport.create(this, this.dbc);

    Composite container = new Composite(parent, SWT.NONE);
    GridLayoutFactory.swtDefaults().numColumns(2).extendedMargins(15, 15, 20, 0).applyTo(container);
    setControl(container);//from   w  w  w . j a v a  2  s  .  co m

    EObjectUIHelper.generateWidgets(getNewlyCreatedEndpoint(), new FormToolkit(getShell().getDisplay()),
            container, null, this.dbc, false, this.features);
}

From source file:de.walware.statet.r.internal.ui.wizards.RPkgProjectWizardPage.java

License:Open Source License

@Override
public void createControl(final Composite parent) {
    initializeDialogUnits(parent);/* w w w .  j  a  v  a 2s.  c  o  m*/

    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(LayoutUtil.createContentGrid(1));

    {
        final Composite group = createRPkgGroup(composite);
        group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    }

    Dialog.applyDialogFont(composite);
    setControl(composite);

    final Realm realm = Realm.getDefault();
    fDbc = new DataBindingContext(realm);
    addBindings(fDbc, realm);
    WizardPageSupport.create(this, fDbc);
}

From source file:gov.redhawk.frontend.ui.wizard.ListenerAllocationWizardPage.java

License:Open Source License

@Override
public void createControl(Composite parent) {
    Composite comp = new Composite(parent, SWT.NONE);
    createGroupControls(comp);//w  w  w.ja v a2s . co  m
    setControl(comp);

    setTitle("Listener Allocation");
    setDescription("Change the Allocation ID if desired.");
    this.uuid = UUID.randomUUID();
    initializeListenerAllocationStruct();
    context = new EMFDataBindingContext();
    addBindings();
    WizardPageSupport.create(this, context);
}

From source file:gov.redhawk.frontend.ui.wizard.TunerAllocationWizardPage.java

License:Open Source License

@Override
public void createControl(Composite parent) {
    Composite comp = new Composite(parent, SWT.NONE);
    createGroupControls(comp);//w w  w  .  j  av a 2 s.  com
    setControl(comp);

    setTitle("Tuner Allocation");
    setDescription("Specify the parameters for the tuner you would like to allocate.");
    this.uuid = UUID.randomUUID();
    initializeTunerAllocationStruct();
    initializeListenerAllocationStruct();
    context = new EMFDataBindingContext();
    addBindings();
    WizardPageSupport.create(this, context);
}

From source file:gov.redhawk.ide.codegen.frontend.ui.wizard.FrontEndTunerPropsPage.java

License:Open Source License

private void createBindings() {
    DataBindingContext ctx = new DataBindingContext();
    // This is really just to get the Finish button to behave
    WizardPageSupport.create(this, ctx);

    IWizardPage[] wizPages = this.getWizard().getPages();
    ScaDeviceProjectPropertiesWizardPage propWizPage = null;

    for (IWizardPage wizPage : wizPages) {
        if (wizPage instanceof ScaDeviceProjectPropertiesWizardPage) {
            propWizPage = (ScaDeviceProjectPropertiesWizardPage) wizPage;
            break;
        }//  w  w  w.j a  v a2  s.  c om
    }

    // This must come after the creation of the page support since creation of page support updates the 
    // error message.  The WizardPageSupport doesn't update the error message because no UI elements have changed
    // so this is a bit of a hack.
    if (propWizPage != null) {
        this.validator = new FrontEndProjectValidator(propWizPage.getProjectSettings(), this);
        ctx.addValidationStatusProvider(validator);
        IObservableValue validationStatus = validator.getValidationStatus();
        validationStatus.addChangeListener(new IChangeListener() {

            @Override
            public void handleChange(ChangeEvent event) {
                if (validator != null) {
                    updateErrorMessage();
                }
            }
        });

        updateErrorMessage();
    }
}

From source file:gov.redhawk.ide.codegen.jet.java.ui.JavaJetGeneratorPropertiesWizardPage.java

License:Open Source License

private void bind() {
    for (final Binding b : this.bindings) {
        this.context.removeBinding(b);
    }/*from   w  ww.j a v  a 2  s . com*/

    this.support = WizardPageSupport.create(this, this.context);

    initFields();

    this.bindings.add(this.context.bindValue(ViewersObservables.observeSingleSelection(this.templateViewer),
            EMFObservables.observeValue(this.implSettings,
                    CodegenPackage.Literals.IMPLEMENTATION_SETTINGS__TEMPLATE),
            createTemplateTargetToModel(), createTemplateModelToTarget()));

    this.bindings.add(this.context.bindValue(SWTObservables.observeText(this.outputDirText, SWT.Modify),
            EMFObservables.observeValue(this.implSettings,
                    CodegenPackage.Literals.IMPLEMENTATION_SETTINGS__OUTPUT_DIR),
            new UpdateValueStrategy().setAfterConvertValidator(new OutputDirectoryValidator(this.softPkg)),
            null));

    this.bindings.add(this.context.bindValue(SWTObservables.observeText(this.packageNameText, SWT.Modify),
            EMFObservables.observeValue(JavaJetGeneratorPropertiesWizardPage.this.packageName,
                    CodegenPackage.Literals.PROPERTY__VALUE),
            new UpdateValueStrategy().setAfterConvertValidator(new JavaPackageNameValidator()), null));

    if ((this.implSettings.getOutputDir() == null) || "".equals(this.implSettings.getOutputDir().trim())) {
        setDefaults();
    } else {
        selectInitialTemplate(false);
    }

    final List<IPropertyDescriptor> propList = new ArrayList<IPropertyDescriptor>();
    for (final IPropertyDescriptor prop : this.selectedTemplate.getPropertyDescriptors()) {
        if (!"java_package".equals(prop.getKey())) {
            propList.add(prop);
        }
    }

    this.propertiesViewer.setInput(propList);
    this.propBinding = createPropertyBinding();
    this.bindings.add(this.propBinding);
}

From source file:gov.redhawk.ide.codegen.ui.BooleanGeneratorPropertiesWizardPage.java

License:Open Source License

private void bind() {
    for (final Binding b : this.bindings) {
        this.context.removeBinding(b);
    }/*from   w  w  w  . j ava 2  s  .  c  o  m*/

    initFields();

    this.bindings.add(this.context.bindValue(ViewersObservables.observeSingleSelection(this.templateViewer),
            EMFObservables.observeValue(this.implSettings,
                    CodegenPackage.Literals.IMPLEMENTATION_SETTINGS__TEMPLATE),
            createTemplateTargetToModel(), createTemplateModelToTarget()));

    this.bindings.add(this.context.bindValue(SWTObservables.observeText(this.outputDirText, SWT.Modify),
            EMFObservables.observeValue(this.implSettings,
                    CodegenPackage.Literals.IMPLEMENTATION_SETTINGS__OUTPUT_DIR),
            new UpdateValueStrategy().setAfterConvertValidator(new OutputDirectoryValidator(this.softPkg)),
            null));

    if (this.implSettings.getOutputDir() == null || this.implSettings.getOutputDir().trim().isEmpty()) {
        setDefaults();
    } else {
        selectInitialTemplate(false);
    }

    this.propertiesViewer.setInput(this.selectedTemplate.getPropertyDescriptors());
    this.propBinding = createPropertyBinding();
    this.bindings.add(this.propBinding);

    this.support = WizardPageSupport.create(this, this.context);
}

From source file:gov.redhawk.ide.codegen.ui.DefaultGeneratorPropertiesWizardPage.java

License:Open Source License

private void bind() {
    initFields();//from w w  w  .j av a2 s  .  co  m

    this.context.bindValue(ViewersObservables.observeSingleSelection(this.templateViewer),
            EMFObservables.observeValue(this.implSettings,
                    CodegenPackage.Literals.IMPLEMENTATION_SETTINGS__TEMPLATE),
            createTemplateTargetToModel(), createTemplateModelToTarget());

    this.context.bindValue(SWTObservables.observeText(this.outputDirText, SWT.Modify),
            EMFObservables.observeValue(this.implSettings,
                    CodegenPackage.Literals.IMPLEMENTATION_SETTINGS__OUTPUT_DIR),
            new UpdateValueStrategy().setAfterConvertValidator(new OutputDirectoryValidator(this.softPkg)),
            null);

    if ((this.implSettings.getOutputDir() == null) || "".equals(this.implSettings.getOutputDir().trim())) {
        setDefaults();
    } else {
        selectInitialTemplate(false);
    }

    this.propertiesViewer.setInput(this.implSettings);
    this.context.addValidationStatusProvider(new AllRequiredPropertiesValidator());

    this.support = WizardPageSupport.create(this, this.context);
}

From source file:gov.redhawk.ide.octave.ui.wizard.MFileSelectionWizardPage.java

License:Open Source License

private void bindValues() {
    // create new Context
    DataBindingContext ctx = new DataBindingContext();

    // Defining the Model objects as Beans
    IObservableValue primaryMFileModel = BeanProperties.value("primaryMFile").observe(this.octaveProjProps);
    IObservableValue currentDepFileModel = BeanProperties.value("currentDepFile").observe(this.octaveProjProps);
    IObservableValue hasDepsModel = BeanProperties.value("hasDeps").observe(this.octaveProjProps);

    // Defining the Target objects
    IObservableValue primaryMFileTarget = WidgetProperties.text(SWT.Modify).observe(this.primaryMFileTextBox);
    IObservableValue currentDepFileTarget = WidgetProperties.text(SWT.Modify).observe(this.dependencyTextBox);
    IObservableValue hasDepsTarget = WidgetProperties.selection().observe(this.dependencyCheckBox);

    // The target objects that need to be disabled when the hasDeps model object changes.
    IObservableValue depsTextBoxTarget = WidgetProperties.enabled().observe(this.dependencyTextBox);
    IObservableValue depsAddButtonTarget = WidgetProperties.enabled().observe(this.depsAddButton);
    IObservableValue depsBrowseButtonTarget = WidgetProperties.enabled().observe(this.depsBrowseButton);
    IObservableValue depsRemoveButtonTarget = WidgetProperties.enabled().observe(this.depsRemoveButton);
    IObservableValue depsListViewerTarget = WidgetProperties.enabled()
            .observe(this.depsListViewer.getControl());

    // Define my strategy for the Primary & Deps M-File bindings.
    UpdateValueStrategy primaryMFileUpdateStrat = new UpdateValueStrategy();
    primaryMFileUpdateStrat.setConverter(getStringToFileConverter());
    primaryMFileUpdateStrat.setAfterConvertValidator(getPrimaryMFileNameValidator());

    UpdateValueStrategy depsMFileUpdateStrat = new UpdateValueStrategy();
    depsMFileUpdateStrat.setConverter(getStringToFileConverter());
    depsMFileUpdateStrat.setAfterConvertValidator(getDepMFileNameValidator());

    // connect them
    primaryMFileBindValue = ctx.bindValue(primaryMFileTarget, primaryMFileModel, primaryMFileUpdateStrat, null);
    currentDepBindValue = ctx.bindValue(currentDepFileTarget, currentDepFileModel, depsMFileUpdateStrat, null);
    ctx.bindValue(hasDepsTarget, hasDepsModel);

    // The bindings for the disabling of the controls
    ctx.bindValue(depsTextBoxTarget, hasDepsModel, null, new UpdateValueStrategy());
    ctx.bindValue(depsAddButtonTarget, hasDepsModel, null, new UpdateValueStrategy());
    ctx.bindValue(depsBrowseButtonTarget, hasDepsModel, null, new UpdateValueStrategy());
    ctx.bindValue(depsRemoveButtonTarget, hasDepsModel, null, new UpdateValueStrategy());
    ctx.bindValue(depsListViewerTarget, hasDepsModel, null, new UpdateValueStrategy());

    // add cool control decoration
    ControlDecorationSupport.create(primaryMFileBindValue, SWT.TOP | SWT.LEFT);
    ControlDecorationSupport.create(currentDepBindValue, SWT.TOP | SWT.LEFT);

    WizardPageSupport.create(this, ctx);
}

From source file:gov.redhawk.ide.octave.ui.wizard.MFileVariableMapingWizardPage.java

License:Open Source License

private void createUIElements(Composite client) {
    client.setLayout(new GridLayout(MFileVariableMapingWizardPage.NUM_COLUMNS, false));

    final Group mFileInputsGroup = new Group(client, SWT.None);
    mFileInputsGroup.setLayout(new GridLayout(1, false));
    mFileInputsGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, true)
            .span(MFileVariableMapingWizardPage.NUM_COLUMNS, 1).create());
    mFileInputsGroup.setText("Inputs");

    final Group mFileOutputsGroup = new Group(client, SWT.None);
    mFileOutputsGroup.setLayout(new GridLayout(1, false));
    mFileOutputsGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, true)
            .span(MFileVariableMapingWizardPage.NUM_COLUMNS, 1).create());
    mFileOutputsGroup.setText("Outputs");

    createOctaveTable(mFileInputsGroup, "functionInputs");
    createOctaveTable(mFileOutputsGroup, "functionOutputs");

    dataBindingContext.addValidationStatusProvider(new ValidationStatusProvider() {
        private IObservableList list = new WritableList();
        {/*  w w w. j  a  va  2s  .co m*/
            list.add(validationValue);
        }

        @Override
        public IObservableValue getValidationStatus() {
            return validationValue;
        }

        @Override
        public IObservableList getTargets() {
            return list;
        }

        @Override
        public IObservableList getModels() {
            return Observables.emptyObservableList();
        }
    });

    WizardPageSupport.create(this, this.dataBindingContext);

    this.setControl(client);
}