Closed
Bug 120988
Opened 23 years ago
Closed 23 years ago
Generalized command manager for Venkman
Categories
(Other Applications Graveyard :: Venkman JS Debugger, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
mozilla0.9.9
People
(Reporter: rginda, Assigned: rginda)
References
Details
Attachments
(1 file)
139.22 KB,
patch
|
Details | Diff | Splinter Review |
Patch coming up integrates a generalized "Command Manager" in Venkman. This should make it very easy to add console commands, menu/menu items, and context menus to the debugger. It'll also make it possible for plugins to extend the debugger commandset and user interface at runtime. It works roughly as follows... command-manager.js This file defines the CommandRecord and CommandManager objects. CommandRecords represent reusable functions that the host application would like to make public via the command line or user interface. CommandRecords have |label|, |name|, |usage|, |flags|, |key|, and |function| properties. CommandRecords can format these fields into strings to provide a form of self-documentation. The CommandManager keeps collections of CommandRecords (via the |addCommand| method. The CommandManager also provides |addMenuItem|, |addToolbarItem|, and |addPopupItem| methods, for adding a CommandRecord to the user interface. In addition, the CommandManager will also manage the visible, checked, and enabled attributes of user interface items under its control. For example, if a command, "help", were added as a popup item, with the "enabledif" attribute set to "this.hasHelp", and |eval("this.hasHelp");| returned false when called from the "onpopupshowing" event for the popup, "help" would become greyed out. venkman-commands.js This file implements the set of commands available from Venkman. Some custom functions are used to create the CommandRecords. These functions look up strings in my .properties files, based on the command name, in order to simplify cmdary. Note that *all* of the commands take exactly one parameter. This parameter is the "event" object created when the command was dispatched. When commands are dispatched as text, as in from the console, parameters are automaticaly parsed and validated by the CommandManager, and placed on the event object. For example, if the "help" command is defined to take parameters of the format "[<help-subject>]", and the command "help foo" is dispatched, the event will have the property |helpSubject| set to "foo". If the parameter is not provided (the braces in the format string make it optional), then it is initialized to |null| by the CommandManager. This allows the commands defined in venkman-commands.js to omit most of the parameter checking. venkman-menus.js This file defines the menu, toolbar, and context menus used by Venkman. Again (as with venkman-commands.js), Venkman specific utility functions are used to make it as simple as possible (maybe even too simple) to hook up a command to a particular menu. There is much more to the patch, but if you've read this far you're probably bored by now, so I'll stop typing :) Comments, questions, and suggestions would be appreciated.
Assignee | ||
Comment 1•23 years ago
|
||
Assignee | ||
Updated•23 years ago
|
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.9
Assignee | ||
Comment 2•23 years ago
|
||
checked in
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Updated•20 years ago
|
Product: Core → Other Applications
Updated•6 years ago
|
Product: Other Applications → Other Applications Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•