DESCRIPTION

Bug 445538 - [Perspectives] Pin Editor command broken and can no longer
be added to perspective's toolbar

Because CommandContributionItem's are now replaced with
HandledContributionItem's in CoolBarToTrimManager we can't update the
state of originally contributed items anymore.

Moved the "pin editor" show/hide and refresh logic from the anonymous
subclass of the ContributionItemFactory.CommandContributionItem into the
WorkLeon OchoachActionBuilder.

Updated CPD tooltips and popup text which warn user that selected item
visibility can't be changed via CPD if the item represents an initially
disabled CommandContributionItem (default is enabled).

Change-Id: I313290938b012c9578a05a999a05f76bac5e2bfb
Signed-off-by: Jayvion Booth xxx@xxx.xxx


COMMENTS

author: Jayvion Booth
date: 2015-02-17 19:02:46.000000000

Uploaded patch set 9.

-------------------------------------
author: Brenden Conley
date: 2015-02-17 20:55:01.000000000

Patch Set 9:

Build Started https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/4600/

-------------------------------------
author: Brenden Conley
date: 2015-02-17 21:32:07.000000000

Patch Set 9: Verified+1

Build Successful 

https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/4600/ : SUCCESS

-------------------------------------
author: Sebastian Porter
date: 2015-02-19 15:36:43.000000000

Patch Set 9:

We should simply not show those items where the action set is null/unknown. This is how it's done in 3.x.

Of course we'd still have to make the toggling work, once close editors automatically is enabled.

-------------------------------------
author: Jayvion Booth
date: 2015-02-19 19:12:33.000000000

Patch Set 9:

The problem is that user will have no idea why the buttons are "invisible" in CPD dialog - giving him some hints could prevent him from entering new bugs and save us some time reproducing them.

-------------------------------------
author: Sebastian Porter
date: 2015-02-19 21:13:06.000000000

Patch Set 9:

I see your point. But how's the life of the user better when we just tell him that he can't change the state? If he doesn't see the item he won't even thing about it ;-).

-------------------------------------
author: Jayvion Booth
date: 2015-02-19 21:39:34.000000000

Patch Set 9:

If the user don't see the item few things can happen:
1) user will complain WTF!?
2) and possibly enter the bug
3) he will give up and blaim stupid Eclipse 
4) he will not notice it

1-3 are negative, 2 contra productive, 4 don't care

If user will see the button, same things might happen, but the probability for 2) is lower because hopefully the error message will give him some ideas and might be he will think "it is not a bug, it is a feature?".

So the main point here is to avoid extra time which both sides would spend writing and reading bug reports.

-------------------------------------
author: Sebastian Porter
date: 2015-02-20 09:39:01.000000000

Patch Set 9:

Fair enough, but given that no one reported a bug in the past 10 years, I suspect we're mostly in 4 ;-).

-------------------------------------
author: Jayvion Booth
date: 2015-02-20 09:50:51.000000000

Patch Set 9:

See bug 397960, bug 437326 and of course the current bug 445538 where user are trying to find or do something with buttons.

But this review is much more then about "improving the error messages". 

The main point is that after the CPD fixes the "old fashioned" way to create custom CommandContributionItem in ContributionItemFactory does not work anymore and *must* be fixed. So the main part are the changes in ContributionItemFactory and WorkLeon OchoachActionBuilder.

-------------------------------------
author: Sebastian Porter
date: 2015-02-20 10:05:28.000000000

Patch Set 9:

> The main point is that after the CPD fixes the "old fashioned" way 

Yes, definitely. I said that above already. Noopur is doing an initial review of this bug now.

-------------------------------------
author: Skylar Chambers
date: 2015-02-20 12:32:25.000000000

Patch Set 9: Code-Review-1

Here are the initial review comments:

- Copyright year and contributors list should be updated in files.

- When we click on disabled "Pin Editor" in CPD, a dialog is shown. It is missing the title text.

- Open new workspace. Enable "Close editors..." in Preferences. Go to CPD and uncheck "Pin Editors". Now, invoke "Reset Perspective". "Pin Editor" does not come back even though CPD shows it as checked.

- Open new workspace. Enable "Close editors..." in Preferences. In Java perspective, go to CPD and uncheck "Pin Editors" and the tool item will be hidden. Go to Debug perspective now. See that "Pin Editor" is not visible in Debug perspective also even though the CPD there shows it checked. 

- Open new workspace. Enable "Close editors..." in Preferences and set number of editors to 2. Open 2 files C1 and C2. Pin C1 and leave it on top. Restart Eclipse. Click on C2 tab to bring it to top. See that "Pin Editor" tool item still shows pinned, even though C2 is not pinned.

- When "Close editors..." is enabled in Preferences, we do not get "Pin Editor" in the editor tab menu like 3.x. This may not be related to the current bug.

-------------------------------------
author: Jayvion Booth
date: 2015-02-21 14:10:46.000000000

Patch Set 9:

> Copyright year and contributors list should be updated in files.

Done

> When we click on disabled "Pin Editor" in CPD, a dialog is shown. It is missing the title text.

Done

> Open new workspace. Enable "Close editors..." in Preferences. Go to CPD and uncheck "Pin Editors". Now, invoke "Reset Perspective". "Pin Editor" does not come back even though CPD shows it as checked.

Done. This and the previous issue are closely related to this patch https://git.eclipse.org/r/#/c/12819/5 for bug 402429 in CoolBarToTrimManager. The problem with this was that it remembered possibly changed model item visibility and not the contribution item visibility. I've verified that example from bug 402429 (attachment) still works with the current patch.

> Open new workspace. Enable "Close editors..." in Preferences. In Java perspective, go to CPD and uncheck "Pin Editors" and the tool item will be hidden. Go to Debug perspective now. See that "Pin Editor" is not visible in Debug perspective also even though the CPD there shows it checked.

Done 

> Open new workspace. Enable "Close editors..." in Preferences and set number of editors to 2. Open 2 files C1 and C2. Pin C1 and leave it on top. Restart Eclipse. Click on C2 tab to bring it to top. See that "Pin Editor" tool item still shows pinned, even though C2 is not pinned.

This issue existed before my patch, but I've fixed it now too. The problem was that the button listener was hooked on partBroughtToTop() but must be hooked on partActivated(). See WorkLeon OchoachActionBuilder (the code was before in ContributionItemFactory).

> When "Close editors..." is enabled in Preferences, we do not get "Pin Editor" in the editor tab menu like 3.x. This may not be related to the current bug.

Caused by e4 changes and not related to the patch. Probably worth a new bug if not reported yet.

-------------------------------------
