Bug 1070957 - Show deprecation notice in App Manager. r=paul
--- a/browser/devtools/app-manager/content/index.js
+++ b/browser/devtools/app-manager/content/index.js
@@ -1,20 +1,21 @@
/* 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/. */
-const Cu = Components.utils;
+const {utils: Cu, interfaces: Ci} = Components;
Cu.import("resource:///modules/devtools/gDevTools.jsm");
const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
const {require} = devtools;
const {ConnectionManager, Connection} = require("devtools/client/connection-manager");
const promise = require("devtools/toolkit/deprecated-sync-thenables");
-const prefs = require('sdk/preferences/service');
-
+const prefs = require("sdk/preferences/service");
+const Services = require("Services");
+const Strings = Services.strings.createBundle("chrome://browser/locale/devtools/app-manager.properties");
let UI = {
_toolboxTabCursor: 0,
_handledTargets: new Map(),
connection: null,
init: function() {
@@ -29,16 +30,17 @@ let UI = {
window.addEventListener("message", this.onMessage);
},
onLoad: function() {
window.removeEventListener("load", this.onLoad);
let defaultPanel = prefs.get("devtools.appmanager.lastTab");
let panelExists = !!document.querySelector("." + defaultPanel + "-panel");
this.selectTab(panelExists ? defaultPanel : "projects");
+ this.showDeprecationNotice();
},
onUnload: function() {
for (let [target, toolbox] of this._handledTargets) {
toolbox.destroy();
}
window.removeEventListener("unload", this.onUnload);
@@ -173,12 +175,38 @@ let UI = {
this._handledTargets.set(target, toolbox);
toolbox.once("destroyed", () => {
this._handledTargets.delete(target)
});
});
} else {
return gDevTools.showToolbox(target, null, host);
}
+ },
+
+ showDeprecationNotice: function() {
+ let message = Strings.GetStringFromName("index.deprecationNotice");
+
+ let buttons = [
+ {
+ label: Strings.GetStringFromName("index.launchWebIDE"),
+ callback: gDevToolsBrowser.openWebIDE
+ },
+ {
+ label: Strings.GetStringFromName("index.readMoreAboutWebIDE"),
+ callback: () => {
+ window.open("https://developer.mozilla.org/docs/Tools/WebIDE");
+ }
+ }
+ ];
+
+ let docShell = window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell);
+ let browser = docShell.chromeEventHandler;
+ let nbox = browser.ownerDocument.defaultView.gBrowser
+ .getNotificationBox(browser);
+ nbox.appendNotification(message, "app-manager-deprecation", null,
+ nbox.PRIORITY_WARNING_LOW, buttons);
}
-}
+};
UI.init();
--- a/browser/locales/en-US/chrome/browser/devtools/app-manager.properties
+++ b/browser/locales/en-US/chrome/browser/devtools/app-manager.properties
@@ -1,12 +1,15 @@
# 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/.
+index.deprecationNotice=The App Manager will be removed in a future release. Your projects have been migrated to WebIDE.
+index.launchWebIDE=Launch WebIDE
+index.readMoreAboutWebIDE=Read More
# LOCALIZATION NOTE (device.deviceSize): %1$S is the device's width, %2$S is
# the device's height, %3$S is the device's pixel density.
# Example: 800x480 (86 DPI).
device.deviceSize=Device size: %1$Sx%2$S (%3$S DPI)
# LOCALIZATION NOTE (connection.connectedToDevice, connection.connectTo):
# %1$S is the host name, %2$S is the port number.
connection.connectedToDevice=Connected to %1$S
connection.connectTo=Connect to %1$S:%2$S