[ANN] Lineage 0.5.1 - easy class extension
Introducing Lineage 0.5.1, my second plugin. Lineage is part of a new personal tradition of small badly named plugins which improve IDEA's code editing features. The start was Lysosome - a tiny caret movement plugin. Now even smaller in version 1.0.1.
http://www.intellij.org/twiki/bin/view/Main/LysosomePlugin
Lineages main feature is an "Extend Class or Interface" intention. Similar to the "Implement Interface" and "Extend Abstract Class" intentions built into IDEA, positioning the cursor on a non-final class header makes the "Extend Class" light bulb pop up. The intention of this plugin is a lot more sensitive however; it's possible to extend any class by positioning the cursor on any class reference. Let me know if you like that or if the light bulbs make you crazy;-)
requests related to "extend class or interface"
http://www.intellij.net/tracker/idea/viewSCR?publicId=3514
http://www.intellij.net/tracker/idea/viewSCR?publicId=15252
http://www.intellij.net/tracker/idea/viewSCR?publicId=29189
requests related to "convert interface to class"
http://www.intellij.net/tracker/idea/viewSCR?publicId=3600
At this moment this plugin only works on Irida EAP builds. I'm planning some additional functionality for version 1.0 and any feature requests are welcome.
Bas
Please sign in to leave a comment.
Bas
>Let me know if you like that or if the light bulbs make you crazy;-)
>
I was surprised that it didn't show me the implement intention here:
public class Foo >Introducing Lineage 0.5.1, my second plugin. Lineage is part of a new personal tradition of small badly named plugins which improve IDEA's code editing >]]>
Be ambitious: thrive for "the BasCollectionPlugin"
Actually, the plugin manager should us build collection of plugins, to
let the user install/uninstall them in 1 go.
Alain
Alain Ravet wrote:
>>Let me know if you like that or if the light bulbs make you crazy;-)
But it does work if you move the cursor one position to the left,
doesn't it? If it's working correctly it shows up there where the
"Implement Interface" or "Extend Cbstract Class" intentions also show up.
e.g. here both "Implement Interface" and "Extend Class" won't appear.
public interface Foo {} but here they both do public interface Foo]]> {}
Let me know if it doesn't work for you (I don't have a Mac to test on).
Bas
Bas Leijdekkers wrote:
Oh yeah, did I mention Lineage also contains a "Convert Interface to
Class" intention. Sort of a reverse of the "Class may be interface"
inspection (in the Class structure category).
Bas
Bas
All it offers me is the "extends" intention.
There is no way I can have it change :
public class Foo ]]>
{
}
public class FooI {}
into
public class Foo implements FooI
{
}
public class FooI {}
Alain
Maybe I wasn't clear in my description of the plugin, but the "extends" intention is basically all it is.
Isn't what you want most easily accomplished by typing "implements FooI"? What would be the gain of doing that via an intention? I guess I don't understand what you want exactly.
Bas
Bas Leijdekkers wrote:
>Maybe I wasn't clear in my description of the plugin, but the "extends" intention is basically all it is.
>
My mistake: I had misunderstood the purpose of the plugin.
Alain
ActionContext testSdc = new ActionContext]]>
((DataContext) null) {
public Project project () { return new StubProject
(projectFilePath); }
public Module module () { return new StubModule
(moduleFilePath); }
};
java.lang.NullPointerException
at
net.intellij.plugins.lineage.SubClassPredicate.satisfiedBy(SubClassPredicate.java:48)
at
net.intellij.plugins.lineage.Intention.findMatchingElement(Intention.java:37)
at net.intellij.plugins.lineage.Intention.isAvailable(Intention.java:65)
at
com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.a(ShowIntentionsPass.java:122)
at
com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.doApplyInformationToEditor(ShowIntentionsPass.java:97)
at
com.intellij.codeInsight.daemon.impl.u.applyInformationToEditor(u.java:0)
at com.intellij.codeInsight.daemon.impl.d$3.run(d$3.java:4)
at com.intellij.openapi.application.impl.c$b_.run(c$b_.java:1)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at
com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:80)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:109)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:152)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:170)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Ah sorry, beginners mistake. Thanks for reporting. I will fix this monday when I have access to my machine again.
Bas
Thanks again for reporting. This problem is fixed in version 0.5.2,
available now.
Bas
Alain Ravet wrote:
Yes! The lack of this has always been the misfeature of IDEA that irritates me most, since I'm absolutely sure that it could be added to the product simply by editing a single line of code. Excellent work. So are you going to be gutsy enough to eventually have a "Select methods to override" panel (as happens on "Implement Abstract Class") or is this the end state?
It cost me a little more effort than editing a single line of code:-) But my intention also has some features "Implement Abstract Class" doesn't have. I gave it version number 0.5 because it's half of what I want 1.0 to be.
I hadn't decided on the "select methods to override" part, but now I've got a request for it I think I'll implement it. I believe I saw the the select methods panel exposed in the openapi somewhere, so it shouldn't be too much of a problem.
Other features I'm thinking about are:
An entry in the "new" menu, so it's possible to right click on a class in the project pane and extend it.
A way to create inner classes. At this moment it's already possible to create an inner subclass if you extend a private inner class, but maybe this should be more exposed.
A backport to IDEA 4.5 "Pallada". I don't know if there is any interest in this. It would take some effort as I use some Irida apis that weren't avaiable in Pallada and I would have to work around that. So I guess I'll wait with this until it's requested.
Bas
Hi Bas,
I just got this in 0.5.2.
Cheers,
N.
java.lang.NullPointerException
at
net.intellij.plugins.lineage.SubClassPredicate.satisfiedBy(SubClassPredicate.java:24)
at
net.intellij.plugins.lineage.Intention.findMatchingElement(Intention.java:37)
at net.intellij.plugins.lineage.Intention.isAvailable(Intention.java:65)
at
com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.a(ShowIntentionsPass.java:122)
at
com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.doApplyInformationToEditor(ShowIntentionsPass.java:97)
at
com.intellij.codeInsight.daemon.impl.u.applyInformationToEditor(u.java:0)
at com.intellij.codeInsight.daemon.impl.d$3.run(d$3.java:4)
at com.intellij.openapi.application.impl.c$b_.run(c$b_.java:1)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at
com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:80)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:109)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:152)
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)
Bas Leijdekkers wrote:
>> ActionContext testSdc = new ActionContext >> ((DataContext) null) { >> public Project project () { return new StubProject >> (projectFilePath); } >> public Module module () { return new StubModule >> (moduleFilePath); } >> }; >> >> >> java.lang.NullPointerException >> at >> net.intellij.plugins.lineage.SubClassPredicate.satisfiedBy(SubClassPredicate.java:48) >>]]>
...
Thanks for reporting Nathan. This is fixed in version 0.5.3, available now.
Bas
Cheers!
N.
Bas Leijdekkers wrote: