I assume that by "Preference Pane" you actually mean the Option Dialog window for your add-on, not just a single <prefpane>
within the <prefwindow>
. I also assume that you have an options.xul
which is fully functional for use as a options dialog using the normal option button from the add-on tab.
I found that somewhat different options than tazyDevel shows above were needed to have the options dialog open so that it appears as if it was opened from the add-ons tab. I am not sure if this is a difference from 2012 to 2014 (when I wrote the code below), or if it is just an implementation difference. If I recall correctly, when I wrote this, I checked to see how Firefox was launching the options dialog windows and copied the options that were being used there.
I use the following code to open the options dialog for one of my add-ons from a button in the add-on's main dialog window (in addition to having it available through the add-ons tab):
XUL (the button that opens the options dialog):
<button label="Options" id="optionsButtonId"
onclick="myExtension.optionsButton();"
tooltiptext="Open the options window."
hidden="false" />
JavaScript:
/**
* The Options button.
*/
optionsButton : function() {
window.openDialog('chrome://myExtension/content/options.xul', '',
'chrome,titlebar,toolbar,centerscreen,modal');
},
Depending on how your code is organized, you may need to manually apply some preferences and/or have preference observer(s) which propagate the changes to what needs to know about them.
myExtension
is a placeholder for whatever you are using to call your extension. A single object variable containing functions is assumed, as is myExtension
being what you use to identify your content in your chrome.manifest
file.