Reuse built-in bookmarks menu item context menu, possible?

30 views
Skip to first unread message

Ruben Goethals

unread,
Feb 6, 2015, 1:24:45 PM2/6/15
to mozilla-la...@googlegroups.com

Hello,

Does anyone know if there is a way to give my menu-item(s) inside a toolbar dropdown button a context menu which is identical to the context menu given to the menu-items in a firefox built-in bookmark toolbar button (see screenshot)?

I tried to check the firefox source code to see how the built-in one has been made and I think I found where those menu-item are created, but I don't find anything about a context menu.  Is it possible that it is automatically generated via this attribute "scheme" ? (Or via the extra classes?)
If not, how is it created and can I reuse that function somehow?

If nothing positive above, do I really have to manually make this common context menu?

Thanks in advance.

Ruben Goethals

unread,
Feb 23, 2015, 5:00:55 PM2/23/15
to mozilla-la...@googlegroups.com
Anyone an idea or just some thoughts about it?

Ruben Goethals

unread,
Feb 26, 2015, 9:16:48 AM2/26/15
to mozilla-la...@googlegroups.com
I guess not. I guess I have to do it manually.  :-/

Ruben Goethals

unread,
Feb 26, 2015, 10:44:59 AM2/26/15
to mozilla-la...@googlegroups.com

OMG!!!   I FOUND IT!  I surprised myself.

This did it:
mi.setAttribute("context", "placesContext");

Only remaining problem is that some items are grayed out. Anyone any idea why?  Some attribute that I need to set?

Ruben Goethals

unread,
Mar 6, 2015, 6:32:44 AM3/6/15
to mozilla-la...@googlegroups.com
Meanwhile, I've posted a stackoverflow bounty for it. For anyone interested to get some reputation over there. :-)
http://stackoverflow.com/questions/28805418/how-to-reuse-bookmarks-contextmenu-contextmenu-commands-not-issued

Ruben Goethals

unread,
May 5, 2015, 7:30:13 PM5/5/15
to mozilla-la...@googlegroups.com

Can anyone help me with this?


I need the following 2 lines triggered in my code and the whole thing will finally work!
Unfortunatly they come from XUL and I don't know how to translate that to SDK. 
  
            this._view = PlacesUIUtils.getViewForNode(doc.getElementById('placesContext'));
            this._view.buildContextMenu(this);

Ruben Goethals

unread,
May 5, 2015, 7:47:29 PM5/5/15
to mozilla-la...@googlegroups.com
Or just reuing the function "buildContextMenu" from "hrome://browser/content/places/browserPlacesViews.js".
How does one do that?
Reply all
Reply to author
Forward
0 new messages