Community
Participate
Working Groups
How to reproduce: 1. Create a new C Project named "Test": - File/New/Project - Select C/C++ > C Project, then click Next - Set "Test" as Project name, select Executable > Empty Project with any existing toolchain - Click Finish 2. Delete the created project: - Select "Test" in the Project Explorer view and press "Suppr" key - In the opened "Delete Resources" dialog, do not check the "Delete project contents on disk" check-box and click OK 3. Create a new C Project named "test" (same name but different case): - File/New/Project - Select C/C++ > C Project, then click Next - Set "test" as Project name, select Executable > Empty Project with any existing toolchain - Click Finish - In the opened "Old project will be overridden" dialog, indicating "OK to override ?", click OK. The project is not created and the New C Project Wizard is not exited as it should. Note that the same actions executed using the New Java Project wizard do not show such issue.
There is an exception in the log for this error: !SUBENTRY 1 org.eclipse.core.resources 4 275 2019-11-12 14:59:18.215 !MESSAGE A resource exists on disk with a different case: 'D:\cdt\runtime-New_configuration\Test'. !STACK 0 java.lang.Exception: A resource exists on disk with a different case: 'D:\cdt\runtime-New_configuration\Test'. at org.eclipse.core.internal.resources.ResourceException.provideStackTrace(ResourceException.java:42) at org.eclipse.core.internal.resources.ResourceException.<init>(ResourceException.java:38) at org.eclipse.core.internal.resources.Project.assertCreateRequirements(Project.java:69) at org.eclipse.core.internal.resources.Project.create(Project.java:267) at org.eclipse.core.internal.resources.Project.create(Project.java:251) at org.eclipse.cdt.core.CCorePlugin$2.run(CCorePlugin.java:967) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2295) at org.eclipse.cdt.core.CCorePlugin.createCDTProject(CCorePlugin.java:962) Now to understand how JDT deals with this issue.
(In reply to Sebastien Leblanc from comment #0) > Note that the same actions executed using the New Java Project wizard do not show such issue. What I see with JDT is an error when I try to use same name, but different case "The name of the new project must ...". AFAICT, based on this SO question it has been like that for a long time. https://stackoverflow.com/questions/19749154/the-name-of-the-project-must-be-issue Sebastien, do you see different behaviour with a Java project?
I think org.eclipse.ui.dialogs.WizardNewProjectCreationPage.validatePage() would be a generic place to make this change so that not every project wizard in the Eclipse universe needs to make the same change. JDT sets the error here: org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageOne.Validator.update(Observable, Object) IPath projectLocation= ResourcesPlugin.getWorkspace().getRoot().getLocation().append(name); if (projectLocation.toFile().exists()) { try {
(In reply to Jonah Graham from comment #2) > What I see with JDT is an error when I try to use same name, but different > case "The name of the new project must ...". AFAICT, based on this SO > question it has been like that for a long time. > https://stackoverflow.com/questions/19749154/the-name-of-the-project-must-be- > issue > > Sebastien, do you see different behaviour with a Java project? Hi Jonah, I observe the same indeed. I agree with your proposal in Comment 3: find a generic place to handle this case in every New Project Wizards.
New Gerrit change created: https://git.eclipse.org/r/152594
New Gerrit change created: https://git.eclipse.org/r/152595
I have come to the conclusion that I cannot put the generic error handling in org.eclipse.ui.dialogs.WizardNewProjectCreationPage.validatePage() as the logic there can't easily error out in this case without impacting other users. Instead I looked as to why, as a user, the notification of the error was lost. I found that other wizards (such as PDE's Feature wizard), display an error on finish. I have therefore reviewed the project wizards to try to make sure we are not swallowing, or only logging such errors. Indeed, some of the wizards simply re-raised a RuntimeException to get around the notification issue. In this case the exception we want to display is a resource exception which helpfully says: "A resource exists on disk with a different case".
Created attachment 280630 [details] screenshot of what user will see with proposed gerrits
Gerrit change https://git.eclipse.org/r/152594 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.tools.templates.git/commit/?id=d8e577d154d31c1f25851736d35ba0f26d337898
Gerrit change https://git.eclipse.org/r/152595 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=c53b59c36bf8746119f620a0f707fbe214388c2d