sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/wizard/NewProjectCreationPageCaseInsensitive.java
changeset 0 522a326673b6
equal deleted inserted replaced
-1:000000000000 0:522a326673b6
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 package com.symbian.smt.gui.wizard;
       
    17 
       
    18 import org.eclipse.core.resources.IProject;
       
    19 import org.eclipse.core.resources.ResourcesPlugin;
       
    20 import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
       
    21 
       
    22 public class NewProjectCreationPageCaseInsensitive extends
       
    23 		WizardNewProjectCreationPage {
       
    24 
       
    25 	public NewProjectCreationPageCaseInsensitive(String pageName) {
       
    26 		super(pageName);
       
    27 	}
       
    28 
       
    29 	@Override
       
    30 	public boolean isPageComplete() {
       
    31 		String projectName = getProjectName().trim();
       
    32 
       
    33 		if (projectName.length() > 0) {
       
    34 			for (IProject project : ResourcesPlugin.getWorkspace().getRoot()
       
    35 					.getProjects()) {
       
    36 				if (project.getName().equalsIgnoreCase(projectName)) {
       
    37 					setErrorMessage("A project with that name already exists in the workspace.");
       
    38 					return false;
       
    39 				}
       
    40 			}
       
    41 		}
       
    42 
       
    43 		if (getLocationPath().isUNC()) {
       
    44 			setErrorMessage("UNC paths are not compatible with the System Model Manager");
       
    45 			return false;
       
    46 		}
       
    47 
       
    48 		return super.isPageComplete();
       
    49 	}
       
    50 }