Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 188996

Summary: [reorg] Deleting linked resource folder from a project removes link target folder rather than just the workspace link
Product: [Eclipse Project] JDT Reporter: Charles Doucette <cdoucette>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: john.arthorne
Version: 3.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Charles Doucette CLA 2007-05-24 14:24:07 EDT
I have a large source tree.
I want to create a project from a subset of that tree.
Sometimes, I want to work on the trunk copy of the tree,
and sometimes, I want to work on a branch.
Thus, I use a linked resource to refer to the top-level directory of my tree.
For example, I created a project called vmsdomino.
It created an empty source directory for me called src.
I created the dummy package "com.vaultus.vms".
I created a linked subfolder called "domino" which is based on an extension of the linked resource I have for the top-level of my source tree.
Unfortunately, that included things I didn't want in my project.
So, I tried to remove the linked folder "domino" from my project.
The dialog box says:

Are you sure you want to delete the linked resource 'folder 'domino''?
Only the workspace link will be deleted. The link target will remain unchanged.

Then I say yes.

Usually, but apparently not always, the link target is indeed deleted, contrary to the message box.
Comment 1 Charles Doucette CLA 2007-05-24 14:35:42 EDT
I just tried this again.
This time, I created the linked folder "domino" under the package "com.vaultus.vms".
Then, the dialog box said this (instead):

(Title "Confirm Delete")

Are you sure you want to delete the linked resource 'folder 'domino''?
Only the workspace link will be deleted. The link target will remain unchanged.

Note that all subelements of the selected linked packages and package fragment roots will be removed from the workspace.

[x] (checkbox) Delete subpackages of selected packages

Again, I pressed the Yes button.

It was followed with another dialog:

(Title "Confirm Delete of Read-Only Elements")

The selected elements contain read-only resources.
Do you still want to delete them?

I pressed Yes.

I just want to remove references from the workspace.
I don't want to alter the underlying external file system.
The original message leads me to believe it won't affect the link target.

Comment 2 John Arthorne CLA 2007-05-24 16:05:49 EDT
This sounds like bug 145049, but that was fixed in the 3.2.1 release. Can you confirm your eclipse version by providing the "build id" value that you see under Help > About.
Comment 3 Charles Doucette CLA 2007-05-24 16:40:53 EDT
Version: 3.2.2
Build id: M20070212-1330
Comment 4 John Arthorne CLA 2007-05-25 11:01:22 EDT
Ok, I can reproduce it now, using either 3.2.2 or I20070522-0010.

Steps:

1) Create a Java project with a source folder
2) Create empty package "com.foo"
3) In the local file system, create some empty directory (c:\temp\bar)
4) Select "com.foo" in Package Explorer, and click New > Folder from context menu
5) Give the folder name "bar", and link it to c:\temp\bar

-> We now see package "com.foo.bar" in the PE

6) Create sub-package "com.foo.bar.bat", and add a CU A.java in this new package
7) Select "com.foo.bar", and click "Delete" from the context menu.
8) In the confirm dialog, check "Delete subpackages of selected packages"
9) Click Yes

-> The linked resource is removed from the workspace, as expected. However, The folder "bat" and A.java have been deleted from the local file system as well!

This is inconsistent from the usual behaviour of deleting a linked folder, which just removes the folder from the workspace, but does not touch the file in the file system.

It is possible this is the intended behaviour, since if you uncheck the option in step 8) it will not delete the sub-package from the local file system. However, this is very confusing for the user, because "delete" in this context could be interpreted as "delete from the workspace", rather than "delete from the file system." If this is the intended behaviour, I suggest rewording the checkbox button to "Delete subpackages of selected packages from the file system", so it's clear what the behaviour is.
Comment 5 Eclipse Genie CLA 2019-12-07 03:34:18 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.