Bug 269844 - [GlobalActions] "Close Unrelated Projects" is dangerous and needs confirmation
Summary: [GlobalActions] "Close Unrelated Projects" is dangerous and needs confirmation
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 3.6 M3   Edit
Assignee: Dina Sayed CLA
QA Contact: Paul Webster CLA
URL:
Whiteboard:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2009-03-24 12:35 EDT by Markus Keller CLA
Modified: 2009-10-27 14:07 EDT (History)
4 users (show)

See Also:


Attachments
Proposed patch (confirmation dialog on closing unrelated projects) (11.92 KB, patch)
2009-08-12 12:10 EDT, Dina Sayed CLA
no flags Details | Diff
Updated proposed patch (15.16 KB, patch)
2009-08-24 05:29 EDT, Dina Sayed CLA
no flags Details | Diff
Modifed patch (15.62 KB, patch)
2009-08-25 12:20 EDT, Dina Sayed CLA
ob1.eclipse: iplog+
Details | Diff
Slightly modified Dina's patch (15.27 KB, patch)
2009-08-28 11:20 EDT, Oleg Besedin CLA
no flags Details | Diff
Documentation update for ref-9.htm (899 bytes, patch)
2009-09-18 18:59 EDT, Dina Sayed CLA
ob1.eclipse: iplog+
Details | Diff
Updated screen shot for the new option (27.38 KB, image/png)
2009-09-18 19:01 EDT, Dina Sayed CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2009-03-24 12:35:32 EDT
I20090317-1745

"Close Unrelated Projects" is a dangerous operation with and hence needs a confirmation dialog (with a "don't nag me again" checkbox, if you want).

I just inadvertently executed this action from the context menu, and now I have to manually restore my workspace state. Even if Undo would work, that would still cause a full build of all closed projects.
Comment 1 Dina Sayed CLA 2009-08-12 12:10:32 EDT
Created attachment 144254 [details]
Proposed patch (confirmation dialog on closing unrelated projects)

Proposed patch for a confirmation dialog on closing unrelated projects
Comment 2 Oleg Besedin CLA 2009-08-13 15:47:18 EDT
Nice patch, it is good that you added a preferences to change the preference later on.

I run into a small wrinkle when trying the updated version. When I select "Never" as the answer, the next time the action is executed it appears as nothing happens - "Close Unrelated Projects" action is enabled but nothing visible happens when it is selected. In theory, it is possible to imagine adding a message box for this case with the link to the preference page, but that probably would be overkill.

Another option would be to use Yes/No indicator rather then Prompt/Always/Never. Something like: "[checkbox] Always close unrelated projects without prompt". Just like the prompt to exit Eclipse. 

Couple technicalities:
- This will be the first change to the org.eclipse.ui.ide bundle in the 3.6. As such, its version needs to be incremented to 3.5.100.
Bundle versions are somewhat confusing subject, here is a good writeup on it:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=278064

- The "contributors" line in the copyrights. Its a bit different from team to team, for Platform/UI we usually add name, e-mail, company name, and, optionally, the bug fixed.

- The years in the copyright headers: there are two dates in the copyright headers, something like:

 * Copyright (c) 2000, 2006 IBM Corporation and others.

The first date is the year file was originally written; the second date is the
last year the file was modified. People almost always overlook the need to update the second year :-). (Platform/UI runs a script before release to update ones that have been overlooked through the development cycle.)
Comment 3 Markus Keller CLA 2009-08-17 08:40:14 EDT
> Another option would be to use Yes/No indicator rather then
> Prompt/Always/Never. Something like: "[checkbox] Always close unrelated
> projects without prompt". Just like the prompt to exit Eclipse. 

I agree that "Never" is confusing. I would expect a dialog that is similar to the confirmation dialog when you try to delete a resource i.e.:

- Title: "Close Unrelated Projects" (the title of a dialog that has been triggered by an action should always be the name of the action)

- Question: "Are you sure you want to close all project that are not related to '<name-of-selected-project>'?" ("Confirm closing projects" is not a question)

- Checkbox: "Always close without prompt"
- Buttons: "OK", "Cancel"


> - The "contributors" line in the copyrights. Its a bit different from team to
> team, for Platform/UI we usually add name, e-mail, company name, and,
> optionally, the bug fixed.

We don't list individual contributors from IBM there.
Comment 4 Oleg Besedin CLA 2009-08-17 09:32:27 EDT
(In reply to comment #3)
Markus, thanks for the suggested texts! I think they will fit perfectly.

> > - The "contributors" line in the copyrights. Its a bit different from team to
> > team, for Platform/UI we usually add name, e-mail, company name, and,
> > optionally, the bug fixed.
> We don't list individual contributors from IBM there.

I believe the Eclipse rule is that we should list all individual contributors in the copyright headers unless they are committers on the same Eclipse top level project.

(Myself, I am never sure what exactly is the "top level project" those days, but that does not apply here anyway.) I guess if the person is already a committer on a different Eclipse Platform component, they have all the paperwork already covering whatever they do on that project. Different projects adopted different standards as to what information goes in there. For instance, I think Equinox decided not to include company name, just the person's name. 

As a random example, see class Binding in the org.eclipse.core.databinding bundle.
Comment 5 Dina Sayed CLA 2009-08-24 05:29:19 EDT
Created attachment 145398 [details]
Updated proposed patch

patch is modified based on the comments.
Comment 6 Oleg Besedin CLA 2009-08-24 15:11:09 EDT
(In reply to comment #5)
> Created an attachment (id=145398) [details]
> Updated proposed patch
> patch is modified based on the comments.

Thanks, it looks good! I like the way you handled possibility of multiple projects being selected. 

A few nitpicks:

- The new checkboxes need keyboard accelerators ("&" signs in "Always close without prompt"; "Always close unrelated projects without prompt")

- CloseUnrelatedProjectsAction: formatting seems to be off in the new code. In the #getSelectedProjectName() method - you only use the first name? Might be easier to merge that code into #promptForConfirmation()

- Bundle version for "org.eclipse.ui.ide" in the manifest.mf needs to be incremented.
Comment 7 Dina Sayed CLA 2009-08-25 12:20:00 EDT
Created attachment 145560 [details]
Modifed patch
Comment 8 Oleg Besedin CLA 2009-08-28 11:20:28 EDT
Created attachment 145950 [details]
Slightly modified Dina's patch

Good patch. I made a slightly modified version of it:
- #promptForConfirmation(): After the prompt dialog is cancelled it throws an OperationCanceledException. That shows in the Error log (Window -> Show View -> Error Log) as "Unhandled event loop exception". I changed it to return false if Cancel or ESC are pressed;
- MessageDialogWithToggle stores preference as "always" / "never", not as boolean. That preference is overwritten by a boolean if "OK" is pressed, but not for Cancel/ESC. I changed the code to don't pass preference store information to it;
- fixed formatting in the CloseUnrelatedProjectsAction - there was a mix of tabs and spaces. (To see the default formatting, select modified portion and press Shift+Ctrl+F.);
- fixed tooltip message in the preferences dialog.
Comment 9 Oleg Besedin CLA 2009-08-28 11:31:06 EDT
Patch applied to CVS Head, good work! 

One last thing left to do is to update documentation. 

There is an entry in the Eclipse help for the modified preference page under Workbench User Guide -> Reference -> Preferences -> Workspace.

This is in the bundle "org.eclipse.platform.doc.user". The easiest way to find the page it to R-click on the entry in the Help and select "copy shortcut". In this case it is:
/help/topic/org.eclipse.platform.doc.user/reference/ref-9.htm

The file has a screenshot of the page and some text desribing options. This page has guidelines for the screenshots:

http://wiki.eclipse.org/Eclipse_Doc_Style_Guide#graphics
Comment 10 Dina Sayed CLA 2009-09-18 18:59:25 EDT
Created attachment 147623 [details]
Documentation update for ref-9.htm
Comment 11 Dina Sayed CLA 2009-09-18 19:01:28 EDT
Created attachment 147624 [details]
Updated screen shot for the new option
Comment 12 Oleg Besedin CLA 2009-09-21 09:34:27 EDT
That's perfect, thank you! Doc changes applied to CVS Head. Marking as fixed.
Comment 13 Oleg Besedin CLA 2009-10-27 14:07:48 EDT
Verified in I20091027-0100.