Bug 182018 - [GlobalActions] Turn ShowInMenu/ShowInAction into API
Summary: [GlobalActions] Turn ShowInMenu/ShowInAction into API
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 206815 (view as bug list)
Depends on: 173649
Blocks: 203789
  Show dependency tree
 
Reported: 2007-04-11 16:41 EDT by Min Idzelis CLA
Modified: 2009-03-02 11:11 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Min Idzelis CLA 2007-04-11 16:41:59 EDT
Build ID: 3.3M6

These classes (ShowInMenu/ShowInAction) are really good canidates for API. The one thing that I would like to see changed before making it API is that I woul dlike to supply the Object that is the ShowInContext. 

Please see related bug 180543
Comment 1 Min Idzelis CLA 2007-04-12 17:47:22 EDT
Related: bug 182225 and bug 182234
Comment 2 Tod Creasey CLA 2007-08-15 12:54:05 EDT
From a commands perspective we now have the org.eclipse.ui.navigate.showInQuickMenu command which you can add to a view and get all of this functionality for free so long as you register an IShowInSource adapter for your view.

The problem is building a submenu for it - I can get an entry that opens a second menu but not one that builds a submenu dynamically.
Comment 3 Tod Creasey CLA 2007-10-31 13:19:40 EDT
What is the plan for this for 3.4? Should we do an API command instead?
Comment 4 Paul Webster CLA 2007-10-31 14:16:31 EDT
I'll be looking at options in the M4/M5 timeframe.

PW
Comment 5 Min Idzelis CLA 2008-01-08 15:32:01 EST
I'm still waiting for this one. Any reason it was untargetted from 3.4M5?
Comment 6 Paul Webster CLA 2008-01-09 10:59:32 EST
Yes, I'm not sure what we will be providing here, since it would probably be command/handler based.

It will also depend on what comes out of bug 173649

PW
Comment 7 Paul Webster CLA 2008-01-11 07:56:41 EST
*** Bug 206815 has been marked as a duplicate of this bug. ***
Comment 8 Paul Webster CLA 2008-03-19 16:48:24 EDT
Min, with  bug 173649 ContributionItemFactory.VIEWS_SHOW_IN.create(IWorkbenchWindow) will produce the ShowInMenu contribution item for consumption.

Using commands/menu contributions new show in targets can be introduced using menu contributions:
   <menuContribution locationURI="popup:org.eclipse.ui.menus.showInMenu">
      <command commandId="org.eclipse.ui.menus.showIn" style="push">
         <parameter name="org.eclipse.ui.menus.showIn.targetId"
                    value="org.eclipse.ui.views.ProgressView">
         </parameter>
         <visibleWhen checkEnabled="false">
            <with variable="showInSelection">
// insert visible when expression here
            </with>
         </visibleWhen>
      </command>
   </menuContribution>

What behaviour exactly were you looking for?

PW
Comment 9 Min Idzelis CLA 2008-03-19 17:12:49 EDT
At the begining I was actually using the IContributionItemFactory, but now I'm using the new way of doing it...

   <menuContribution
            locationURI="popup:MYEDITORID#PopupMenu?after=MYSEPERATOR">
         <command
               commandId="org.eclipse.ui.navigate.showInQuickMenu"
               label="Show in">
         </command>
      </menuContribution> 

However, this never displayed the 2nd-level cascade. If I clicked on "show in" it would then dismiss the context menu, and a new disembodied menu would show up with all the targets. I would have liked it if I could see the show in targets as a sub-menu off the context menu. 


Also, I want to be able to customize the ShowInContext item that is passed to the IShowInTarget. I think thay may have already been possible. 

For example, I have a GEF editor. The selection is an EditPart. It would like to convert the EditPart to an IFile. The ShowInContext's selection should be the IFile. 

--
Just to be clear... bug that this depends on makes it possible to add new ShowInTargets via extension point, instead of having to rely on Perspectives. 
Comment 10 Paul Webster CLA 2008-03-19 17:53:35 EDT
(In reply to comment #9)
> At the begining I was actually using the IContributionItemFactory, but now I'm
> using the new way of doing it...
> 
>    <menuContribution
>             locationURI="popup:MYEDITORID#PopupMenu?after=MYSEPERATOR">
>          <command
>                commandId="org.eclipse.ui.navigate.showInQuickMenu"
>                label="Show in">
>          </command>
>       </menuContribution> 

Min, you would use this XML instead of your command element to insert the menu/short-cut/target items

         <menu
               commandId="org.eclipse.ui.navigate.showInQuickMenu"
               id="org.eclipse.ui.ide.markers.showInMenu"
               label="%menu.showIn.label"
               mnemonic="%menu.showIn.mnemonic">
            <dynamic
                  class="org.eclipse.ui.ExtensionFactory:showInContribution"
                  id="org.eclipse.ui.menus.dynamicShowInMenu">
            </dynamic>
         </menu>



> Also, I want to be able to customize the ShowInContext item that is passed to
> the IShowInTarget. I think thay may have already been possible. 

ShowInContext is already API, but it's the IShowInSource that gets a chance to customize it on the way out.

> For example, I have a GEF editor. The selection is an EditPart. It would like
> to convert the EditPart to an IFile. The ShowInContext's selection should be
> the IFile. 

Your editor can return whatever it wants in its ShowInContext.

Later,
PW
Comment 11 Paul Webster CLA 2008-03-24 13:47:40 EDT
(In reply to comment #10)
> (In reply to comment #9)
> > At the begining I was actually using the IContributionItemFactory, but now I'm
> > using the new way of doing it...
> > 
> >    <menuContribution
> >             locationURI="popup:MYEDITORID#PopupMenu?after=MYSEPERATOR">
> >          <command
> >                commandId="org.eclipse.ui.navigate.showInQuickMenu"
> >                label="Show in">
> >          </command>
> >       </menuContribution> 
> 
> Min, you would use this XML instead of your command element to insert the
> menu/short-cut/target items
> 
>          <menu
>                commandId="org.eclipse.ui.navigate.showInQuickMenu"
>                id="org.eclipse.ui.ide.markers.showInMenu"
>                label="%menu.showIn.label"
>                mnemonic="%menu.showIn.mnemonic">
>             <dynamic
>                   class="org.eclipse.ui.ExtensionFactory:showInContribution"
>                   id="org.eclipse.ui.menus.dynamicShowInMenu">
>             </dynamic>
>          </menu>
> 
> 
> 

Did you get a chance to try the new menu contribution XML?

PW
Comment 12 Min Idzelis CLA 2008-03-24 18:01:51 EDT
When was the Eclipse platform updated to support this style?

<menu
     commandId="org.eclipse.ui.navigate.showInQuickMenu"
               id="com.ibm.etools.diagram.web.ui.showInQuickMenuId"
               label="Show In">
            <dynamic
                  class="org.eclipse.ui.ExtensionFactory:showInContribution"
                  id="org.eclipse.ui.menus.dynamicShowInMenu">
            </dynamic>
         </menu>

I put the menu within the <menuContribution> block. 


I just tried it in my development target (which is based on Eclipse code from 20080205). It's not working yet. Should it already be working on that build or should I wait for a later one?
Comment 13 Paul Webster CLA 2008-03-24 18:49:59 EDT
(In reply to comment #12)
> When was the Eclipse platform updated to support this style?
> 
> <menu
>      commandId="org.eclipse.ui.navigate.showInQuickMenu"
>                id="com.ibm.etools.diagram.web.ui.showInQuickMenuId"
>                label="Show In">
>             <dynamic
>                   class="org.eclipse.ui.ExtensionFactory:showInContribution"
>                   id="org.eclipse.ui.menus.dynamicShowInMenu">
>             </dynamic>
>          </menu>
> 
> I put the menu within the <menuContribution> block. 
> 
> 
> I just tried it in my development target (which is based on Eclipse code from
> 20080205). It's not working yet. Should it already be working on that build or
> should I wait for a later one?
> 

Ah, it won't be available until at least I20080320-0800

PW
Comment 14 Paul Webster CLA 2008-03-31 15:00:43 EDT
Let me know how it worked with the later I build.

PW
Comment 15 Paul Webster CLA 2009-03-02 11:11:26 EST
This work has concluded.
PW