org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/NewFlickrApplicationWizardPage.java
author Eugene Ostroukhov <eugeneo@symbian.org>
Mon, 16 Aug 2010 16:23:25 -0700
changeset 465 87920e15f8eb
permissions -rw-r--r--
Added a way to contribute wizard pages for templates
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
465
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     1
/**
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     2
 * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     3
 * All rights reserved.
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     8
 *
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     9
 * Initial Contributors:
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    10
 * Symbian Foundation - initial contribution.
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    11
 * Contributors:
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    12
 * Description:
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    13
 * Overview:
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    14
 * Details:
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    15
 * Platforms/Drives/Compatibility:
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    16
 * Assumptions/Requirement/Pre-requisites:
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    17
 * Failures and causes:
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    18
 */
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    19
package org.symbian.tools.wrttools.wizards;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    20
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    21
import java.text.MessageFormat;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    22
import java.util.Collection;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    23
import java.util.LinkedList;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    24
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    25
import org.eclipse.core.databinding.Binding;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    26
import org.eclipse.core.databinding.DataBindingContext;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    27
import org.eclipse.core.databinding.UpdateValueStrategy;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    28
import org.eclipse.core.databinding.observable.value.IObservableValue;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    29
import org.eclipse.core.databinding.validation.IValidator;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    30
import org.eclipse.core.runtime.IStatus;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    31
import org.eclipse.core.runtime.Status;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    32
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    33
import org.eclipse.jface.databinding.swt.SWTObservables;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    34
import org.eclipse.jface.databinding.wizard.WizardPageSupport;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    35
import org.eclipse.jface.wizard.WizardPage;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    36
import org.eclipse.swt.SWT;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    37
import org.eclipse.swt.layout.GridData;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    38
import org.eclipse.swt.layout.GridLayout;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    39
import org.eclipse.swt.widgets.Button;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    40
import org.eclipse.swt.widgets.Composite;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    41
import org.eclipse.swt.widgets.Label;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    42
import org.eclipse.swt.widgets.Text;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    43
import org.symbian.tools.tmw.ui.project.INewApplicationWizardPage;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    44
import org.symbian.tools.tmw.ui.project.IProjectTemplate;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    45
import org.symbian.tools.tmw.ui.project.IProjectTemplateContext;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    46
import org.symbian.tools.wrttools.Activator;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    47
import org.symbian.tools.wrttools.util.CompoundValidator;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    48
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    49
public class NewFlickrApplicationWizardPage extends WizardPage implements INewApplicationWizardPage {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    50
    private static class NonEmptyStringValidator implements IValidator {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    51
        private final String propertyName;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    52
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    53
        public NonEmptyStringValidator(String propertyName) {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    54
            this.propertyName = propertyName;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    55
        }
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    56
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    57
        public IStatus validate(Object value) {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    58
            if (value == null || value.toString().trim().length() == 0) {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    59
                return new Status(IStatus.ERROR, Activator.PLUGIN_ID, MessageFormat.format("Field {0} is empty",
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    60
                        propertyName));
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    61
            }
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    62
            return Status.OK_STATUS;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    63
        }
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    64
    }
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    65
    private DataBindingContext bindingContext;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    66
    private final Collection<Binding> bindings = new LinkedList<Binding>();
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    67
    private IProjectTemplateContext context;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    68
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    69
    public NewFlickrApplicationWizardPage() {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    70
        super("FlickrFiles");
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    71
        setTitle("Application Files");
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    72
        setDescription("Specify application file names");
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    73
    }
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    74
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    75
    protected void addTemplateControls(Composite root) {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    76
        createLabel(root, "Flickr URL:");
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    77
        createText(root, "flickrUrl", "Flickr URL", bindingContext);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    78
        createLabel(root, "");
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    79
        createLabel(root, "");
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    80
    }
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    81
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    82
    public void createControl(Composite parent) {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    83
        Composite root = new Composite(parent, SWT.NONE);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    84
        WizardPageSupport.create(this, bindingContext);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    85
        root.setLayout(new GridLayout(2, false));
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    86
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    87
        createLabel(root, "Name of main HTML:");
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    88
        createText(root, IProjectTemplate.CommonKeys.main_html, "HTML file name", bindingContext);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    89
        createLabel(root, "");
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    90
        createLabel(root, "");
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    91
        createLabel(root, "Name of CSS file:");
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    92
        createText(root, IProjectTemplate.CommonKeys.main_css, "CSS file name", bindingContext);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    93
        createLabel(root, "");
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    94
        createLabel(root, "");
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    95
        createLabel(root, "Name of JavaScript file:");
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    96
        createText(root, IProjectTemplate.CommonKeys.main_js, "JavaScript file name", bindingContext);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    97
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    98
        createLabel(root, "");
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    99
        Button homeScreen = new Button(root, SWT.CHECK);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   100
        homeScreen.setText("Enable HomeScreen");
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   101
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   102
        createLabel(root, "");
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   103
        createLabel(root, "");
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   104
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   105
        IObservableValue view = SWTObservables.observeSelection(homeScreen);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   106
        IObservableValue model = context.getParameterObservable(WizardContext.HOME_SCREEN);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   107
        bindingContext.bindValue(view, model);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   108
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   109
        addTemplateControls(root);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   110
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   111
        setControl(root);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   112
    }
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   113
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   114
    protected void createLabel(Composite root, String text) {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   115
        Label label = new Label(root, SWT.NONE);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   116
        label.setText(text);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   117
    }
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   118
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   119
    protected Text createText(Composite root, String property, String propertyName, DataBindingContext bindingContext,
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   120
            IValidator... validators) {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   121
        Text text = new Text(root, SWT.BORDER);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   122
        text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   123
        ISWTObservableValue view = SWTObservables.observeText(text, SWT.Modify);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   124
        UpdateValueStrategy strategy = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   125
        NonEmptyStringValidator validator = new NonEmptyStringValidator(propertyName);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   126
        strategy.setBeforeSetValidator(validators.length == 0 ? validator
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   127
                : new CompoundValidator(validator, validators));
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   128
        bindings.add(bindingContext.bindValue(view, context.getParameterObservable(property), strategy, null));
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   129
        return text;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   130
    }
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   131
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   132
    public void init(IProjectTemplateContext context, DataBindingContext bindingContext) {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   133
        this.context = context;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   134
        this.bindingContext = bindingContext;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   135
    }
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   136
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   137
    public void remove() {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   138
        for (Binding binding : bindings) {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   139
            bindingContext.removeBinding(binding);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   140
        }
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   141
    }
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   142
}