DESCRIPTION

Bug 411724 - Hidden toolbar doesn't stay hidden

CleanupAddon contained code to automatically make a UI element
visible when one of its children became visible. This is
appropriate for part stacks and sash containers but not for
toolbars, so we use instanceof checks to ensure we're using
it when appropriate.

Change-Id: I821b96ddffea10ed10840ed64fed7cc05e488bae
Signed-off-by: Kelly Potter xxx@xxx.xxx


COMMENTS

author: Kelly Potter
date: 2015-05-02 03:04:51.000000000

Uploaded patch set 5.

-------------------------------------
author: Brenden Conley
date: 2015-05-02 03:04:57.000000000

Patch Set 5:

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

-------------------------------------
author: Brenden Conley
date: 2015-05-02 03:22:30.000000000

Patch Set 5: Verified+1

Build Successful 

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

-------------------------------------
author: Brock Pruitt
date: 2015-05-02 20:05:25.000000000

Patch Set 5: Code-Review+1

-------------------------------------
author: Zaid Mosley
date: 2015-05-05 20:47:22.000000000

Patch Set 5: Code-Review-1

(3 comments)

See inline comments

Line:148, bundles/org.eclipse.e4.ui.workLeon Ochoach.addons.swt/src/org/eclipse/e4/ui/workbench/addons/cleanupaddon/CleanupAddon.java -> I think this method is not necessary, see below

Line:158, bundles/org.eclipse.e4.ui.workLeon Ochoach.addons.swt/src/org/eclipse/e4/ui/workbench/addons/cleanupaddon/CleanupAddon.java -> This is the "safe guarding" code. If there is a check missing, please add it here, instead of adding additional checks later.

Line:190, bundles/org.eclipse.e4.ui.workLeon Ochoach.addons.swt/src/org/eclipse/e4/ui/workbench/addons/cleanupaddon/CleanupAddon.java -> Please avoid unnecessary ws changes.

-------------------------------------
author: Kelly Potter
date: 2015-05-05 22:44:41.000000000

Patch Set 5:

(2 comments)

Line:158, bundles/org.eclipse.e4.ui.workLeon Ochoach.addons.swt/src/org/eclipse/e4/ui/workbench/addons/cleanupaddon/CleanupAddon.java -> There will likely be cases where it is appropriate to run the code that manages the SWT widget hierarchy but not the code that propogates visibilty flags, so a single set of guards at the start of the method may be risky. 

See my comments below.

Line:190, bundles/org.eclipse.e4.ui.workLeon Ochoach.addons.swt/src/org/eclipse/e4/ui/workbench/addons/cleanupaddon/CleanupAddon.java -> I'm not sure that this IS unnecessary. This code does two things:

1. It ensures that the widget itself is parented correctly and has the correct z-order in the SWT widget hierarchy. I don't understand why this is necessary, but if it is then it would apply equally to pretty much anything that uses SWT widgets.

2. It propagates visibility changes from child elements to their parent. This is only applicable to part sash container and part stack, and doing this for other model elements is harmful.

I wrote the checks the way I did to suppress behavior 2 without modifying behavior 1. Without investigating why behavior 1 exists, I don't want to disturb it this late in the release cycle.

In the interest of not introducing regressions at this point, I'm inclined to leave this code as-is for now with a TODO suggesting that it should be refactored. Then post-release we can refactor it.

I suspect, though, that a single guard at the start of the method won't work for both behaviors since they are almost certainly intended for different use-cases. I'd suggest that the post-release refactor should break this into two separate methods for the two use-cases (called propogateVisibilyChanges and manageSwtWidgetHierarchy, for example) with a separate set of guards for each.

-------------------------------------
author: Teagan Marsh
date: 2015-05-06 00:42:48.000000000

Patch Set 5:

Interesting finding, Stefan.  I wonder if rather than using instanceof tests, we should instead use IPresentationEngine.HIDDEN_EXPLICITLY

-------------------------------------
author: Zaid Mosley
date: 2015-05-06 17:29:09.000000000

Patch Set 5: -Code-Review

Thanks for the explanation Stefan, sounds reasonable. I withdrawn my -1.

But as I'm unable to reproduce the resurrection of the hidden toolbar, I cannot set the review flag in the bug report required for RC1.  Sergey already gave +1. So maybe Brian?

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