Bug 815277 - Source editor's 'Find' and 'Jump to line' commands should use the frontend UI, r=past

This commit is contained in:
Victor Porof 2012-11-27 18:19:23 +02:00
Родитель 878954fbc8
Коммит 64d9e2f0dd
6 изменённых файлов: 122 добавлений и 54 удалений

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

@ -34,10 +34,10 @@ ToolbarView.prototype = {
this._chromeGlobals = document.getElementById("chrome-globals");
this._scripts = document.getElementById("sources");
let resumeKey = LayoutHelpers.prettyKey(document.getElementById("resumeKey"));
let stepOverKey = LayoutHelpers.prettyKey(document.getElementById("stepOverKey"));
let stepInKey = LayoutHelpers.prettyKey(document.getElementById("stepInKey"));
let stepOutKey = LayoutHelpers.prettyKey(document.getElementById("stepOutKey"));
let resumeKey = LayoutHelpers.prettyKey(document.getElementById("resumeKey"), true);
let stepOverKey = LayoutHelpers.prettyKey(document.getElementById("stepOverKey"), true);
let stepInKey = LayoutHelpers.prettyKey(document.getElementById("stepInKey"), true);
let stepOutKey = LayoutHelpers.prettyKey(document.getElementById("stepOutKey"), true);
this._resumeTooltip = L10N.getFormatStr("resumeButtonTooltip", [resumeKey]);
this._pauseTooltip = L10N.getFormatStr("pauseButtonTooltip", [resumeKey]);
this._stepOverTooltip = L10N.getFormatStr("stepOverTooltip", [stepOverKey]);
@ -577,11 +577,11 @@ FilterView.prototype = {
this._variableOperatorButton = document.getElementById("variable-operator-button");
this._variableOperatorLabel = document.getElementById("variable-operator-label");
this._globalSearchKey = LayoutHelpers.prettyKey(document.getElementById("globalSearchKey"));
this._fileSearchKey = LayoutHelpers.prettyKey(document.getElementById("fileSearchKey"));
this._lineSearchKey = LayoutHelpers.prettyKey(document.getElementById("lineSearchKey"));
this._tokenSearchKey = LayoutHelpers.prettyKey(document.getElementById("tokenSearchKey"));
this._variableSearchKey = LayoutHelpers.prettyKey(document.getElementById("variableSearchKey"));
this._fileSearchKey = LayoutHelpers.prettyKey(document.getElementById("fileSearchKey"), true);
this._globalSearchKey = LayoutHelpers.prettyKey(document.getElementById("globalSearchKey"), true);
this._tokenSearchKey = LayoutHelpers.prettyKey(document.getElementById("tokenSearchKey"), true);
this._lineSearchKey = LayoutHelpers.prettyKey(document.getElementById("lineSearchKey"), true);
this._variableSearchKey = LayoutHelpers.prettyKey(document.getElementById("variableSearchKey"), true);
this._searchbox.addEventListener("click", this._onClick, false);
this._searchbox.addEventListener("select", this._onSearch, false);
@ -879,7 +879,7 @@ FilterView.prototype = {
// Perform a global search based on the specified operator.
if (isGlobal) {
if (isReturnKey && isDifferentToken) {
if (isReturnKey && (isDifferentToken || DebuggerView.GlobalSearch.hidden)) {
DebuggerView.GlobalSearch.performSearch(token);
} else {
DebuggerView.GlobalSearch[["focusNextMatch", "focusPrevMatch"][action]]();
@ -934,10 +934,10 @@ FilterView.prototype = {
},
/**
* Called when the source line filter key sequence was pressed.
* Called when the global search filter key sequence was pressed.
*/
_doLineSearch: function DVF__doLineSearch() {
this._doSearch(SEARCH_LINE_FLAG);
_doGlobalSearch: function DVF__doGlobalSearch() {
this._doSearch(SEARCH_GLOBAL_FLAG);
this._searchboxPanel.hidePopup();
},
@ -950,10 +950,10 @@ FilterView.prototype = {
},
/**
* Called when the global search filter key sequence was pressed.
* Called when the source line filter key sequence was pressed.
*/
_doGlobalSearch: function DVF__doGlobalSearch() {
this._doSearch(SEARCH_GLOBAL_FLAG);
_doLineSearch: function DVF__doLineSearch() {
this._doSearch(SEARCH_LINE_FLAG);
this._searchboxPanel.hidePopup();
},
@ -974,10 +974,13 @@ FilterView.prototype = {
_tokenOperatorLabel: null,
_lineOperatorButton: null,
_lineOperatorLabel: null,
_globalSearchKey: "",
_variableOperatorButton: null,
_variableOperatorLabel: null,
_fileSearchKey: "",
_lineSearchKey: "",
_globalSearchKey: "",
_tokenSearchKey: "",
_lineSearchKey: "",
_variableSearchKey: "",
_target: null,
_prevSearchedFile: "",
_prevSearchedLine: -1,

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

@ -15,8 +15,8 @@ const GLOBAL_SEARCH_LINE_MAX_LENGTH = 300; // chars
const GLOBAL_SEARCH_EXPAND_MAX_RESULTS = 50;
const GLOBAL_SEARCH_ACTION_MAX_DELAY = 1500; // ms
const SEARCH_GLOBAL_FLAG = "!";
const SEARCH_LINE_FLAG = ":";
const SEARCH_TOKEN_FLAG = "#";
const SEARCH_LINE_FLAG = ":";
const SEARCH_VARIABLE_FLAG = "*";
/**

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

@ -35,12 +35,12 @@
oncommand="DebuggerView.Toolbar._onStepOutPressed()"/>
<command id="fileSearchCommand"
oncommand="DebuggerView.Filtering._doFileSearch()"/>
<command id="lineSearchCommand"
oncommand="DebuggerView.Filtering._doLineSearch()"/>
<command id="tokenSearchCommand"
oncommand="DebuggerView.Filtering._doTokenSearch()"/>
<command id="globalSearchCommand"
oncommand="DebuggerView.Filtering._doGlobalSearch()"/>
<command id="tokenSearchCommand"
oncommand="DebuggerView.Filtering._doTokenSearch()"/>
<command id="lineSearchCommand"
oncommand="DebuggerView.Filtering._doLineSearch()"/>
<command id="variableSearchCommand"
oncommand="DebuggerView.Filtering._doVariableSearch()"/>
<command id="addBreakpointCommand"
@ -73,10 +73,33 @@
<menuseparator/>
<menuitem id="se-cMenu-selectAll"/>
<menuseparator/>
<menuitem id="se-cMenu-find"/>
<menuitem id="se-cMenu-findAgain"/>
<menuitem id="se-dbg-cMenu-findFile"
label="&debuggerUI.searchFile;"
accesskey="&debuggerUI.searchFile.key;"
key="fileSearchKey"
command="fileSearchCommand"/>
<menuitem id="se-dbg-cMenu-findGlobal"
label="&debuggerUI.searchGlobal;"
accesskey="&debuggerUI.searchGlobal.key;"
key="globalSearchKey"
command="globalSearchCommand"/>
<menuseparator/>
<menuitem id="se-cMenu-gotoLine"/>
<menuitem id="se-dbg-cMenu-findToken"
label="&debuggerUI.searchToken;"
accesskey="&debuggerUI.searchToken.key;"
key="tokenSearchKey"
command="tokenSearchCommand"/>
<menuitem id="se-dbg-cMenu-findLine"
label="&debuggerUI.searchLine;"
accesskey="&debuggerUI.searchLine.key;"
key="lineSearchKey"
command="lineSearchCommand"/>
<menuseparator/>
<menuitem id="se-dbg-cMenu-findVariable"
label="&debuggerUI.searchVariable;"
accesskey="&debuggerUI.searchVariable.key;"
key="variableSearchKey"
command="variableSearchCommand"/>
</menupopup>
<menupopup id="debuggerPrefsContextMenu"
position="before_end"
@ -105,48 +128,46 @@
</menupopup>
</popupset>
<keyset id="sourceEditorKeys"/>
<keyset id="debuggerKeys">
<key id="resumeKey"
keycode="VK_F6"
keycode="&debuggerUI.stepping.resume;"
command="resumeCommand"/>
<key id="stepOverKey"
keycode="VK_F7"
keycode="&debuggerUI.stepping.stepOver;"
command="stepOverCommand"/>
<key id="stepInKey"
keycode="VK_F8"
keycode="&debuggerUI.stepping.stepIn;"
command="stepInCommand"/>
<key id="stepOutKey"
keycode="VK_F8"
keycode="&debuggerUI.stepping.stepOut;"
modifiers="shift"
command="stepOutCommand"/>
<key id="fileSearchKey"
key="P"
modifiers="control shift"
key="&debuggerUI.searchFile.key;"
modifiers="accel"
command="fileSearchCommand"/>
<key id="lineSearchKey"
key="G"
modifiers="control shift"
command="lineSearchCommand"/>
<key id="tokenSearchKey"
key="T"
modifiers="control shift"
command="tokenSearchCommand"/>
<key id="globalSearchKey"
key="F"
modifiers="control shift"
key="&debuggerUI.searchGlobal.key;"
modifiers="accel alt"
command="globalSearchCommand"/>
<key id="tokenSearchKey"
key="&debuggerUI.searchToken.key;"
modifiers="accel"
command="tokenSearchCommand"/>
<key id="lineSearchKey"
key="&debuggerUI.searchLine.key;"
modifiers="accel"
command="lineSearchCommand"/>
<key id="variableSearchKey"
key="V"
modifiers="control shift"
key="&debuggerUI.searchVariable.key;"
modifiers="accel alt"
command="variableSearchCommand"/>
<key id="addBreakpointKey"
key="B"
key="&debuggerUI.seMenuBreak.key;"
modifiers="accel"
command="addBreakpointCommand"/>
<key id="addConditionalBreakpointKey"
key="B"
key="&debuggerUI.seMenuCondBreak.key;"
modifiers="accel shift"
command="addConditionalBreakpointCommand"/>
</keyset>
@ -181,6 +202,7 @@
<spacer flex="1"/>
<toolbarbutton id="toggle-panes"
class="devtools-toolbarbutton"
tooltiptext="&debuggerUI.panesButton.tooltip;"
tabindex="0"/>
<toolbarbutton id="debugger-options"
class="devtools-option-toolbarbutton"

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

@ -97,8 +97,6 @@ function test()
"#editMenuKeys not found");
ok(document.getElementById("sourceEditorCommands"),
"#sourceEditorCommands found");
ok(document.getElementById("sourceEditorKeys"),
"#sourceEditorKeys found");
// Map command ids to their expected disabled state.
let commands = {"se-cmd-undo": true, "se-cmd-redo": true,

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

@ -326,10 +326,12 @@ this.LayoutHelpers = LayoutHelpers = {
*
* @param Node aElemKey
* The key element to get the modifiers from.
* @param boolean aAllowCloverleaf
* Pass true to use the cloverleaf symbol instead of a descriptive string.
* @return string
* A prettified and properly separated modifier keys string.
*/
prettyKey: function LH_prettyKey(aElemKey)
prettyKey: function LH_prettyKey(aElemKey, aAllowCloverleaf)
{
let elemString = "";
let elemMod = aElemKey.getAttribute("modifiers");
@ -338,9 +340,12 @@ this.LayoutHelpers = LayoutHelpers = {
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-";
if (!aAllowCloverleaf) {
elemString += "Cmd-";
} else {
elemString += PlatformKeys.GetStringFromName("VK_META") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
}
} else {
elemString += PlatformKeys.GetStringFromName("VK_CONTROL") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");

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

@ -35,6 +35,10 @@
- the button that closes the debugger UI. -->
<!ENTITY debuggerUI.closeButton.tooltip "Close">
<!-- LOCALIZATION NOTE (debuggerUI.panesButton.tooltip): This is the tooltip for
- the button that toggles the panes visible or hidden in the debugger UI. -->
<!ENTITY debuggerUI.panesButton.tooltip "Toggle panes">
<!-- LOCALIZATION NOTE (debuggerUI.optsButton.tooltip): This is the tooltip for
- the button that opens up an options context menu for the debugger UI. -->
<!ENTITY debuggerUI.optsButton.tooltip "Debugger Options">
@ -64,6 +68,31 @@
- appears in the filter panel popup as a description. -->
<!ENTITY debuggerUI.searchPanelTitle "Operators">
<!-- LOCALIZATION NOTE (debuggerUI.searchFile): This is the text that appears
- in the source editor's context menu for the scripts search operation. -->
<!ENTITY debuggerUI.searchFile "Filter scripts">
<!ENTITY debuggerUI.searchFile.key "P">
<!-- LOCALIZATION NOTE (debuggerUI.searchGlobal): This is the text that appears
- in the source editor's context menu for the global search operation. -->
<!ENTITY debuggerUI.searchGlobal "Search in all files">
<!ENTITY debuggerUI.searchGlobal.key "F">
<!-- LOCALIZATION NOTE (debuggerUI.searchToken): This is the text that appears
- in the source editor's context menu for the token search operation. -->
<!ENTITY debuggerUI.searchToken "Find">
<!ENTITY debuggerUI.searchToken.key "F">
<!-- LOCALIZATION NOTE (debuggerUI.searchLine): This is the text that appears
- in the source editor's context menu for the line search operation. -->
<!ENTITY debuggerUI.searchLine "Jump to line...">
<!ENTITY debuggerUI.searchLine.key "J">
<!-- LOCALIZATION NOTE (debuggerUI.searchVariable): This is the text that appears
- in the source editor's context menu for the variables search operation. -->
<!ENTITY debuggerUI.searchVariable "Filter variables">
<!ENTITY debuggerUI.searchVariable.key "V">
<!-- LOCALIZATION NOTE (debuggerUI.condBreakPanelTitle): This is the text that
- appears in the conditional breakpoint panel popup as a description. -->
<!ENTITY debuggerUI.condBreakPanelTitle "This breakpoint will stop execution only if the following expression is true">
@ -71,8 +100,19 @@
<!-- LOCALIZATION NOTE (debuggerUI.seMenuBreak): This is the text that
- appears in the source editor context menu for adding a breakpoint. -->
<!ENTITY debuggerUI.seMenuBreak "Add breakpoint">
<!ENTITY debuggerUI.seMenuBreak.key "B">
<!-- LOCALIZATION NOTE (debuggerUI.seMenuCondBreak): This is the text that
- appears in the source editor context menu for adding a conditional
- breakpoint. -->
<!ENTITY debuggerUI.seMenuCondBreak "Add conditional breakpoint">
<!ENTITY debuggerUI.seMenuCondBreak.key "B">
<!-- LOCALIZATION NOTE (debuggerUI.stepping): These are the keycodes that
- control the stepping commands in the debugger (continue, step over,
- step in and step out). -->
<!ENTITY debuggerUI.stepping.resume "VK_F6">
<!ENTITY debuggerUI.stepping.stepOver "VK_F7">
<!ENTITY debuggerUI.stepping.stepIn "VK_F8">
<!ENTITY debuggerUI.stepping.stepOut "VK_F8">