Being a Java developer feels kinda common now days, you write plenty of code, you
try to incorporate new cool technologies & frameworks, new APIs & Legacy code.
You use many tools, build servers, JEE servers, Database tools, logging tools and the list just goes
on and on.
Kinda common, like I said. but you know what's not that common, enriching your IDE so
you can add some benefits to your daily and mundane tasks that you & your colleagues do regularly.
First, If you aren't an Intellij user - move to Intellij!
If you're an Eclipse user and you must work with Eclipse, since it has many plugins that you really
can't live without, what can I tell ya...your screwed :-)
If you use NetBeans by any chance, (gush, I only worked with it for a short while, and it was only for a specific task which required the use of NetBean's swing builder, which I can admit, has no equals, but who cares about Swing these days?)
You aren't working with 1 of those three? yeah I know there are more,
Some links about the IDEs out there -
eclipse-vs-netbeans-vs-jdeveloper-vs-intellij-idea
Comparison_of_integrated_development_environments
I didn't know there are so many IDEs out there, I wonder if all are still maintained.
Let's make it easy for us all, move to Intellij!
Working with Intellij can be really fun & really productive if you know what you're doing.
- The only thing I find Intellij a bit excessive, is the memory consumption, which is pretty preposterous. With big projects like 20+ modules with around 100 classes in each, with many plugins enabled, I get my Intellij instance reach up as 3GB (that's with defining a -Xmx=2g)
So have plenty of memory, fast SDD and a powerful computer in general and you're good to go.
Next step comes the need for a custom plugin.
And this blog post, isn't about how to develop a plugin, this blog post is only about praising JetBrains & more specifically their OpenApi.
The OpenApi is JetBrains source code for their Intellij community edition.
I can distinctly say, that the source code is not 100% synchronized to their binary forms, but its in the high 90's and thats good enough.
I've been writing plugins & Inspections for about 5 years now, and maybe apart from Spring,
there's no other one location of code that holds so much, and written so eloquently.
Writing a plugin has a pretty steep learning curve, that's for sure. but you'll be grateful if you use your spare time to write some productive plugin that you must develop (because no body else did or will)
The Intellij plugins repo is pretty massive, and I can tell you no one knows all the useful plugins out there, and sometimes it's easier to write one then to find a plugin that does kinda what you like.
Intellij was written more then 10 years ago, and the JetBrains people wrote all the Utils you may ever want and more.
It's amazes me every time, I start writing some extension for my plugin, and after a few years of dwelling in the OpenApi, I always start with trying to find if Intellij has some Utils or some Interface/AbtractClass to be incorporated to my needs.
To my amazement they mostly do, and by most counts, you don't have to write a lot of code.
That's the silver lining, the cloudy day is you may not understand how to use their Util, interface/AbtractClass, do you need to register it for it to work, some how?, some where?
Well, yeah, it can be a bit annoying, and the documentation is a bitch, (AKA non existing, well, that's not totally true, since they added some posts on plugins development in the last few years, but it's still really lacking, and it's mostly tutorials)
But, there are plenty of open source plugins by JetBrains , and many of the plugins in the repo are open source as well & it's a great place to learn new tricks and Utils you may never know about.
The developers forum is not bad, and you get answered to any valid question you may have. They answer pretty fast, so don't hesitate to post a question. (just look for a similar question first in the forum, if you ask a duplicated question, they take off points, I'm not kidding).
Using Intellij it's easy to search any class in the OpenApi, by search *Util* you'll get many results, try the same with *Manager*
A few names of Utils you want to look for -
AnnotationUtil, PsiTreeUtil, PsiManager - to manipulate psi elements.
FileDocumentManager & PsiDocumentManager,FileManager - Documents, PsiFile
& VirtualFile manipulation.
ApplicationManager, ProjectManager,ModuleManager - Application/Project/Modules access
and control.
These are some base Util class they you'll find really useful and probably will
use a few of them in any plugin development.
AnnotationUtil, PsiTreeUtil, PsiManager - to manipulate psi elements.
FileDocumentManager & PsiDocumentManager,FileManager - Documents, PsiFile
& VirtualFile manipulation.
ApplicationManager, ProjectManager,ModuleManager - Application/Project/Modules access
and control.
These are some base Util class they you'll find really useful and probably will
use a few of them in any plugin development.
That's all, I just had to get it off my system, thank you :-)