Bug 192906

Summary: [efs] No Error when trying to Create Remote Project when project with name exists
Product: [Tools] Target Management Reporter: Kevin Doyle <kjdoyle>
Component: RSEAssignee: Remy Suen <remy.suen>
Status: CLOSED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: normal    
Priority: P3 CC: ddykstal.eclipse, dmcknigh, kmunir, remy.suen
Version: 2.0Keywords: bugday, contributed
Target Milestone: 2.0.1Flags: mober.at+eclipse: review? (ddykstal.eclipse)
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 201438, 202098    
Attachments:
Description Flags
Patch to throw a CoreException if the project already exists. mober.at+eclipse: iplog+

Description Kevin Doyle CLA 2007-06-15 11:46:08 EDT
If you try to create a remote project and a project with that name already exists nothing happens.  No error message is displayed.

Steps to Reproduce:
1. Go to the Java perspective and create a new java project.
2. Find a folder that has the same name as the java project you just created.
3. Right click on it and select "Create Remote Project".
A Dialog will appear and disappear quickly making it look like something happened, but nothing does happen.

-----------Enter bugs above this line-----------
TM 2.0RC3 Testing
installation : eclipse-SDK-3.3RC4
RSE install  : RSE 2.0 RC3
java.runtime : Sun 1.5.0_11-b03
os.name:     : Windows XP, Service Pack 2
------------------------------------------------
Comment 1 Remy Suen CLA 2007-08-27 22:05:22 EDT
What should the expected behaviour be?

As comment #0 states, if the project exists (and is open), it does nothing. If it's closed, it'll move on and try to create it which causes a CoreException to be thrown since it already exists. This exception is logged although the user does not seem to get any visual feedback.
Comment 2 Kevin Doyle CLA 2007-08-27 22:35:14 EDT
As you mentioned we are not getting any visual feedback.  We should be displaying an Error Dialog, so the user knows what happened.
Comment 3 Remy Suen CLA 2007-08-28 07:31:55 EDT
Created attachment 77119 [details]
Patch to throw a CoreException if the project already exists.

I've altered the code to throw an InvocationTargetException instead because that's what they're for, for propagating checked exceptions upward.

Ideally, you should be able to choose a different name for the project, but since I don't know how RSE works, I don't know if that's supported or not.
Comment 4 Martin Oberhuber CLA 2007-09-03 12:33:11 EDT
Dave - I like the patch, but what do you think about the fact that it adds an NLS string? It adds an NLS string for reporting the fact that the remote project can not be created because a project with the same name already exists.

In 2.0, the error was not reported to the user but only logged (with an untranslated message). Can we add such an NLS string in 2.0.1 ? My personal take would be that an english-only message is better than no message at all, but I might be mistaken.

Note that either way, this fix is only a temporal solution. Kevin filed bug 201438 for a future improvement to display a pre-filled new project wizard when creating a remote project; then, users would be able to specify the name of the project to be created - this would be a more elegant solution.
Comment 5 Martin Oberhuber CLA 2007-09-03 13:37:52 EDT
I found a way to apply the patch without the NLS change: Allowing the Eclipse core project.create() operation forward its CoreException through the InvocationException, gives now a dialog like this:

Create Remote Project
Internal Error: Resource '/test' already exists.

Since this error is an NLS string from the Platform, it will be properly translated. For the patch's original error message, which is slightly more user-friednly, I added a FIXME comment and I'm also adding a comment to bug 201438 which is intended to build on this one.

Thanks for the patch, this was excellent quality code!
Comment 6 David Dykstal CLA 2007-09-04 12:24:01 EDT
(In reply to comment #4)
> Dave - I like the patch, but what do you think about the fact that it adds an
> NLS string? It adds an NLS string for reporting the fact that the remote
> project can not be created because a project with the same name already exists.
> 
> In 2.0, the error was not reported to the user but only logged (with an
> untranslated message). Can we add such an NLS string in 2.0.1 ? My personal
> take would be that an english-only message is better than no message at all,
> but I might be mistaken.
> 
> Note that either way, this fix is only a temporal solution. Kevin filed bug
> 201438 for a future improvement to display a pre-filled new project wizard when
> creating a remote project; then, users would be able to specify the name of the
> project to be created - this would be a more elegant solution.
> 

Martin - I agree that an English message is better than none, but we should be careful to not add too many! In this case, I see no problem in adding it.
Comment 7 Kevin Doyle CLA 2007-09-13 10:30:10 EDT
Verified fixed with 2.0.1RC1.