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

Bug 26805

Summary: [CVS Watch/Edit] Could display other editors when editing a file
Product: [Eclipse Project] Platform Reporter: Michael Valenta <Michael.Valenta>
Component: TeamAssignee: Platform-VCM-Inbox <platform-vcm-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: gregor.kohlwes, rwilms
Version: 2.1Keywords: helpwanted
Target Milestone: 2.1 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Implementation of the cvs editors command
none
Editors Patch Version 2 none

Description Michael Valenta CLA 2002-11-20 16:04:45 EST
This was extracted from bug 21577.

I think it would be useful to have these additional features:

a) Before performing an edit, query the current editors and if there is at 
least one, display these to the user, giving the user the option to cancel the 
edit operation. 

b) Add an 'autowatch' feature which will automatically create a watch when 
adding certain file types, in particular those that cannot be merged.
Comment 1 Gregor Kohlwes CLA 2002-12-17 08:02:49 EST
Created attachment 2824 [details]
Implementation of the cvs editors command

The following patches (org.eclipse.team.cvs.core and org.eclipse.team.cvs.ui) 
implement the cvs editors command. There is a new popup team menu entry which
opens a new view containing information about the editors of the selected
resource. In case of IProject and IFolder the view will show the editors of the
contained files. This patch will be the base to fix this bug by changing the
EditAction and changing the FileModificationValidator. We will show a dialog
with the editors - if there are any - whenever the user wants to edit a file.
This feature will be configurable on the preference page.

Any comments, feedback or suggestion are welcome.
Comment 2 Michael Valenta CLA 2002-12-18 15:04:51 EST
Your patch looks good and is almost ready to be committed. However, the Eclipse 
charter describes the licensing and copyright requirements for newly submitted 
files. Go to the bottom of the following link to read them.

http://www.eclipse.org/eclipse/eclipse-charter.html

Basically, each new file you submit must have a copyright notice.

As for the code itself, it is good enough to commit but I'll mention some 
things I think could be added to make it better.

1) The ShowEditorsAction should probably be cancellable. Any uncancellable 
operation could potentially make the user wait for whatever time is specified 
as the CVS communication time (default is 60 seconds).

2) EditorsDialog is not used and should be removed

3) It's probably not worth having a separate interface for IEditorsInfo. I 
realize that a similar relationship exists for ILogInfo/LogInfo but I'm not 
sure if it is all that benefitial. I don't mind if you keep the interface for 
now but we may remove it if we refactor other listeners.

4) The resource name in the Editors view should show the project name (see next 
point).

5) I think it would be appropriate for the Show Editors command to be multi-
select and allow selections accross projects (as other CVS operations allow). 
This would require point 4.

6) It would be nice to be able to sort the view by the various columns.

As I said, I would submit the patch as is once the copyright notices are added. 
I mentioned the above in case you feel ambitious (and because we will 
eventually get bug reports for some of them anyway).
Comment 3 Michael Valenta CLA 2002-12-24 11:51:07 EST
I just noticed that the provider of the patch was not in the CC list of the bug. 
I've added their name in hopes that they will see the response/suggestions I 
added to the bug report last week. 
Comment 4 Gregor Kohlwes CLA 2003-01-13 07:13:02 EST
Created attachment 2955 [details]
Editors Patch Version 2

Here is the next version of our patch. 
In reference to the above points:

1) The ShowEditorsAction is now cancellable.

2) The EditorsDialog is now used to inform the user
whenever he wants to edit a read-only file or wants to
execute an edit command.

3) IEditorsInfo has been deleted.

4) and 5) A multiselect could be problematic. The editors
command already shows the editors of the children of the 
selected resource. If we allow multiselection there
could be an overlap and different projects could be located
in different CVS Servers. It is not impossible to allow 
multiselection, but I don't know if it is worth.

6) Next version :-)

Additionally we have added the required copyright notices.
Comment 5 Michael Valenta CLA 2003-01-13 15:28:42 EST
I have released this patch to HEAD. Please verify that the released code 
matches what you provided. Also, I modified the Watch/Edit prompt preferences 
test to reflect the new behavior (as I saw it). Please verify that this matches 
your intention. Finally, thanks for the contribution. I'm sure that any users 
of watch/edit will appreciate this.