Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359778 - [ActivityMgmt] [Compatibility] Commands Capabilities / Activities in Eclipse 4
Summary: [ActivityMgmt] [Compatibility] Commands Capabilities / Activities in Eclipse 4
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: All All
: P4 normal with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug candidate46
Keywords: needinfo
: 392709 (view as bug list)
Depends on: 359887 450284
Blocks: 381765 407166
  Show dependency tree
 
Reported: 2011-10-03 18:41 EDT by Eric Moffatt CLA
Modified: 2021-05-21 06:17 EDT (History)
16 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Moffatt CLA 2011-10-03 18:41:47 EDT
This is a commands version of bug 355497.

That defect is tracking the non-commands implementation, this one allows us to defer the work on the commands side...
Comment 1 Paul Webster CLA 2011-10-05 17:01:09 EDT
Note to self: see ContributionItemUpdater in WorkbenchMenuService in 3.x

PW
Comment 2 Dean Roberts CLA 2011-10-06 09:17:16 EDT
Copying Paul's comment from the original Capabilities defect to the Menu/Commands Capabilities defect.

Yesterday I was observing that some menu filtering was, in fact, occurring, but not refresh was being triggered by the change in capabilities.  However, once changed, opening new perspectives etc. would tend to show the correct(ish) menu operations.

I will be investigating further.



(In reply to comment #10)
> Paul, there are a number of different API's (various collection filters...) in
> the WorkbenchActivityHelper, do you know if any of them are used outside of the
> commands code ?

The one I'm thinking of in 3.x is in WorkbenchMenuService. 
ContributionItemUpdater gets an IIdentifier for individual IContributionItems,
and then adds itself as an IIdentifierListener.  It combines any visibleWhen
that applies to that ICI and any activity state as well.
Comment 3 Dean Roberts CLA 2011-10-06 09:20:11 EDT
Since, according to Paul's comment, the menu operations are also using IIdentifierListeners, correct menu operation will likely require the fix for bug 359887.  Unless menus also only attach one listener to each IIdentifier ... in which case the defect is masked.
Comment 4 Brian de Alwis CLA 2011-11-08 12:27:25 EST
Dean, I wondered if you had made any further progress on this.  I'm looking to use activities to control the visibility of a set of top-level menus.  I can put in some cycles on this, but I'd rather avoid duplicate effort.
Comment 5 Dean Roberts CLA 2011-11-08 12:53:37 EST
No I have not been looking at this recently.
Comment 6 Brian de Alwis CLA 2011-11-25 16:20:18 EST
I've pushed an initial set of commits to address activities for menus to the branch 'bdealwis/359778-activities'.

   http://git.eclipse.org/c/platform/eclipse.platform.ui.git/log/?h=bdealwis/359778-activities

My initial case was to get support for menus contributed from extension points.  This has not been extensively tested.  

The implementation is implemented against the E4AP model.  It walks the application model (and listens for changes) and adds/removes IIdentifier hooks for menus, toolbars, and perspectives.

I've implemented this within the WorkbenchMenuService class although it could (should?) be easily extracted into a standalone bundle; if the activity support was pulled out of org.eclipse.ui, we could bring this into the Eclipse 4 AP.

There are three commits.  The first is a minor fix and should be adopted.  The second works around a problem from how contributed menus are rendered.  The third provides the gut of the implementation.

commit f77397953f8bbc09f8869296e68731dc98169b32

    Ensure menus generated from plugin.xml have appropriate contributorURIs

We weren't maintaining contributor info when creating model objects.

commit 04138638b7bb438ed7c402818bf0c4038730cf48

    Allow contributed menus to have their visibility toggled.
    Menus contributed from a MMenuContribution are duplicated as part of the
    rendering process (ContributionRecord#mergeIntoModel()), and thus the
    toggling visibility on the source menu is ignored.

commit e7e8ffbb17cb5c12b8c2c9e8461fdeb4d9bbbc6b

    A first cut at providing activity support for menus, toolbars, and perspectives.
    NB: The menuContributionListener has a workaround for bug 364529.
Comment 7 Eric Moffatt CLA 2011-12-09 11:39:47 EST
Moving to M5.
Comment 8 Eric Moffatt CLA 2012-04-17 13:54:37 EDT
this is likely too deep to jamb into M7, no ?
Comment 9 Paul Webster CLA 2012-04-17 14:03:52 EDT
This will have to be deferred to SR1
PW
Comment 10 Torkild Resheim CLA 2012-04-18 10:03:47 EDT
(In reply to comment #9)
> This will have to be deferred to SR1
> PW
Too bad. This is a show-stopper for us.
Comment 11 Torkild Resheim CLA 2012-06-27 05:01:53 EDT
We would very much like to move our product over to 4.2, but cannot yet do this as this feature is quite important for us. If someone could give me some pointers for getting started I would like to contribute a patch.
Comment 12 Paul Webster CLA 2012-06-27 08:16:19 EDT
For the general information, see http://wiki.eclipse.org/Platform_UI/How_to_Contribute

Most of the code you are interested in is in http://git.eclipse.org/c/platform/eclipse.platform.ui.git/  If you need EclipseContext and DI projects, they're in http://git.eclipse.org/c/platform/eclipse.platform.runtime.git/  We're working in master in both projects.  See http://wiki.eclipse.org/Platform-releng/Git_Workflows#Configuring_the_repo for how we configure our repos (rebase=true on all tracked branches)


hints:

In 3.x, when menu contribution items were created in the WorkbenchMenuService, their visibleWhen was managed by org.eclipse.ui.internal.menus.WorkbenchMenuService.ContributionItemUpdater which took into account the visibleWhen and the IIdentifier state (activity calculation).

In 4.x menu element visibility is calculated starting in the org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRendererFilter.updateElementVisibility(MMenu, MenuManagerRenderer, MenuManager, IEclipseContext, int, boolean) in org.eclipse.e4.ui.workbench.renderers.swt

toolbar items visibility is managed in a runAndTrack created in org.eclipse.e4.ui.workbench.renderers.swt.ToolBarManagerRenderer.processAddition(MToolBar, ToolBarManager, MToolBarContribution)

When hooking in there, keep in mind that this plugin can't see activities or IIdentifiers.

PW
Comment 13 Paul Webster CLA 2012-10-24 10:15:41 EDT
*** Bug 392709 has been marked as a duplicate of this bug. ***
Comment 14 Patrik Suzzi CLA 2016-09-16 09:45:31 EDT
What is the current status of this bug?
I feel like it is an important one, but I don't understand the requirements.
Comment 15 Eclipse Genie CLA 2021-05-21 06:17:01 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.