forked from nathan-osman/REST-Easy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.js
62 lines (49 loc) · 2.21 KB
/
bootstrap.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var CHROME_URL = 'chrome://resteasy/content/resteasy.html';
function install(data, reason) {}
function uninstall(data, reason) {}
function startup(data, reason) {
// Load the required modules for initializing the add-on
Components.utils.import('chrome://resteasy/content/js/modules/browser.jsm');
Components.utils.import('chrome://resteasy/content/js/modules/l10n.jsm');
Components.utils.import('chrome://resteasy/content/js/modules/menu.jsm');
Components.utils.import('chrome://resteasy/content/js/modules/toolbar.jsm');
Components.utils.import('chrome://resteasy/content/js/modules/watchwindows.jsm');
// Opens a new tab for REST Easy
function openRestEasy(window) {
addTab(window, CHROME_URL);
}
// For each open window, create the necessary UI overlays
watchWindows(function(window) {
// Add the menu items to the two web developer menus
addItemToDesktopMenu(window,
'appmenu_webDeveloper_popup',
'appmenu_resteasy',
_('ui.title'),
openRestEasy);
addItemToDesktopMenu(window,
'menuWebDeveloperPopup',
'menu_resteasy',
_('ui.title'),
openRestEasy);
// Add the menu item to the mobile menu
addItemToMobileMenu(window,
_('ui.title'),
openRestEasy);
// Add the item to the toolbar
addItemToToolbar(window,
'launcher',
_('ui.title'),
'chrome://resteasy/content/img/icon16.png',
openRestEasy);
});
}
function shutdown(data, reason) {
// Load the unload function
Components.utils.import('chrome://resteasy/content/js/modules/unload.jsm');
// Run the unloaders when we're shutting down
if(reason != APP_SHUTDOWN)
unload();
}