This topic describes the textEditor sample plugin that creates a simple editor for viewing and editing text files. Basing on this information, you can develop your own plugins that uses similar techniques.
The textEditor plugin uses the following techniques and Java classes:
- UI Designer and the DialogWrapper class to create user friendly UI designed for selecting/viewing/modifying text files.
- Selecting files using the Open dialog box provided by the
- Accessing files using Virtual File System (VFS) . The following Java classes are used:
To clarify how to develop your plugin that creates the text editor using the above techniques, consider the textEditor sample plugin available in the <%IDEA project folder%>/community/samples/textEditor> directory. When launched, this plugin displays a panel that allows you to select, open, view and optionally modify text files in your local file system.
To run the sample plugin
- Start IntelliJ IDEA and open the textEditor project saved into the <%IDEA project folder%>/community/samples/textEditor directory.
- Ensure that the project settings are valid for your environment. If necessary, modify the project settings.
To view or modify the project settings, on the toolbar, click , and then complete the Project Structure dialog box that opens.
- Run the plugin by choosing the Run | Run on the main menu.
If necessary, change the Run/Debug Configurations .
The plugin adds the new menu command Text Editor to the FileMenu group on the main menu:
Clicking this command causes IntelliJ IDEA to display the Sample Text File Editor panel you can use to view or modify text files. Alternatively, you can display this panel by pressing
Ctrl + F10.
The Sample Text File Editor panel is similar to the following screen: