How to develop your IntelliJ IDEA plugins even faster with JRebel

Back in my NetBeans times I wrote several articles (1, 2) about using Zeroturnarounds JRebel to develop NetBeans plugins faster by not restarting nor reloading the whole target-platform. JRebel is a Java agent, so it can be used with nearly every Java-based application. Even for developing IDEA plugins. And here is how you do it:

One-Time-Setup

  1. Buy a JRebel license or get a free one for your open-source plugin at myRebel
  2. Install the JRebel plugin for IDEA from the plugin manager (for bundling JRebel, a configuration UI and debugging support)
  3. Activate the plugin using the license from step 1
  4. Update the your Run- or Debug configuration with the Java agent configuration – based on the standard documentation)
    For example: -agentpath:/Users/markiewb/Downloads/jrebel/lib/libjrebel64.dylib
    runconfiguration

Every-day-workflow

  1. Run / debug your plugin using the configuration created above – JRebel should show its banner and an IDEA instance should load
    banner
  2. Edit your Java sources as normal and when you want to get the changes reloaded then compile the project/all the changed files (thus the sources are compiled into class-files and JRebel can pick up the changes)
  3. Reinvoke your plugins actions (or what ever) in the target platform – your changes should be picked up

Notes

Note 1 Not all changes will be picked up. JRebel does not have yet official support for this usage scenario. Especially changes in the plugin.xml won’t be picked up. But within existing or new Java classes you can code and refactor as much as you like!

Note 2 If you are on Mac OS consider to install JRebel separately. I had issues to set the Java agent with the bundled JRebel from the JRebel IDE plugin. Do you see the culprit in -agentpath:/Users/markiewb/Library/Application Support/IntelliJIdea2017.2/jr-ide-idea/lib/jrebel6/lib/libjrebel64.dylib? The whitespace!

Note 3 Of course this also works when you write plugins for the other Java based IntelliJ platform IDEs like WebStorm, PHPStorm and so on.

Advertisements

IDEA: Navigator plugin for GWT

Within the last two days I wrote a new plugin, which allows you to jump faster between files of GWT services.

Using IDEAs “Related symbols” action you can jump from the async method in the interface to its implementation and vice-versa – all based on filename conventions and it is nice example of a GotoRelatedProvider.

Here you jump between files:

Here you jump between methods of files:

https://plugins.jetbrains.com/plugin/9912-navigator-extension-for-google-web-toolkit

This plugin requires the community edition of IntelliJ IDEA.

IDEA: External Tools as a Run Configuration?

Try the Run Configuration For External Tools-plugin.

RunPopup.png

The idea of an empty run configuration type is also provided by Batch Scripts Support– or BashSupport-plugin. So if you already use one of the bash plugins, you do not need my plugin.

IDEA: ‘Find duplicated classes in classpath’ plugin

In legacy projects sometimes a Java class (with the same fully qualified name) exists in several projects. If you combine these projects, you will never know, which class is used at runtime. It is like Maven dependency hell.

So I wrote a plugin to find out duplicated classes in the classpath. Get it here https://plugins.jetbrains.com/plugin/9663-find-duplicates-inspection, but do not expect much support from me (because it is only a proof-of-concept).

screenshot_16924.png

NetBeans: How to simplify copy/paste Java code from online tutorials

Some months ago I created a small useful NetBeans plugin, which allows to you to save time when pasting code samples from online tutorials. Today I used it again and I still find it very useful in this specific context. And it saves you time. That is why I want to report about it.

What is the feature? You can copy the Java source code of whole classes from a tutorial and paste it via Menu|Edit|Paste to new file. Either the package declaration of the Java class is taken in account or the Java class is placed in the correct package. This depends on the selected node and it is documented included screencasts at https://github.com/markiewb/nb-paste-to-new-file.

That sounds familiar? Yes, this feature already exists natively in Eclipse JDT and Intellij IDEA.

Give it a try, when using NetBeans! Happy coding.

BTW: I am still looking for maintainers for my plugins! Because of time issues, I will not bugfix nor implement features anymore. Support your favorite IDE and by contribution to your favorite plugin!

PasteToNewJavaFile

IDEA: How to “create a file from a file template”-plugin…

At https://github.com/markiewb/idea-create-from-template-plugin you will find an IDEA plugin, which shows you some APIs in action:

  • How to add an action to the context menu
  • How to create a context sensitive action. The action is only activated for Maven-based module nodes.
  • How to add an option panel – see projectConfigurable in the plugin.xml
  • How to register and use a project based settings service. See projectService in the plugin.xml
  • How to register a file template. See fileTemplateGroup in plugin.xml and resources/fileTemplates.j2ee