Bug 310446 - [LinkedResources] "Preferences > Linked Resources > New..." should not show "Variable..."
Summary: [LinkedResources] "Preferences > Linked Resources > New..." should not show "...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 RC2   Edit
Assignee: Serge Beauchamp CLA
QA Contact: Serge Beauchamp CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-26 09:23 EDT by Markus Keller CLA
Modified: 2010-05-19 07:13 EDT (History)
2 users (show)

See Also:
Szymon.Brandys: review+
pawel.pogorzelski1: review+


Attachments
Patch (3.39 KB, patch)
2010-05-04 08:44 EDT, Serge Beauchamp CLA
no flags Details | Diff
Latest Patch (8.52 KB, patch)
2010-05-12 11:05 EDT, Serge Beauchamp CLA
no flags Details | Diff
Patch (8.52 KB, patch)
2010-05-13 04:49 EDT, Serge Beauchamp CLA
no flags Details | Diff
Minor changes to the Serge patch (6.11 KB, patch)
2010-05-14 07:08 EDT, Szymon Brandys CLA
no flags Details | Diff
Patch (8.72 KB, patch)
2010-05-18 05:56 EDT, Serge Beauchamp CLA
no flags Details | Diff
Patch (6.12 KB, patch)
2010-05-18 05:59 EDT, Serge Beauchamp CLA
no flags Details | Diff
Patch (6.58 KB, patch)
2010-05-18 08:26 EDT, Serge Beauchamp CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2010-04-26 09:23:12 EDT
I20100425-2000

"Preferences > Linked Resources": The "New..." and "Edit..." dialogs should not show the "Variable..." button. When I select a variable, the "New Variable" dialog show an error (Path must be absolute.), and when I try to click "Extend...", nothing happens.
Comment 1 Serge Beauchamp CLA 2010-05-04 08:44:12 EDT
Created attachment 166946 [details]
Patch

Szymon, can you review it for me please?  Thanks
Comment 2 Szymon Brandys CLA 2010-05-12 07:55:40 EDT
Build id: I20100509-0800

I think that the fix introduces an inconsistency.

On 'Preferences > Linked Resources', I can't add variables made of other variables, even if they are resolved to an absolute location.
E.g. I created a variable 'temp' pointing at 'c:/temp'. I wanted to create a variable 'tempD' pointing at 'c:/temp/d' using a location 'temp/d'. I couldn't. 
It looks like I am able to do this using 'the NewFile wizard > Advanced > Variables' though.

One more issue, probably not related to this one.
Steps:
1) Open the NewFolder wizard
2) Go to 'Advanced' and check 'Linked Folder'
3) Type "c:/"

I'm getting an exception

org.eclipse.core.runtime.CoreException: No file system is defined for scheme: c
	at org.eclipse.core.internal.filesystem.Policy.error(Policy.java:55)
	at org.eclipse.core.internal.filesystem.Policy.error(Policy.java:50)
	at org.eclipse.core.internal.filesystem.InternalFileSystemCore.getFileSystem(InternalFileSystemCore.java:65)
	at org.eclipse.core.internal.filesystem.InternalFileSystemCore.getStore(InternalFileSystemCore.java:107)
	at org.eclipse.core.filesystem.EFS.getStore(EFS.java:470)
	at org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils.getFileStore(IDEResourceInfoUtils.java:211)
	at org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils.getFileInfo(IDEResourceInfoUtils.java:184)
	at org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup.validateLinkLocation(CreateLinkedResourceGroup.java:695)
	at org.eclipse.ui.dialogs.WizardNewFolderMainPage.validateLinkedResource(WizardNewFolderMainPage.java:726)
	at org.eclipse.ui.dialogs.WizardNewFolderMainPage.validatePage(WizardNewFolderMainPage.java:773)
	at org.eclipse.ui.dialogs.WizardNewFolderMainPage$2.handleEvent(WizardNewFolderMainPage.java:184)
	at org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup$2.modifyText(CreateLinkedResourceGroup.java:291)
	
I couldn't see the problem on 3.5.

Another issue:
Steps:
1) Open the 'NewFolder' wizard
2) 'Advanced > Linked Folder > Variables'
3) Click 'New' to open the 'New Variable' dialog
3b) Add a new variable and press 'Ok', the variable SHOULD be saved at this point
4) On the 'Select Path Variable' dialog click 'Cancel'
5) The variable is not set as the location in the 'NewFolder' wizard, it's ok
6) Open 'Variables' again, you can't see the added variable, but you should

Feel free to open separate bugs for described issues. However they all should be addressed for 3.6.
Comment 3 Szymon Brandys CLA 2010-05-12 08:03:23 EDT
(In reply to comment #2)

You could look at the 'Run Configurations' dialog. 
1) Create a launch configuration, go to 'Main > Workspace Data'
2) Click variables and try to edit, add or remove some of them
3) Notice that changes are stored, no matter 'Ok' or 'Cancel' is pressed
Comment 4 Serge Beauchamp CLA 2010-05-12 11:01:07 EDT
(In reply to comment #2)
> Build id: I20100509-0800
> 
> I think that the fix introduces an inconsistency.
> 
> On 'Preferences > Linked Resources', I can't add variables made of other
> variables, even if they are resolved to an absolute location.
> E.g. I created a variable 'temp' pointing at 'c:/temp'. I wanted to create a
> variable 'tempD' pointing at 'c:/temp/d' using a location 'temp/d'. I couldn't. 
> It looks like I am able to do this using 'the NewFile wizard > Advanced >
> Variables' though.
> 

The New file wizard > Advanced > Variables uses the Project Path Variable Manager (because you're trying to create a file in a project), as opposed to the preferences one that uses the legacy workspace path variable manager.

The workspace path variable manager didn't support variables, only absolute paths, and its capabilities haven't changed:  it still doesn't support variables.

The workspace path variable manager doesn't support the built-int path variables either (PROJECT_LOC, etc...). 

The existing workspace path variable manager was left un-touched and left alone for compatibility reasons.

> One more issue, probably not related to this one.
> Steps:
> 1) Open the NewFolder wizard
> 2) Go to 'Advanced' and check 'Linked Folder'
> 3) Type "c:/"
> 
> I'm getting an exception
> 
> org.eclipse.core.runtime.CoreException: No file system is defined for scheme: c
>     at org.eclipse.core.internal.filesystem.Policy.error(Policy.java:55)
>     at org.eclipse.core.internal.filesystem.Policy.error(Policy.java:50)
>     at
> org.eclipse.core.internal.filesystem.InternalFileSystemCore.getFileSystem(InternalFileSystemCore.java:65)
>     at
> org.eclipse.core.internal.filesystem.InternalFileSystemCore.getStore(InternalFileSystemCore.java:107)
>     at org.eclipse.core.filesystem.EFS.getStore(EFS.java:470)
>     at
> org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils.getFileStore(IDEResourceInfoUtils.java:211)
>     at
> org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils.getFileInfo(IDEResourceInfoUtils.java:184)
>     at
> org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup.validateLinkLocation(CreateLinkedResourceGroup.java:695)
>     at
> org.eclipse.ui.dialogs.WizardNewFolderMainPage.validateLinkedResource(WizardNewFolderMainPage.java:726)
>     at
> org.eclipse.ui.dialogs.WizardNewFolderMainPage.validatePage(WizardNewFolderMainPage.java:773)
>     at
> org.eclipse.ui.dialogs.WizardNewFolderMainPage$2.handleEvent(WizardNewFolderMainPage.java:184)
>     at
> org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup$2.modifyText(CreateLinkedResourceGroup.java:291)
> 
> I couldn't see the problem on 3.5.
> 

With the new patch, putting "c:/" now generates a wizard error, so it prevents the 'Finish' button to be clicked - the same behavior as 3.5.

Also, putting something like "c:/foo", where "foo" doesn't exist is interpreted as an absolute path, rather than a URI (scheme:/path), even though it is undistinguishable from the URI syntax.

This is done by verifying if the scheme exist, and if it doesn't, interpret the string as an absolute path with the wrote slash orientation.

> Another issue:
> Steps:
> 1) Open the 'NewFolder' wizard
> 2) 'Advanced > Linked Folder > Variables'
> 3) Click 'New' to open the 'New Variable' dialog
> 3b) Add a new variable and press 'Ok', the variable SHOULD be saved at this
> point
> 4) On the 'Select Path Variable' dialog click 'Cancel'
> 5) The variable is not set as the location in the 'NewFolder' wizard, it's ok
> 6) Open 'Variables' again, you can't see the added variable, but you should
> 

Ok, so that means that when the user will have the variable list in a selection dialog, all add, remove, and edits will be effective right away, even though the user presses cancel, is that right?

If so, this is now effective with the latest patch.
Comment 5 Serge Beauchamp CLA 2010-05-12 11:05:03 EDT
Created attachment 168162 [details]
Latest Patch
Comment 6 Szymon Brandys CLA 2010-05-13 04:25:53 EDT
(In reply to comment #5)
> Created an attachment (id=168162)
> Latest Patch

Sorry, but I'm not able to apply the patch. Could you update it?
Comment 7 Szymon Brandys CLA 2010-05-13 04:46:55 EDT
(In reply to comment #4)
> The New file wizard > Advanced > Variables uses the Project Path Variable
> Manager (because you're trying to create a file in a project), as opposed to the
> preferences one that uses the legacy workspace path variable manager.
> 
> The workspace path variable manager didn't support variables, only absolute
> paths, and its capabilities haven't changed:  it still doesn't support
> variables.

Right, this is the inconsistency I'm talking about. The user is not aware of implementation details and the fact that we have different implementations for projects and workspace. It's too late to work on it in 3.6, but I hope you will look at it during 3.7. Could you raise a bug against that?


> The workspace path variable manager doesn't support the built-int path variables
> either (PROJECT_LOC, etc...).

There is Bug 311520 for the empty workspace variable list.

> With the new patch, putting "c:/" now generates a wizard error, so it prevents
> the 'Finish' button to be clicked - the same behavior as 3.5.
> 
> Also, putting something like "c:/foo", where "foo" doesn't exist is interpreted
> as an absolute path, rather than a URI (scheme:/path), even though it is
> undistinguishable from the URI syntax.
> 
> This is done by verifying if the scheme exist, and if it doesn't, interpret the
> string as an absolute path with the wrote slash orientation.

Ok. But writing and exception to the console is bad, right? We should not write an exception, if everyting works fine.
Could you raise a bug for that and investigate?

> Ok, so that means that when the user will have the variable list in a selection
> dialog, all add, remove, and edits will be effective right away, even though the
> user presses cancel, is that right?

Yes.

I'll look at the patch when it's updated. Please raise separate bugs for described issues. Thanks :)
Comment 8 Serge Beauchamp CLA 2010-05-13 04:49:25 EDT
Created attachment 168358 [details]
Patch

Patch wtih updated sources from trunk as of now.
Comment 9 Szymon Brandys CLA 2010-05-14 07:08:16 EDT
Created attachment 168524 [details]
Minor changes to the Serge patch

Moreover I would open a separate bug for fixes in CreateLinkedResourcesGroup. I found more cases when exceptions are written down to the console. For instance, try to type 'file://c:'
Comment 10 Szymon Brandys CLA 2010-05-14 07:17:39 EDT
(In reply to comment #9)
> Moreover I would open a separate bug for fixes in CreateLinkedResourcesGroup. I
> found more cases when exceptions are written down to the console. For instance,
> try to type 'file://c:'

I opened bug 312888.
Comment 11 Serge Beauchamp CLA 2010-05-14 07:39:25 EDT
(In reply to comment #10)
> (In reply to comment #9)
> > Moreover I would open a separate bug for fixes in CreateLinkedResourcesGroup. I
> > found more cases when exceptions are written down to the console. For instance,
> > try to type 'file://c:'
> 
> I opened bug 312888.

Ok, thanks.
Comment 12 Serge Beauchamp CLA 2010-05-18 05:56:51 EDT
Created attachment 168887 [details]
Patch

Merging Szymon's patch
Comment 13 Serge Beauchamp CLA 2010-05-18 05:59:24 EDT
Created attachment 168888 [details]
Patch

Pulling out the CreateLinkedResourceGroup.java changes (now in bug 312888).

Can you  please review the changes?  I believe they address all concerns raised in this bug (minus the 312888 ones)

Thanks,
Comment 14 Szymon Brandys CLA 2010-05-18 06:30:47 EDT
The patch looks good. I found one issue though. I can't reproduce it without the patch.
Steps:
1) Go to "Preferences > General > Linked Resources"
2) Click "New"
3) In the "New variable" provide the name and the location

As the location I tried to enter "c:/home" and I got NPEs.
Comment 15 Serge Beauchamp CLA 2010-05-18 08:26:23 EDT
Created attachment 168906 [details]
Patch

now addresses the NPE reported by Szymon
Comment 16 Pawel Pogorzelski CLA 2010-05-19 07:11:05 EDT
Serge, the patch looks good.

I don't like the layout with "File..." and "Folder..." buttons. It's even worse if "Variable..." is present because the location field is so short. This is not related to the patch though.
Comment 17 Serge Beauchamp CLA 2010-05-19 07:13:44 EDT
Thanks!  Now fixed on head.