Plugin Development FAQ

Skip to end of metadata
Go to start of metadata

This FAQ is a topical index of questions that have been asked (and answered) on our OpenAPI forum. This is a work in progress.

Open-Source Plugins

How do I compile the Scala plugin?

Version Differences

How do I replace my usage of Project.getProjectFile() in 7.0?
How do I replace my usage of DataConstants with DataKeys in 7.0?
How do I replace my usage of ToolWindowManager.registerToolWindow() in 7.0?
How do I replace my usage of PsiSearchHelper.findReferences() in 7.0?
How do I replace my usage of DelayedFileStatusProvider in 6.0?

Action System

How do I trigger actions programmatically?
How do I add a main menu item?
How do I customize the "New..." menu?
How do I customize the compiler output context menu?
How do I get the context of an action (selected file, active project etc.)?
How do I change the icon of an action dynamically?
How do I add icons to the IDEA toolbar?
Where do I get the list of built-in action IDs?

Accessing and Modifying the Source Code

How do I find all subclasses of a class?
How do I find all anonymous classes created in a class?
How do I calculate the value of a string literal token?
How do I rename or move a Java class?
How do I build the list of all classes used by a given class or package?
How do I insert whitespace into the PSI?
How do I add properties to a .properties file?
How do I find specific method calls inside a PsiMethod?
What is the lifecycle of a PSI element?
How do I find a file given its name (but no path)?
How do I create a new class in the given package?
How do I make a PsiClass extend another PsiClass?
How do I find references to a class from non-Java files?
How do I find the source file given the path to a .class file?
How do I find classes with the specified non-qualified name?
How do I find the module in which a class is located?

Working with XML and XML DOM

How do I change the value of an XML attribute through the PSI?
How do I add custom references to Java elements in XML files?
How do I programmatically register a DTD or schema?
What is the "strict" parameter in DomElement.getParentOfType()?

Code Completion

How do I determine what type of code completion was invoked?
How do I provide additional code completion in specific places of a Java file?

Refactoring

How can I receive notifications about refactoring events?
How do I show a refactoring dialog programmatically?

Run/Debug

How do I implement a custom run configuration?

Make/Compile

How do I get access to class files generated by javac?

Version Control Integration

Can I provide line status markers for files in a custom file system?
How do I update the state of VCS actions depending on file status?
How can I find out the module of a deleted file?
Can I provide additional decorations for changelists in the Changes view?
How do I report out-of-date files?

Test Framework

How can I use the new test framework?
How do I create a library dependency in my test module?

Plugin Architecture

Why are the extension elements in my plugin.xml red?
How can I read the plugin descriptor of my plugin from code?
How do I provide a custom exception reporter for my plugin?
How can I add the help topics of my plugin to the IntelliJ IDEA help system?
How do I get the version of IntelliJ IDEA under which my plugin is running?

Editors, Documents and Files

Why doesn't the file change on disk after I changed it through the PSI?
Can I hook into the file save logic?
Can I mark a part of a file as read-only? How do I control what happens when the user tries to edit such a part?
How do I implement a custom editor?
How can I show several editors for a single file in tabs?
Can I open an editor which has no underlying file on disk?
How do I save the content of my custom editor when the user saves all documents?
How do I highlight elements in a source code editor? How do I allow to navigate between highlighted elements using Find Next?
How do I force code to be re-analyzed?
How do I get the active editor instance?
How do I get the cursor position in the current editor?
How do I clear the read-only status of a file?
How do I show a popup hint in an editor?
How do I create live template-like red box edit regions in an editor?
How can I show an editor with error highlighting in a toolwindow?

Inspections

Can I build an inspection that processes XML files?
Why are the inspection results shown multiple times?
How can I provide a quick fix that creates a method?
Is it possible to inspect only the elements that have been modified after the last full inspection?

Project Structure

Can I add a new module dependency storage format?
What is the Pair to be passed to JavaModuleBuilder.setSourcePaths()?
How do I access all configured JDKs?

Custom Languages

How do I provide Parameter Info support for my language?
How do I provide auto-popup code completion in my language?
How to make a closing brace unindent?
How to automatically insert closing quotes?
How do I provide Ctrl+mouse popups for my language?
How do I enable debugging for my custom language which is compiled into Java?
How do I generate virtual Java classes mirroring the classes of my language?

User Interface

How do I provide animated status bar notifications?
How do I enable file name completion in a combobox?
How do I show a popup with left-aligned and right-aligned parts for each item?
Can I use an embedded Web browser from my plugin?
How do I provide a custom icon for files/PSI elements?
Can I show a progress indicator for WriteActions?
How do I make it possible to search the options of my plugin in the Settings dialog?
How do I show a custom window or popup based on Structure View?
Is it possible to extend the Project View tree?
How do I show the "Project Structure" dialog programmatically?
How do I print messages in the console view?
How do I show the package selector dialog programmatically?
How do I provide syntax and error highlighting in a combo box editor?
How can I get notified when my toolwindow is activated?
How can I provide Close and Rerun buttons in my Usage View window?

General

How do I get the currently active project outside of an AnAction?
How do I detect when a project is closing?
How can I implement a custom stack trace analyzer?
Where is the state of an ApplicationComponent stored?
How do I open a project programmatically?
How do I get the folder of the currently selected file?
How do I encrypt some values in the configuration data of my plugin?

Contributors

Thanks to Sascha Weinreuter, Hugo Palma and Jay 'sliding' BS for their help in compiling the FAQ.

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Sep 06, 2007

    Anonymous

    The link for Why are the extension elements in my plugin.xml red? is not correct, please fix it.

    1. Sep 07, 2007

      Fixed, thanks.

  2. Oct 06, 2007

    Anonymous

    How do I force code to be re-analyzed? points to the wrong entry (previous one)

    1. Oct 09, 2007

      Fixed, thanks.

  3. Feb 26, 2013

    Thread for question 'How can I add the help topics of my plugin to the IntelliJ IDEA help system' is obsolete - no code visible in response