From 7d298b299a2696e488479e44ac488f1d75f0a9e6 Mon Sep 17 00:00:00 2001 From: Michael Ratcliffe Date: Thu, 2 Feb 2012 19:26:30 +0000 Subject: [PATCH] Bug 683499 - GCLI needs an 'edit' command (for CSS only to start with); r=jwalker --- browser/devtools/webconsole/GcliCommands.jsm | 34 +++++++++++++++++++ .../browser/devtools/gclicommands.properties | 20 +++++++++++ 2 files changed, 54 insertions(+) diff --git a/browser/devtools/webconsole/GcliCommands.jsm b/browser/devtools/webconsole/GcliCommands.jsm index 31532b9e0ae..07dbf13d82d 100644 --- a/browser/devtools/webconsole/GcliCommands.jsm +++ b/browser/devtools/webconsole/GcliCommands.jsm @@ -126,6 +126,40 @@ gcli.addCommand({ } }); +/** + * 'edit' command + */ +gcli.addCommand({ + name: "edit", + description: gcli.lookup("editDesc"), + manual: gcli.lookup("editManual"), + params: [ + { + name: 'resource', + type: { + name: 'resource', + include: 'text/css' + }, + description: gcli.lookup("editResourceDesc") + }, + { + name: "line", + defaultValue: 1, + type: { + name: "number", + min: 1, + step: 10 + }, + description: gcli.lookup("editLineToJumpToDesc") + } + ], + exec: function(args, context) { + let hud = HUDService.getHudReferenceById(context.environment.hudId); + let StyleEditor = hud.gcliterm.document.defaultView.StyleEditor; + StyleEditor.openChrome(args.resource.element, args.line); + } +}); + let breakpoints = []; /** diff --git a/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties b/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties index bfa6a92669b..f4a1ce01820 100644 --- a/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties +++ b/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties @@ -129,3 +129,23 @@ breakdelRemoved=Breakpoint removed # 'console close' command. This string is designed to be shown in a menu # alongside the command name, which is why it should be as short as possible. consolecloseDesc=Close the console + +# LOCALIZATION NOTE (editDesc) A very short description of the 'edit' +# command. See editManual for a fuller description of what it does. This +# string is designed to be shown in a menu alongside the command name, which +# is why it should be as short as possible. +editDesc=Tweak a page resource + +# LOCALIZATION NOTE (editManual) A fuller description of the 'edit' command, +# displayed when the user asks for help on what it does. +editManual=Edit one of the resources that is part of this page (or maybe any generic web resource?) + +# LOCALIZATION NOTE (editResourceDesc) A very short string to describe the +# 'resource' parameter to the 'edit' command, which is displayed in a dialog +# when the user is using this command. +editResourceDesc=URL to edit + +# LOCALIZATION NOTE (editLineToJumpToDesc) A very short string to describe the +# 'line' parameter to the 'edit' command, which is displayed in a dialog +# when the user is using this command. +editLineToJumpToDesc=Line to jump to