MacrosPlugin allows you to create, maintain and execute simple macros using Java scripting (BeanShell).
This plugin was inspired by BeanShellPlugin and ToStringPlugin.
WARNING
- Shows a list of all currently installed macros
- Allows to add new and remove existing macros
- Allows to run macros either from a dialog or as an IDEA action
- Allows to create an action for a macros, add it to one of the existing action groups and to map it to a key
- Print Method Parameters
- This macros by default adds itself to Generate menu and being invoked on a method adds System.out.println( "all methods parameters, nicely formatted" ) to the beginning of the method.
- I could not find any legal way to map a key stroke to an action using OpenAPI, so I did it using some very nasty hack (using obfuscated classes). Obviously it can be broken very easy in the next build, but since the classes I am using are in openapi package there is a slight chance that JetBrains guys do not change it too often (if any). I hope this kind of functionality will be exposed in future versions of OpenAPI.
- 1.0 Initial version
- 1.1 Bug fix and log panel added
- Fixed bug which caused a error when opening IDEA with the plugin for the first time
- Added tool window for logging which is initialized when the first print from a macros is executed. The output from the print goes to this tool window.
- Fixed bug when executing a macros from a dialog
Each macros should have a description in xml file. The description is somewhat similar to a plugin description. All macros descriptions are located in <IDEA>/plugins/macros directory which can be changed via IDEA application settings.
To create a new macros/description you can either do it by hand or you can use Macros Manager dialog which is mapped by default to F10.
Each macros must have a corresponding executable code located in BeanShell file with extension .bsh BeanShell is a scripting language which looks like Java and has access to Java libraries via reflection. Thus it has access to IDEA API which is the point here
Each macros has access to a special variable 'context'. This variable holds a reference to an object MacroContext? which provides several useful methods (more info on that is coming soon).
Command print inside a macros prints messages to a special tool window which gets registered on demand, i.e. if you don't use any macros or macros do not print messages the tool window will not be created.
Command log inside a macros prints messages to IDEA log file.
TODO
Great plugin! One could use some help on the syntax for key stroke and maybe have a popup containing the ActionManager?.xml (in the doc directory) to get action anchors id. -- JacquesMorel - 15 Jan 2003
Nice plugin... A few things:
* F10 conflicts with the Javadoc editor plugin
* The help button doesnt work
* No help given on format required for setting keyboard shortcuts. I figured out that control shift z would do the job.
-- GlenStampoultzis
Download binary distribution, place it into <IDEA HOME> and unzip. It will place bean shell jar into IDEA lib/ directory, the plugin into plugin/ directory and simple macro into plugin/macros/ directory.
The config file attached use the native emacs Ctrl-K binding. To make it work you will have to remove manually the current assignment since the MacrosPlugin doesn't remove builtin assignment. -- JacquesMorel - 15 Jan 2003
-- DmitrySkavish - 21 Dec 2002
|
|