diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCCProjectWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCCProjectWizard.java new file mode 100644 index 00000000000..4aa1e31f87e --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCCProjectWizard.java @@ -0,0 +1,37 @@ +package org.eclipse.cdt.ui.wizards; + +/* + * (c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + */ + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; + + +/** + * C Project wizard that creates a new project resource in + */ +public abstract class NewCCProjectWizard extends NewCProjectWizard { + + public NewCCProjectWizard() { + super(); + setDialogSettings(CUIPlugin.getDefault().getDialogSettings()); + } + + public NewCCProjectWizard(String title, String description) { + super(); + setDialogSettings(CUIPlugin.getDefault().getDialogSettings()); + } + + + protected void doRun(IProgressMonitor monitor) throws CoreException { + super.doRun(monitor); + // Add C++ Nature to the newly created project. + if (newProject != null){ + CCorePlugin.getDefault().convertProjectFromCtoCC(newProject, monitor); + } + } +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCProjectWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCProjectWizard.java new file mode 100644 index 00000000000..1701efd7106 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCProjectWizard.java @@ -0,0 +1,304 @@ +package org.eclipse.cdt.ui.wizards; + +/* + * (c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + */ + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.internal.ui.CPluginImages; +import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExecutableExtension; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation; +import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard; +import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard; + + +/** + * C Project wizard that creates a new project resource in + * a location of the user's choice. + */ +public abstract class NewCProjectWizard extends BasicNewResourceWizard implements IExecutableExtension { + + private static final String OP_ERROR= "CProjectWizard.op_error"; //$NON-NLS-1$ + private static final String OP_DESC= "CProjectWizard.op_description"; //$NON-NLS-1$ + + private static final String PREFIX= "CProjectWizard"; //$NON-NLS-1$ + private static final String WZ_TITLE= "CProjectWizard.title"; //$NON-NLS-1$ + private static final String WZ_DESC= "CProjectWizard.description"; //$NON-NLS-1$ + + private static final String WINDOW_TITLE = "CProjectWizard.windowTitle"; //$NON-NLS-1$ + + + private String wz_title; + private String wz_desc; + private String op_error; + + protected IConfigurationElement fConfigElement; + protected NewCProjectWizardPage fMainPage; + protected IProject newProject; + + List tabItemsList = new ArrayList(); + + public NewCProjectWizard() { + this(CUIPlugin.getResourceString(WZ_TITLE), CUIPlugin.getResourceString(WZ_DESC), + CUIPlugin.getResourceString(OP_ERROR)); + } + + public NewCProjectWizard(String title, String description) { + this(title, description, CUIPlugin.getResourceString(OP_ERROR)); + } + + public NewCProjectWizard(String title, String description, String error) { + super(); + setDialogSettings(CUIPlugin.getDefault().getDialogSettings()); + setNeedsProgressMonitor(true); + wz_title = title; + wz_desc = description; + op_error = error; + } + + /** + * @see Wizard#createPages + */ + public void addPages() { + fMainPage= new NewCProjectWizardPage(CUIPlugin.getResourceString(PREFIX)); + fMainPage.setTitle(wz_title); + fMainPage.setDescription(wz_desc); + addPage(fMainPage); + } + + protected abstract void doRunPrologue(IProgressMonitor monitor); + + protected abstract void doRunEpilogue(IProgressMonitor monitor); + + protected IStatus isValidName(String name) { + return new Status(IStatus.OK, CUIPlugin.PLUGIN_ID, 0, "", null); + } + + /** + * Method isValidLocation. + * @param projectFieldContents + * @return IStatus + */ + protected IStatus isValidLocation(String projectFieldContents) { + return new Status(IStatus.OK, CUIPlugin.PLUGIN_ID, 0, "", null); + } + + /** + * Gets the project location path from the main page + * Overwrite this method if you do not have a main page + */ + protected IPath getLocationPath() throws UnsupportedOperationException { + if (null == fMainPage) + throw new UnsupportedOperationException(); + return fMainPage.getLocationPath(); + } + + /** + * Gets the project handle from the main page. + * Overwrite this method if you do not have a main page + */ + + protected IProject getProjectHandle() throws UnsupportedOperationException { + if (null == fMainPage) + throw new UnsupportedOperationException(); + return fMainPage.getProjectHandle(); + } + + /** + * Returns the C project handle corresponding to the project defined in + * in the main page. + * + * @returns the C project + */ + public IProject getNewProject() { + return newProject; + } + + protected IResource getSelectedResource() { + return getNewProject(); + } + + /** + * @see Wizard#performFinish + */ + public boolean performFinish() { + if (!invokeRunnable(getRunnable())) { + return false; + } + BasicNewProjectResourceWizard.updatePerspective(fConfigElement); + IResource resource = getSelectedResource(); + selectAndReveal(resource); + if (resource != null && resource.getType() == IResource.FILE) { + IFile file = (IFile)resource; + // Open editor on new file. + IWorkbenchWindow dw = getWorkbench().getActiveWorkbenchWindow(); + if (dw != null) { + try { + IWorkbenchPage page = dw.getActivePage(); + if (page != null) + page.openEditor(file); + } catch (PartInitException e) { + MessageDialog.openError(dw.getShell(), + CUIPlugin.getResourceString(OP_ERROR), e.getMessage()); + } + } + } + return true; + } + + /** + * Stores the configuration element for the wizard. The config element will be used + * in performFinish to set the result perspective. + * + * @see IExecutableExtension#setInitializationData + */ + public void setInitializationData(IConfigurationElement cfig, String propertyName, Object data) { + fConfigElement= cfig; + } + + /* + * Reimplemented method from superclass + */ + protected void initializeDefaultPageImageDescriptor() { + setDefaultPageImageDescriptor(CPluginImages.DESC_WIZABAN_NEW_PROJ); + } + + /* (non-Javadoc) + * Method declared on IWorkbenchWizard. + */ + public void init(IWorkbench workbench, IStructuredSelection currentSelection) { + super.init(workbench, currentSelection); + setWindowTitle(CUIPlugin.getResourceString(WINDOW_TITLE)); + } + + public IRunnableWithProgress getRunnable() { + return new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + if (monitor == null) { + monitor= new NullProgressMonitor(); + } + monitor.beginTask(CUIPlugin.getResourceString(OP_DESC), 3); + + doRunPrologue(new SubProgressMonitor(monitor, 1)); + try { + doRun(new SubProgressMonitor(monitor, 1)); + } + catch (CoreException e) { + throw new InvocationTargetException(e); + } + doRunEpilogue(new SubProgressMonitor(monitor, 1)); + + monitor.done(); + } + }; + } + + /** + * Utility method: call a runnable in a WorkbenchModifyDelegatingOperation + */ + protected boolean invokeRunnable(IRunnableWithProgress runnable) { + IRunnableWithProgress op= new WorkspaceModifyDelegatingOperation(runnable); + try { + getContainer().run(false, true, op); + } catch (InvocationTargetException e) { + Shell shell= getShell(); + String title= CUIPlugin.getResourceString(OP_ERROR + ".title"); //$NON-NLS-1$ + String message= CUIPlugin.getResourceString(OP_ERROR + ".message"); //$NON-NLS-1$ + + Throwable th= e.getTargetException(); + CUIPlugin.errorDialog(shell, title, message, th); + try { + getProjectHandle().delete(false, false, null); + } catch (CoreException ignore) { + } catch (UnsupportedOperationException ignore) { + } + return false; + } catch (InterruptedException e) { + return false; + } + return true; + } + + protected void doRun(IProgressMonitor monitor) throws CoreException { + createNewProject(monitor); + } + + /** + * Creates a new project resource with the selected name. + *

+ * In normal usage, this method is invoked after the user has pressed Finish on + * the wizard; the enablement of the Finish button implies that all controls + * on the pages currently contain valid values. + *

+ *

+ * Note that this wizard caches the new project once it has been successfully + * created; subsequent invocations of this method will answer the same + * project resource without attempting to create it again. + *

+ * + * @return the created project resource, or null if the project + * was not created + */ + protected IProject createNewProject(IProgressMonitor monitor) throws CoreException { + + if (newProject != null) + return newProject; + + // get a project handle + IProject newProjectHandle = null; + try { + newProjectHandle = getProjectHandle(); + } catch (UnsupportedOperationException e) { + throw new CoreException(new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, 0, e.getMessage(), null)); + } + + // get a project descriptor + IPath defaultPath = Platform.getLocation(); + IPath newPath = getLocationPath(); + if (defaultPath.equals(newPath)) + newPath = null; + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName()); + description.setLocation(newPath); + + newProject = CCorePlugin.getDefault().createCProject(description, newProjectHandle, monitor, getProjectID()); + return newProject; + } + + + /** + * Method getID. + * @return String + */ + public abstract String getProjectID(); + +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCProjectWizardOptionPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCProjectWizardOptionPage.java new file mode 100644 index 00000000000..95c80e88637 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCProjectWizardOptionPage.java @@ -0,0 +1,55 @@ +/* + * Created on 7-Aug-2003 + * + * Copyright (c) 2002,2003 QNX Software Systems Ltd. + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.ui.wizards; + +import org.eclipse.cdt.ui.TabFolderOptionBlock; +import org.eclipse.cdt.ui.ICOptionContainer; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.widgets.Composite; + +public abstract class NewCProjectWizardOptionPage extends WizardPage implements ICOptionContainer { + + private TabFolderOptionBlock fOptionBlock; + + public NewCProjectWizardOptionPage(String pageName) { + this(pageName, null, null); + } + + public NewCProjectWizardOptionPage(String pageName, String title, ImageDescriptor titleImage) { + super(pageName, title, titleImage); + } + + protected abstract TabFolderOptionBlock createOptionBlock(); + + public void createControl(Composite parent) { + fOptionBlock = createOptionBlock(); + setControl(fOptionBlock.createContents(parent)); + } + + public void setVisible(boolean visible) { + super.setVisible(visible); + fOptionBlock.setVisible(visible); + updateContainer(); + } + + public void updateContainer() { + fOptionBlock.update(); + setPageComplete(fOptionBlock.isValid()); + setErrorMessage(fOptionBlock.getErrorMessage()); + } + + public void performApply(IProgressMonitor monitor) { + fOptionBlock.performApply(monitor); + } + + public abstract IProject getProject(); +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCProjectWizardPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCProjectWizardPage.java new file mode 100644 index 00000000000..bbcb466427c --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCProjectWizardPage.java @@ -0,0 +1,350 @@ +package org.eclipse.cdt.ui.wizards; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +import java.io.File; + +import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.help.WorkbenchHelp; +import org.eclipse.ui.internal.IHelpContextIds; + +/** + * Standard main page for a wizard that is creates a project resource. + *

+ * This page may be used by clients as-is; it may be also be subclassed to suit. + *

+ *

+ * Example useage: + *

+ * mainPage = new CProjectWizardPage("basicCProjectPage");
+ * mainPage.setTitle("Project");
+ * mainPage.setDescription("Create a new project resource.");
+ * 
+ *

+ */ +public class NewCProjectWizardPage extends WizardPage { + + protected boolean useDefaults = true; + + // initial value stores + private String initialProjectFieldValue; + private IPath initialLocationFieldValue; + + // widgets + private Text projectNameField; + protected Text locationPathField; + protected Label locationLabel; + protected Button browseButton; + + private Listener nameModifyListener = new Listener() { + public void handleEvent(Event e) { + setLocationForSelection(); + setPageComplete(validatePage()); + } + }; + + private Listener locationModifyListener = new Listener() { + public void handleEvent(Event e) { + setPageComplete(validatePage()); + } + }; + + // constants + private static final int SIZING_TEXT_FIELD_WIDTH = 250; + + /** (non-Javadoc) + * Method declared on IDialogPage. + */ + public void createControl(Composite parent) { + Composite composite = new Composite(parent, SWT.NULL); + + WorkbenchHelp.setHelp(composite, IHelpContextIds.NEW_PROJECT_WIZARD_PAGE); + + composite.setLayout(new GridLayout()); + composite.setLayoutData(new GridData(GridData.FILL_BOTH)); + + createProjectNameGroup(composite); + createProjectLocationGroup(composite); + projectNameField.setFocus(); + validatePage(); + // Show description on opening + setErrorMessage(null); + setMessage(null); + setControl(composite); + } + + /** + * Creates the project location specification controls. + * + * @param parent the parent composite + */ + private final void createProjectLocationGroup(Composite parent) { + + // project specification group + Composite projectGroup = new Composite(parent,SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 3; + projectGroup.setLayout(layout); + projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + final Button useDefaultsButton = new Button(projectGroup, SWT.CHECK | SWT.RIGHT); + useDefaultsButton.setText(CUIPlugin.getResourceString("CProjectWizardPage.useDefaultLabel")); //$NON-NLS-1$ + useDefaultsButton.setSelection(this.useDefaults); + + GridData buttonData = new GridData(); + buttonData.horizontalSpan = 3; + useDefaultsButton.setLayoutData(buttonData); + + createUserSpecifiedProjectLocationGroup(projectGroup,!this.useDefaults); + + SelectionListener listener = new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + useDefaults = useDefaultsButton.getSelection(); + browseButton.setEnabled(!useDefaults); + locationPathField.setEnabled(!useDefaults); + locationLabel.setEnabled(!useDefaults); + setLocationForSelection(); + if (!useDefaults) + locationPathField.setText(""); //$NON-NLS-1$ + } + }; + useDefaultsButton.addSelectionListener(listener); + } + + /** + * Creates the project name specification controls. + * + * @param parent the parent composite + */ + private final void createProjectNameGroup(Composite parent) { + // project specification group + Composite projectGroup = new Composite(parent,SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + projectGroup.setLayout(layout); + projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + // new project label + Label projectLabel = new Label(projectGroup,SWT.NONE); + projectLabel.setText(CUIPlugin.getResourceString("CProjectWizardPage.nameLabel")); //$NON-NLS-1$ + + // new project name entry field + projectNameField = new Text(projectGroup, SWT.BORDER); + GridData data = new GridData(GridData.FILL_HORIZONTAL); + data.widthHint = SIZING_TEXT_FIELD_WIDTH; + projectNameField.setLayoutData(data); + + // Set the initial value first before listener + // to avoid handling an event during the creation. + if (initialProjectFieldValue != null) + projectNameField.setText(initialProjectFieldValue); + projectNameField.addListener(SWT.Modify, nameModifyListener); + projectNameField.setVisible(true); + } + + /** + * Creates the project location specification controls. + * + * @param projectGroup the parent composite + * @param boolean - the initial enabled state of the widgets created + */ + private void createUserSpecifiedProjectLocationGroup(Composite projectGroup, boolean enabled) { + + // location label + locationLabel = new Label(projectGroup,SWT.NONE); + locationLabel.setText(CUIPlugin.getResourceString("CProjectWizardPage.locationLabel")); //$NON-NLS-1$ + locationLabel.setEnabled(enabled); + + // project location entry field + locationPathField = new Text(projectGroup, SWT.BORDER); + GridData data = new GridData(GridData.FILL_HORIZONTAL); + data.widthHint = SIZING_TEXT_FIELD_WIDTH; + locationPathField.setLayoutData(data); + locationPathField.setEnabled(enabled); + + // browse button + browseButton = new Button(projectGroup, SWT.PUSH); + browseButton.setText(CUIPlugin.getResourceString("CProjectWizardPage.browseLabel")); //$NON-NLS-1$ + browseButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + handleLocationBrowseButtonPressed(); + } + }); + + browseButton.setEnabled(enabled); + + // Set the initial value first before listener + // to avoid handling an event during the creation. + if (initialLocationFieldValue != null) + locationPathField.setText(initialLocationFieldValue.toOSString()); + locationPathField.addListener(SWT.Modify, locationModifyListener); + } + + /** + * Returns the current project location path as entered by + * the user, or its anticipated initial value. + * + * @return the project location path, its anticipated initial value, or null + * if no project location path is known + */ + public IPath getLocationPath() { + if (useDefaults) + return initialLocationFieldValue; + + return new Path(locationPathField.getText()); + } + + /** + * Creates a project resource handle for the current project name field value. + *

+ * This method does not create the project resource; this is the responsibility + * of IProject::create invoked by the new project resource wizard. + *

+ * + * @return the new project resource handle + */ + public IProject getProjectHandle() { + return ResourcesPlugin.getWorkspace().getRoot().getProject(getProjectName()); + } + + /** + * Returns the current project name as entered by the user, or its anticipated + * initial value. + * + * @return the project name, its anticipated initial value, or null + * if no project name is known + */ + public String getProjectName() { + if (projectNameField == null) + return initialProjectFieldValue; + + return projectNameField.getText(); + } + + /** + * Open an appropriate directory browser + */ + protected void handleLocationBrowseButtonPressed() { + DirectoryDialog dialog = new DirectoryDialog(locationPathField.getShell()); + dialog.setMessage(CUIPlugin.getResourceString("CProjectWizardPage.directoryLabel")); //$NON-NLS-1$ + + String dirName = locationPathField.getText(); + if (!dirName.equals("")) {//$NON-NLS-1$ + File path = new File(dirName); + if (path.exists()) + dialog.setFilterPath(dirName); + } + + String selectedDirectory = dialog.open(); + if (selectedDirectory != null) + locationPathField.setText(selectedDirectory); + } + + /** + * Creates a new project creation wizard page. + * + * @param pageName the name of this page + */ + public NewCProjectWizardPage(String pageName) { + super(pageName); + setPageComplete(false); + this.initialLocationFieldValue = Platform.getLocation(); + } + + /** + * Set the location to the default location if we are set to useDefaults. + */ + protected void setLocationForSelection() { + if (useDefaults) { + IPath defaultPath = Platform.getLocation().append(projectNameField.getText()); + locationPathField.setText(defaultPath.toOSString()); + } + } + + /** + * Returns whether this page's controls currently all contain valid + * values. + * + * @return true if all controls are valid, and + * false if at least one is invalid + */ + protected boolean validatePage() { + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + + String projectFieldContents = projectNameField.getText(); + if (projectFieldContents.equals("")) { //$NON-NLS-1$ + setErrorMessage(null); + setMessage(CUIPlugin.getResourceString("CProjectWizardPage.projectNameEmpty")); //$NON-NLS-1$ + return false; + } + + // Give a chance to the wizard to do its own validation + IStatus validName = ((NewCProjectWizard)getWizard()).isValidName(projectFieldContents); + if (!validName.isOK()) { + setErrorMessage(validName.getMessage()); + return false; + } + + IStatus nameStatus = + workspace.validateName(projectFieldContents, IResource.PROJECT); + if (!nameStatus.isOK()) { + setErrorMessage(nameStatus.getMessage()); + return false; + } + + String locationFieldContents = locationPathField.getText(); + + if (!locationFieldContents.equals("")) {//$NON-NLS-1$ + // Give a chance to the wizard to do its own validation + IStatus validLocation = ((NewCProjectWizard)getWizard()).isValidLocation(projectFieldContents); + if (!validLocation.isOK()) { + setErrorMessage(validLocation.getMessage()); + return false; + } + + IPath path = new Path("");//$NON-NLS-1$ + if (!path.isValidPath(locationFieldContents)) { + setErrorMessage(CUIPlugin.getResourceString("CProjectWizardPage.locationError")); //$NON-NLS-1$ + return false; + } + if (!useDefaults && Platform.getLocation().isPrefixOf(new Path(locationFieldContents))) { + setErrorMessage(CUIPlugin.getResourceString("CProjectWizardPage.defaultLocationError")); //$NON-NLS-1$ + return false; + } + } + + if (getProjectHandle().exists()) { + setErrorMessage(CUIPlugin.getResourceString("CProjectWizardPage.projectExistsMessage")); //$NON-NLS-1$ + return false; + } + + setErrorMessage(null); + setMessage(null); + return true; + } +}