plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/NewWrtAppTemplatePage.java
author Eugene Ostroukhov <eugeneo@symbian.org>
Mon, 23 Aug 2010 17:20:11 -0700
changeset 474 e2f461f0a9e0
child 475 77edd0cbdfe0
permissions -rw-r--r--
All templates are ported to a new framework
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
474
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     1
/**
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     2
 * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     3
 * All rights reserved.
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     8
 *
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     9
 * Initial Contributors:
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    10
 * Symbian Foundation - initial contribution.
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    11
 * Contributors:
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    12
 * Description:
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    13
 * Overview:
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    14
 * Details:
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    15
 * Platforms/Drives/Compatibility:
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    16
 * Assumptions/Requirement/Pre-requisites:
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    17
 * Failures and causes:
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    18
 */
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    19
package org.symbian.tools.wrttools.wizards;
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    20
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    21
import org.eclipse.core.databinding.observable.value.IObservableValue;
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    22
import org.eclipse.jface.databinding.swt.SWTObservables;
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    23
import org.eclipse.jface.databinding.wizard.WizardPageSupport;
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    24
import org.eclipse.swt.SWT;
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    25
import org.eclipse.swt.layout.GridLayout;
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    26
import org.eclipse.swt.widgets.Button;
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    27
import org.eclipse.swt.widgets.Composite;
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    28
import org.symbian.tools.tmw.ui.project.AbstractNewApplicationWizardPage;
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    29
import org.symbian.tools.tmw.ui.project.IProjectTemplate;
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    30
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    31
/**
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    32
 * Entry for the basic template parameters.
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    33
 * 
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    34
 * @author Eugene Ostroukhov (eugeneo@symbian.org)
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    35
 */
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    36
public class NewWrtAppTemplatePage extends AbstractNewApplicationWizardPage {
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    37
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    38
    public NewWrtAppTemplatePage() {
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    39
        this("WRTApplicationFiles", "Application Files", "Specify application file names");
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    40
    }
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    41
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    42
    protected NewWrtAppTemplatePage(String name, String title, String description) {
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    43
        super(name, title, description);
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    44
    }
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    45
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    46
    public final void createControl(Composite parent) {
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    47
        Composite root = new Composite(parent, SWT.NONE);
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    48
        WizardPageSupport.create(this, bindingContext);
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    49
        root.setLayout(new GridLayout(2, false));
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    50
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    51
        createLabel(root, "Name of main HTML:");
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    52
        createText(root, IProjectTemplate.CommonKeys.main_html, "HTML file name", bindingContext);
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    53
        createLabel(root, "");
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    54
        createLabel(root, "");
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    55
        createLabel(root, "Name of CSS file:");
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    56
        createText(root, IProjectTemplate.CommonKeys.main_css, "CSS file name", bindingContext);
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    57
        createLabel(root, "");
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    58
        createLabel(root, "");
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    59
        createLabel(root, "Name of JavaScript file:");
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    60
        createText(root, IProjectTemplate.CommonKeys.main_js, "JavaScript file name", bindingContext);
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    61
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    62
        createLabel(root, "");
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    63
        Button homeScreen = new Button(root, SWT.CHECK);
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    64
        homeScreen.setText("Enable HomeScreen");
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    65
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    66
        createLabel(root, "");
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    67
        createLabel(root, "");
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    68
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    69
        IObservableValue view = SWTObservables.observeSelection(homeScreen);
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    70
        IObservableValue model = context.getParameterObservable(WizardContext.HOME_SCREEN);
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    71
        bindingContext.bindValue(view, model);
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    72
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    73
        addTemplateControls(root);
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    74
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    75
        setControl(root);
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    76
    }
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    77
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    78
    protected void addTemplateControls(Composite root) {
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    79
        // Subclasses may override
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    80
    }
e2f461f0a9e0 All templates are ported to a new framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    81
}