Home » Java » Enterprise Java » Work started on Apache Camel Intellij IDEA plugin

About Claus Ibsen

Claus Ibsen
Claus Ibsen is a principal software engineer from Red Hat. Claus is working full time as Apache Camel committer. And is author of the "Camel in Action" book.

Work started on Apache Camel Intellij IDEA plugin

Just because its Christmas does not mean the Camel stands still.

On the even of the 23rd I took the evening to do a bit of research and start hack on a little prototype for an Apache Camel plugin for IDEA. Its something that has been on my radar for a longer time.

The reason is that Apache Camel provides a catalog with has a ton of great information for tooling. The catalog includes every little detail about every Camel component, EIPs, data formats, languages, and much more.

I have long wanted to have a little plugin for IDEA (and also Eclipse if possible) for code assistance to setup Camel endpoints – in other words, having ctrl + space to show a list of Camel options you can use on any given Camel endpoint.

Sidestory begins …


So in the darkness of the night I found myself back in Intellij IDEA plugin land. It was a long long time since last time I hacked on a IDEA plugin. It was so many years ago I cannot remember exactly, but it was around 2002. I created a little plugin called Generate toString which would generate nice toString methods for your POJO classes, like you can generte equals/hashCode etc. Over the years that followed I maintained the plugin and upgraded it for newer IDEA versions which would often break the plugin, or they have moved/changed their APIs. Back then the plugin API was hardly documented, and there was no source code of the editor itself, so it was no fun to try to figure out how to get it to work again, or how to use some of  the existing IDEA dialogs etc. But in the end it was possible, and for a few dialogs I actually had to build it myself using Java Swing etc. The plugin later found a new home at Jetbrains where they took over and provides the plugin out of the box in IDEA. Thanks Jetbrains. You make the best editor on the planet.


You can read more about this story in the following blog posts:

Fast forward to 2016 and I was back in somewhat familiar waters, the AST model is still named PsiSomething.

… sidestory ends.

However doing a plugin that hooks into the Java language of IDEA took a while to find out, because I was walking down the wrong path, trying to find an
extension-point about smart completion.

So instead I looked at some of the out of the box plugins as you can find their source code, and eventually found a plugin that hook into the Java language which took me down the right path.

So after a while I got something working, which was marvelous to see that the smart completion suggestion list included the Camel endpoint options for the given component.  On christmas morning I hacked some more, and posted a tweet with the first screenshot

Today on the 25th December I do have a bit more time as well to polish up the code and to publish it on github.

I have created a new project on github where we can hack on the code to make the plugin awesome and great. The intention is that the code eventually will be donated to Apache Camel. But for now we can keep it separated so its easier because there is only the plugin code, and not all the other Camel source as well.

Github project: https://github.com/davsclaus/camel-idea-plugin

You can find more details on the github page, where there is instructions how to try / run and build the plugin. There is also a issue tracker with tickets for stuff we need to work on.

Anyone is welcome to help with the plugin. Sadly I don’t have so much time currently to justify spending days hacking on the plugin, even thought it would be really fun. I have to focus on completing the Camel in Action 2nd edition book. I am 85% complete with the microservices chapter, and then have another chapter to complete as soon as possible in the start of 2017. However I am also a human whom want to have a bit fun hacking so I will hack a bit from time to time on the plugin.

A shameless plug for the book, there is a 40% discount code during the holidays. The discount code is camiach(40% off Camel in Action, Second Edition, all formats, expiration: January 7, 2017)

To finish this blog post here are the latest screenshot of the Camel IDEA plugin in action:

Smart completion to present possible Camel options

The plugin also supports smart completion for the values, for example an enum based option shows which choices there are (and which one is the default if there is a default value)

Smart completion for enum values

Reference: Work started on Apache Camel Intellij IDEA plugin from our JCG partner Claus Ibsen at the Claus Ibsen riding the Apache Camel blog.

 

(0 rating, 0 votes)
You need to be a registered member to rate this.
Start the discussion Views Tweet it!
Do you want to know how to develop your skillset to become a Java Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. JPA Mini Book
2. JVM Troubleshooting Guide
3. JUnit Tutorial for Unit Testing
4. Java Annotations Tutorial
5. Java Interview Questions
6. Spring Interview Questions
7. Android UI Design
and many more ....
Email address:

Leave a Reply

avatar
  Subscribe  
Notify of