Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

This document is a work in progress.

This topic describes the ConditionalOperatorConverter sample plugin that adds a new intention action to the IDEA Intensions list. In addition, the sample plugin contains a JUnit-based test. Basing on this information, you can develop your own plugins using similar techniques.

About Intention Actions

IntelliJ IDEA interface analyzes your code and helps you handle the situations that may result in errors. When a possible problem is suspected, IntelliJ IDEA suggests appropriate intention actions, denoted with the special icons. For more information, refer to Intention Actions in IntelliJ IDEA Web Help.
You can view a list of all available intention actions using the Intention List provided by IntelliJ IDEA interface.

To display Intention List

  1. On the toolbar, click .
    The Settings dialog box opens.
  2. Under IDE Settings, click Intentions.
    This displays the list of all intention actions currently available in IntelliJ IDEA. The intention actions are grouped according to the areas of their use.
    To enable/disable an intention action, select/clear the check box to its left.

Used Techniques

The ConditionalOperatorConverter sample plugin illustrates the use of the following techniques:

  1. How to analyze a PSI tree .
  2. How to find a Java token of interest in the PSI tree.
  3. How to invoke a quick fix action for a token element under cursor using the PsiElementBaseIntentionAction class.
  4. How to create a JUnit test for this plugin using the IdeaTestFixtureFactory class.

Sample Plugin

The ConditionalOperatorConverter sample plugin is available in the <%IDEA project folder%>/community/samples/ConditionalOperatorConvertor> directory. When launched, this plugin adds the Convert ternary operator if statement item under Conditional Operator in the In

  • No labels