Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-ui-dev] dynamic content in pop-up menus for objectContribution

Chris,

Correct, object contributions do not support dynamic items.  The main 
issue is that we want to avoid plugin activation.
We've considered scenarios like:
- allow a dynamic menu to be declared in the XML
- allow it to be placed in existing menus (either in specific main menus 
or context menus, or as an object contribution in context menus)
- provide programmatic API to add/remove items to a dynamic menu
- have the workbench be responsible for persisting these
- on restart, the workbench can populate the dynamic menus based on the 
persisted items without activating plugins

This approach will work for dynamic submenus like Run History where the 
list of items would only be updated by running code, but not for ones that 
are essentially generated from other extensions in the XML (e.g. Run As).

For more context on this problem, see:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=29709
and the other PRs it references, particularly:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=11114

Regards,
Nick






Chris Tilt <chris@xxxxxxxxx> 
Sent by: platform-ui-dev-admin@xxxxxxxxxxx
01/20/2004 02:21 PM
Please respond to
platform-ui-dev


To
platform-ui-dev@xxxxxxxxxxx
cc

Subject
Re: [platform-ui-dev] dynamic content in pop-up menus for 
objectContribution






Nick, thanks for your note. Just to be sure I'm not missing the point, 
are you saying there is no way to add dynamic content (code or xml) in 
the context of an objectContribution rather than a toolbar or view?

I looked at the OpenWithMenu and I see other examples that add "drop 
down" style menus, but they all stem from toolbars or views. If there is 
a mechanism, even with code, that I can build a "drop down" menu from an 
object context, please hit me over the head with it.

Justification: we are trying to implement the contextual launch in such 
a way as to minimize the need for further extension point contributions 
(since most of the data is already specified for launch shortcuts). We 
want it to be as general as possible so that it works in all reasonable 
views and perhaps editors.

Thanks, Chris

Nick Edgar wrote:

> Chris,
> 
> ObjectContributions do not currently support dynamic items, nor do 
> viewActions or editorActions.  And action sets only apply to the main 
> menus and toolbars (independent of selection).
> The Open With submenu in our views is added in code, not via extensio 
(If 
> you're interested, see o.e.ui.actions.OpenWithMenu and 
> o.e.ui.views.navigator.OpenActionGroup.fillOpenWithMenu).
> It would be feasible to add the "dropdown" style similar to what's in 
> action sets.  The corresponding interface is 
> IWorkbenchWindowPulldownDelegate2.  Darin (either S or W) knows all 
about 
> this one.
> 
> Nick
> 
> 
> 
> 
> 
> Chris Tilt <chris@xxxxxxxxx> 
> Sent by: platform-ui-dev-admin@xxxxxxxxxxx
> 01/19/2004 07:17 PM
> Please respond to
> platform-ui-dev
> 
> 
> To
> platform-ui-dev@xxxxxxxxxxx
> cc
> 
> Subject
> [platform-ui-dev] dynamic content in pop-up menus for objectContribution
> 
> 
> 
> 
> 
> 
> My apologies for posting to the dev list, but we've spent considerable 
> time looking for the answer.
> 
> Is it possible to contribute dynamic content (as in late-binding actions 

> and labels) to a cascaded pop-up menu in an objectContribution? I've 
> read through the plugin schemas and it seems that objectContributions in 

> the context of a pop-up menu extension have a limited set of attributes 
> that do not support dynamic actions.
> 
> I also tried attaching an actionSet (within actionSet extension) to a 
> menu defined within a pop-up extension. But of course, you know that 
> didn't work.
> 
> The OpenWith class is used often for dynamic menu content, but only in 
> viewContribution(s), as far as I see.
> 
> The debug team is working on creating Run/Debug in a context menu, which 

> will be most useful as an objectContribution. I would greatly appreciate 

> any hints.
> 
> Cheers, Chris
> 
> P.S. Pasted below is non-working attempt that shows the desired feature.
> 
> Chris Tilt
> IBM/US/Beaverton
> Eclipse Debug Team
> 
> <!-- ========================================= -->
> <!-- Contextual Launch Menu (Work in Progress) -->
> <!-- ========================================= -->
>     <extension
>           point="org.eclipse.ui.popupMenus"> <!-- this is what we are 
> extending -->
>        <objectContribution
>              objectClass="org.eclipse.core.resources.IResource"
>              id="org.eclipse.debug.ui.contextualLaunch">
>                                  <menu
>  label="%LaunchMenu.label"
>  path="additions"
>  id="contextualLaunch.popupMenu"> <!-- others may reference this 
> launch pop-up -->
>                                                  <separator
>  name="launchGroup">
>                                                  </separator>
>                                  </menu>
>                    </objectContribution>
>                  </extension>
>                  <!-- Add Run and Debug Menu Group points to the 
> Contextual Launch 
> pop-up -->
>                  <extension
>           point="org.eclipse.ui.popupMenus">
>        <objectContribution
>              objectClass="org.eclipse.core.resources.IResource"
>              id="org.eclipse.debug.ui.contextualLaunch.run_debug">
>           <menu
>                 label="%LaunchActionsMenu.label"
>                 path="contextualLaunch.popupMenu/launchGroup"
>                 id="org.eclipse.debug.ui.contextual.launch">
>              <separator
>                    name="runGroup">
>              </separator>
>              <separator
>                    name="debugGroup">
>              </separator>
>           </menu>
>         </objectContribution>
>                  </extension>
>                  <!-- Add specific Run and Debug Actions to the 
Contextual 
> Launch pop-up -->
>                  <extension
>           point="org.eclipse.ui.actionSets">
>        <actionSet
>              label="%LaunchActions.label"
>              visible="true"
>              id="org.eclipse.debug.ui.ContextualLaunchActions">
>           <action
> 
> 
definitionId="org.eclipse.debug.internal.ui.actions.RunHistoryMenuAction"
>                 label="%RunAsMenu.label"
>                 style="pulldown"
> 
> class="org.eclipse.debug.internal.ui.actions.ContextualRunAs"
> 
> menubarPath="org.eclipse.debug.ui.contextual.launch/runGroup"
>  id="org.eclipse.debug.internal.ui.actions.ContextualRunAs">
>           </action>
>           <action
> 
> 
definitionId="org.eclipse.debug.internal.ui.actions.DebugHistoryMenuAction"
>                 label="%DebugAsMenu.label"
>                 style="pulldown"
> 
> class="org.eclipse.debug.internal.ui.actions.ContextualDebugAs"
> 
> menubarPath="org.eclipse.debug.ui.contextual.launch/debugGroup"
> 
> id="org.eclipse.debug.internal.ui.actions.ContextualDebugAs">
>           </action>
>        </actionSet>
>      </extension>
> _______________________________________________
> platform-ui-dev mailing list
> platform-ui-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/platform-ui-dev
> 
> 
> _______________________________________________
> platform-ui-dev mailing list
> platform-ui-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/platform-ui-dev

_______________________________________________
platform-ui-dev mailing list
platform-ui-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-ui-dev




Back to the top