Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-ui-dev] [Contributions] ActionContributionItem should support binding to existing widgets (fill() method case)

The ActionContributionItem has a fill() method that inserts a new item in a specified composite parent. This method can be invoked used in MenuManager.update(boolean, boolean) method for a contributed action (for example, "Quick Assist" action provided by AbstractTextEditor.

When such editor is used as a page in MultiPageEditor and editor context menu is to be created, the MenuManager's menu is built in a few steps and the update method is invoked at the end of each step due to update the Menu.

At the last time the update() method is called, the menu is full of items (including ActionContributionItem items) created and inserted at the previous steps of context menu creation.

So, when the update() method merges the items into a menu and an order of the menu model items differs from what we have in the menu (this occurs in MultiPageEditor-like editors) the IContributionItem.fill(Menu parent, int index) method is used to put new actions from a model into the menu.

In case of item is ActionContributionItem the method fill() has the "if (widget == null && ...) {}" statement which body is never called because the contributed actions already have their "widget" member initialized (probably on some of previous call to MenuManager.update() method or as it described in https://bugs.eclipse.org/bugs/show_bug.cgi?id=70088 issue).

As result I don't see any of ActionContributionItem items in editor context menu (opposite to what I see in the same menu in a non-multipage text editor).

WDYT, does it looks like a bug?

If this is not a bug, how can I make ActionContributedItems to be shown in a Context Menu on text page of my Multipage Editor (StructuredTextEditor is used on one of its page)?

Any help appreciated,
Thanks,
Victor


Back to the top