Bug 31384 - Deleting a Link deletes the content of the link result in loss of data
Summary: Deleting a Link deletes the content of the link result in loss of data
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-07 18:54 EST by Dirk Baeumer CLA
Modified: 2009-08-30 02:34 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Baeumer CLA 2003-02-07 18:54:47 EST
I20030206

- create a normal Java project
- create a folder and link the folder to an existing workspace.
Observe: the link is rendered as an empty package and a lot of ghost folders
are rendered as well.

- delete the link folder/package
Observe: this also deletes folders from the source folder as well 
(the .metadata directory and sometimes projects as well), resulting in Loss of 
DATA. Note that the dialog that pops up states that only the link will be 
removed from the workspace.
Comment 1 Adam Kiezun CLA 2003-02-10 05:55:40 EST
i cannot link a folder to an existing workspace (the dialog will not allow me)

did you mean _any_ workspace or the workspace that the project is in?
(i cannot do either, but would help to know)
Comment 2 Adam Kiezun CLA 2003-02-10 06:00:24 EST
not, true - i can link a folder in workspace to A to workspace B 
(there's a warning in the dialog)
Comment 3 Adam Kiezun CLA 2003-02-10 06:07:51 EST
btw, it's a very strange idea to link a folder inside 1 workspace to point to a 
whole workspace
Comment 4 Dirk Baeumer CLA 2003-02-10 06:10:47 EST
That's correct, but the problem results form the folder names containing a '.'. 
See bug 31383 which might be helpful here as well.
Comment 5 Adam Kiezun CLA 2003-02-10 06:12:05 EST
could not reproduce deleting projects (.metadata does seem to be gone)

whatever causes it - it's unlikely us; we call 
ISourceManipulation::delete(false, pm) on the IPackageFragment
Comment 6 Philipe Mulet CLA 2003-02-12 07:08:38 EST
Can you provide exact steps to reproduce ? What is the exact classpath of the 
normal Java project ? How is the linked folder playing on the build path ?
Is the link targeting the root dir of a workspace ?

Comment 7 Dirk Baeumer CLA 2003-02-12 08:18:40 EST
You can use the setup described in bug 31383. When you delete link the whole 
contents of link gets deleted. But I suspect that happens only to folders that 
have a . in its name.
Comment 8 Philipe Mulet CLA 2003-02-13 11:41:36 EST
There are too many ramifications if we implement logical operations on Java 
elements when links are in the game.

At the platform level, links are lightweight. At our level they don't exist as 
links, just as folders. If we were to change this, we would not be able to 
preserve subpackages (or nested source roots) when unlinking a folder. At the 
resource level, this is what you want, but at the Java model level this would 
be a big change.

Also, what about copying a linked package, are we updating all children package 
statement to reflect the new link name (what if others still share sources).

At this point in the game, this is way to risky to address. We will address 
short-term data loss by refusing to perform such operations on linked resources 
alltogether.

UI should only perform a resource operation once it has detected a linked 
resource is underneath.

Moving to UI for further action.
Comment 9 Dirk Baeumer CLA 2003-02-13 13:08:53 EST
Philippe, why can't you detect the case that the underlying resource is a link 
and only delete the "link" in this case. If we add that logical we have to keep 
it in sync with what the Java model is doing, which, as you pointed out, might 
change in the future.

Can you please comment on this.
Comment 10 Philipe Mulet CLA 2003-02-13 13:31:16 EST
The model is currently agnostic about links, and clearly doesn't support them 
for these operations.

If we did act on the link itself, it would likely become inconsistent on the 
Java model side (wouldn't preserve subpackages any longer). Also the delta 
computation wouldn't be trivial looking at our code, doable but scary to change 
at this point.

Disabling our code in case a link scenario is detected is the most we can do. 
For now, given you special case links already (ask confirmation to user), it 
should only do a resource action, not an (unsupported) Java model action.

We are only talking about RC1 here. Post 2.1 we may want to leverage these 
operations into the model.
Comment 11 Dirk Baeumer CLA 2003-02-13 13:58:56 EST
OK, that makes sense.

Adam, how much work is it to detect this case and to call the corresponding 
method on IResource.
Comment 12 Adam Kiezun CLA 2003-02-14 08:50:48 EST
well, this would be nothing else than one more workaround for missing 
functionality/bugs
Comment 13 Dirk Baeumer CLA 2003-02-14 09:05:08 EST
This is correct, but as Philippe pointed out they can't fix it for 2.1 but are 
willing to do so for 2.2. So I think we should add the work around and move the 
PR to Core after we added it.
Comment 14 Adam Kiezun CLA 2003-02-14 09:24:11 EST
no probs, agreed to put a question/warning dialog that subpackages will be
deleted too
i mean, given a package strucitre

a
a.b
a.b.c

where a is a linked folder, deleting package a will cause the whole subtree of 
foilders underneath to be unlinked, which will remove all 3 packages from the 
workspace. i will put a warning saying that this will happen
Comment 15 Adam Kiezun CLA 2003-02-14 11:34:48 EST
workaround added - you get information in the dialog
and the package or cu is unlinked

(in the case of deleting a default package (which is unsupported by jcore but 
worked around in the ui) all cus are unlinked)

moving to core for further action
Comment 16 Philipe Mulet CLA 2003-02-14 12:16:14 EST
Post 2.1
Comment 17 Eclipse Webmaster CLA 2009-08-30 02:34:12 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.