jGRASP Plugin for IntelliJ

The jGRASP Plugin for IntelliJ brings the jGRASP viewers and viewer canvas to the IntelliJ Java and Kotlin debugger in IDEA, Android Studio, and other IntelliJ-derived Java and/or Kotlin IDEs.



Requirements

The plugin is compatible with IDEA 2023.1 or higher, Android Studio 2023.1.1.6 or higher, or any IntelliJ-based IDE with build 231.8109.175 or higher that includes the IntelliJ Java module.


Notes

UI colors can be a bit off depending on the IntelliJ version, selected Theme, and OS. IntelliJ uses a lot of custom UI components, and their Look&Feels/Themes don't set up correct colors for all standard Swing components. Our plugin shares a lot of UI code with stand-alone jGRASP, and we want to keep it that way, so using IntelliJ's custom components everywhere is not a reasonable option. We will continue to work on this and correct it as much as is possible.

Viewers can be slow to display in Android apps on Android Studio, even with a relatively fast emulator.

Currently, IntelliJ local history is not supported for jGRASP viewer canvas files.


Installation

From a project window in IDEA or Android Studio go to "File" > "Settings" ("IntelliJ IDEA" or "Android Studio" > "Preferences" on macOS), or if you don't have a project open, from the start screen go to "Configure" > "Plugins". Select "Plugins" on the left, the "Marketplace" tab on the top, and search for "jGRASP". Then hit the "Install" button for the jGRASP plugin.


Features and Use

With the plugin installed, a "jGRASP" menu will appear on the menu bar. From there you can open a viewer canvas, change settings, copy the jGRASP example files, and open jGRASP help items.

Buttons for opening a viewer canvas canvas icon, and "run in canvas" run-in-canvas icon will appear on the main toolbar "run" group. Open viewer canvas and autostep/autoresume mode autostep icon will also appear on the debug toolbar. "Run in canvas" will start the debugger and open an associated canvas. Autostep/resume allows the canvas to be used in a "movie" mode that runs automatically through steps or breakpoints. This is useful for understanding code and for debugging.

To use the jGRASP viewers, you must either set a breakpoint in your program and use the "Debug" toolbar button or "Run" > "Debug" menu item. Alternately, the jGRASP "run in canvas" toolbar item or menu item will start the debugger and stop at the first line of main().

The jGRASP tab that appears when debugging provides an alternate view of the local variables and parameters, along with a single viewer for the currently selected item.

You can drag variables or values from anywhere in the IntelliJ debugger onto a viewer canvas. You can also drag viewers and elements displayed in those viewers from any canvas to another or within a single canvas.

When you right click on a variable in the IntelliJ debugger or the jGRASP tab, you will see "View by Name" and "View Value" items. These will open a single (not canvas) viewer for the variable. For "View by Name", the viewer will be tracked based on its expression and scope. So if a "by name" viewer is opened on variable "x" in main(), it will always display the current value of "x" when in the scope of "main", and whatever value it last had in "main" when in other scopes. For "View value", the viewer will always display the value at the time it was opened. So if a "by value" viewer is opened on a string variable "x" when it has value "test", it will continue to display that value even if "x" is assigned a new value. This is useful for viewing changes to objects that are be modified from background threads.

For information on features of the jGRASP viewers and viewer canvas, see the documentation and linked videos on this website. We highly recommend viewing our Viewer Canvas YouTube video.


Future Plans

Viewers for Android Studio and other IntelliJ library classes will be added for those classes that would benefit.

An extension point will be created so that user and third-party viewers can be added as plugins.

The jGRASP "Interactions" and "Workbench" features will be added.