Bug 1090949 - Add way to make WebIDE runtimes configurable. r=ochameau

This commit is contained in:
Jan Keromnes 2015-04-08 14:42:00 -04:00
Родитель 730714e0b7
Коммит 24089aabe1
4 изменённых файлов: 39 добавлений и 8 удалений

Просмотреть файл

@ -415,16 +415,29 @@ let UI = {
parent.firstChild.remove();
}
for (let runtime of runtimeList[type]) {
let panelItemNode = document.createElement("toolbarbutton");
panelItemNode.className = "panel-item runtime-panel-item-" + type;
panelItemNode.setAttribute("label", runtime.name);
parent.appendChild(panelItemNode);
let r = runtime;
panelItemNode.addEventListener("click", () => {
let panelItemNode = document.createElement("hbox");
panelItemNode.className = "panel-item-complex";
let connectButton = document.createElement("toolbarbutton");
connectButton.className = "panel-item runtime-panel-item-" + type;
connectButton.setAttribute("label", r.name);
connectButton.setAttribute("flex", "1");
connectButton.addEventListener("click", () => {
this.hidePanels();
this.dismissErrorNotification();
this.connectToRuntime(r);
}, true);
panelItemNode.appendChild(connectButton);
if (r.configure && UI.isRuntimeConfigurationEnabled()) {
let configButton = document.createElement("toolbarbutton");
configButton.className = "configure-button";
configButton.addEventListener("click", r.configure.bind(r), true);
panelItemNode.appendChild(configButton);
}
parent.appendChild(panelItemNode);
}
}
},
@ -631,6 +644,10 @@ let UI = {
return Services.prefs.getBoolPref("devtools.webide.showProjectEditor");
},
isRuntimeConfigurationEnabled: function() {
return Services.prefs.getBoolPref("devtools.webide.enableRuntimeConfiguration");
},
openProject: function() {
let project = AppManager.selectedProject;

Просмотреть файл

@ -78,6 +78,8 @@ const Strings = Services.strings.createBundle("chrome://browser/locale/devtools/
* A |Connection| object from the DevTools |ConnectionManager|.
* @return Promise
* Resolved once you've called the |connection|'s connect() method.
* configure() OPTIONAL
* Show a configuration screen if the runtime is configurable.
*/
/* SCANNER REGISTRY */

Просмотреть файл

@ -197,7 +197,8 @@ panel > .panel-arrowcontainer > .panel-arrowcontent {
font-size: 13px; /* height of the icons */
}
.panel-item:hover {
.panel-item:hover,
.panel-item-complex:hover {
background: #CBF0FE;
}
@ -263,7 +264,8 @@ panel > .panel-arrowcontainer > .panel-arrowcontent {
.runtime-panel-item-usb,
.runtime-panel-item-wifi,
.runtime-panel-item-other,
.runtime-panel-item-simulator {
.runtime-panel-item-simulator,
.configure-button {
list-style-image: url("icons.png");
}
@ -280,12 +282,21 @@ panel > .panel-arrowcontainer > .panel-arrowcontent {
.runtime-panel-item-wifi { -moz-image-region: rect(208px,438px,234px,412px) }
.runtime-panel-item-other { -moz-image-region: rect(26px,438px,52px,412px) }
.runtime-panel-item-simulator { -moz-image-region: rect(0px,438px,26px,412px) }
.configure-button { -moz-image-region: rect(104px,462px,129px,438px) }
.configure-button > .toolbarbutton-icon {
width: 13px;
height: 13px;
}
.configure-button > .toolbarbutton-text {
display: none;
}
#runtime-actions {
border-top: 1px solid rgba(221,221,221,1);
}
#runtime-actions > toolbarbutton {
border-top: 1px solid rgba(221,221,221,1);
background-color: rgba(233,233,233,1);

Просмотреть файл

@ -10,6 +10,7 @@ pref("devtools.webide.autoinstallFxdtAdapters", true);
pref("devtools.webide.autoConnectRuntime", true);
pref("devtools.webide.restoreLastProject", true);
pref("devtools.webide.enableLocalRuntime", false);
pref("devtools.webide.enableRuntimeConfiguration", false);
pref("devtools.webide.addonsURL", "https://ftp.mozilla.org/pub/mozilla.org/labs/fxos-simulator/index.json");
pref("devtools.webide.simulatorAddonsURL", "https://ftp.mozilla.org/pub/mozilla.org/labs/fxos-simulator/#VERSION#/#OS#/fxos_#SLASHED_VERSION#_simulator-#OS#-latest.xpi");
pref("devtools.webide.simulatorAddonID", "fxos_#SLASHED_VERSION#_simulator@mozilla.org");