зеркало из https://github.com/mozilla/gecko-dev.git
Bug 785889 - Make search related keyboard shortcuts discoverable, r=past
This commit is contained in:
Родитель
7442d7e110
Коммит
2f88458c33
|
@ -46,8 +46,8 @@ DebuggerUI.prototype = {
|
|||
tabs.addEventListener("TabSelect", bound_refreshCommand, true);
|
||||
|
||||
win.addEventListener("unload", function onClose(aEvent) {
|
||||
tabs.removeEventListener("TabSelect", bound_refreshCommand, true);
|
||||
win.removeEventListener("unload", onClose, false);
|
||||
tabs.removeEventListener("TabSelect", bound_refreshCommand, true);
|
||||
}, false);
|
||||
},
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
|
|||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import('resource://gre/modules/Services.jsm');
|
||||
Cu.import("resource:///modules/devtools/LayoutHelpers.jsm");
|
||||
|
||||
/**
|
||||
* Controls the debugger view by handling the source scripts, the current
|
||||
|
@ -51,6 +52,7 @@ let DebuggerController = {
|
|||
window.removeEventListener("DOMContentLoaded", this._startupDebugger, true);
|
||||
|
||||
DebuggerView.cacheView();
|
||||
DebuggerView.initializeKeys();
|
||||
DebuggerView.initializePanes();
|
||||
DebuggerView.initializeEditor(function() {
|
||||
DebuggerView.GlobalSearch.initialize();
|
||||
|
|
|
@ -33,12 +33,58 @@ let DebuggerView = {
|
|||
cacheView: function DV_cacheView() {
|
||||
this._onTogglePanesButtonPressed = this._onTogglePanesButtonPressed.bind(this);
|
||||
|
||||
// Panes and view containers
|
||||
this._togglePanesButton = document.getElementById("toggle-panes");
|
||||
this._stackframesAndBreakpoints = document.getElementById("stackframes+breakpoints");
|
||||
this._stackframes = document.getElementById("stackframes");
|
||||
this._breakpoints = document.getElementById("breakpoints");
|
||||
this._variables = document.getElementById("variables");
|
||||
this._scripts = document.getElementById("scripts");
|
||||
this._globalSearch = document.getElementById("globalsearch");
|
||||
this._globalSearchSplitter = document.getElementById("globalsearch-splitter");
|
||||
|
||||
// Keys
|
||||
this._fileSearchKey = document.getElementById("fileSearchKey");
|
||||
this._lineSearchKey = document.getElementById("lineSearchKey");
|
||||
this._tokenSearchKey = document.getElementById("tokenSearchKey");
|
||||
this._globalSearchKey = document.getElementById("globalSearchKey");
|
||||
this._resumeKey = document.getElementById("resumeKey");
|
||||
this._stepOverKey = document.getElementById("stepOverKey");
|
||||
this._stepInKey = document.getElementById("stepInKey");
|
||||
this._stepOutKey = document.getElementById("stepOutKey");
|
||||
|
||||
// Buttons, textboxes etc.
|
||||
this._resumeButton = document.getElementById("resume");
|
||||
this._stepOverButton = document.getElementById("step-over");
|
||||
this._stepInButton = document.getElementById("step-in");
|
||||
this._stepOutButton = document.getElementById("step-out");
|
||||
this._scriptsSearchbox = document.getElementById("scripts-search");
|
||||
this._globalOperatorButton = document.getElementById("global-operator");
|
||||
this._tokenOperatorButton = document.getElementById("token-operator");
|
||||
this._lineOperatorButton = document.getElementById("line-operator");
|
||||
},
|
||||
|
||||
/**
|
||||
* Applies the correct key labels and tooltips across global view elements.
|
||||
*/
|
||||
initializeKeys: function DV_initializeKeys() {
|
||||
this._resumeButton.setAttribute("tooltiptext",
|
||||
L10N.getFormatStr("pauseButtonTooltip", [LayoutHelpers.prettyKey(this._resumeKey)]));
|
||||
this._stepOverButton.setAttribute("tooltiptext",
|
||||
L10N.getFormatStr("stepOverTooltip", [LayoutHelpers.prettyKey(this._stepOverKey)]));
|
||||
this._stepInButton.setAttribute("tooltiptext",
|
||||
L10N.getFormatStr("stepInTooltip", [LayoutHelpers.prettyKey(this._stepInKey)]));
|
||||
this._stepOutButton.setAttribute("tooltiptext",
|
||||
L10N.getFormatStr("stepOutTooltip", [LayoutHelpers.prettyKey(this._stepOutKey)]));
|
||||
|
||||
this._scriptsSearchbox.setAttribute("placeholder",
|
||||
L10N.getFormatStr("emptyFilterText", [LayoutHelpers.prettyKey(this._fileSearchKey)]));
|
||||
this._globalOperatorButton.setAttribute("value",
|
||||
L10N.getFormatStr("searchPanelGlobal", [LayoutHelpers.prettyKey(this._globalSearchKey)]));
|
||||
this._tokenOperatorButton.setAttribute("value",
|
||||
L10N.getFormatStr("searchPanelToken", [LayoutHelpers.prettyKey(this._tokenSearchKey)]));
|
||||
this._lineOperatorButton.setAttribute("value",
|
||||
L10N.getFormatStr("searchPanelLine", [LayoutHelpers.prettyKey(this._lineSearchKey)]));
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -92,6 +138,11 @@ let DebuggerView = {
|
|||
this._stackframesAndBreakpoints.parentNode.removeChild(this._stackframesAndBreakpoints);
|
||||
this._variables.parentNode.removeChild(this._variables);
|
||||
this._globalSearch.parentNode.removeChild(this._globalSearch);
|
||||
|
||||
// Delete all the cached global view elements.
|
||||
for (let i in this) {
|
||||
if (!(this[i] instanceof Function)) delete this[i];
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -145,10 +196,12 @@ let DebuggerView = {
|
|||
if (aVisibleFlag) {
|
||||
this._stackframesAndBreakpoints.style.marginLeft = "0";
|
||||
this._togglePanesButton.removeAttribute("stackframesAndBreakpointsHidden");
|
||||
this._togglePanesButton.setAttribute("tooltiptext", L10N.getStr("collapsePanes"));
|
||||
} else {
|
||||
let margin = parseInt(this._stackframesAndBreakpoints.getAttribute("width")) + 1;
|
||||
this._stackframesAndBreakpoints.style.marginLeft = -margin + "px";
|
||||
this._togglePanesButton.setAttribute("stackframesAndBreakpointsHidden", "true");
|
||||
this._togglePanesButton.setAttribute("tooltiptext", L10N.getStr("expandPanes"));
|
||||
}
|
||||
Prefs.stackframesPaneVisible = aVisibleFlag;
|
||||
},
|
||||
|
@ -168,10 +221,12 @@ let DebuggerView = {
|
|||
if (aVisibleFlag) {
|
||||
this._variables.style.marginRight = "0";
|
||||
this._togglePanesButton.removeAttribute("variablesHidden");
|
||||
this._togglePanesButton.setAttribute("tooltiptext", L10N.getStr("collapsePanes"));
|
||||
} else {
|
||||
let margin = parseInt(this._variables.getAttribute("width")) + 1;
|
||||
this._variables.style.marginRight = -margin + "px";
|
||||
this._togglePanesButton.setAttribute("variablesHidden", "true");
|
||||
this._togglePanesButton.setAttribute("tooltiptext", L10N.getStr("expandPanes"));
|
||||
}
|
||||
Prefs.variablesPaneVisible = aVisibleFlag;
|
||||
},
|
||||
|
@ -184,7 +239,25 @@ let DebuggerView = {
|
|||
_stackframes: null,
|
||||
_breakpoints: null,
|
||||
_variables: null,
|
||||
_globalSearch: null
|
||||
_scripts: null,
|
||||
_globalSearch: null,
|
||||
_globalSearchSplitter: null,
|
||||
_fileSearchKey: null,
|
||||
_lineSearchKey: null,
|
||||
_tokenSearchKey: null,
|
||||
_globalSearchKey: null,
|
||||
_resumeKey: null,
|
||||
_stepOverKey: null,
|
||||
_stepInKey: null,
|
||||
_stepOutKey: null,
|
||||
_resumeButton: null,
|
||||
_stepOverButton: null,
|
||||
_stepInButton: null,
|
||||
_stepOutButton: null,
|
||||
_scriptsSearchbox: null,
|
||||
_globalOperatorButton: null,
|
||||
_tokenOperatorButton: null,
|
||||
_lineOperatorButton: null
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -823,10 +896,10 @@ GlobalSearchView.prototype = {
|
|||
/**
|
||||
* Initialization function, called when the debugger is initialized.
|
||||
*/
|
||||
initialize: function DVS_initialize() {
|
||||
this._pane = document.getElementById("globalsearch");
|
||||
this._splitter = document.getElementById("globalsearch-splitter");
|
||||
this._searchbox = document.getElementById("scripts-search");
|
||||
initialize: function DVGS_initialize() {
|
||||
this._pane = DebuggerView._globalSearch;
|
||||
this._splitter = DebuggerView._globalSearchSplitter;
|
||||
this._searchbox = DebuggerView._scriptsSearchbox;
|
||||
|
||||
this._pane.addEventListener("scroll", this._onResultsScroll, false);
|
||||
this._searchbox.addEventListener("blur", this._onFocusLost, false);
|
||||
|
@ -1203,6 +1276,10 @@ ScriptsView.prototype = {
|
|||
DebuggerController.SourceScripts.showScript(selectedItem.getUserData("sourceScript"));
|
||||
},
|
||||
|
||||
_prevSearchedFile: "",
|
||||
_prevSearchedLine: 0,
|
||||
_prevSearchedToken: "",
|
||||
|
||||
/**
|
||||
* Performs a file search if necessary.
|
||||
*
|
||||
|
@ -1425,7 +1502,7 @@ ScriptsView.prototype = {
|
|||
* Initialization function, called when the debugger is initialized.
|
||||
*/
|
||||
initialize: function DVS_initialize() {
|
||||
this._scripts = document.getElementById("scripts");
|
||||
this._scripts = DebuggerView._scripts;
|
||||
this._searchbox = document.getElementById("scripts-search");
|
||||
this._searchboxPanel = document.getElementById("scripts-search-panel");
|
||||
|
||||
|
@ -1471,26 +1548,27 @@ function StackFramesView() {
|
|||
|
||||
StackFramesView.prototype = {
|
||||
|
||||
/**
|
||||
* Sets the current frames state based on the debugger active thread state.
|
||||
*
|
||||
* @param string aState
|
||||
* Either "paused" or "attached".
|
||||
*/
|
||||
updateState: function DVF_updateState(aState) {
|
||||
let resume = document.getElementById("resume");
|
||||
/**
|
||||
* Sets the current frames state based on the debugger active thread state.
|
||||
*
|
||||
* @param string aState
|
||||
* Either "paused" or "attached".
|
||||
*/
|
||||
updateState: function DVF_updateState(aState) {
|
||||
let resume = DebuggerView._resumeButton;
|
||||
let resumeKey = LayoutHelpers.prettyKey(DebuggerView._resumeKey);
|
||||
|
||||
// If we're paused, show a pause label and a resume label on the button.
|
||||
if (aState == "paused") {
|
||||
resume.setAttribute("tooltiptext", L10N.getStr("resumeTooltip"));
|
||||
resume.setAttribute("checked", true);
|
||||
}
|
||||
// If we're attached, do the opposite.
|
||||
else if (aState == "attached") {
|
||||
resume.setAttribute("tooltiptext", L10N.getStr("pauseTooltip"));
|
||||
resume.removeAttribute("checked");
|
||||
}
|
||||
},
|
||||
// If we're paused, show a pause label and a resume label on the button.
|
||||
if (aState == "paused") {
|
||||
resume.setAttribute("tooltiptext", L10N.getFormatStr("resumeButtonTooltip", [resumeKey]));
|
||||
resume.setAttribute("checked", true);
|
||||
}
|
||||
// If we're attached, do the opposite.
|
||||
else if (aState == "attached") {
|
||||
resume.setAttribute("tooltiptext", L10N.getFormatStr("pauseButtonTooltip", [resumeKey]));
|
||||
resume.removeAttribute("checked");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes all elements from the stackframes container, leaving it empty.
|
||||
|
@ -1725,11 +1803,11 @@ StackFramesView.prototype = {
|
|||
initialize: function DVF_initialize() {
|
||||
let close = document.getElementById("close");
|
||||
let pauseOnExceptions = document.getElementById("pause-exceptions");
|
||||
let resume = document.getElementById("resume");
|
||||
let stepOver = document.getElementById("step-over");
|
||||
let stepIn = document.getElementById("step-in");
|
||||
let stepOut = document.getElementById("step-out");
|
||||
let frames = document.getElementById("stackframes");
|
||||
let resume = DebuggerView._resumeButton;
|
||||
let stepOver = DebuggerView._stepOverButton;
|
||||
let stepIn = DebuggerView._stepInButton;
|
||||
let stepOut = DebuggerView._stepOutButton;
|
||||
let frames = DebuggerView._stackframes;
|
||||
|
||||
close.addEventListener("click", this._onCloseButtonClick, false);
|
||||
pauseOnExceptions.checked = DebuggerController.StackFrames.pauseOnExceptions;
|
||||
|
@ -1752,11 +1830,11 @@ StackFramesView.prototype = {
|
|||
destroy: function DVF_destroy() {
|
||||
let close = document.getElementById("close");
|
||||
let pauseOnExceptions = document.getElementById("pause-exceptions");
|
||||
let resume = document.getElementById("resume");
|
||||
let stepOver = document.getElementById("step-over");
|
||||
let stepIn = document.getElementById("step-in");
|
||||
let stepOut = document.getElementById("step-out");
|
||||
let frames = this._frames;
|
||||
let resume = DebuggerView._resumeButton;
|
||||
let stepOver = DebuggerView._stepOverButton;
|
||||
let stepIn = DebuggerView._stepInButton;
|
||||
let stepOut = DebuggerView._stepOutButton;
|
||||
let frames = DebuggerView._stackframes;
|
||||
|
||||
close.removeEventListener("click", this._onCloseButtonClick, false);
|
||||
pauseOnExceptions.removeEventListener("click", this._onPauseExceptionsClick, false);
|
||||
|
@ -2295,7 +2373,7 @@ BreakpointsView.prototype = {
|
|||
* Initialization function, called when the debugger is initialized.
|
||||
*/
|
||||
initialize: function DVB_initialize() {
|
||||
let breakpoints = document.getElementById("breakpoints");
|
||||
let breakpoints = DebuggerView._breakpoints;
|
||||
breakpoints.addEventListener("click", this._onBreakpointClick, false);
|
||||
|
||||
this._breakpoints = breakpoints;
|
||||
|
@ -3401,7 +3479,7 @@ PropertiesView.prototype = {
|
|||
* Initialization function, called when the debugger is initialized.
|
||||
*/
|
||||
initialize: function DVP_initialize() {
|
||||
this._vars = document.getElementById("variables");
|
||||
this._vars = DebuggerView._variables;
|
||||
|
||||
this.emptyText();
|
||||
this.createHierarchyStore();
|
||||
|
|
|
@ -37,23 +37,23 @@
|
|||
<commandset id="sourceEditorCommands"/>
|
||||
<keyset id="sourceEditorKeys"/>
|
||||
<keyset id="scriptSearchKeys">
|
||||
<key key="P" modifiers="access shift"
|
||||
<key id="fileSearchKey" key="P" modifiers="access shift"
|
||||
oncommand="DebuggerView.Scripts._onFileSearch()"/>
|
||||
<key key="G" modifiers="access shift"
|
||||
<key id="lineSearchKey" key="G" modifiers="access shift"
|
||||
oncommand="DebuggerView.Scripts._onLineSearch()"/>
|
||||
<key key="T" modifiers="access shift"
|
||||
<key id="tokenSearchKey" key="T" modifiers="access shift"
|
||||
oncommand="DebuggerView.Scripts._onTokenSearch()"/>
|
||||
<key key="F" modifiers="access shift"
|
||||
<key id="globalSearchKey" key="F" modifiers="access shift"
|
||||
oncommand="DebuggerView.Scripts._onGlobalSearch()"/>
|
||||
</keyset>
|
||||
<keyset id="threadStateKeys">
|
||||
<key keycode="VK_F6"
|
||||
<key id="resumeKey" keycode="VK_F6"
|
||||
oncommand="DebuggerView.StackFrames._onResume()"/>
|
||||
<key keycode="VK_F7"
|
||||
<key id="stepOverKey" keycode="VK_F7"
|
||||
oncommand="DebuggerView.StackFrames._onStepOver()"/>
|
||||
<key keycode="VK_F8"
|
||||
<key id="stepInKey" keycode="VK_F8"
|
||||
oncommand="DebuggerView.StackFrames._onStepIn()"/>
|
||||
<key keycode="VK_F8" modifiers="shift"
|
||||
<key id="stepOutKey" keycode="VK_F8" modifiers="shift"
|
||||
oncommand="DebuggerView.StackFrames._onStepOut()"/>
|
||||
</keyset>
|
||||
|
||||
|
@ -74,23 +74,19 @@
|
|||
tabindex="0"/>
|
||||
<toolbarbutton id="step-over"
|
||||
class="devtools-toolbarbutton"
|
||||
tooltiptext="&debuggerUI.stepOverButton.tooltip;"
|
||||
tabindex="0"/>
|
||||
<toolbarbutton id="step-in"
|
||||
class="devtools-toolbarbutton"
|
||||
tooltiptext="&debuggerUI.stepInButton.tooltip;"
|
||||
tabindex="0"/>
|
||||
<toolbarbutton id="step-out"
|
||||
class="devtools-toolbarbutton"
|
||||
tooltiptext="&debuggerUI.stepOutButton.tooltip;"
|
||||
tabindex="0"/>
|
||||
</hbox>
|
||||
<menulist id="scripts" class="devtools-menulist"
|
||||
sizetopopup="always"
|
||||
label="&debuggerUI.emptyScriptText;"/>
|
||||
<textbox id="scripts-search" type="search"
|
||||
class="devtools-searchinput"
|
||||
emptytext="&debuggerUI.emptyFilterText;"/>
|
||||
class="devtools-searchinput"/>
|
||||
<checkbox id="pause-exceptions"
|
||||
type="checkbox"
|
||||
tabindex="0"
|
||||
|
@ -111,17 +107,17 @@
|
|||
<hbox align="center">
|
||||
<button class="operator" label="!"
|
||||
onclick="DebuggerView.Scripts._onGlobalSearch()"/>
|
||||
<label class="plain operator" value="&debuggerUI.searchPanelGlobal;"/>
|
||||
<label id="global-operator" class="plain operator"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<button class="operator" label="#"
|
||||
onclick="DebuggerView.Scripts._onTokenSearch()"/>
|
||||
<label class="plain operator" value="&debuggerUI.searchPanelToken;"/>
|
||||
<label id="token-operator" class="plain operator"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<button class="operator" label=":"
|
||||
onclick="DebuggerView.Scripts._onLineSearch()"/>
|
||||
<label class="plain operator" value="&debuggerUI.searchPanelLine;"/>
|
||||
<label id="line-operator" class="plain operator"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</panel>
|
||||
|
|
|
@ -7,12 +7,18 @@
|
|||
var gPane = null;
|
||||
var gTab = null;
|
||||
var gDebugger = null;
|
||||
var gView = null;
|
||||
var gLH = null;
|
||||
var gL10N = null;
|
||||
|
||||
function test() {
|
||||
debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
|
||||
gTab = aTab;
|
||||
gPane = aPane;
|
||||
gDebugger = gPane.contentWindow;
|
||||
gView = gDebugger.DebuggerView;
|
||||
gLH = gDebugger.LayoutHelpers;
|
||||
gL10N = gDebugger.L10N;
|
||||
|
||||
testPause();
|
||||
});
|
||||
|
@ -23,7 +29,8 @@ function testPause() {
|
|||
"Should be running after debug_tab_pane.");
|
||||
|
||||
let button = gDebugger.document.getElementById("resume");
|
||||
is(button.getAttribute("tooltiptext"), gDebugger.L10N.getStr("pauseTooltip"),
|
||||
is(button.getAttribute("tooltiptext"),
|
||||
gL10N.getFormatStr("pauseButtonTooltip", [gLH.prettyKey(gView._resumeKey)]),
|
||||
"Button tooltip should be pause when running.");
|
||||
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("paused", function() {
|
||||
|
@ -35,7 +42,8 @@ function testPause() {
|
|||
is(gDebugger.DebuggerController.activeThread.paused, true,
|
||||
"Should be paused after an interrupt request.");
|
||||
|
||||
is(button.getAttribute("tooltiptext"), gDebugger.L10N.getStr("resumeTooltip"),
|
||||
is(button.getAttribute("tooltiptext"),
|
||||
gL10N.getFormatStr("resumeButtonTooltip", [gLH.prettyKey(gView._resumeKey)]),
|
||||
"Button tooltip should be resume when paused.");
|
||||
|
||||
is(frames.querySelectorAll(".dbg-stackframe").length, 0,
|
||||
|
@ -58,7 +66,8 @@ function testResume() {
|
|||
"Should be paused after an interrupt request.");
|
||||
|
||||
let button = gDebugger.document.getElementById("resume");
|
||||
is(button.getAttribute("tooltiptext"), gDebugger.L10N.getStr("pauseTooltip"),
|
||||
is(button.getAttribute("tooltiptext"),
|
||||
gL10N.getFormatStr("pauseButtonTooltip", [gLH.prettyKey(gView._resumeKey)]),
|
||||
"Button tooltip should be pause when running.");
|
||||
|
||||
closeDebuggerAndFinish();
|
||||
|
@ -74,4 +83,8 @@ registerCleanupFunction(function() {
|
|||
removeTab(gTab);
|
||||
gPane = null;
|
||||
gTab = null;
|
||||
gDebugger = null;
|
||||
gView = null;
|
||||
gLH = null;
|
||||
gL10N = null;
|
||||
});
|
||||
|
|
|
@ -23,10 +23,10 @@ Cu.import("resource://gre/modules/Services.jsm");
|
|||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource:///modules/PropertyPanel.jsm");
|
||||
Cu.import("resource:///modules/source-editor.jsm");
|
||||
Cu.import("resource:///modules/devtools/LayoutHelpers.jsm");
|
||||
Cu.import("resource:///modules/devtools/scratchpad-manager.jsm");
|
||||
Cu.import("resource://gre/modules/jsdebugger.jsm");
|
||||
|
||||
|
||||
const SCRATCHPAD_CONTEXT_CONTENT = 1;
|
||||
const SCRATCHPAD_CONTEXT_BROWSER = 2;
|
||||
const SCRATCHPAD_L10N = "chrome://browser/locale/devtools/scratchpad.properties";
|
||||
|
@ -37,47 +37,6 @@ const BUTTON_POSITION_CANCEL = 1;
|
|||
const BUTTON_POSITION_DONT_SAVE = 2;
|
||||
const BUTTON_POSITION_REVERT=0;
|
||||
|
||||
let keysbundle = Services.strings.createBundle("chrome://global-platform/locale/platformKeys.properties");
|
||||
|
||||
|
||||
function SP_Pretty_Key(aElemKey) {
|
||||
|
||||
let elemString = "";
|
||||
let elemMod = aElemKey.getAttribute("modifiers");
|
||||
|
||||
if (elemMod.match("accel")) {
|
||||
if (navigator.platform.indexOf("Mac") !== -1) {
|
||||
// XXX bug 779642 Use "Cmd-" literal vs cloverleaf meta-key until
|
||||
// Orion adds variable height lines
|
||||
// elemString += keysbundle.GetStringFromName("VK_META_CMD") +
|
||||
// keysbundle.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
elemString += "Cmd-";
|
||||
} else {
|
||||
elemString += keysbundle.GetStringFromName("VK_CONTROL") +
|
||||
keysbundle.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
}
|
||||
}
|
||||
|
||||
if (elemMod.match("shift")) {
|
||||
elemString += keysbundle.GetStringFromName("VK_SHIFT") +
|
||||
keysbundle.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
}
|
||||
if (elemMod.match("alt")) {
|
||||
elemString += keysbundle.GetStringFromName("VK_ALT") +
|
||||
keysbundle.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
}
|
||||
if (elemMod.match("ctrl")) {
|
||||
elemString += keysbundle.GetStringFromName("VK_CONTROL") +
|
||||
keysbundle.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
}
|
||||
if (elemMod.match("meta")) {
|
||||
elemString += keysbundle.GetStringFromName("VK_META") +
|
||||
keysbundle.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
}
|
||||
|
||||
return elemString + aElemKey.getAttribute("key").toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* The scratchpad object handles the Scratchpad window functionality.
|
||||
*/
|
||||
|
@ -481,9 +440,9 @@ var Scratchpad = {
|
|||
let insertionPoint = selection.start != selection.end ?
|
||||
selection.end : // after selected text
|
||||
this.editor.getCharCount(); // after text end
|
||||
|
||||
|
||||
let newComment = "\n/*\n" + aValue + "\n*/";
|
||||
|
||||
|
||||
this.setText(newComment, insertionPoint, insertionPoint);
|
||||
|
||||
// Select the new comment.
|
||||
|
@ -512,7 +471,7 @@ var Scratchpad = {
|
|||
else if (aError.lineNumber) {
|
||||
stack = "@" + aError.lineNumber;
|
||||
}
|
||||
|
||||
|
||||
let newComment = "Exception: " + ( aError.message || aError) + ( stack == "" ? stack : "\n" + stack.replace(/\n$/, "") );
|
||||
|
||||
this.writeAsComment(newComment);
|
||||
|
@ -933,7 +892,6 @@ var Scratchpad = {
|
|||
*/
|
||||
revertFile: function SP_revertFile(aCallback)
|
||||
{
|
||||
|
||||
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
|
||||
file.initWithPath(this.filename);
|
||||
|
||||
|
@ -1099,9 +1057,9 @@ var Scratchpad = {
|
|||
|
||||
let initialText = this.strings.formatStringFromName(
|
||||
"scratchpadIntro1",
|
||||
[SP_Pretty_Key(document.getElementById("sp-key-run")),
|
||||
SP_Pretty_Key(document.getElementById("sp-key-inspect")),
|
||||
SP_Pretty_Key(document.getElementById("sp-key-display"))],
|
||||
[LayoutHelpers.prettyKey(document.getElementById("sp-key-run")),
|
||||
LayoutHelpers.prettyKey(document.getElementById("sp-key-inspect")),
|
||||
LayoutHelpers.prettyKey(document.getElementById("sp-key-display"))],
|
||||
3);
|
||||
|
||||
if ("arguments" in window &&
|
||||
|
|
|
@ -8,6 +8,16 @@ const Cu = Components.utils;
|
|||
const Ci = Components.interfaces;
|
||||
const Cr = Components.results;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Services",
|
||||
"resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "PlatformKeys", function() {
|
||||
return Services.strings.createBundle(
|
||||
"chrome://global-platform/locale/platformKeys.properties");
|
||||
});
|
||||
|
||||
var EXPORTED_SYMBOLS = ["LayoutHelpers"];
|
||||
|
||||
LayoutHelpers = {
|
||||
|
@ -310,4 +320,60 @@ LayoutHelpers = {
|
|||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Prettifies the modifier keys for an element.
|
||||
*
|
||||
* @param Node aElemKey
|
||||
* The key element to get the modifiers from.
|
||||
* @return string
|
||||
* A prettified and properly separated modifier keys string.
|
||||
*/
|
||||
prettyKey: function LH_prettyKey(aElemKey)
|
||||
{
|
||||
let elemString = "";
|
||||
let elemMod = aElemKey.getAttribute("modifiers");
|
||||
|
||||
if (elemMod.match("accel")) {
|
||||
if (Services.appinfo.OS == "Darwin") {
|
||||
// XXX bug 779642 Use "Cmd-" literal vs. cloverleaf meta-key until
|
||||
// Orion adds variable height lines.
|
||||
// elemString += PlatformKeys.GetStringFromName("VK_META") +
|
||||
// PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
elemString += "Cmd-";
|
||||
} else {
|
||||
elemString += PlatformKeys.GetStringFromName("VK_CONTROL") +
|
||||
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
}
|
||||
}
|
||||
if (elemMod.match("access")) {
|
||||
if (Services.appinfo.OS == "Darwin") {
|
||||
elemString += PlatformKeys.GetStringFromName("VK_CONTROL") +
|
||||
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
} else {
|
||||
elemString += PlatformKeys.GetStringFromName("VK_ALT") +
|
||||
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
}
|
||||
}
|
||||
if (elemMod.match("shift")) {
|
||||
elemString += PlatformKeys.GetStringFromName("VK_SHIFT") +
|
||||
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
}
|
||||
if (elemMod.match("alt")) {
|
||||
elemString += PlatformKeys.GetStringFromName("VK_ALT") +
|
||||
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
}
|
||||
if (elemMod.match("ctrl")) {
|
||||
elemString += PlatformKeys.GetStringFromName("VK_CONTROL") +
|
||||
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
}
|
||||
if (elemMod.match("meta")) {
|
||||
elemString += PlatformKeys.GetStringFromName("VK_META") +
|
||||
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
}
|
||||
|
||||
return elemString +
|
||||
(aElemKey.getAttribute("keycode").replace(/^.*VK_/, "") ||
|
||||
aElemKey.getAttribute("key")).toUpperCase();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -13,74 +13,46 @@
|
|||
|
||||
<!-- LOCALIZATION NOTE (debuggerMenu.label): This is the label for the
|
||||
- application menu item that opens the debugger UI. -->
|
||||
<!ENTITY debuggerMenu.label2 "Debugger">
|
||||
<!ENTITY debuggerMenu.label2 "Debugger">
|
||||
|
||||
<!-- LOCALIZATION NOTE (remoteDebuggerMenu.label): This is the label for the
|
||||
- application menu item that opens the remote debugger UI. -->
|
||||
<!ENTITY remoteDebuggerMenu.label "Remote Debugger">
|
||||
<!ENTITY remoteDebuggerMenu.label "Remote Debugger">
|
||||
|
||||
<!-- LOCALIZATION NOTE (chromeDebuggerMenu.label): This is the label for the
|
||||
- application menu item that opens the browser debugger UI. -->
|
||||
<!ENTITY chromeDebuggerMenu.label "Browser Debugger">
|
||||
<!ENTITY chromeDebuggerMenu.label "Browser Debugger">
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerMenu.commandkey): This is the command key that
|
||||
- launches the debugger UI. Do not translate this one! -->
|
||||
<!ENTITY debuggerMenu.commandkey "S">
|
||||
<!ENTITY debuggerMenu.commandkey "S">
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerUI.closeButton.tooltip): This is the tooltip for
|
||||
- the button that closes the debugger UI. -->
|
||||
<!ENTITY debuggerUI.closeButton.tooltip "Close">
|
||||
<!ENTITY debuggerUI.closeButton.tooltip "Close">
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerUI.pauseExceptions): This is the label for the
|
||||
- checkbox that toggles pausing on exceptions. -->
|
||||
<!ENTITY debuggerUI.pauseExceptions "Pause on exceptions">
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerUI.stepOverButton.tooltip): This is the tooltip for
|
||||
- the button that steps over a function call. -->
|
||||
<!ENTITY debuggerUI.stepOverButton.tooltip "Step Over">
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerUI.stepInButton): This is the tooltip for the
|
||||
- button that steps into a function call. -->
|
||||
<!ENTITY debuggerUI.stepInButton.tooltip "Step In">
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerUI.stepOutButton): This is the tooltip for the
|
||||
- button that steps out of a function call. -->
|
||||
<!ENTITY debuggerUI.stepOutButton.tooltip "Step Out">
|
||||
<!ENTITY debuggerUI.pauseExceptions "Pause on exceptions">
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerUI.stackTitle): This is the label for the
|
||||
- widget that displays the call stack frames in the debugger. -->
|
||||
<!ENTITY debuggerUI.stackTitle "Call stack">
|
||||
<!ENTITY debuggerUI.stackTitle "Call stack">
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerUI.scriptTitle): This is the label for the
|
||||
- widget that displays the source code for the script that is currently
|
||||
- being inspected in the debugger. -->
|
||||
<!ENTITY debuggerUI.scriptTitle "Script">
|
||||
<!ENTITY debuggerUI.scriptTitle "Script">
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerUI.propertiesTitle): This is the label for the
|
||||
- widget that displays the variables in the various available scopes in the
|
||||
- debugger. -->
|
||||
<!ENTITY debuggerUI.propertiesTitle "Scope variables">
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerUI.emptyFilterText): This is the text that
|
||||
- appears in the filter text box when it is empty. -->
|
||||
<!ENTITY debuggerUI.emptyFilterText "Filter scripts">
|
||||
<!ENTITY debuggerUI.propertiesTitle "Scope variables">
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerUI.searchPanelTitle): This is the text that
|
||||
- appears in the filter panel popup as a description. -->
|
||||
<!ENTITY debuggerUI.searchPanelTitle "Operators">
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerUI.searchPanelGlobal): This is the text that
|
||||
- appears in the filter panel popup for the global search operation. -->
|
||||
<!ENTITY debuggerUI.searchPanelGlobal "Search in all files">
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerUI.searchPanelToken): This is the text that
|
||||
- appears in the filter panel popup for the token search operation. -->
|
||||
<!ENTITY debuggerUI.searchPanelToken "Find in this file">
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerUI.searchPanelLine): This is the text that
|
||||
- appears in the filter panel popup for the line search operation. -->
|
||||
<!ENTITY debuggerUI.searchPanelLine "Jump to line">
|
||||
<!ENTITY debuggerUI.searchPanelTitle "Operators">
|
||||
|
||||
<!-- LOCALIZATION NOTE (emptyScriptText): The text to display in the menulist when
|
||||
- there are no scripts. -->
|
||||
<!ENTITY debuggerUI.emptyScriptText "No scripts">
|
||||
<!ENTITY debuggerUI.emptyScriptText "No scripts">
|
||||
|
|
|
@ -43,13 +43,33 @@ remoteDebuggerReconnectMessage=Server not found. Try again? (host:port)
|
|||
# debugger prompt asking for the remote host and port to connect to.
|
||||
remoteDebuggerConnectionFailedMessage=Could not find a server at the specified hostname and port number.
|
||||
|
||||
# LOCALIZATION NOTE (collapsePanes): This is the tooltip for the button
|
||||
# that collapses the left and right panes in the debugger UI. -->
|
||||
collapsePanes=Collapse panes
|
||||
|
||||
# LOCALIZATION NOTE (expandPanes): This is the tooltip for the button
|
||||
# that expands the left and right panes in the debugger UI. -->
|
||||
expandPanes=Expand panes
|
||||
|
||||
# LOCALIZATION NOTE (pauseLabel): The label that is displayed on the pause
|
||||
# button when the debugger is in a running state.
|
||||
pauseTooltip=Click to pause
|
||||
pauseButtonTooltip=Click to pause (%S)
|
||||
|
||||
# LOCALIZATION NOTE (resumeLabel): The label that is displayed on the pause
|
||||
# button when the debugger is in a paused state.
|
||||
resumeTooltip=Click to resume
|
||||
resumeButtonTooltip=Click to resume (%S)
|
||||
|
||||
# LOCALIZATION NOTE (stepOverTooltip): The label that is displayed on the
|
||||
# button that steps over a function call.
|
||||
stepOverTooltip=Step Over (%S)
|
||||
|
||||
# LOCALIZATION NOTE (stepInTooltip): The label that is displayed on the
|
||||
# button that steps into a function call.
|
||||
stepInTooltip=Step In (%S)
|
||||
|
||||
# LOCALIZATION NOTE (stepOutTooltip): The label that is displayed on the
|
||||
# button that steps out of a function call.
|
||||
stepOutTooltip=Step Out (%S)
|
||||
|
||||
# LOCALIZATION NOTE (emptyStackText): The text that is displayed in the stack
|
||||
# frames list when there are no frames to display.
|
||||
|
@ -67,6 +87,22 @@ noScriptsText=No scripts
|
|||
# menulist when there are no matching scripts after filtering.
|
||||
noMatchingScriptsText=No matching scripts
|
||||
|
||||
# LOCALIZATION NOTE (emptyFilterText): This is the text that appears in the
|
||||
# filter text box when it is empty.
|
||||
emptyFilterText=Filter scripts (%S)
|
||||
|
||||
# LOCALIZATION NOTE (searchPanelGlobal): This is the text that appears in the
|
||||
# filter panel popup for the global search operation.
|
||||
searchPanelGlobal=Search in all files (%S)
|
||||
|
||||
# LOCALIZATION NOTE (searchPanelToken): This is the text that appears in the
|
||||
# filter panel popup for the token search operation.
|
||||
searchPanelToken=Find in this file (%S)
|
||||
|
||||
# LOCALIZATION NOTE (searchPanelLine): This is the text that appears in the
|
||||
# filter panel popup for the line search operation.
|
||||
searchPanelLine=Jump to line (%S)
|
||||
|
||||
# LOCALIZATION NOTE (breakpointMenuItem): The text for all the elements that
|
||||
# are displayed in the breakpoints menu item popup.
|
||||
breakpointMenuItem.enableSelf=Enable breakpoint
|
||||
|
|
Загрузка…
Ссылка в новой задаче