org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/NewApplicationWizard.java
author Eugene Ostroukhov <eugeneo@symbian.org>
Mon, 16 Aug 2010 16:23:25 -0700
changeset 465 87920e15f8eb
parent 463 aea4c83725d8
child 466 129c94e78375
permissions -rw-r--r--
Added a way to contribute wizard pages for templates
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
463
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     1
/**
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     2
 * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     3
 * All rights reserved.
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     8
 *
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     9
 * Initial Contributors:
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    10
 * Symbian Foundation - initial contribution.
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    11
 * Contributors:
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    12
 * Description:
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    13
 * Overview:
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    14
 * Details:
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    15
 * Platforms/Drives/Compatibility:
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    16
 * Assumptions/Requirement/Pre-requisites:
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    17
 * Failures and causes:
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    18
 */
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    19
package org.symbian.tools.tmw.internal.ui.wizard;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    20
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    21
import java.util.Collections;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    22
import java.util.Set;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    23
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    24
import org.eclipse.core.databinding.DataBindingContext;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    25
import org.eclipse.core.runtime.IPath;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    26
import org.eclipse.jface.viewers.IStructuredSelection;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    27
import org.eclipse.jface.wizard.IWizardPage;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    28
import org.eclipse.ui.INewWizard;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    29
import org.eclipse.ui.IWorkbench;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    30
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    31
import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    32
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    33
import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    34
import org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    35
import org.symbian.tools.tmw.core.TMWCore;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    36
import org.symbian.tools.tmw.core.projects.IFProjSupport;
465
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
    37
import org.symbian.tools.tmw.ui.project.INewApplicationWizardPage;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
    38
import org.symbian.tools.tmw.ui.project.IProjectTemplate;
463
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    39
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    40
/**
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    41
 * @author Eugene Ostroukhov (eugeneo@symbian.org)
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    42
 */
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    43
public final class NewApplicationWizard extends ModifyFacetedProjectWizard implements INewWizard {
465
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
    44
    private final PageContributions contributions = new PageContributions();
463
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    45
    private final DataBindingContext databindingContext = new DataBindingContext();
465
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
    46
    private NewApplicationFacetsWizardPage facetsPage;
463
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    47
    private NewApplicationDetailsWizardPage firstPage;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    48
    private IStructuredSelection selection;
465
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
    49
    private NewApplicationTemplateWizardPage templatesPage;
463
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    50
    private final WizardContext wizardContext = new WizardContext();
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    51
    private IWorkbench workbench;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    52
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    53
    public NewApplicationWizard() {
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    54
        setShowFacetsSelectionPage(false);
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    55
    }
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    56
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    57
    public void addPages() {
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    58
        this.firstPage = createFirstPage();
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    59
        addPage(this.firstPage);
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    60
        final IFacetedProject project = getFacetedProject();
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    61
        final Set<IProjectFacetVersion> facets;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    62
        if (project == null) {
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    63
            facets = Collections.emptySet();
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    64
        } else {
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    65
            facets = project.getProjectFacets();
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    66
        }
465
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
    67
        facetsPage = new NewApplicationFacetsWizardPage(facets, getFacetedProjectWorkingCopy());
463
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    68
        addPage(facetsPage);
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    69
        templatesPage = new NewApplicationTemplateWizardPage(wizardContext, databindingContext);
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    70
        addPage(templatesPage);
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    71
        super.addPages();
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    72
    }
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    73
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    74
    public boolean canFinish() {
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    75
        return this.firstPage.isPageComplete() && super.canFinish();
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    76
    }
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    77
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    78
    protected NewApplicationDetailsWizardPage createFirstPage() {
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    79
        firstPage = new NewApplicationDetailsWizardPage(wizardContext, databindingContext);
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    80
        return firstPage;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    81
    }
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    82
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    83
    @Override
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    84
    public IWizardPage getNextPage(final IWizardPage page) {
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    85
        if (page == this.firstPage) {
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    86
            final IFacetedProjectWorkingCopy fpjwc = getFacetedProjectWorkingCopy();
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    87
            fpjwc.setProjectName(getProjectName());
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    88
            fpjwc.setProjectLocation(getProjectLocation());
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    89
            final IFProjSupport fprojSupport = TMWCore.getFProjSupport();
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    90
            IRuntime runtime = fprojSupport.getRuntime(wizardContext.getRuntime());
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    91
            fpjwc.setTargetedRuntimes(Collections.singleton(runtime));
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    92
            fpjwc.setPrimaryRuntime(runtime);
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    93
            fpjwc.setProjectFacets(fprojSupport.getFixedFacetsVersions(wizardContext.getRuntime()));
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    94
            fpjwc.setFixedProjectFacets(fprojSupport.getFixedFacets(wizardContext.getRuntime()));
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    95
            fpjwc.setProjectFacetActionConfig(fprojSupport.getTMWFacet(), wizardContext);
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    96
        }
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    97
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    98
        IWizardPage nextPage = super.getNextPage(page);
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    99
        return nextPage;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   100
    }
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   101
465
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   102
    private IProjectTemplate template = null;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   103
    private INewApplicationWizardPage[] templatePages = new INewApplicationWizardPage[0];
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   104
463
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   105
    public IWizardPage[] getPages() {
465
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   106
        final IProjectTemplate current = wizardContext.getTemplate();
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   107
        if (template != current) {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   108
            for (INewApplicationWizardPage page : templatePages) {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   109
                page.remove();
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   110
                page.dispose();
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   111
            }
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   112
            if (current == null) {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   113
                template = null;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   114
                templatePages = new INewApplicationWizardPage[0];
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   115
            } else {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   116
                template = current;
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   117
                templatePages = contributions.createPages(template.getId());
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   118
                for (INewApplicationWizardPage page : templatePages) {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   119
                    page.setWizard(this);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   120
                    page.init(wizardContext, databindingContext);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   121
                }
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   122
            }
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   123
        }
463
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   124
        final IWizardPage[] base = super.getPages();
465
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   125
        final IWizardPage[] pages = new IWizardPage[base.length + 3 + templatePages.length];
463
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   126
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   127
        pages[0] = this.firstPage;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   128
        pages[1] = this.templatesPage;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   129
        pages[2] = this.facetsPage;
465
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   130
        if (templatePages.length > 0) {
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   131
            System.arraycopy(templatePages, 0, pages, 3, templatePages.length);
87920e15f8eb Added a way to contribute wizard pages for templates
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
   132
        }
463
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   133
        System.arraycopy(base, 0, pages, 2, base.length);
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   134
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   135
        return pages;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   136
    }
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   137
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   138
    protected IPath getProjectLocation() {
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   139
        return firstPage.getLocationPath();
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   140
    }
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   141
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   142
    protected String getProjectName() {
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   143
        return wizardContext.getProjectName();
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   144
    }
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   145
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   146
    /**
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   147
     * Returns the selection that this wizard was launched from.
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   148
     * 
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   149
     * @return the selection that this wizard was launched from
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   150
     * @since 1.4
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   151
     */
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   152
    public IStructuredSelection getSelection() {
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   153
        return this.selection;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   154
    }
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   155
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   156
    /**
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   157
     * Returns the workbench that this wizard belongs to.
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   158
     * 
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   159
     * @return the workbench that this wizard belongs to
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   160
     * @since 1.4
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   161
     */
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   162
    public IWorkbench getWorkbench() {
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   163
        return this.workbench;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   164
    }
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   165
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   166
    public void init(final IWorkbench workbench, final IStructuredSelection selection) {
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   167
        this.workbench = workbench;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   168
        this.selection = selection;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   169
    }
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   170
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   171
    public boolean performFinish() {
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   172
        super.performFinish();
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   173
        return true;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   174
    }
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   175
}