Bug 37189 - [DND] Drag & Drop import should use validateEdit
Summary: [DND] Drag & Drop import should use validateEdit
Status: RESOLVED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Knut Radloff CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-02 18:29 EDT by Peter Hack CLA
Modified: 2003-05-20 10:29 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Hack CLA 2003-05-02 18:29:01 EDT
If the drop target is a pre-existing file, the drop operation should call 
IFileModificationValidator.validateEdit() instead of performing a delete 
before the copy/move.  This will add the new file contents to the existing 
version history if the file is under version control.  The current deletion 
behavior yields a new version controlled file with no history connection to 
previous versions.
Comment 1 Debbie Wilson CLA 2003-05-06 11:48:26 EDT
Looks like an extension of 16907.

Comment 2 Knut Radloff CLA 2003-05-06 18:09:50 EDT
According to the IWorkspace spec validateEdit should be used when a file is 
read-only and is about to be written to using e.g., setContents.
The Navigator copy/move operations are using setContents when overwriting 
existing files so the version history scenario should work.
Are you referring to the Package Explorer or the Navigator?
The Navigator meta bug for the validateEdit/setContents discussion was bug 
27187.
Comment 3 Peter Hack CLA 2003-05-07 20:18:18 EDT
In our failing scenario, using Eclipse 2.1, dragging a file from the Windows 
Explorer and dropping it into either the Eclipse Navigator or Package Explorer 
views only works if the destination file is writeable.  If the file is under 
ClearCase control and is read-only (i.e. checked in), the drop operation fails 
silently.

This scenario in Eclipse 2.0 deleted the destination file and created a new 
file with the copy of the source file.
Comment 4 Knut Radloff CLA 2003-05-08 11:48:35 EDT
This is indeed a bug. validateEdit is only called when copying/moving files or 
resources within Eclipse. It should also be called when importing files using 
drag and drop. It is called when importing using the import wizard.
Comment 5 Nick Edgar CLA 2003-05-12 22:54:53 EDT
Must fix for 2.1.1 since this is a regression from 2.0.
Comment 6 Knut Radloff CLA 2003-05-13 11:57:46 EDT
Upon closer inspection I realized that the ImportOperation does a validateEdit.
This works for me when testing with the pessimistic repository provider on the 
VCM page (after fixing a UI bug in the example plugin).

Does the validateEdit work when you drag and drop within the Navigator? Do you 
get the expected checkout prompt in that case (assuming you prompt)?
Comment 7 Knut Radloff CLA 2003-05-16 13:52:19 EDT
I would like to find out if any action is required for 2.1.1. Were you able to 
look at this?
Comment 8 Peter Hack CLA 2003-05-19 08:53:01 EDT
It turns out our validateEdit code was not expecting to be called with a UI 
context from a non-UI thread.  If calling from a non-UI thread with a UI 
context is allowed, then this defect can be closed.
Comment 9 Knut Radloff CLA 2003-05-19 12:18:04 EDT
I would be inclined to say that calling validateEdit from a non-UI thread 
should be allowed/the norm. Not all IFileModificationValidators may even use 
the UI context that is passed in.
Opened bug 37838 to clarify the spec.
Comment 10 John Arthorne CLA 2003-05-20 10:13:46 EDT
Calling validateEdit from a non-UI thread is certainly both intended and very
likely.  At the core level we know nothing of the UI thread, so the validator
will have to syncExec into the UI if necessary. Looks like this bug can be
closed. We'll look into clarifying the spec as mentioned in bug 37838.
Comment 11 Knut Radloff CLA 2003-05-20 10:29:07 EDT
Closing