ff addon execute menu item - firefox

I want to modify an existing addon for simplicity. I have this code:
<popup id="contentAreaContextMenu">
<menu id="llOpenLocalLink" label="&llOpenLocalLink.label;" insertbefore="context-sep-open" >
<menupopup>
<menuitem id="llOpenInThisTab" label="&llOpenInThisTab.label;" oncommand="LocalLink.openLinkInThisTab(event)"/>
<menuitem id="llOpenInNewTab" label="&llOpenInNewTab.label;" oncommand="LocalLink.openLinkInNewTab(event)"/>
<menuitem id="llOpenInNewWindow" label="&llOpenInNewWindow.label;" oncommand="LocalLink.openLinkInNewWindow(event)"/>
</menupopup>
</menu>
</popup>
And I only want a single menu entry which is executed if clicked. I tried this but it is not executed:
<popup id="contentAreaContextMenu">
<menu id="llOpenLocalLink" label="&llOpenLocalLink.label;" insertbefore="context- sep-open" oncommand="LocalLink.openLinkInNewTab(event)">
</menu>
</popup>
Ok. I found the answer:
<popup id="contentAreaContextMenu">
<menuitem id="llOpenLocalLink" label="&llOpenLocalLink.label;" insertbefore="context-sep-open" oncommand="LocalLink.openLinkInNewTab(event)"/>
</popup>

Related

Nativescript Vue: Why does position of code matter in a Dock Layout matter?

Why does this following code produce this result: https://imgur.com/a/lQhLs8o ?
However, if I move the BottomNavigatorBar component to top position before CountryListComponent, it produces the desired result that looks like this: https://imgur.com/a/23z7bb2 ?
<template>
<Page actionBarHidden="true">
<DockLayout height="100%">
// first
<CountryListComponent dock="top">
// second
<BottomNavigationBar dock="bottom" activeColor="pink"
inactiveColor="yellow"
backgroundColor="black"
verticalAlignment="bottom"
#tabSelected="this.changeTab"
row="1">
<BottomNavigationTab title="Fiaarst" icon="icon-29.png" />
<BottomNavigationTab title="Second" icon="icon-29.png" />
<BottomNavigationTab title="Third" icon="icon-29.png" />
</BottomNavigationBar>
</DockLayout>
</Page>
</template>
CountryListComponent
<template>
<StackLayout backgroundColor="blue">
</StackLayout>
</template>
Refer the DockLayout documentation, by default stretchLastChild will be true which means BottomNavigationBar will take entire space if it's last child and vice versa.

VSIX/VSPackage: Solution Control Explorer context menu

I am having a lot of issues trying to understand how to get a submenu working in VisualStudio 2013's Solution Control Explorer, when creating a VSPackage project. I am able to add buttons, and that is great. However, I want to create the submenus such as the existing "Find" and "Advanced":
The code below is getting the two buttons in the menu list (as seen in the image/link above), but it does not show the submenu. I have tried to add buttons to the submenu, but it still does not show.
<Commands package="guidFirstPackagePkg">
<Menus>
<Menu guid="guidVSPackage3CmdSet" id="SubMenu" priority="0x0100" type="Menu">
<Parent guid="guidSourceControlExplorerMenuGroup" id="SourceControlExplorerMenuGroupId"/>
<Strings>
<ButtonText>Sub Menu</ButtonText>
<CommandName>Sub Menu</CommandName>
</Strings>
</Menu>
</Menus>
<!--Buttons section. -->
<Buttons>
<Button guid="guidVSPackage2CmdSet" id="cmdIdImport" priority="0x0100" type="Button">
<Parent guid="guidSourceControlExplorerMenuGroup" id="SourceControlExplorerMenuGroupId" />
<Strings>
<ButtonText>Import</ButtonText>
</Strings>
</Button>
<Button guid="guidVSPackage2CmdSet" id="cmdIdExport" priority="0x0100" type="Button">
<Parent guid="guidSourceControlExplorerMenuGroup" id="SourceControlExplorerMenuGroupId" />
<Strings>
<ButtonText>Export</ButtonText>
</Strings>
</Button>
</Buttons>
</Commands>
<Symbols>
<!-- This is the package guid. -->
<GuidSymbol name="guidFirstPackagePkg" value="{fd27b3da-39c0-486a-9900-652cb81b0744}" />
<GuidSymbol name="guidSourceControlExplorerMenuGroup" value="{ffe1131c-8ea1-4d05-9728-34ad4611bda9}">
<IDSymbol name="SourceControlExplorerMenuGroupId" value="0x1111" />
</GuidSymbol>
<GuidSymbol name="guidVSPackage2CmdSet" value="{1d975044-0a78-4e91-a6c2-2e841f4280e4}">
<IDSymbol name="cmdIdImport" value="0x0100" />
<IDSymbol name="cmdIdExport" value="0x0110" />
</GuidSymbol>
<GuidSymbol name="guidVSPackage3CmdSet" value="{C860DEF0-0A00-44BE-A8D9-393BACE1A44A}">
<IDSymbol name="SubMenu" value="0x1001"/>
</GuidSymbol>
</Symbols>
Any ideas of what I am doing wrong? Wrong linking, can I not use the same "SourceControlExplorerMenuGroupId" for menus, but only buttons?
I know a related post dealt with the addition of a button to the Solution Control Explorer, however, I was unable to replicated this for a Solution Control Explorer submenu:
Creating VSIX package for TFS Source control explorer context menu extension
Another reference I tried, but was not related to Solution Control Explorer:
Why isn't my vspackage's context menu showing
Your <Menus> code is fine.
Create a group with its parent guid and id matching your menu guid and id:
<Groups>
<Group guid="guidVSPackage3CmdSet" id="MyMenuGroup" priority="0x0600">
<Parent guid="guidVSPackage3CmdSet" id="SubMenu" />
</Group>
</Groups>
Then, just have your buttons be children of the group:
<Buttons>
<Button guid="guidVSPackage2CmdSet" id="cmdIdImport" priority="0x0100" type="Button">
<Parent guid="guidVSPackage3CmdSet" id="MyMenuGroup" />
<Strings>
<ButtonText>Import</ButtonText>
</Strings>
</Button>
<Button guid="guidVSPackage2CmdSet" id="cmdIdExport" priority="0x0100" type="Button">
<Parent guid="guidVSPackage3CmdSet" id="MyMenuGroup" />
<Strings>
<ButtonText>Export</ButtonText>
</Strings>
</Button>
</Buttons>

Add submenu in menupopup mozilla extension developmet?

Here I am working with firefox extension development. I have using XUL Overlays to add menu popup item in my extension.
<menupopup id="menu_ToolsPopup">
<menuitem label="HP Scheduler Options..."
insertafter="devToolsSeparator"
oncommand="openPreferences('hpschedPane');" />
</menupopup>
Here I need to add sub menu with menu item.
<menupopup id="menu_ToolsPopup">
<menuitem label="HP Scheduler Options..."
insertafter="devToolsSeparator"
oncommand="openPreferences('hpschedPane');" />
<menu id="..." label="My submenu!">
<menupopup>
<menuitem label="My menu item in the submenu!" oncommand="..." />
</menupopup>
</menu>
</menupopup>

Firefox Extension - How to use preference for a menulist?

I'm trying to use the tag <preference> for saving the state of a <menulist>. But I can't find out of what i'm doing wrong.
Here's my code:
<preferences>
<preference id="selectpref1" name="preference.name" type="int" />
</preferences>
<menulist>
<menupopup preference="selectpref1">
<menuitem label="option 1" value="1"/>
<menuitem label="option 2" value="2"/>
<menuitem label="option 3" value="3"/>
<menuitem label="option 4" value="4"/>
</menupopup>
</menulist>
You can do it, here's code from my extension:
<hbox align="center">
<label value="Log Level" control="loglevellist" />
<menulist id="loglevellist" preference="loglevel" preference-editable="true">
<menupopup>
<menuitem label="Full" value="0" />
<menuitem label="Relevant" value ="1" />
<menuitem label="Warning" value="2" />
<menuitem label="Error" value="3" />
<menuitem label="Critical" value="4" />
</menupopup>
</menulist>
</hbox>
loglevel preference is integer. Basically I think you're only missing preference-editable attribute
EDIT:
I didn't see properly, you had preference attribute on menupopup instead on menulist - preference should go on menulist.
I'm pretty sure you can't do that. You just need to add an oncommand to each of the menuitems, which changes the preference. You might also want to add a listener for the "popupshowing" event, which checks the preference and puts a checkmark by whichever one is currently selected.
See https://developer.mozilla.org/en/Code_snippets/Preferences

How to insert image in status bar?

I want to create an image in my statusbar, but why it can't appear?
And, how to add menu in status bar when I click right the mouse?
This is my script:
<?xml version="1.0"?>
<!--
# Fungsi dari file ini adalah mengatur tampilan dan perilaku addon.
# Membuat menu "search hadits" pada saat user klik kanan pada halaman browser atau
# pada saat user klik kanan pada kata di halaman browser.
-->
<overlay id="inline_trans"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!--
# Membuat Menu Klik kanan pada halaman firefox.
# Memanggil fungsi pada haditsSearch.js untuk mulai melakukan pencarian hadits.
-->
<popup id="contentAreaContextMenu">
<menuitem class="inlinetrans" id="inlineContext" oncommand= "hadits_mean.startFind(null);"
label="Cari Terjemahan"/>
</popup>
<!-- ======================================================== -->
<!--
<window id="main-window">
<popupset id="mainPopupSet"></popupset>
<vbox id="hadits_holder" />
</window>
-->
<!--
<spacer flex="1"/>
<progressmeter mode="determined" value="82"/>
-->
<statusbar id="status-bar">
<statusbarpanel id="status-bar-inlinetrans"
src="chrome://inlinetrans/skin/imagesOn_kecil.png"
label="indonesia inline translator"
context="indonesia inline translator menu"
onclick="alert('okeh cuy')"
tooltiptext="inlinetrans versi 1.0"
/>
</statusbar>
</overlay>
You need an <image>. Something like:
<statusbar id="status-bar">
<statusbarpanel id="status-bar-inlinetrans">
<image src="chrome://inlinetrans/skin/imagesOn_kecil.png" />
</statusbarpanel>
</statusbar>
The other attributes can probably go on either the image or the statusbarpanel.

Resources