Re: IdeaScript v.0.1 (Prototype Release)

This is a great plugin idea. Two things:

1/ I would like to make a script to implement a kind of multiple
inheritance, ie:
I have interfaces I1, I2, etc, with concrete implementations C1, C2, etc.
I want to create a class that "extends" C1, C2... so I declare it that way:

class A implements I1, I2
{
private I1 itsInnerI1 = new C1 ();
private I2 itsInnerI2 = new C2 ();
...

And for each method declaration of each interface, I define a similar method
in class A:

void m1I1 ()
{
itsInnerI1.m1I1 ();
}

int m2I1 ()
{
return itsInnerI1.m2I1 ();
}
...
}

So I would like to be able to make a script that:
-Checks the cursor is in an implement's interface declaration ("implements
I|1, I2")
-Generate the field declarations if not already declared.
-Remove all previously generated methods for this interface (they could be
identified by a javadoc tag)
-Generate all the methods.

Is it a feasible thing? How could I do that?

2/ When I launch Idea #915 with ScriptPlugin installed, I get the following
exception. It doesn't seem to otherwise affect the operation of the plugin.
java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:67)
at com.intellij.openapi.components.a.a.getComponent(a.java:84)
at
com.intellij.openapi.actionSystem.ActionManager.getInstance(ActionManager.java:2)
at com.digimax.idea.script.IdeaScript.]]>(IdeaScript.java:40)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at com.intellij.openapi.application.b.d.c(d.java:238)
at com.intellij.openapi.components.a.a.a(a.java:143)
at com.intellij.openapi.components.a.a.k(a.java:90)
at com.intellij.openapi.components.a.a.i(a.java:186)
at com.intellij.openapi.application.b.d.a(d.java:240)
at com.intellij.idea.e.b(e.java:4)
at com.intellij.idea.k.run(k.java:1)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)



Kirk Woll wrote:

IdeaScript is an Ant-like scripting language for Idea. It allows you to
easily create scripts to codify repetitive tasks in our favorite IDE. The
architecture is easily extendable so you can quickly create commands to
make your scripts do whatever you want (or more precisely, whatever Idea's
Open-API will let you).

Using IdeaScript, you can:

  • Create classes, methods, fields, etc.

  • Navigate to files, classes, or members within classes

  • Move the cursor anywhere around the editor and

edit the contents of the editor (cut, copy, paste,
etc.)

  • Other miscellaneous commands


This plugin is probably not for everyone but I already find it useful so I
thought I'd share what I have so far. This is the first public release and
as such I hope to elicit developer comments and criticism. Where I am
most interested in feedback is the currently chosen element names for the
commands and the names of their properties. (Since changing these down
the line will break people's scripts.) Also, I'd like to hear suggestions
on commands that aren't present yet but that you would find useful.

IdeaScript is available at:
http://www.intellij.org/twiki/bin/view/Main/IdeaScript

Please read that page completely so you don't miss anything. A short
tutorial is also available from that page.

Please sign in to leave a comment.