DESCRIPTION

Bug 391430 - Dynamically creating / deleting menu items in Menu and MPopupMenu doesn't work

Reactivate the fix of Sopot and modify it so it can handle the remove
and add of many elements. Additionally the determination of the insert
index changes so it can handle the differences between MenuManager and
E4 model.

Change-Id: I800574190347c0f94e4a2d951bb7611ab73cc9e3
Signed-off-by: Jaydon Logan xxx@xxx.xxx


COMMENTS

author: Jaydon Logan
date: 2014-04-03 17:29:32.000000000

Uploaded patch set 4.

-------------------------------------
author: Brenden Conley
date: 2014-04-03 17:29:37.000000000

Patch Set 4:

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

-------------------------------------
author: Brenden Conley
date: 2014-04-03 17:44:53.000000000

Patch Set 4: Verified+1

Build Successful 

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

-------------------------------------
author: Jaydon Logan
date: 2014-04-03 17:46:30.000000000

Patch Set 4:

Hi all,

I've changed the implementation to use the UIEvents.asIterable() and fixed an issue in the remove method which prevented a reordering/readding of the menu elements.

I made some tests concerning the "incomplete Menu-Elements created via Live-Editor" I mentioned previously. The tests showed that a Menu without a child element isn't created at all by the MenuManager (so the menu will never appear). After you create a child element in the menu, remove, and add it again it will appear (the remove and add can be triggered in the Live-Editor if you reorder the menu). Something similiar happens if you add a HandledMenuItem, the item will appear on the UI if you enter a label but a later added command will not be executed (do the add/remove trick and it can be executed).

So we have to make a decision: Do we want to handle all kind of incomplete Menu-Elements or do we say this causes to many extra events to be handle which isn't worth the effort?

René

-------------------------------------
author: Slade Moran
date: 2014-04-03 17:48:58.000000000

Patch Set 4: Code-Review-1

I get an exception, comments in bug

-------------------------------------
author: Jaydon Logan
date: 2014-04-03 18:12:00.000000000

Patch Set 4:

The problem for the exception of Paul was found and had nothing to do with this commit.

-------------------------------------
author: Slade Moran
date: 2014-04-03 18:18:04.000000000

Patch Set 4:

(1 comment)

Line:683, bundles/org.eclipse.e4.ui.workLeon Ochoach.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java -> This seems to be an O(n^2) algorithm.  But these methods are called frequently, especially when opening a menu (like the context menu) and could cause an especially noticeable delay for the user.

-------------------------------------
author: Jaydon Logan
date: 2014-04-03 18:23:26.000000000

Patch Set 4:

(1 comment)

Line:683, bundles/org.eclipse.e4.ui.workLeon Ochoach.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java -> That's the reason why I try to exit as soon as possible and also why the search begins at "children.indexOf(newElement);  -- (line: 711)" which should be really close to the possible insert index (so not many iterations made here).

-------------------------------------
author: Zaid Mosley
date: 2014-04-23 10:58:25.000000000

Patch Set 4:

Paul, are you OK with the feedback from Rene or do you require more work here?

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