org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WRTProjectDetailsWizardPage.java
author Eugene Ostroukhov <eugeneo@symbian.org>
Tue, 13 Jul 2010 15:27:46 -0700
changeset 443 c5a1d477afa1
parent 442 980aaebb8022
permissions -rw-r--r--
Bug 3223 - New project wizard does not handle a case when there is a project in the location
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
     1
/**
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
     2
 * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
     3
 * All rights reserved.
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
     8
 *
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
     9
 * Initial Contributors:
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
    10
 * Symbian Foundation - initial contribution.
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
    11
 * Contributors:
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
    12
 * Description:
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
    13
 * Overview:
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
    14
 * Details:
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
    15
 * Platforms/Drives/Compatibility:
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
    16
 * Assumptions/Requirement/Pre-requisites:
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
    17
 * Failures and causes:
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
    18
 */
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
    19
package org.symbian.tools.wrttools.wizards;
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
    20
443
c5a1d477afa1 Bug 3223 - New project wizard does not handle a case when there is a project in the location
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 442
diff changeset
    21
import java.io.File;
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    22
import java.net.URI;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    23
3
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
    24
import org.eclipse.core.databinding.DataBindingContext;
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    25
import org.eclipse.core.databinding.validation.IValidator;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    26
import org.eclipse.core.resources.IProject;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    27
import org.eclipse.core.resources.IResource;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    28
import org.eclipse.core.resources.IWorkspace;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    29
import org.eclipse.core.resources.ResourcesPlugin;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    30
import org.eclipse.core.runtime.IPath;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    31
import org.eclipse.core.runtime.IStatus;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    32
import org.eclipse.core.runtime.Path;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    33
import org.eclipse.core.runtime.Status;
3
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
    34
import org.eclipse.jface.databinding.wizard.WizardPageSupport;
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    35
import org.eclipse.jface.dialogs.Dialog;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    36
import org.eclipse.jface.wizard.WizardPage;
3
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
    37
import org.eclipse.swt.SWT;
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    38
import org.eclipse.swt.layout.GridData;
3
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
    39
import org.eclipse.swt.layout.GridLayout;
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
    40
import org.eclipse.swt.widgets.Composite;
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    41
import org.eclipse.swt.widgets.Event;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    42
import org.eclipse.swt.widgets.Label;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    43
import org.eclipse.swt.widgets.Listener;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    44
import org.eclipse.swt.widgets.Text;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    45
import org.eclipse.ui.PlatformUI;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    46
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    47
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    48
import org.eclipse.ui.internal.ide.IIDEHelpContextIds;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    49
import org.eclipse.ui.internal.ide.dialogs.ProjectContentsLocationArea;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    50
import org.eclipse.ui.internal.ide.dialogs.ProjectContentsLocationArea.IErrorMessageReporter;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    51
import org.symbian.tools.wrttools.Activator;
17
f1b0259bb410 Validation was added to new project creation wizard
Eugene Ostroukhov <eostroukhov@symbian.org>
parents: 3
diff changeset
    52
import org.symbian.tools.wrttools.util.RegexpValidator;
3
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
    53
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    54
@SuppressWarnings("restriction")
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    55
public final class WRTProjectDetailsWizardPage extends WizardPage {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    56
    public static final class ProjectNameValidator implements IValidator {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    57
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    58
        public IStatus validate(Object value) {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    59
            IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace();
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    60
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    61
            String projectFieldContents = (String) value;
441
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
    62
            IStatus nameStatus = workspace.validateName(projectFieldContents, IResource.PROJECT);
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    63
            if (!nameStatus.isOK()) {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    64
                return nameStatus;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    65
            }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    66
441
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
    67
            IProject handle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectFieldContents);
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    68
            if (handle.exists()) {
441
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
    69
                return new Status(IStatus.ERROR, Activator.PLUGIN_ID,
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    70
                        IDEWorkbenchMessages.WizardNewProjectCreationPage_projectExistsMessage);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    71
            }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    72
            return Status.OK_STATUS;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    73
        }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    74
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    75
    }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    76
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    77
    private ProjectContentsLocationArea locationArea;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    78
    private final DataBindingContext bindingContext;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    79
    private final WizardContext context;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    80
441
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
    81
    public WRTProjectDetailsWizardPage(WizardContext context, DataBindingContext bindingContext) {
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    82
        super("WRTApp");
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    83
        setImageDescriptor(null);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    84
        setTitle("Application Details");
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    85
        setDescription("Specify application details");
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    86
        this.context = context;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    87
        this.bindingContext = bindingContext;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    88
    }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    89
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    90
    public void createControl(Composite parent) {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    91
        Composite root = new Composite(parent, SWT.NONE);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    92
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    93
        initializeDialogUnits(parent);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    94
441
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
    95
        PlatformUI.getWorkbench().getHelpSystem().setHelp(root, IIDEHelpContextIds.NEW_PROJECT_WIZARD_PAGE);
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    96
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    97
        WizardPageSupport.create(this, bindingContext);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
    98
        root.setLayout(new GridLayout(2, false));
441
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
    99
        createProjectNameGroup(root);
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   100
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   101
        context.createLabel(root, "");
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   102
        context.createLabel(root, "");
441
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
   103
        context.createLabel(root, "Application identifier:");
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   104
441
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
   105
        context.createText(root, WizardContext.WIDGET_ID, "applicatoin identifier", bindingContext, null,
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
   106
                new RegexpValidator("[\\w]*(\\.\\w[\\w]*)*", "{0} is not a valid applicatoin ID", true));
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   107
        context.createLabel(root, "");
442
980aaebb8022 Bug 3192 - phonegap wizard: Contacts filter does not seem to work
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 441
diff changeset
   108
        context.createLabel(root, "This id should be unique for successful installation of application on the device");
441
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
   109
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   110
        context.createLabel(root, "");
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   111
        context.createLabel(root, "");
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   112
441
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
   113
        context.createLabel(root, "Application name:");
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
   114
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
   115
        context.createText(root, WizardContext.WIDGET_NAME, "application name", bindingContext, null,
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
   116
                new RegexpValidator("[^\\w\\. ]", "Application name cannot contain {0} character", false));
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
   117
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
   118
        context.createLabel(root, "");
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
   119
        context.createLabel(root, "This will be the application display name on the device");
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   120
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   121
        Composite composite = new Composite(root, SWT.NONE);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   122
        GridLayout gridLayout = new GridLayout(1, false);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   123
        gridLayout.marginWidth = 0;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   124
        composite.setLayout(gridLayout);
441
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
   125
        composite.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, true, 2, 1));
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   126
441
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
   127
        locationArea = new ProjectContentsLocationArea(getErrorReporter(), composite);
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
   128
        if (context.getProjectName() != null && context.getProjectName().trim().length() > 0) {
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   129
            locationArea.updateProjectName(context.getProjectName());
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   130
        }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   131
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   132
        // Scale the button based on the rest of the dialog
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   133
        setButtonLayoutData(locationArea.getBrowseButton());
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   134
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   135
        setPageComplete(validatePage());
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   136
        // Show description on opening
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   137
        setErrorMessage(null);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   138
        setMessage(null);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   139
        setControl(root);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   140
        Dialog.applyDialogFont(root);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   141
    }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   142
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   143
    /**
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   144
     * Creates the project name specification controls.
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   145
     *
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   146
     * @param parent
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   147
     *            the parent composite
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   148
     */
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   149
    private final void createProjectNameGroup(Composite parent) {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   150
        // new project label
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   151
        Label projectLabel = new Label(parent, SWT.NONE);
441
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
   152
        projectLabel.setText(IDEWorkbenchMessages.WizardNewProjectCreationPage_nameLabel);
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   153
        projectLabel.setFont(parent.getFont());
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   154
441
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
   155
        Text projectNameField = context.createText(parent, WizardContext.PROJECT_NAME, "project name", bindingContext,
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   156
                null, new ProjectNameValidator());
3
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
   157
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   158
        projectNameField.setFont(parent.getFont());
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   159
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   160
        projectNameField.addListener(SWT.Modify, nameModifyListener);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   161
    }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   162
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   163
    /**
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   164
     * Returns the current project location path as entered by the user, or its
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   165
     * anticipated initial value. Note that if the default has been returned the
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   166
     * path in a project description used to create a project should not be set.
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   167
     *
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   168
     * @return the project location path or its anticipated initial value.
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   169
     */
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   170
    public IPath getLocationPath() {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   171
        return new Path(locationArea.getProjectLocation());
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   172
    }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   173
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   174
    /**
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   175
     * /** Returns the current project location URI as entered by the user, or
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   176
     * <code>null</code> if a valid project location has not been entered.
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   177
     *
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   178
     * @return the project location URI, or <code>null</code>
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   179
     * @since 3.2
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   180
     */
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   181
    public URI getLocationURI() {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   182
        return locationArea.getProjectLocationURI();
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   183
    }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   184
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   185
    private final Listener nameModifyListener = new Listener() {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   186
        public void handleEvent(Event e) {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   187
            if (isPageComplete()) {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   188
                setLocationForSelection();
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   189
                boolean valid = validatePage();
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   190
                setPageComplete(valid);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   191
            }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   192
        }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   193
    };
3
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
   194
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   195
    /**
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   196
     * Get an error reporter for the receiver.
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   197
     *
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   198
     * @return IErrorMessageReporter
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   199
     */
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   200
    private IErrorMessageReporter getErrorReporter() {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   201
        return new IErrorMessageReporter() {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   202
            /*
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   203
             * (non-Javadoc)
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   204
             *
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   205
             * @see
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   206
             * org.eclipse.ui.internal.ide.dialogs.ProjectContentsLocationArea
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   207
             * .IErrorMessageReporter#reportError(java.lang.String)
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   208
             */
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   209
            public void reportError(String errorMessage, boolean infoOnly) {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   210
                if (infoOnly) {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   211
                    setMessage(errorMessage, IStatus.INFO);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   212
                    setErrorMessage(null);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   213
                } else {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   214
                    setErrorMessage(errorMessage);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   215
                }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   216
                boolean valid = errorMessage == null;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   217
                if (valid) {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   218
                    valid = validatePage();
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   219
                }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   220
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   221
                setPageComplete(valid);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   222
            }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   223
        };
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   224
    }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   225
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   226
    /**
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   227
     * Set the location to the default location if we are set to useDefaults.
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   228
     */
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   229
    void setLocationForSelection() {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   230
        locationArea.updateProjectName(context.getProjectName());
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   231
    }
3
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
   232
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   233
    /**
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   234
     * Returns whether this page's controls currently all contain valid values.
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   235
     *
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   236
     * @return <code>true</code> if all controls are valid, and
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   237
     *         <code>false</code> if at least one is invalid
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   238
     */
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   239
    protected boolean validatePage() {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   240
        if (isPageComplete() || context.getProjectName().trim().length() == 0) {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   241
            return false;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   242
        }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   243
        String projectName = context.getProjectName();
441
85f06000ab13 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 439
diff changeset
   244
        IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   245
        locationArea.setExistingProject(project);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   246
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   247
        String validLocationMessage = locationArea.checkValidLocation();
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   248
        if (validLocationMessage != null) { // there is no destination location
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   249
                                            // given
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   250
            setErrorMessage(validLocationMessage);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   251
            return false;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   252
        }
443
c5a1d477afa1 Bug 3223 - New project wizard does not handle a case when there is a project in the location
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 442
diff changeset
   253
        File file = new File(locationArea.getProjectLocationURI());
c5a1d477afa1 Bug 3223 - New project wizard does not handle a case when there is a project in the location
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 442
diff changeset
   254
        if (file.isFile()) {
c5a1d477afa1 Bug 3223 - New project wizard does not handle a case when there is a project in the location
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 442
diff changeset
   255
            setErrorMessage(String.format("%s is an existing file", file));
c5a1d477afa1 Bug 3223 - New project wizard does not handle a case when there is a project in the location
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 442
diff changeset
   256
            return false;
c5a1d477afa1 Bug 3223 - New project wizard does not handle a case when there is a project in the location
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 442
diff changeset
   257
        } else if (file.isDirectory() && file.listFiles().length > 0) {
c5a1d477afa1 Bug 3223 - New project wizard does not handle a case when there is a project in the location
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 442
diff changeset
   258
            setErrorMessage(String.format("%s is a non-empty folder", file));
c5a1d477afa1 Bug 3223 - New project wizard does not handle a case when there is a project in the location
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 442
diff changeset
   259
            return false;
c5a1d477afa1 Bug 3223 - New project wizard does not handle a case when there is a project in the location
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 442
diff changeset
   260
        }
439
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   261
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   262
        setErrorMessage(null);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   263
        setMessage(null);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   264
        return true;
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   265
    }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   266
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   267
    /**
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   268
     * Returns the useDefaults.
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   269
     *
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   270
     * @return boolean
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   271
     */
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   272
    public boolean useDefaults() {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   273
        return locationArea.isDefault();
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   274
    }
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   275
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   276
    @Override
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   277
    public void setVisible(boolean visible) {
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   278
        // TODO Auto-generated method stub
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   279
        super.setVisible(visible);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   280
        setErrorMessage(null);
57fff6202b74 Bug 3184 - Reorganize new project wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 155
diff changeset
   281
    }
3
d3477de62514 Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff changeset
   282
}