IntelliJ Community . MacrosPlugin

 
MacrosPlugin 

HOME INDEX SEARCH CHANGES GO  

MacrosPlugin

What is it?

MacrosPlugin allows you to create, maintain and execute simple macros using Java scripting (BeanShell).

This plugin was inspired by BeanShellPlugin and ToStringPlugin.

WARNING warning.gif

Current Features

  • 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

Available macros (please add your macros here)

  • 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.

Known problems

  • 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.

Change history

  • 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

Using

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 smile

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

Comments

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

Plugin installation

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.

Contribs

Emacs Kill Rest of current line from caret

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

IntelliJPluginWebForm
IntelliJPluginName: MacrosPlugin
IntelliJPluginVersion: 1.1
IntelliJPluginVendor: Dmitry Skavish (dmitry@jzoxNOSPAM321.com)
IntelliJPluginBinary: http://www.intellij.org/twiki/pub/Main/MacrosPlugin/macros-plugin.zip
IntelliJPluginSource: http://www.intellij.org/twiki/pub/Main/MacrosPlugin/macros-plugin-src.zip
IntelliJPluginClassification: CodeHelper?, ConsolePlugin, ProgramStructureInterface, SystemPlugin?
TopicClassification: IntelliJPluginPackage
TopicShortDescription: MacrosPlugin allows you to create, maintain and execute simple macros using Java scripting (BeanShell).
TestedOnOS:
ShouldRunOnOS:

Attachment: sort Action: Size: Date: Who: Comment:
macros-plugin.zip action 240324 23 Dec 2002 - 02:44 DmitrySkavish binary distribution v1.1
macros-plugin-src.zip action 33563 23 Dec 2002 - 02:45 DmitrySkavish source code v1.1
KillRestofLineFromCaret.zip action 718 15 Jan 2003 - 06:32 JacquesMorel Extract to plugins/macros directory

e d i t a t t a c h r e f - b y d i f f s m o r e
Have ideas, requests, problems regarding this site? Send feedback.
Copyright © 2000-2003 by the contributing authors. All materials at intellij.org are the property of the contributing authors.