First build for GH pages

This commit is contained in:
breandan considine 2016-01-14 19:38:06 -08:00
parent 48c8cc57b8
commit eddddd5205
467 changed files with 34584 additions and 0 deletions

443
CONTRIBUTING.html Normal file
View File

@ -0,0 +1,443 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title> / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="CONTRIBUTING">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<a name="contributing" class="elem-anchor"></a>
<h1>Contributing<a href="#contributing" class="anchor-link"><span></span></a></h1>
<p>Thanks for contributing! Here are few useful things to know before submitting your Pull Request.</p>
<ul>
<li>Licensing - see <a href="LICENSE.txt"><span>LICENSE.txt</span></a></li>
<li><a href="#contributing-to-the-intellij-platform"><span>Contributing to the IntelliJ Platform</span></a></li>
<li><a href="#setting-up-your-environment"><span>Setting up your environment</span></a>
<ul>
<li><a href="#developing-with-docker"><span>Developing with Docker</span></a></li>
<li><a href="#developing-locally"><span>Developing locally</span></a></li>
</ul>
</li>
<li><a href="#markup"><span>Markup</span></a>
<ul>
<li><a href="#summarymd"><span>_SUMMARY.md</span></a></li>
<li><a href="#redirects"><span>Redirects</span></a></li>
<li><a href="#table-of-contents"><span>Table of contents</span></a></li>
<li><a href="#liquid-tags-and-filters"><span>Liquid tags and filters</span></a></li>
<li><a href="#syntax-highlighting"><span>Syntax highlighting</span></a></li>
<li><a href="#tables"><span>Tables</span></a></li>
<li><a href="#links"><span>Links</span></a></li>
<li><a href="#notes-and-callouts"><span>Callouts</span></a></li>
<li><a href="#images"><span>Images</span></a></li>
</ul>
</li>
<li>Style guide</li>
<li><a href="#a-word-on-submodules"><span>A word on submodules</span></a></li>
</ul>
<a name="contributing-to-the-intellij-platform" class="elem-anchor"></a>
<h2>Contributing to the IntelliJ Platform<a href="#contributing-to-the-intellij-platform" class="anchor-link"><span></span></a></h2>
<p>This document describes our contribution guidelines for the IntelliJ SDK Docs. For information about contributing to the IntelliJ Platform, please visit <a href="/intellij/sdk/docs/basics/platform_contributions.html"><span>Contributing to the IntelliJ Platform</span></a>.</p>
<a name="setting-up-your-environment" class="elem-anchor"></a>
<h2>Setting up your environment<a href="#setting-up-your-environment" class="anchor-link"><span></span></a></h2>
<p>This site runs via <a href="http://jekyllrb.com" data-bypass="yes" target="_blank"><span>Jekyll</span></a>, which is a popular static site generator, written in Ruby. It can be hosted locally to ensure that any changes are correct. Once set up, running the site is as easy as calling <code class="code highlight language-text">rake preview</code>.</p>
<p>Alternatively, the site can also be hosted in a <a href="https://www.docker.com" data-bypass="yes" target="_blank"><span>Docker container</span></a>. On Mac and Windows, this means the site is hosted in a virtual machine. Docker maintains this container, building it based on the instructions in the <a href="Dockerfile"><span><code class="code highlight language-text">Dockerfile</code></span></a>. All dependencies (Ruby, etc.) are automatically installed when building the image, which reduces the manual configuration steps. The Docker image is also used to build the <a href="http://www.jetbrains.org/intellij/sdk/docs/index.html" data-bypass="yes" target="_blank"><span>published site</span></a>, so it is a known working environment.</p>
<a name="developing-with-docker" class="elem-anchor"></a>
<h3>Developing with Docker<a href="#developing-with-docker" class="anchor-link"><span></span></a></h3>
<p>Follow these steps to work with Docker:</p>
<ul>
<li>Firstly, install Docker, using the <a href="https://www.docker.com/docker-toolbox" data-bypass="yes" target="_blank"><span>Docker Toolbox</span></a>.</li>
<li>On Windows and Mac, start the Docker host virtual machine (start the “Docker Quickstart terminal” or run “Kitematic”. See the Getting Started guides on <a href="https://www.docker.com" data-bypass="yes" target="_blank"><span>docker.com</span></a> for more details).</li>
<li>Clone the <a href="https://github.com/JetBrains/intellij-sdk-docs" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">intellij-sdk-docs</code></span></a> repo to the local machine, and <a href="#a-word-on-submodules"><span>initialise the <code class="code highlight language-text">sdkdocs-template</code> submodule</span></a>.</li>
<li>Change the current directory to the parent directory of the git repo.</li>
<li>Run <code class="code highlight language-text">docker build -t intellij-sdk-docs .</code>. This will build the docker image from the current folder, and give it the tag <code class="code highlight language-text">intellij-sdk-docs</code>.
<ul>
<li>Note that this must be run from a command prompt that has the various <code class="code highlight language-text">DOCKER_*</code> environment variables set up, such as the Docker Quickstart Terminal.</li>
</ul>
</li>
<li>Run <code class="code highlight language-text">docker run -p 4000:4000 -v $PWD:/usr/src/app intellij-sdk-docs</code>. This command will:
<ul>
<li>Start the docker container called <code class="code highlight language-text">intellij-sdk-docs</code>.</li>
<li>Forward port 4000 from the docker container to port 4000 on the docker client.</li>
</ul>
<aside class="note">
<p> For Windows and Mac, this means port 4000 of the docker container is forwarded to port 4000 of the docker virtual machine, not <code class="code highlight language-text">localhost</code>. For Linux, the docker client is the host machine, so <code class="code highlight language-text">localhost:4000</code> is forwarded to port 4000 on the docker container.</p>
<p>In order to hit the containers port 4000 from Windows or the Mac, it is necessary to hit the IP address of the docker client (virtual machine). Use <code class="code highlight language-text">docker-machine ip default</code> to get the IP address of the docker client. Use <code class="code highlight language-text">X.X.X.X:4000</code> to hit the client in the virtual machine, which is in turn mapped to the containers port 4000.</p>
<p>Alternatively, modify the virtual machines settings to automatically forward port 4000 to <code class="code highlight language-text">localhost</code>. See this <a href="http://acaird.github.io/computers/2014/11/16/docker-virtualbox-host-networking/" data-bypass="yes" target="_blank"><span>blog post</span></a> for more details.</p>
</aside>
<ul>
<li>Mount the current directory (<code class="code highlight language-text">$PWD</code> is a Unix style environment variable. You can use <code class="code highlight language-text">%CD%</code> on Windows, or specify the full path) as <code class="code highlight language-text">/usr/src/app</code> inside the docker container. This means the docker image will see the <code class="code highlight language-text">intellij-sdk-docs</code> repo as the folder <code class="code highlight language-text">/usr/src/app</code>.</li>
</ul>
<aside class="note">
<p> If running on Windows in an msys bash script (e.g. the “Docker Quickstart terminal”), the path to the local folder needs to be properly escaped, or the msys environment will translate the paths to standard Windows path, and you will see an error such as <code class="code highlight language-text">invalid value "C:\\Users\\...;C:\\Program Files\\Git\\usr\\src\\app" for flag -v</code>. To fix this, prefix the full path with double slashes, e.g. <code class="code highlight language-text">-v //c/Users/...</code>, or <code class="code highlight language-text">docker run -p 4000:4000 -v /$PWD:/usr/src/app intellij-sdk-docs</code> (note the leading slash before <code class="code highlight language-text">$PWD</code>).</p>
</aside>
<ul>
<li>Run the commands specific in the Dockerfiles <code class="code highlight language-text">CMD</code> instruction, which runs both <code class="code highlight language-text">rake bootstrap</code>, which ensures all of the prerequisites are installed, and <code class="code highlight language-text">rake preview</code>, which builds the site and starts to host it.</li>
</ul>
</li>
<li>Finally, you can access the newly created site by visiting <a href="http://localhost:4000/intellij/sdk/docs/" data-bypass="yes" target="_blank"><span>http://localhost:4000/intellij/sdk/docs/</span></a>, or by using the IP address of the docker client virtual machine (see note above).</li>
</ul>
<a name="developing-locally" class="elem-anchor"></a>
<h3>Developing locally<a href="#developing-locally" class="anchor-link"><span></span></a></h3>
<p>In order to build the documentation site, you will need:</p>
<ul>
<li>Ruby 2 - Jekyll is a Ruby application.</li>
<li>Ruby 2 DevKit (for Windows) - Some of Jekylls dependencies need to be compiled, and require the DevKit to be installed.</li>
<li><code class="code highlight language-text">gem install bundler</code> - the site uses <a href="http://bundler.io" data-bypass="yes" target="_blank"><span>Bundler</span></a> to manage gem dependencies within the repo, rather than globally installing to the local operating system. Run this command to install the Bundler toolset globally.</li>
</ul>
<p><strong>OS X</strong></p>
<p>OS X comes with Ruby already installed. The only steps required are:</p>
<ul>
<li><code class="code highlight language-text">gem install bundler</code></li>
</ul>
<p><strong>Windows</strong></p>
<ul>
<li>Install <a href="http://rubyinstaller.org" data-bypass="yes" target="_blank"><span>Ruby 2</span></a> and the <a href="http://rubyinstaller.org/downloads/" data-bypass="yes" target="_blank"><span>Ruby 2 DevKit</span></a> (one of the gems needs to build a native component)
<ul>
<li>After installing the DevKit, make sure to edit the <code class="code highlight language-text">config.yml</code> file to point to the Ruby installation</li>
</ul>
</li>
</ul>
<p>This is made easier if you use <a href="https://chocolatey.org" data-bypass="yes" target="_blank"><span>Chocolatey</span></a>, a package manager for Windows:</p>
<ul>
<li><code class="code highlight language-text">choco install ruby</code></li>
<li><code class="code highlight language-text">choco install ruby2.devkit</code>
<ul>
<li>After installing the DevKit, make sure to edit the <code class="code highlight language-text">config.yml</code> file to point to the Ruby installation.</li>
<li>By default, this is <code class="code highlight language-text">C:\tools\DevKit\config.yml</code></li>
<li>Add the line <code class="code highlight language-text">- C:\tools\ruby21</code> (including the leading minus sign)</li>
</ul>
</li>
</ul>
<aside class="note">
<p> Before running the <code class="code highlight language-text">rake bootstrap</code> step listed below, please run the <code class="code highlight language-text">devkitvars.bat</code> file from the DevKit. E.g. <code class="code highlight language-text">C:\tools\DevKit\devkitvars.bat</code></p>
</aside>
<a name="bootstrapping-the-environment" class="elem-anchor"></a>
<h3>Bootstrapping the environment<a href="#bootstrapping-the-environment" class="anchor-link"><span></span></a></h3>
<ol>
<li>Ensure Bundler is installed - <code class="code highlight language-text">gem install bundler</code></li>
<li>On Windows, ensure the <code class="code highlight language-text">devkitvars.bat</code> file has been run in the current command prompt (e.g. <code class="code highlight language-text">c:\tools\DevKit\devkitvars.bat</code>).</li>
<li>Clone the documentation site.</li>
<li>Initialise and update the <code class="code highlight language-text">sdkdocs-template</code> submodule - <code class="code highlight language-text">git submodule init</code> and <code class="code highlight language-text">git submodule update</code></li>
<li><code class="code highlight language-text">rake bootstrap</code> - this uses Bundler to download all required gems.</li>
<li><code class="code highlight language-text">rake preview</code> - this will build the site, and host it in a local webserver.</li>
</ol>
<a name="building-and-previewing-the-site" class="elem-anchor"></a>
<h3>Building and previewing the site<a href="#building-and-previewing-the-site" class="anchor-link"><span></span></a></h3>
<p>To build and test the site, simply run <code class="code highlight language-text">rake preview</code>. This will build the site and host it, using the config provided. The URL of the hosted site is displayed on the screen, and depends on the <code class="code highlight language-text">baseurl</code> field defined in <code class="code highlight language-text">_config.yml</code>.</p>
<a name="markup" class="elem-anchor"></a>
<h2>Markup<a href="#markup" class="anchor-link"><span></span></a></h2>
<p>By default, when building the site, all files are copied to the destination <code class="code highlight language-text">_site</code> folder. Some files are excluded in the <code class="code highlight language-text">_config.yml</code> and <code class="code highlight language-text">sdkdocs-template/jekyll/_config-defaults.yml</code> files. The documentation files themselves are <a href="http://daringfireball.net/projects/markdown/" data-bypass="yes" target="_blank"><span>Markdown</span></a> files (<code class="code highlight language-text">.md</code>) that get automatically converted to HTML when the site is built.</p>
<p>However, only markdown files beginning with a <a href="http://yaml.org" data-bypass="yes" target="_blank"><span>YAML</span></a> header are converted. If the markdown file doesnt contain a header, it wont be converted. In other words, to convert a <code class="code highlight language-text">.md</code> file to HTML, it should look like this:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_md"><span class="nn">---</span>
<span class="nn">---</span>
<span class="gh"># Introduction</span>
Lorem ipsum...
</code></pre>
<p>The two lines at the top of the file are the markers of the YAML “front matter”. Fields can be added in between these markers, and are used when generating the HTML. Typically, this header will be empty, although it is required by Jekyll (if omitted, the file isnt converted).</p>
<p>The YAML header can contain data that is used when generating the site. For example, the page title can be specified as a simple piece of markdown - <code class="code highlight language-text"># Title</code>, or it can be specified in the YAML, and the page template will display it appropriately:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_md"><span class="nn">---</span>
<span class="s">title</span><span class="pi">:</span> <span class="s">The Title Of The Page</span>
<span class="nn">---</span>
Lorem ipsum...
</code></pre>
<p>The YAML header can also include <a href="#redirects"><span>redirect</span></a> information.</p>
<a name="summarymd" class="elem-anchor"></a>
<h3>_SUMMARY.md<a href="#summarymd" class="anchor-link"><span></span></a></h3>
<p>The table of contents for the site is displayed in the tree view on the left hand side of the site, and it is generated from the <code class="code highlight language-text">_SUMMARY.md</code> file. It is a simple markdown list, with each item in the list being a link to another markdown page, either in the root folder, or sub-folders. The list can have nested items, which will be displayed as child items in the table of contents.</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_md"><span class="gh"># Summary</span>
<span class="p">
*</span> <span class="p">[</span><span class="nv">Introduction</span><span class="p">](</span><span class="sx">README.md</span><span class="p">)</span>
<span class="p">*</span> <span class="p">[</span><span class="nv">About This Guide</span><span class="p">](</span><span class="sx">Intro/About.md</span><span class="p">)</span>
<span class="p"> *</span> <span class="p">[</span><span class="nv">Key Topics</span><span class="p">](</span><span class="sx">Intro/KeyTopics.md</span><span class="p">)</span>
</code></pre>
<p>The contents can be split into “parts” by separating the list into several lists, each new list starting with a level 2 heading (<code class="code highlight language-text">##</code>).</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_md"><span class="gh"># Summary</span>
<span class="p">
*</span> <span class="p">[</span><span class="nv">Introduction</span><span class="p">](</span><span class="sx">README.md</span><span class="p">)</span>
<span class="p">*</span> <span class="p">[</span><span class="nv">About This Guide</span><span class="p">](</span><span class="sx">Intro/About.md</span><span class="p">)</span>
<span class="p"> *</span> <span class="p">[</span><span class="nv">Key Topics</span><span class="p">](</span><span class="sx">Intro/KeyTopics.md</span><span class="p">)</span>
<span class="gu">## Part I - Extending the Platform</span>
<span class="p">*</span> <span class="p">[</span><span class="nv">Getting Started</span><span class="p">](</span><span class="sx">Docs/GettingStarted.md</span><span class="p">)</span>
<span class="p">*</span> ...
</code></pre>
<p>If a node doesnt have a link, but is just plain text, it will still appear in the table of contents, but will be greyed out and not clickable. It acts like a placeholder for a documentation item. This is useful to keep track of what should be documented, but hasnt yet, and can be useful to show readers that the topic exists, but isnt yet documented (Pull Requests always welcome!).</p>
<a name="redirects" class="elem-anchor"></a>
<h3>Redirects<a href="#redirects" class="anchor-link"><span></span></a></h3>
<p>The documentation site is set up to include the <a href="https://github.com/jekyll/jekyll-redirect-from" data-bypass="yes" target="_blank"><span>jekyll-redirect-from</span></a> plugin, which will generate “dummy” pages that automatically redirect to a given page. For example, to specify that the <code class="code highlight language-text">index.html</code> page will be generated to redirect to <code class="code highlight language-text">README.md</code>, the <code class="code highlight language-text">README.md</code> file should include the following in the YAML header:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_md"><span class="nn">---</span>
<span class="s">redirect_from</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">/index.html</span>
<span class="nn">---</span>
<span class="gh"># Introduction</span>
Lorem ipsum...
</code></pre>
<p>This will create an <code class="code highlight language-text">index.html</code> file that will automatically redirect to the generated <code class="code highlight language-text">README.html</code> file. This is very useful to allow the site URL to automatically show the <code class="code highlight language-text">README.html</code> file - <code class="code highlight language-text">http://localhost:4001/foo-test/</code> will try to load <code class="code highlight language-text">index.html</code>, which will automatically redirect to <code class="code highlight language-text">README.html</code>.</p>
<p>It is also useful to redirect when renaming or moving files. Multiple redirects can be added to the YAML header.</p>
<a name="table-of-contents" class="elem-anchor"></a>
<h3>Table of contents<a href="#table-of-contents" class="anchor-link"><span></span></a></h3>
<p>The site is configured to use the <a href="http://kramdown.gettalong.org" data-bypass="yes" target="_blank"><span>Kramdown Markdown converter</span></a>, which adds some extra features over traditional markdown, such as “attribute lists”, which can apply attributes to the generated elements.</p>
<p>One useful attribute is <code class="code highlight language-text">{:toc}</code>, which can be applied to a list item, which will get replaced with a list of links to header items. E.g. the following list item will be replaced by links to all of the header items in the page:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_md"><span class="p">*</span> Dummy list item
{:toc}
</code></pre>
<p>Further Kramdown features are described on the <a href="http://kramdown.gettalong.org/converter/html.html" data-bypass="yes" target="_blank"><span>converter page</span></a>, and attribute lists are described on the <a href="http://kramdown.gettalong.org/syntax.html" data-bypass="yes" target="_blank"><span>syntax page</span></a>. Note that source code formatting is configured to use <a href="https://help.github.com/articles/github-flavored-markdown/" data-bypass="yes" target="_blank"><span>GitHub Flavoured Mardown</span></a> and “code fences”, see below.</p>
<a name="liquid-tags-and-filters" class="elem-anchor"></a>
<h3>Liquid tags and filters<a href="#liquid-tags-and-filters" class="anchor-link"><span></span></a></h3>
<p>Jekyll uses the <a href="http://liquidmarkup.org" data-bypass="yes" target="_blank"><span>Liquid</span></a> templating language to process files. This means standard Liquid tags and filters are available. There should be little need to use them however, as the Markdown format is already quite rich. See the <a href="http://jekyllrb.com/docs/templates/" data-bypass="yes" target="_blank"><span>Jekyll site</span></a> for more details.</p>
<a name="syntax-highlighting" class="elem-anchor"></a>
<h3>Syntax highlighting<a href="#syntax-highlighting" class="anchor-link"><span></span></a></h3>
<p>Source code can be represented by using <a href="https://help.github.com/articles/github-flavored-markdown/" data-bypass="yes" target="_blank"><span>GitHub Flavoured Markdown</span></a> code fences, which are three back ticks:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_text">```
// Source code goes here...
```
</code></pre>
<p>Syntax highlighting can be applied by specifying the language after the first set of ticks:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_text">```csharp
// Some C# code
```
```java
// Some Java code
```
</code></pre>
<p>Here is the list of <a href="https://github.com/jneen/rouge/wiki/List-of-supported-languages-and-lexers" data-bypass="yes" target="_blank"><span>supported languages</span></a> (and also <a href="https://kotlinlang.org" data-bypass="yes" target="_blank"><span>Kotlin</span></a>, of course).</p>
<!-- Not currently supported by rouge, or by the site's CSS
The site is also configured to highlight a range of files in the source code, by specifying `{start-end}` which is the start and end line of the highlighting:
```java{2-3}
// Not highlighted
// Highlighted
// Highlighted
// Not highlighted
```
-->
<a name="tables" class="elem-anchor"></a>
<h3>Tables<a href="#tables" class="anchor-link"><span></span></a></h3>
<p>The Kramdown parser also supports tables. The syntax is to use the pipe (<code class="code highlight language-text">|</code>) and minus symbols:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_text">```md
| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| Blah | Blah | Blah |
```
</code></pre>
<a name="links" class="elem-anchor"></a>
<h3>Links<a href="#links" class="anchor-link"><span></span></a></h3>
<p>Links are handled as normal markdown links, and can be links to external sites, pages within the sites, or headings in the sites. When a Markdown header is converted to an HTML header, it is assigned an ID, so it can be linked, e.g. <code class="code highlight language-text">## Introduction</code> will get the ID of <code class="code highlight language-text">introduction</code>, and can be linked either in the same page <code class="code highlight language-text">[click here](#introduction)</code> or cross page <code class="code highlight language-text">[click here](page.html#introduction)</code>. The anchor name will be all lower case, and spaces are replaced with <code class="code highlight language-text">-</code>, e.g. <code class="code highlight language-text">## Page setup</code> becomes <code class="code highlight language-text">#page-setup</code>.</p>
<ul>
<li><code class="code highlight language-text">[External site](http://example.org)</code> will link to an external site</li>
<li><code class="code highlight language-text">[Other page in current directory](Page2.md)</code> will link to a page in the same directory as the current page. Note that the extension is <code class="code highlight language-text">.md</code>, NOT <code class="code highlight language-text">.html</code>.</li>
<li><code class="code highlight language-text">[Page in another folder](/Folder2/Page2.md)</code> will link to a page in another folder. Note that the URL is navigating from root - this works even if the site is hosted in a sub-folder (e.g. this link will work for <code class="code highlight language-text">http://localhost:4000/devguide/Folder2/Page2.html</code>). Relative links will also work (<code class="code highlight language-text">../Folder2/Page2.md</code>).</li>
<li><code class="code highlight language-text">[Link to section on another page](Page2.md#another-section)</code> will link to a heading on another page. The ID of the heading is generated by making the text lowercase and replacing spaces with <code class="code highlight language-text">-</code>.</li>
<li><code class="code highlight language-text">[Link to section on current page](#another-section)</code> will link to a heading on the current page.</li>
</ul>
<a name="notes-and-callouts" class="elem-anchor"></a>
<h3>Notes and callouts<a href="#notes-and-callouts" class="anchor-link"><span></span></a></h3>
<p>Notes and callouts can be specified using the blockquote syntax. The converter will look at the first following word to see if it is bold. If so, it will apply that as a callout style. For example:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_text">&gt; **NOTE** This is a note
</code></pre>
<p>Will be displayed as a callout, styled as a “note”. The other styles available for callouts are “note”, “warning”, “tip” and “todo”.</p>
<a name="images" class="elem-anchor"></a>
<h3>Images<a href="#images" class="anchor-link"><span></span></a></h3>
<p>Images can be included by adding the file directly to the repository and adding a link to the image like so:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_text">```md
![Alt text](path-to-img.png)
```
</code></pre>
<p>Please downscale screenshots made at high resolution.</p>
<a name="a-word-on-submodules" class="elem-anchor"></a>
<h2>A word on submodules<a href="#a-word-on-submodules" class="anchor-link"><span></span></a></h2>
<p>The <code class="code highlight language-text">sdkdocs-template</code> repo is added as a submodule, and it also contains a submodule to the private <code class="code highlight language-text">webhelp-template</code> repo. The <code class="code highlight language-text">sdkdocs-template</code> repo contains build time scripts and compiled and minified JS and CSS that allow the site to run. The private <code class="code highlight language-text">webhelp-template</code> repo contains the code to build the JS and CSS. It is currently closed source, but the plan is to make it open source at some point, in which case, it is likely the two repos will be merged.</p>
<p>After cloning, a submodule needs to be initialised and updated:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_text">```
git submodule init
git submodule update
```
</code></pre>
<p>This will create a <code class="code highlight language-text">.gitmodules</code> file, register a submodule in the <code class="code highlight language-text">sdkdocs-template</code> folder, and check out the files. (Note that when a repo is added as a submodule, it doesnt get a <code class="code highlight language-text">.git</code> folder, but instead gets a <code class="code highlight language-text">.git</code> file that points to the location of the <code class="code highlight language-text">.git</code> folder.</p>
<p>A submodule can be updated using normal git commands such as <code class="code highlight language-text">git pull</code>. It can be switched to a different branch using <code class="code highlight language-text">git checkout</code>, and any changes to the currently checked out revision need to be committed back into the main repo, as normal git commands. It is initially cloned at a specific revision, and not as part of a branch.update</p>
<p>If changes are made to the submodule, they should be made on a branch to a clone, and a Pull Request sent. Changes can be made and committed, and the hosting repo will need to commit a pointer to the current version of the submodule.</p>
<p>If there are any problems with the <code class="code highlight language-text">sdkdocs-template</code>, please <a href="https://github.com/JetBrains/sdkdocs-template/issues" data-bypass="yes" target="_blank"><span>raise an issue</span></a>.</p>
<div class="last-modified">
Last modified: 6 January 2016
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

35
Dockerfile Normal file
View File

@ -0,0 +1,35 @@
FROM ruby:2.2
RUN apt-get update
RUN apt-get --yes install locales
RUN dpkg-reconfigure -f noninteractive locales && \
locale-gen C.UTF-8 && \
/usr/sbin/update-locale LANG=C.UTF-8
RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && \
locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# Tell anyone who's interested that we're running in docker
ENV DOCKER true
RUN apt-get --yes install nodejs
# Add bundle install to Docker image
ADD Gemfile* /tmp/
ADD Rakefile /tmp/
ADD _SUMMARY.md /tmp/
ADD .git /tmp/.git
ADD sdkdocs-template /tmp/sdkdocs-template
WORKDIR /tmp
RUN rake bootstrap
WORKDIR /usr/src/app
EXPOSE 4000
CMD \
rake bootstrap --trace && \
rake preview

16
HOWTO.md Normal file
View File

@ -0,0 +1,16 @@
Rules for migrating documents from other sources
====
#TODOs and issues under development
Any issues in a document needed to be re-worked, extended, and\/or newly written should be marked with.
```
<!--TODO Provide detailed description here-->
```
#Tracking old already processed content
If you've migrated a document from confluence, this document should be marked with `migrated` tag.
Please make all the tags **case sensitive**.
These tags are required for future coverage and consistency testing.
Thanks.

View File

1
HelpTOC.json Normal file

File diff suppressed because one or more lines are too long

191
LICENSE.txt Normal file
View File

@ -0,0 +1,191 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
Copyright 2015 JetBrains Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

76
README.md Normal file
View File

@ -0,0 +1,76 @@
IntelliJ Platform SDK Documentation
=======
This is a repository for
[IntelliJ Platform SDK Documentation](http://www.jetbrains.org/intellij/sdk/docs/)
site.
##Reporting Bugs
Please inform about any content inconsistencies, outdated materials, cosmetic issues, and other defects you find by submitting an issue to
[YouTrack](https://youtrack.jetbrains.com/issues/IJSDK).
##Working With the Site Locally
To check out and run a local copy of the site follow the steps described below.
###Pre-requirements
* Make sure you have a
[git client](http://git-scm.com/downloads)
installed
* This site requires
[Ruby 2.0](https://www.ruby-lang.org/) or higher.
Follow the official Ruby language
[download](https://www.ruby-lang.org/en/downloads/)
and
[installation](https://www.ruby-lang.org/en/documentation/installation/)
instructions to get Ruby working on your machine.
* This site requires [Jekyll](http://jekyllrb.com/),
a Ruby-based site generating framework.
To install Jekyll refer to it's
[installation guidelines](http://jekyllrb.com/docs/installation/).
**Note:** If you are using Windows, you can face some specific aspects while installing Jekyll.
See this [Run Jekyll on Windows Guide](http://jekyll-windows.juthilo.com/) to get more information.
### Checking Out Site Repository
To check out the source code run the following command:
```bash
git clone https://github.com/JetBrains/intellij-sdk-docs.git
```
###Initializing Submodules
The site uses JetBrains custom web templates.
To enable custom templates locally you need to initialize repository submodules.
Run the following command in the checkout directory to do so.
```bash
git submodule update --init --remote
```
###Building and Previewing
A set of Rake tasks, a Make-like programs implemented in Ruby, provides short commands to build and run the site locally.
####Building Site from Sources
* Make sure you are in a project root directory
* To build static site content run
```
rake build
```
####Previewing
* To start the web-server run
```
rake preview
```
* Open the address
[http://127.0.0.1:4000/](http://127.0.0.1:4000/)
in your browser.
**Note:** Make sure you haven't change default Jekyll port during installation.

1
app/css/styles.min.css vendored Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

8
app/img/svg/close.svg Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="100%" height="100%" viewBox="0 0 14 14" xml:space="preserve">
<path fill="#BFBFBF" d="M7,0C3.134,0,0,3.134,0,7c0,3.866,3.134,7,7,7s7-3.134,7-7C14,3.134,10.866,0,7,0z M10.185,9.059
c0.312,0.312,0.312,0.816,0,1.128c-0.312,0.311-0.816,0.311-1.128,0L6.978,8.108l-2.079,2.079c-0.312,0.311-0.816,0.311-1.128,0
c-0.312-0.312-0.312-0.816,0-1.128L5.85,6.98L3.795,4.926c-0.311-0.312-0.311-0.816,0-1.128c0.312-0.312,0.816-0.312,1.128,0
l2.054,2.054l2.085-2.085c0.312-0.312,0.816-0.312,1.128,0c0.311,0.312,0.311,0.816,0,1.128L8.105,6.98L10.185,9.059z"/>
</svg>

After

Width:  |  Height:  |  Size: 713 B

16
app/img/svg/menu.svg Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="100%" height="100%" viewBox="0 0 17 16.969" enable-background="new 0 0 17 16.969" xml:space="preserve">
<g>
<rect x="0.5" y="0.5" fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" width="16" height="3.969"/>
<path fill="#999999" d="M16,1v2.969H1V1H16 M17,0H0v4.969h17V0L17,0z"/>
</g>
<g>
<rect x="0.5" y="6.5" fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" width="16" height="3.969"/>
<path fill="#999999" d="M16,7v2.969H1V7H16 M17,6H0v4.969h17V6L17,6z"/>
</g>
<g>
<rect x="0.5" y="12.5" fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" width="16" height="3.969"/>
<path fill="#999999" d="M16,13v2.969H1V13H16 M17,12H0v4.969h17V12L17,12z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 852 B

30
app/img/svg/pdf.svg Normal file
View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="100%" height="100%" viewBox="0 0 38 47" enable-background="new 0 0 38 47" xml:space="preserve">
<g>
<path fill="#B2B3B3" d="M28.583,4L34,9.415V43H7V4H28.583 M28.997,3H6v41h29V9L28.997,3L28.997,3z"/>
</g>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#BFBFBF" d="M28.021,3h1v7h-1V3z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#BFBFBF" d="M29.021,10V9h6v1H29.021z"/>
<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" fill="#454545" d="M27.348,28.749h-1.304v-1.978h0.965v-1.009H13.992
v1.009h0.965v1.978h-1.304c-0.36,0-0.652-0.282-0.652-0.629V22.01c0-0.608,2.609-1.259,7.174-1.259c0.242,0,0.456,0,0.652,0
c4.524,0,7.174,0.636,7.174,1.259v6.109C28,28.467,27.708,28.749,27.348,28.749z M25.499,22.296c-0.54,0-0.978,0.423-0.978,0.944
s0.438,0.944,0.978,0.944s0.979-0.423,0.979-0.944S26.039,22.296,25.499,22.296z M16.015,16.411c0-0.348,0.292-0.629,0.652-0.629
h7.666c0.36,0,0.652,0.282,0.652,0.629v3.336h-8.97V16.411z M24.985,32.152c0,0.348-0.292,0.629-0.652,0.629h-7.666
c-0.36,0-0.652-0.282-0.652-0.629v-5.386h8.97V32.152z M23.993,27.333h-6.986v0.63h6.986V27.333z M23.993,28.593h-6.986v0.629h6.986
V28.593z M23.993,29.852h-6.986v0.629h6.986V29.852z M23.993,31.111h-6.986v0.629h6.986V31.111z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F26F71" d="M0,9h17v9H0V9z"/>
<g>
<path fill="#FFFFFF" d="M6.149,12.752c0,0.178-0.027,0.349-0.081,0.513S5.927,13.574,5.804,13.7s-0.286,0.227-0.488,0.302
s-0.452,0.113-0.749,0.113H4.128v1.667H3.583v-4.283h1.061c0.262,0,0.487,0.028,0.677,0.083s0.346,0.137,0.469,0.243
s0.214,0.238,0.272,0.394S6.149,12.553,6.149,12.752z M4.128,13.651h0.378c0.182,0,0.34-0.016,0.476-0.047s0.248-0.082,0.337-0.151
s0.156-0.159,0.201-0.27s0.067-0.245,0.067-0.403c0-0.277-0.08-0.483-0.24-0.617s-0.41-0.201-0.75-0.201H4.128V13.651z"/>
<path fill="#FFFFFF" d="M10.195,13.599c0,0.361-0.047,0.678-0.141,0.951s-0.229,0.5-0.407,0.683s-0.396,0.32-0.655,0.412
s-0.552,0.138-0.88,0.138H7.04v-4.283h1.192c0.299,0,0.569,0.045,0.812,0.135s0.448,0.223,0.618,0.4s0.301,0.396,0.394,0.658
S10.195,13.255,10.195,13.599z M9.618,13.616c0-0.285-0.032-0.532-0.097-0.74s-0.158-0.379-0.281-0.514s-0.274-0.235-0.454-0.3
s-0.384-0.098-0.612-0.098H7.585v3.349H8.06c0.516,0,0.904-0.143,1.166-0.428S9.618,14.177,9.618,13.616z"/>
<path fill="#FFFFFF" d="M11.689,15.781h-0.545v-4.283h2.224v0.48h-1.679v1.512h1.567v0.48h-1.567V15.781z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

11
app/img/svg/search.svg Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="100%" height="100%" viewBox="0 0 13.001 13.993" enable-background="new 0 0 13.001 13.993" xml:space="preserve">
<path fill="#848990" d="M12.74,13.385l-0.316,0.333c-0.349,0.367-0.915,0.367-1.264,0
l-2.528-2.659c-0.293-0.308-0.325-0.77-0.126-1.13L7.125,8.474c-0.743,0.58-1.66,0.927-2.657,0.927C2,9.402,0,7.297,0,4.701
C0,2.105,2,0,4.468,0c2.468,0,4.468,2.105,4.468,4.701c0,1.208-0.437,2.307-1.15,3.14l1.352,1.422
c0.342-0.209,0.781-0.175,1.074,0.133l2.527,2.659C13.088,12.422,13.088,13.018,12.74,13.385z M7.81,4.682
c0-1.947-1.5-3.526-3.351-3.526c-0.515,0-0.998,0.133-1.434,0.352c0.233,0.252-0.019,0,0,0c-0.363,0-0.948,0.879-0.948,1.29
c0-0.02-0.378,0.602-0.626,0.358C1.238,3.619,1.108,4.132,1.108,4.682c0,1.947,1.5,3.525,3.351,3.525
C6.31,8.207,7.81,6.629,7.81,4.682z"/>
</svg>

After

Width:  |  Height:  |  Size: 957 B

1
app/img/svg/zoom-in.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 128.366 119.076"><path d="M75.307 16.07l27.916 41.763c.021-1.302-.018-2.606-.112-3.91l-24.237-36.257c-1.168-.585-2.357-1.118-3.567-1.596zM45.646 15.024c-.681.216-1.358.447-2.031.698l47.801 71.511c.489-.526.964-1.062 1.424-1.607l-47.194-70.602zM50.997 13.68c-.731.135-1.459.294-2.186.466l46.055 68.899c.438-.606.858-1.224 1.264-1.849l-45.133-67.516zM42.508 19.68l-1.728 1.155 46.818 70.041c.537-.453 1.062-.916 1.571-1.391l-46.661-69.805zM38.786 23.872l-1.727 1.155 46.188 69.095.349-.221c.464-.311.912-.636 1.36-.96l-46.17-69.069zM91.456 27.137c-1.917-2.076-4-3.934-6.22-5.567l16.725 25.02c-.654-2.662-1.568-5.285-2.741-7.838l-7.764-11.615zM63.15 13.164c-.867-.082-1.737-.138-2.609-.168l39.877 59.654c.305-.815.59-1.638.846-2.469l-38.114-57.017zM34.469 26.763l-1.727 1.154 45.987 68.795c.62-.31 1.235-.635 1.846-.977l-46.106-68.972zM70.24 14.413c-.978-.256-1.961-.485-2.953-.673l35.019 52.388c.204-.987.373-1.981.511-2.981l-32.577-48.734zM56.801 13.009c-.793.04-1.587.096-2.379.179l43.469 65.03c.378-.699.74-1.406 1.08-2.123l-42.17-63.086zM14.953 53.987c-.085 1.184-.126 2.372-.117 3.562l26.931 40.289c1.096.464 2.209.88 3.336 1.254l-30.15-45.105zM18.222 40.175c-.326.784-.63 1.576-.909 2.376l39.26 58.734c.847.048 1.695.069 2.544.068l-40.895-61.178zM28.835 27.688l-1.728 1.156 46.761 69.952c.666-.237 1.33-.491 1.989-.764l-47.022-70.344zM31.375 91.644c1.499 1.202 3.069 2.292 4.692 3.277l-20.714-30.987c.29 1.876.696 3.742 1.234 5.587l14.788 22.123zM24.03 30.161c-.452.586-.889 1.183-1.309 1.788l45.718 68.392c.72-.156 1.438-.332 2.152-.525l-46.561-69.655zM16.151 46.429c-.234.939-.428 1.887-.601 2.839l34.143 51.078c.946.204 1.896.388 2.854.53l-36.396-54.447zM20.884 34.812c-.395.675-.767 1.361-1.125 2.053l43.005 64.333c.776-.065 1.551-.147 2.326-.254l-44.206-66.132z"/><path fill="#fff" stroke="#000" stroke-width="3" stroke-miterlimit="10" d="M97.905 52.154c0 23.125-18.747 41.873-41.874 41.873-23.126 0-41.874-18.747-41.874-41.873 0-23.126 18.748-41.873 41.874-41.873 23.127 0 41.874 18.747 41.874 41.873"/><path stroke="#000" stroke-width="4" stroke-miterlimit="10" fill="none" d="M44.002 52.914h24M56.002 64.913v-23.999"/></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

1
app/img/svg/zoom-in2.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 86.75 86.75"><path stroke-miterlimit="10" d="M85.248 43.377c0-23.125-18.747-41.873-41.874-41.873-23.126 0-41.874 18.747-41.874 41.873 0 23.126 18.748 41.873 41.874 41.873 23.127 0 41.874-18.747 41.874-41.873" stroke="#000" stroke-width="3"/><path stroke-miterlimit="10" d="M25.31 43.376h36.128m-18.064-18.063v36.128" fill="#fff" stroke="#fff" stroke-width="4"/><path stroke-miterlimit="10" d="M78.089 43.377c0-19.171-15.542-34.714-34.715-34.714-19.172 0-34.715 15.542-34.715 34.714 0 19.172 15.543 34.714 34.715 34.714 19.173 0 34.715-15.542 34.715-34.714" stroke="#fff" stroke-width="4" fill="none"/></svg>

After

Width:  |  Height:  |  Size: 687 B

9
app/js/main.build.js Normal file

File diff suppressed because one or more lines are too long

36
app/js/vendor/requirejs/require.js vendored Normal file
View File

@ -0,0 +1,36 @@
/*
RequireJS 2.1.14 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
Available via the MIT or new BSD license.
see: http://github.com/jrburke/requirejs for details
*/
var requirejs,require,define;
(function(ba){function G(b){return"[object Function]"===K.call(b)}function H(b){return"[object Array]"===K.call(b)}function v(b,c){if(b){var d;for(d=0;d<b.length&&(!b[d]||!c(b[d],d,b));d+=1);}}function T(b,c){if(b){var d;for(d=b.length-1;-1<d&&(!b[d]||!c(b[d],d,b));d-=1);}}function t(b,c){return fa.call(b,c)}function m(b,c){return t(b,c)&&b[c]}function B(b,c){for(var d in b)if(t(b,d)&&c(b[d],d))break}function U(b,c,d,e){c&&B(c,function(c,g){if(d||!t(b,g))e&&"object"===typeof c&&c&&!H(c)&&!G(c)&&!(c instanceof
RegExp)?(b[g]||(b[g]={}),U(b[g],c,d,e)):b[g]=c});return b}function u(b,c){return function(){return c.apply(b,arguments)}}function ca(b){throw b;}function da(b){if(!b)return b;var c=ba;v(b.split("."),function(b){c=c[b]});return c}function C(b,c,d,e){c=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+b);c.requireType=b;c.requireModules=e;d&&(c.originalError=d);return c}function ga(b){function c(a,k,b){var f,l,c,d,e,g,i,p,k=k&&k.split("/"),h=j.map,n=h&&h["*"];if(a){a=a.split("/");l=a.length-1;j.nodeIdCompat&&
Q.test(a[l])&&(a[l]=a[l].replace(Q,""));"."===a[0].charAt(0)&&k&&(l=k.slice(0,k.length-1),a=l.concat(a));l=a;for(c=0;c<l.length;c++)if(d=l[c],"."===d)l.splice(c,1),c-=1;else if(".."===d&&!(0===c||1==c&&".."===l[2]||".."===l[c-1])&&0<c)l.splice(c-1,2),c-=2;a=a.join("/")}if(b&&h&&(k||n)){l=a.split("/");c=l.length;a:for(;0<c;c-=1){e=l.slice(0,c).join("/");if(k)for(d=k.length;0<d;d-=1)if(b=m(h,k.slice(0,d).join("/")))if(b=m(b,e)){f=b;g=c;break a}!i&&(n&&m(n,e))&&(i=m(n,e),p=c)}!f&&i&&(f=i,g=p);f&&(l.splice(0,
g,f),a=l.join("/"))}return(f=m(j.pkgs,a))?f:a}function d(a){z&&v(document.getElementsByTagName("script"),function(k){if(k.getAttribute("data-requiremodule")===a&&k.getAttribute("data-requirecontext")===i.contextName)return k.parentNode.removeChild(k),!0})}function e(a){var k=m(j.paths,a);if(k&&H(k)&&1<k.length)return k.shift(),i.require.undef(a),i.makeRequire(null,{skipMap:!0})([a]),!0}function n(a){var k,c=a?a.indexOf("!"):-1;-1<c&&(k=a.substring(0,c),a=a.substring(c+1,a.length));return[k,a]}function p(a,
k,b,f){var l,d,e=null,g=k?k.name:null,j=a,p=!0,h="";a||(p=!1,a="_@r"+(K+=1));a=n(a);e=a[0];a=a[1];e&&(e=c(e,g,f),d=m(r,e));a&&(e?h=d&&d.normalize?d.normalize(a,function(a){return c(a,g,f)}):-1===a.indexOf("!")?c(a,g,f):a:(h=c(a,g,f),a=n(h),e=a[0],h=a[1],b=!0,l=i.nameToUrl(h)));b=e&&!d&&!b?"_unnormalized"+(O+=1):"";return{prefix:e,name:h,parentMap:k,unnormalized:!!b,url:l,originalName:j,isDefine:p,id:(e?e+"!"+h:h)+b}}function s(a){var k=a.id,b=m(h,k);b||(b=h[k]=new i.Module(a));return b}function q(a,
k,b){var f=a.id,c=m(h,f);if(t(r,f)&&(!c||c.defineEmitComplete))"defined"===k&&b(r[f]);else if(c=s(a),c.error&&"error"===k)b(c.error);else c.on(k,b)}function w(a,b){var c=a.requireModules,f=!1;if(b)b(a);else if(v(c,function(b){if(b=m(h,b))b.error=a,b.events.error&&(f=!0,b.emit("error",a))}),!f)g.onError(a)}function x(){R.length&&(ha.apply(A,[A.length,0].concat(R)),R=[])}function y(a){delete h[a];delete V[a]}function F(a,b,c){var f=a.map.id;a.error?a.emit("error",a.error):(b[f]=!0,v(a.depMaps,function(f,
d){var e=f.id,g=m(h,e);g&&(!a.depMatched[d]&&!c[e])&&(m(b,e)?(a.defineDep(d,r[e]),a.check()):F(g,b,c))}),c[f]=!0)}function D(){var a,b,c=(a=1E3*j.waitSeconds)&&i.startTime+a<(new Date).getTime(),f=[],l=[],g=!1,h=!0;if(!W){W=!0;B(V,function(a){var i=a.map,j=i.id;if(a.enabled&&(i.isDefine||l.push(a),!a.error))if(!a.inited&&c)e(j)?g=b=!0:(f.push(j),d(j));else if(!a.inited&&(a.fetched&&i.isDefine)&&(g=!0,!i.prefix))return h=!1});if(c&&f.length)return a=C("timeout","Load timeout for modules: "+f,null,
f),a.contextName=i.contextName,w(a);h&&v(l,function(a){F(a,{},{})});if((!c||b)&&g)if((z||ea)&&!X)X=setTimeout(function(){X=0;D()},50);W=!1}}function E(a){t(r,a[0])||s(p(a[0],null,!0)).init(a[1],a[2])}function I(a){var a=a.currentTarget||a.srcElement,b=i.onScriptLoad;a.detachEvent&&!Y?a.detachEvent("onreadystatechange",b):a.removeEventListener("load",b,!1);b=i.onScriptError;(!a.detachEvent||Y)&&a.removeEventListener("error",b,!1);return{node:a,id:a&&a.getAttribute("data-requiremodule")}}function J(){var a;
for(x();A.length;){a=A.shift();if(null===a[0])return w(C("mismatch","Mismatched anonymous define() module: "+a[a.length-1]));E(a)}}var W,Z,i,L,X,j={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},h={},V={},$={},A=[],r={},S={},aa={},K=1,O=1;L={require:function(a){return a.require?a.require:a.require=i.makeRequire(a.map)},exports:function(a){a.usingExports=!0;if(a.map.isDefine)return a.exports?r[a.map.id]=a.exports:a.exports=r[a.map.id]={}},module:function(a){return a.module?
a.module:a.module={id:a.map.id,uri:a.map.url,config:function(){return m(j.config,a.map.id)||{}},exports:a.exports||(a.exports={})}}};Z=function(a){this.events=m($,a.id)||{};this.map=a;this.shim=m(j.shim,a.id);this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};Z.prototype={init:function(a,b,c,f){f=f||{};if(!this.inited){this.factory=b;if(c)this.on("error",c);else this.events.error&&(c=u(this,function(a){this.emit("error",a)}));this.depMaps=a&&a.slice(0);this.errback=
c;this.inited=!0;this.ignore=f.ignore;f.enabled||this.enabled?this.enable():this.check()}},defineDep:function(a,b){this.depMatched[a]||(this.depMatched[a]=!0,this.depCount-=1,this.depExports[a]=b)},fetch:function(){if(!this.fetched){this.fetched=!0;i.startTime=(new Date).getTime();var a=this.map;if(this.shim)i.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],u(this,function(){return a.prefix?this.callPlugin():this.load()}));else return a.prefix?this.callPlugin():this.load()}},load:function(){var a=
this.map.url;S[a]||(S[a]=!0,i.load(this.map.id,a))},check:function(){if(this.enabled&&!this.enabling){var a,b,c=this.map.id;b=this.depExports;var f=this.exports,l=this.factory;if(this.inited)if(this.error)this.emit("error",this.error);else{if(!this.defining){this.defining=!0;if(1>this.depCount&&!this.defined){if(G(l)){if(this.events.error&&this.map.isDefine||g.onError!==ca)try{f=i.execCb(c,l,b,f)}catch(d){a=d}else f=i.execCb(c,l,b,f);this.map.isDefine&&void 0===f&&((b=this.module)?f=b.exports:this.usingExports&&
(f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=l;this.exports=f;if(this.map.isDefine&&!this.ignore&&(r[c]=f,g.onResourceLoad))g.onResourceLoad(i,this.map,this.depMaps);y(c);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a=
this.map,b=a.id,d=p(a.prefix);this.depMaps.push(d);q(d,"defined",u(this,function(f){var l,d;d=m(aa,this.map.id);var e=this.map.name,P=this.map.parentMap?this.map.parentMap.name:null,n=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(e=f.normalize(e,function(a){return c(a,P,!0)})||""),f=p(a.prefix+"!"+e,this.map.parentMap),q(f,"defined",u(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),d=m(h,f.id)){this.depMaps.push(f);
if(this.events.error)d.on("error",u(this,function(a){this.emit("error",a)}));d.enable()}}else d?(this.map.url=i.nameToUrl(d),this.load()):(l=u(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),l.error=u(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(h,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),l.fromText=u(this,function(f,c){var d=a.name,e=p(d),P=M;c&&(f=c);P&&(M=!1);s(e);t(j.config,b)&&(j.config[d]=j.config[b]);try{g.exec(f)}catch(h){return w(C("fromtexteval",
"fromText eval for "+b+" failed: "+h,h,[b]))}P&&(M=!0);this.depMaps.push(e);i.completeLoad(d);n([d],l)}),f.load(a.name,n,l,j))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){V[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,u(this,function(a,b){var c,f;if("string"===typeof a){a=p(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=m(L,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;q(a,"defined",u(this,function(a){this.defineDep(b,
a);this.check()}));this.errback&&q(a,"error",u(this,this.errback))}c=a.id;f=h[c];!t(L,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,u(this,function(a){var b=m(h,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:j,contextName:b,registry:h,defined:r,urlFetched:S,defQueue:A,Module:Z,makeModuleMap:p,
nextTick:g.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=j.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(j[b]||(j[b]={}),U(j[b],a,!0,!0)):j[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(aa[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),j.shim=b);a.packages&&v(a.packages,function(a){var b,
a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(j.paths[b]=a.location);j.pkgs[b]=a.name+"/"+(a.main||"main").replace(ia,"").replace(Q,"")});B(h,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=p(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ba,arguments));return b||a.exports&&da(a.exports)}},makeRequire:function(a,e){function j(c,d,m){var n,q;e.enableBuildCallback&&(d&&G(d))&&(d.__requireJsBuild=
!0);if("string"===typeof c){if(G(d))return w(C("requireargs","Invalid require call"),m);if(a&&t(L,c))return L[c](h[a.id]);if(g.get)return g.get(i,c,a,j);n=p(c,a,!1,!0);n=n.id;return!t(r,n)?w(C("notloaded",'Module name "'+n+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):r[n]}J();i.nextTick(function(){J();q=s(p(null,a));q.skipMap=e.skipMap;q.init(c,d,m,{enabled:!0});D()});return j}e=e||{};U(j,{isBrowser:z,toUrl:function(b){var d,e=b.lastIndexOf("."),k=b.split("/")[0];if(-1!==
e&&(!("."===k||".."===k)||1<e))d=b.substring(e,b.length),b=b.substring(0,e);return i.nameToUrl(c(b,a&&a.id,!0),d,!0)},defined:function(b){return t(r,p(b,a,!1,!0).id)},specified:function(b){b=p(b,a,!1,!0).id;return t(r,b)||t(h,b)}});a||(j.undef=function(b){x();var c=p(b,a,!0),e=m(h,b);d(b);delete r[b];delete S[c.url];delete $[b];T(A,function(a,c){a[0]===b&&A.splice(c,1)});e&&(e.events.defined&&($[b]=e.events),y(b))});return j},enable:function(a){m(h,a.id)&&s(a).enable()},completeLoad:function(a){var b,
c,d=m(j.shim,a)||{},g=d.exports;for(x();A.length;){c=A.shift();if(null===c[0]){c[0]=a;if(b)break;b=!0}else c[0]===a&&(b=!0);E(c)}c=m(h,a);if(!b&&!t(r,a)&&c&&!c.inited){if(j.enforceDefine&&(!g||!da(g)))return e(a)?void 0:w(C("nodefine","No define call for "+a,null,[a]));E([a,d.deps||[],d.exportsFn])}D()},nameToUrl:function(a,b,c){var d,e,h;(d=m(j.pkgs,a))&&(a=d);if(d=m(aa,a))return i.nameToUrl(d,b,c);if(g.jsExtRegExp.test(a))d=a+(b||"");else{d=j.paths;a=a.split("/");for(e=a.length;0<e;e-=1)if(h=a.slice(0,
e).join("/"),h=m(d,h)){H(h)&&(h=h[0]);a.splice(0,e,h);break}d=a.join("/");d+=b||(/^data\:|\?/.test(d)||c?"":".js");d=("/"===d.charAt(0)||d.match(/^[\w\+\.\-]+:/)?"":j.baseUrl)+d}return j.urlArgs?d+((-1===d.indexOf("?")?"?":"&")+j.urlArgs):d},load:function(a,b){g.load(i,a,b)},execCb:function(a,b,c,d){return b.apply(d,c)},onScriptLoad:function(a){if("load"===a.type||ja.test((a.currentTarget||a.srcElement).readyState))N=null,a=I(a),i.completeLoad(a.id)},onScriptError:function(a){var b=I(a);if(!e(b.id))return w(C("scripterror",
"Script error for: "+b.id,a,[b.id]))}};i.require=i.makeRequire();return i}var g,x,y,D,I,E,N,J,s,O,ka=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,la=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,Q=/\.js$/,ia=/^\.\//;x=Object.prototype;var K=x.toString,fa=x.hasOwnProperty,ha=Array.prototype.splice,z=!!("undefined"!==typeof window&&"undefined"!==typeof navigator&&window.document),ea=!z&&"undefined"!==typeof importScripts,ja=z&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,
Y="undefined"!==typeof opera&&"[object Opera]"===opera.toString(),F={},q={},R=[],M=!1;if("undefined"===typeof define){if("undefined"!==typeof requirejs){if(G(requirejs))return;q=requirejs;requirejs=void 0}"undefined"!==typeof require&&!G(require)&&(q=require,require=void 0);g=requirejs=function(b,c,d,e){var n,p="_";!H(b)&&"string"!==typeof b&&(n=b,H(c)?(b=c,c=d,d=e):b=[]);n&&n.context&&(p=n.context);(e=m(F,p))||(e=F[p]=g.s.newContext(p));n&&e.configure(n);return e.require(b,c,d)};g.config=function(b){return g(b)};
g.nextTick="undefined"!==typeof setTimeout?function(b){setTimeout(b,4)}:function(b){b()};require||(require=g);g.version="2.1.14";g.jsExtRegExp=/^\/|:|\?|\.js$/;g.isBrowser=z;x=g.s={contexts:F,newContext:ga};g({});v(["toUrl","undef","defined","specified"],function(b){g[b]=function(){var c=F._;return c.require[b].apply(c,arguments)}});if(z&&(y=x.head=document.getElementsByTagName("head")[0],D=document.getElementsByTagName("base")[0]))y=x.head=D.parentNode;g.onError=ca;g.createNode=function(b){var c=
b.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");c.type=b.scriptType||"text/javascript";c.charset="utf-8";c.async=!0;return c};g.load=function(b,c,d){var e=b&&b.config||{};if(z)return e=g.createNode(e,c,d),e.setAttribute("data-requirecontext",b.contextName),e.setAttribute("data-requiremodule",c),e.attachEvent&&!(e.attachEvent.toString&&0>e.attachEvent.toString().indexOf("[native code"))&&!Y?(M=!0,e.attachEvent("onreadystatechange",b.onScriptLoad)):
(e.addEventListener("load",b.onScriptLoad,!1),e.addEventListener("error",b.onScriptError,!1)),e.src=d,J=e,D?y.insertBefore(e,D):y.appendChild(e),J=null,e;if(ea)try{importScripts(d),b.completeLoad(c)}catch(m){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,m,[c]))}};z&&!q.skipDataMain&&T(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(I=b.getAttribute("data-main"))return s=I,q.baseUrl||(E=s.split("/"),s=E.pop(),O=E.length?E.join("/")+"/":"./",q.baseUrl=
O),s=s.replace(Q,""),g.jsExtRegExp.test(s)&&(s=I),q.deps=q.deps?q.deps.concat(s):[s],!0});define=function(b,c,d){var e,g;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(ka,"").replace(la,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(M){if(!(e=J))N&&"interactive"===N.readyState||T(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return N=b}),e=N;e&&(b||
(b=e.getAttribute("data-requiremodule")),g=F[e.getAttribute("data-requirecontext")])}(g?g.defQueue:R).push([b,c,d])};define.amd={jQuery:!0};g.exec=function(b){return eval(b)};g(q)}})(this);

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

BIN
apple-touch-icon-72x72.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
apple-touch-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

112
basics.html Normal file
View File

@ -0,0 +1,112 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Quick Start Guide / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Quick Start Guide</h1>
<p>This section covers the basics of working with <em>IntelliJ Platform</em>.
It will familiarize you with the working environment, project structure, and frequently used API components.</p>
<ul>
<li><a href="basics/types_of_plugins.html"><span>Main Types of IntelliJ Platform Plugins</span></a></li>
<li><a href="basics/getting_started.html"><span>Getting Started</span></a></li>
<li><a href="basics/architectural_overview.html"><span>Architectural Overview</span></a></li>
<li><a href="basics/project_structure.html"><span>Project Structure</span></a></li>
<li><a href="basics/checkout_and_build_community.html"><span>Check Out And Build Community Edition</span></a></li>
<li><a href="basics/settings_caches_logs.html"><span>IDE Settings, Caches, Logs, and Plugins</span></a></li>
<li><a href="basics/indexing_and_psi_stubs.html"><span>Indexing and PSI Stubs</span></a></li>
<li><a href="basics/run_configurations.html"><span>Run Configurations</span></a></li>
<li><a href="basics/testing_plugins.html"><span>Testing Plugins</span></a></li>
</ul>
<div class="last-modified">
Last modified: 30 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

279
basics/action_system.html Normal file
View File

@ -0,0 +1,279 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Action System / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/action_system">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Action System</h1>
<a name="executing-and-updating-actions" class="elem-anchor"></a>
<h2>Executing and updating actions<a href="#executing-and-updating-actions" class="anchor-link"><span></span></a></h2>
<p>The system of actions allows plugins to add their own items to IDEA menus and toolbars. An action is a class, derived from the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnAction.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">AnAction</code></span></a> class, whose <code class="code highlight language-text">actionPerformed</code> method is called when the menu item or toolbar button is selected.
For example, one of the action classes is responsible for the <strong>File | Open File…</strong> menu item and for the <strong>Open File</strong> toolbar button.</p>
<p>Actions are organized into groups, which, in turn, can contain other groups. A group of actions can form a toolbar or a menu.
Subgroups of the group can form submenus of the menu.</p>
<p>Every action and action group has an unique identifier. Identifiers of many of the standard IDEA actions are defined in the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java" data-bypass="yes" target="_blank"><span>IdeActions</span></a> class.</p>
<p>Every action can be included in multiple groups, and thus appear in multiple places within the IDEA user interface. Different places where actions can appear are defined by constants in the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/platform-api/src/com/intellij/openapi/actionSystem/ActionPlaces.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">ActionPlaces</code></span></a> interface. For every place where the action appears, a new <code class="code highlight language-text">Presentation</code> is created. Thus, the same action can have different text or icons when it appears in different places of the user interface. Different presentations for the action are created by copying the presentation returned by the <code class="code highlight language-text">AnAction.getTemplatePresentation()</code> method.</p>
<p>To update the state of the action, the method <code class="code highlight language-text">AnAction.update()</code> is periodically called by IDEA. The <code class="code highlight language-text">AnActionEvent</code> object passed to this method carries the information about the current context for the action, and in particular, the specific presentation which needs to be updated.</p>
<p>To retrieve the information about the current state of the IDE, including the active project, the selected file, the selection in the editor and so on, the method <code class="code highlight language-text">AnActionEvent.getData()</code> can be used. Different data keys that can be passed to that method are defined in the <code class="code highlight language-text">DataKeys</code> class.</p>
<p>The <code class="code highlight language-text">AnActionEvent</code> instance is also passed to the <code class="code highlight language-text">actionPerformed</code> method.</p>
<a name="registering-actions" class="elem-anchor"></a>
<h2>Registering Actions<a href="#registering-actions" class="anchor-link"><span></span></a></h2>
<p>There are two main ways to register an action: either by listing it in the <code class="code highlight language-text">&lt;actions&gt;</code> section of the <code class="code highlight language-text">plugin.xml</code> file, or through Java code.</p>
<a name="registering-actions-in-pluginxml" class="elem-anchor"></a>
<h3>Registering Actions in plugin.xml<a href="#registering-actions-in-pluginxml" class="anchor-link"><span></span></a></h3>
<p>Registering actions in <code class="code highlight language-text">plugin.xml</code> is demonstrated in the following example. The example section of <code class="code highlight language-text">plugin.xml</code> demonstrates all elements which can be used in the <code class="code highlight language-text">&lt;actions&gt;</code> section, and describes the meaning of each element.</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_xml"><span class="c">&lt;!-- Actions --&gt;</span>
<span class="nt">&lt;actions&gt;</span>
<span class="c">&lt;!-- The &lt;action&gt; element defines an action to register.
The mandatory "id" attribute specifies an unique
identifier for the action.
The mandatory "class" attribute specifies the
full-qualified name of the class implementing the action.
The mandatory "text" attribute specifies the text of the
action (tooltip for toolbar button or text for menu item).
The optional "use-shortcut-of" attribute specifies the ID
of the action whose keyboard shortcut this action will use.
The optional "description" attribute specifies the text
which is displayed in the status bar when the action is focused.
The optional "icon" attribute specifies the icon which is
displayed on the toolbar button or next to the menu item. --&gt;</span>
<span class="nt">&lt;action</span> <span class="na">id=</span><span class="s">"VssIntegration.GarbageCollection"</span> <span class="na">class=</span><span class="s">"com.foo.impl.CollectGarbage"</span> <span class="na">text=</span><span class="s">"Collect _Garbage"</span> <span class="na">description=</span><span class="s">"Run garbage collector"</span> <span class="na">icon=</span><span class="s">"icons/garbage.png"</span><span class="nt">&gt;</span>
<span class="c">&lt;!-- The &lt;add-to-group&gt; node specifies that the action should be added
to an existing group. An action can be added to several groups.
The mandatory "group-id" attribute specifies the ID of the group
to which the action is added.
The group must be implemented by an instance of the DefaultActionGroup class.
The mandatory "anchor" attribute specifies the position of the
action in the group relative to other actions. It can have the values
"first", "last", "before" and "after".
The "relative-to-action" attribute is mandatory if the anchor
is set to "before" and "after", and specifies the action before or after which
the current action is inserted. --&gt;</span>
<span class="nt">&lt;add-to-group</span> <span class="na">group-id=</span><span class="s">"ToolsMenu"</span> <span class="na">relative-to-action=</span><span class="s">"GenerateJavadoc"</span> <span class="na">anchor=</span><span class="s">"after"</span><span class="nt">/&gt;</span>
<span class="c">&lt;!-- The &lt;keyboard-shortcut&gt; node specifies the keyboard shortcut
for the action. An action can have several keyboard shortcuts.
The mandatory "first-keystroke" attribute specifies the first
keystroke of the action. The key strokes are specified according
to the regular Swing rules.
The optional "second-keystroke" attribute specifies the second
keystroke of the action.
The mandatory "keymap" attribute specifies the keymap for which
the action is active. IDs of the standard keymaps are defined as
constants in the com.intellij.openapi.keymap.KeymapManager class. --&gt;</span>
<span class="nt">&lt;keyboard-shortcut</span> <span class="na">first-keystroke=</span><span class="s">"control alt G"</span> <span class="na">second-keystroke=</span><span class="s">"C"</span> <span class="na">keymap=</span><span class="s">"$default"</span><span class="nt">/&gt;</span>
<span class="c">&lt;!-- The &lt;mouse-shortcut&gt; node specifies the mouse shortcut for the
action. An action can have several mouse shortcuts.
The mandatory "keystroke" attribute specifies the clicks and
modifiers for the action. It is defined as a sequence of words
separated by spaces:
"button1", "button2", "button3" for the mouse buttons;
"shift", "control", "meta", "alt", "altGraph" for the modifier keys;
"doubleClick" if the action is activated by a double-click of the button.
The mandatory "keymap" attribute specifies the keymap for which
the action is active. IDs of the standard keymaps are defined as
constants in the com.intellij.openapi.keymap.KeymapManager class. --&gt;</span>
<span class="nt">&lt;mouse-shortcut</span> <span class="na">keystroke=</span><span class="s">"control button3 doubleClick"</span> <span class="na">keymap=</span><span class="s">"$default"</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/action&gt;</span>
<span class="c">&lt;!-- The &lt;group&gt; element defines an action group. &lt;action&gt;, &lt;group&gt; and
&lt;separator&gt; elements defined within it are automatically included in the group.
The mandatory "id" attribute specifies an unique identifier for the action.
The optional "class" attribute specifies the full-qualified name of
the class implementing the group. If not specified,
com.intellij.openapi.actionSystem.DefaultActionGroup is used.
The optional "text" attribute specifies the text of the group (text
for the menu item showing the submenu).
The optional "description" attribute specifies the text which is displayed
in the status bar when the group is focused.
The optional "icon" attribute specifies the icon which is displayed on
the toolbar button or next to the group.
The optional "popup" attribute specifies how the group is presented in
the menu. If a group has popup="true", actions in it are placed in a
submenu; for popup="false", actions are displayed as a section of the
same menu delimited by separators. --&gt;</span>
<span class="nt">&lt;group</span> <span class="na">class=</span><span class="s">"com.foo.impl.MyActionGroup"</span> <span class="na">id=</span><span class="s">"TestActionGroup"</span> <span class="na">text=</span><span class="s">"Test Group"</span> <span class="na">description=</span><span class="s">"Group with test actions"</span> <span class="na">icon=</span><span class="s">"icons/testgroup.png"</span> <span class="na">popup=</span><span class="s">"true"</span><span class="nt">&gt;</span>
<span class="nt">&lt;action</span> <span class="na">id=</span><span class="s">"VssIntegration.TestAction"</span> <span class="na">class=</span><span class="s">"com.foo.impl.TestAction"</span> <span class="na">text=</span><span class="s">"My Test Action"</span> <span class="na">description=</span><span class="s">"My test action"</span><span class="nt">/&gt;</span>
<span class="c">&lt;!-- The &lt;separator&gt; element defines a separator between actions.
It can also have an &lt;add-to-group&gt; child element. --&gt;</span>
<span class="nt">&lt;separator/&gt;</span>
<span class="nt">&lt;group</span> <span class="na">id=</span><span class="s">"TestActionSubGroup"</span><span class="nt">/&gt;</span>
<span class="c">&lt;!-- The &lt;reference&gt; element allows to add an existing action to the group.
The mandatory "ref" attribute specifies the ID of the action to add. --&gt;</span>
<span class="nt">&lt;reference</span> <span class="na">ref=</span><span class="s">"EditorCopy"</span><span class="nt">/&gt;</span>
<span class="nt">&lt;add-to-group</span> <span class="na">group-id=</span><span class="s">"MainMenu"</span> <span class="na">relative-to-action=</span><span class="s">"HelpMenu"</span> <span class="na">anchor=</span><span class="s">"before"</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/group&gt;</span>
<span class="nt">&lt;/actions&gt;</span>
</code></pre>
<a name="registering-actions-from-code" class="elem-anchor"></a>
<h2>Registering Actions from Code<a href="#registering-actions-from-code" class="anchor-link"><span></span></a></h2>
<p>To register an action from code, two steps are required.</p>
<ul>
<li>First, an instance of the class derived from <code class="code highlight language-text">AnAction</code> must be passed to the <code class="code highlight language-text">registerAction</code> method of the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/ActionManager.java" data-bypass="yes" target="_blank"><span>ActionManager</span></a> class, to associate the action with an ID.</li>
<li>Second, the action needs to be added to one or more groups. To get an instance of an action group by ID, it is necessary to call <code class="code highlight language-text">ActionManager.getAction()</code> and cast the returned value to the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/platform-api/src/com/intellij/openapi/actionSystem/DefaultActionGroup.java" data-bypass="yes" target="_blank"><span>DefaultActionGroup</span></a> class.</li>
</ul>
<p>You can create a plugin that registers actions on IDEA startup using the following procedure.</p>
<p><strong>To register an action on IDEA startup</strong></p>
<ul>
<li>Create a new class that implements the <code class="code highlight language-text">ApplicationComponent</code> interface.</li>
<li>In this class, override the <code class="code highlight language-text">getComponentName</code>, <code class="code highlight language-text">initComponent</code>, and <code class="code highlight language-text">disposeComponent</code> methods.</li>
<li>Register this class in the <code class="code highlight language-text">&lt;application-components&gt;</code> section of the plugin.xml file.</li>
</ul>
<p>To clarify the above procedure, consider the following sample Java class <code class="code highlight language-text">MyPluginRegistration</code> that registers an action defined in a custom <code class="code highlight language-text">TextBoxes</code> class and adds a new menu command to the <em>Window</em> menu group on the main menu:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">MyPluginRegistration</span> <span class="kd">implements</span> <span class="n">ApplicationComponent</span> <span class="o">{</span>
<span class="c1">// Returns the component name (any unique string value).</span>
<span class="nd">@NotNull</span> <span class="kd">public</span> <span class="n">String</span> <span class="nf">getComponentName</span><span class="o">()</span> <span class="o">{</span>
<span class="k">return</span> <span class="s">"MyPlugin"</span><span class="o">;</span>
<span class="o">}</span>
<span class="c1">// If you register the MyPluginRegistration class in the &lt;application-components&gt; section of</span>
<span class="c1">// the plugin.xml file, this method is called on IDEA start-up.</span>
<span class="kd">public</span> <span class="kt">void</span> <span class="nf">initComponent</span><span class="o">()</span> <span class="o">{</span>
<span class="n">ActionManager</span> <span class="n">am</span> <span class="o">=</span> <span class="n">ActionManager</span><span class="o">.</span><span class="na">getInstance</span><span class="o">();</span>
<span class="n">TextBoxes</span> <span class="n">action</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TextBoxes</span><span class="o">();</span>
<span class="c1">// Passes an instance of your custom TextBoxes class to the registerAction method of the ActionManager class.</span>
<span class="n">am</span><span class="o">.</span><span class="na">registerAction</span><span class="o">(</span><span class="s">"MyPluginAction"</span><span class="o">,</span> <span class="n">action</span><span class="o">);</span>
<span class="c1">// Gets an instance of the WindowMenu action group.</span>
<span class="n">DefaultActionGroup</span> <span class="n">windowM</span> <span class="o">=</span> <span class="o">(</span><span class="n">DefaultActionGroup</span><span class="o">)</span> <span class="n">am</span><span class="o">.</span><span class="na">getAction</span><span class="o">(</span><span class="s">"WindowMenu"</span><span class="o">);</span>
<span class="c1">// Adds a separator and a new menu command to the WindowMenu group on the main menu.</span>
<span class="n">windowM</span><span class="o">.</span><span class="na">addSeparator</span><span class="o">();</span>
<span class="n">windowM</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">action</span><span class="o">);</span>
<span class="o">}</span>
<span class="c1">// Disposes system resources.</span>
<span class="kd">public</span> <span class="kt">void</span> <span class="nf">disposeComponent</span><span class="o">()</span> <span class="o">{</span>
<span class="o">}</span>
<span class="o">}</span>
</code></pre>
<p>Note, that the sample <code class="code highlight language-text">TextBoxes</code> class is described in <a href="/intellij/sdk/docs/basics/getting_started.html"><span>Getting Started with Plugin Development</span></a>.</p>
<p>To ensure that your plugin is initialized on IDEA start-up, make the following changes to the <code class="code highlight language-text">&lt;application-components&gt;</code> section of the <code class="code highlight language-text">plugin.xml</code> file:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_xml"><span class="nt">&lt;application-components&gt;</span>
<span class="c">&lt;!-- Add your application components here --&gt;</span>
<span class="nt">&lt;component&gt;</span>
<span class="nt">&lt;implementation-class&gt;</span>MypackageName.MyPluginRegistration<span class="nt">&lt;/implementation-class&gt;</span>
<span class="nt">&lt;/component&gt;</span>
<span class="nt">&lt;/application-components&gt;</span>
</code></pre>
<a name="building-ui-from-actions" class="elem-anchor"></a>
<h2>Building UI from Actions<a href="#building-ui-from-actions" class="anchor-link"><span></span></a></h2>
<p>If a plugin needs to include a toolbar or popup menu built from a group of actions in its own user interface, that can be accomplished through the <code class="code highlight language-text">ActionPopupMenu</code> and <code class="code highlight language-text">ActionToolbar</code> classes. These objects can be created through calls to <code class="code highlight language-text">ActionManager.createActionPopupMenu</code> and <code class="code highlight language-text">ActionManager.createActionToolbar</code>. To get a Swing component from such an object, simply call the getComponent() method.</p>
<p>If your action toolbar is attached to a specific component (for example, a panel in a toolwindow), you usually need to call <code class="code highlight language-text">ActionToolbar.setTargetComponent()</code> and pass the instance of the related component as a parameter. This ensures that the state of the toolbar buttons depends on the state of the related component, and not on the current focus location within the IDE frame.</p>
<div class="last-modified">
Last modified: 26 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,112 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Architectural Overview / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/architectural_overview">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Architectural Overview</h1>
<p>This topic describes the architecture of the <em>IntelliJ Platform</em> from a plugin developers point of view. It is organized in a task-based manner to answer specific questions like “what can I do with this object?”, “how do I get to this object?” and so on.</p>
<p>Before proceeding please make sure youre familiar with the basic concepts of IntelliJ Platform plugin development. If not, consider starting with the live demo and tutorials at <a href="http://www.jetbrains.com/idea/plugins/" data-bypass="yes" target="_blank"><span>www.jetbrains.com/idea/plugins/</span></a> and then returning to this document.</p>
<p>The following subjects are covered:</p>
<ul>
<li><a href="architectural_overview/general_threading_rules.html"><span>General threading rules</span></a></li>
<li><a href="architectural_overview/virtual_file.html"><span>Virtual files</span></a></li>
<li><a href="architectural_overview/documents.html"><span>Documents</span></a></li>
<li><a href="architectural_overview/psi_files.html"><span>PSI files</span></a></li>
<li><a href="architectural_overview/file_view_providers.html"><span>File view providers</span></a></li>
<li><a href="architectural_overview/psi_elements.html"><span>Psi elements</span></a></li>
</ul>
<div class="last-modified">
Last modified: 23 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,146 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Documents / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/architectural_overview/documents">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Documents</h1>
<p>A document is an editable sequence of Unicode characters, which typically corresponds to the text contents of a virtual file. Line breaks in a document are <em>always</em> normalized to <code class="code highlight language-text">\n</code>. The <em>IntelliJ Platform</em> handles encoding and line break conversions when loading and saving documents transparently.</p>
<a name="how-do-i-get-a-document" class="elem-anchor"></a>
<h2>How do I get a document?<a href="#how-do-i-get-a-document" class="anchor-link"><span></span></a></h2>
<ul>
<li>From an action: <code class="code highlight language-text">e.getData(PlatformDataKeys.EDITOR).getDocument()</code></li>
<li>From a virtual file: <code class="code highlight language-text">FileDocumentManager.getDocument()</code>. This call forces the document content to be loaded from disk if it wasnt loaded previously; if youre only interested in open documents or documents which may have been modified, use <code class="code highlight language-text">FileDocumentManager.getCachedDocument()</code> instead.</li>
<li>From a PSI file: <code class="code highlight language-text">PsiDocumentManager.getInstance().getDocument()</code> or <code class="code highlight language-text">PsiDocumentManager.getInstance().getCachedDocument()</code></li>
</ul>
<a name="what-can-i-do-with-a-document" class="elem-anchor"></a>
<h2>What can I do with a Document?<a href="#what-can-i-do-with-a-document" class="anchor-link"><span></span></a></h2>
<p>You may perform any operations that access or modify the file contents on “plain text” level (as a sequence of characters, not as a tree of Java elements).</p>
<a name="where-does-a-document-come-from" class="elem-anchor"></a>
<h2>Where does a Document come from?<a href="#where-does-a-document-come-from" class="anchor-link"><span></span></a></h2>
<p>Document instances are created when some operation needs to access the text contents of a file (in particular, this is needed to build the PSI for a file). Also, document instances not linked to any virtual files can be created temporarily, for example, to represent the contents of a text editor field in a dialog.</p>
<a name="how-long-does-a-document-persist" class="elem-anchor"></a>
<h2>How long does a Document persist?<a href="#how-long-does-a-document-persist" class="anchor-link"><span></span></a></h2>
<p>Document instances are weakly referenced from <code class="code highlight language-text">VirtualFile</code> instances. Thus, an unmodified <code class="code highlight language-text">Document</code> instance can be garbage-collected if it isnt referenced by anyone, and a new instance will be created if the document contents is accessed again later. Storing <code class="code highlight language-text">Document</code> references in long-term data structures of your plugin will cause memory leaks.</p>
<a name="how-do-i-create-a-document" class="elem-anchor"></a>
<h2>How do I create a Document?<a href="#how-do-i-create-a-document" class="anchor-link"><span></span></a></h2>
<p>If you need to create a new file on disk, you dont create a <code class="code highlight language-text">Document</code>: you create a PSI file and then get its <code class="code highlight language-text">Document</code>. If you need to create a <code class="code highlight language-text">Document</code> instance which isnt bound to anything, you can use <code class="code highlight language-text">EditorFactory.createDocument</code>.</p>
<a name="how-do-i-get-notified-when-documents-change" class="elem-anchor"></a>
<h2>How do I get notified when Documents change?<a href="#how-do-i-get-notified-when-documents-change" class="anchor-link"><span></span></a></h2>
<ul>
<li><code class="code highlight language-text">Document.addDocumentListener</code> allows you to receive notifications about changes in a particular <code class="code highlight language-text">Document</code> instance.</li>
<li><code class="code highlight language-text">EditorFactory.getEventMulticaster().addDocumentListener</code> allows you to receive notifications about changes in all open documents.</li>
<li><code class="code highlight language-text">FileDocumentManager.addFileDocumentManagerListener</code> allows you to receive notifications when any <code class="code highlight language-text">Document</code> is saved or reloaded from disk.</li>
</ul>
<a name="what-are-the-rules-of-working-with-documents" class="elem-anchor"></a>
<h2>What are the rules of working with Documents?<a href="#what-are-the-rules-of-working-with-documents" class="anchor-link"><span></span></a></h2>
<p>The general read/write action rules are in effect. In addition to that, any operations which modify the contents of the document must be wrapped in a command (<code class="code highlight language-text">CommandProcessor.getInstance().executeCommand()</code>). <code class="code highlight language-text">executeCommand()</code> calls can be nested, and the outermost <code class="code highlight language-text">executeCommand</code> call is added to the undo stack. If multiple documents are modified within a command, undoing this command will by default show a confirmation dialog to the user.</p>
<p>If the file corresponding to a <code class="code highlight language-text">Document</code> is read-only (for example, not checked out from the version control system), document modifications will fail. Thus, before modifying the <code class="code highlight language-text">Document</code>, it is necessary to call <code class="code highlight language-text">ReadonlyStatusHandler.getInstance(project).ensureFilesWritable()</code> to check out the file if necessary.</p>
<p>All text strings passed to <code class="code highlight language-text">Document</code> modification methods (<code class="code highlight language-text">setText</code>, <code class="code highlight language-text">insertString</code>, <code class="code highlight language-text">replaceString</code>) must use only \n as line separators.</p>
<div class="last-modified">
Last modified: 23 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,141 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>File View Providers / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/architectural_overview/file_view_providers">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>File View Providers</h1>
<p>A file view provider (see the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/psi/FileViewProvider.java" data-bypass="yes" target="_blank"><span>FileViewProvider</span></a> class) was introduced in <em>IntelliJ IDEA</em> 6.0. Its main purpose is to manage access to multiple PSI trees within a single file.</p>
<p>For example, a JSPX page has a separate PSI tree for the Java code in it (<code class="code highlight language-text">PsiJavaFile</code>), a separate tree for the XML code (<code class="code highlight language-text">XmlFile</code>), and a separate tree for JSP as a whole <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/java/jsp-openapi/src/com/intellij/psi/jsp/JspFile.java" data-bypass="yes" target="_blank"><span>JspFile</span></a>).</p>
<p>Each of the PSI trees covers the entire contents of the file, and contains special “outer language elements” in the places where contents in a different language can be found.</p>
<p>A <code class="code highlight language-text">FileViewProvider</code> instance corresponds to a single <code class="code highlight language-text">VirtualFile</code>, a single <code class="code highlight language-text">Document</code>, and can be used to retrieve multiple <code class="code highlight language-text">PsiFile</code> instances.</p>
<a name="how-do-i-get-an-fvp" class="elem-anchor"></a>
<h2>How do I get an FVP?<a href="#how-do-i-get-an-fvp" class="anchor-link"><span></span></a></h2>
<ul>
<li>From a VirtualFile: <code class="code highlight language-text">PsiManager.getInstance(project).findViewProvider()</code></li>
<li>From a PSI file: <code class="code highlight language-text">psiFile.getViewProvider()</code></li>
</ul>
<a name="what-can-i-do-with-an-fvp" class="elem-anchor"></a>
<h2>What can I do with an FVP?<a href="#what-can-i-do-with-an-fvp" class="anchor-link"><span></span></a></h2>
<ul>
<li>To get the list of all languages for which PSI trees exist in a file: <code class="code highlight language-text">fileViewProvider.getLanguages()</code></li>
<li>To get the PSI tree for a particular language: <code class="code highlight language-text">fileViewProvider.getPsi(language)</code>, where the <code class="code highlight language-text">language</code> parameter can take values of the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/lang/Language.java" data-bypass="yes" target="_blank"><span>Language</span></a> type defined in <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/platform-api/src/com/intellij/lang/StdLanguages.java" data-bypass="yes" target="_blank"><span>StdLanguages</span></a> class. For example, to get the PSI tree for XML, use <code class="code highlight language-text">fileViewProvider.getPsi(StdLanguages.XML)</code>.</li>
<li>To find an element of a particular language at the specified offset in the file: <code class="code highlight language-text">fileViewProvider.findElementAt(offset,language)</code></li>
</ul>
<a name="how-do-i-extend-the-fileviewprovider" class="elem-anchor"></a>
<h2>How do I extend the FileViewProvider?<a href="#how-do-i-extend-the-fileviewprovider" class="anchor-link"><span></span></a></h2>
<p>To create a file type that has multiple interspersing trees for different languages, your plugin must contain an extension to the <code class="code highlight language-text">fileType.fileViewProviderFactory</code> <a href="/intellij/sdk/docs/basics/plugin_structure/plugin_extensions_and_extension_points.html"><span>extension point</span></a> available in the <em>IntelliJ Platform</em> core.</p>
<p>This extension point is declared using the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeExtensionPoint.java" data-bypass="yes" target="_blank"><span>FileTypeExtensionPoint</span></a>
bean class.</p>
<p>To access this extension point, create a Java class that implements the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/psi/FileViewProviderFactory.java" data-bypass="yes" target="_blank"><span>FileViewProviderFactory</span></a> interface, and in this class, override the <code class="code highlight language-text">createFileViewProvider</code> method.</p>
<p>To declare the extension to the <code class="code highlight language-text">fileType.fileViewProviderFactory</code> extension point, to the <code class="code highlight language-text">&lt;extensions&gt;</code> section of the plugin.xml file, add the following syntax:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_xml"><span class="nt">&lt;extensions&gt;</span>
<span class="nt">&lt;fileType.fileViewProviderFactory</span> <span class="na">filetype=</span><span class="s">"%file_type%"</span> <span class="na">implementationClass=</span><span class="s">"%class_name%"</span> <span class="nt">/&gt;</span>
<span class="nt">&lt;/extensions&gt;</span>
</code></pre>
<p>Where <code class="code highlight language-text">%file_type%</code> refers to the type of the file being created (for example, “JFS”), and the <code class="code highlight language-text">%class_name%</code> refers to the name of your Java class that implements the <code class="code highlight language-text">FileViewProviderFactory</code> interface.</p>
<div class="last-modified">
Last modified: 13 December 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,105 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>General Threading Rules / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/architectural_overview/general_threading_rules">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>General Threading Rules</h1>
<p>In general, data structures in the <em>IntelliJ Platform</em> are covered by a single reader/writer lock.</p>
<p>Reading data is allowed from any thread. Reading data from the UI thread does not require any special effort. However, read operations performed from any other thread need to be wrapped in a read action by using <code class="code highlight language-text">ApplicationManager.getApplication().runReadAction()</code>.</p>
<p>Writing data is only allowed from the UI thread, and write operations always need to be wrapped in a write action with <code class="code highlight language-text">ApplicationManager.getApplication().runWriteAction()</code>.</p>
<p>To pass control from a background thread to the event dispatch thread, instead of the standard <code class="code highlight language-text">SwingUtilities.invokeLater()</code>, plugins should use <code class="code highlight language-text">ApplicationManager.getApplication().invokeLater()</code>. The latter API allows specifying the <em>modality state</em> for the call, i.e. the stack of modal dialogs under which the call is allowed to execute. Passing <code class="code highlight language-text">ModalityState.NON_MODAL</code> means that the operation will be executed after all modal dialogs are closed. Passing <code class="code highlight language-text">ModalityState.stateForComponent()</code> means that the operation may be executed while the specified component (part of a dialog) is still visible.</p>
<div class="last-modified">
Last modified: 23 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,119 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>PSI Elements / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/architectural_overview/psi_elements">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>PSI Elements</h1>
<p>A PSI (Program Structure Interface) file represents a hierarchy of PSI elements (so-called <em>PSI trees</em>). A single PSI file may include several PSI trees in a particular programming language. A PSI element, in its turn, can have child PSI elements.</p>
<p>PSI elements and operations on the level of individual PSI elements are used to explore the internal structure of source code as it is interpreted by the <strong>IntelliJ Platform</strong>. For example, you can use PSI elements to perform code analysis, such as <a href="http://www.jetbrains.com/idea/help/code-inspection.html" data-bypass="yes" target="_blank"><span>code inspections</span></a> or <a href="http://www.jetbrains.com/idea/help/intention-actions.html" data-bypass="yes" target="_blank"><span>intention actions</span></a>.</p>
<p>The <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/psi/PsiElement.java" data-bypass="yes" target="_blank"><span>PsiElement</span></a> class is the common base class for PSI elements.</p>
<a name="how-do-i-get-a-psi-element" class="elem-anchor"></a>
<h2>How do I get a PSI element?<a href="#how-do-i-get-a-psi-element" class="anchor-link"><span></span></a></h2>
<ul>
<li>From an action: <code class="code highlight language-text">e.getData(LangDataKeys.PSI_ELEMENT)</code>. Note: if an editor is currently open and the element under caret is a reference, this will return the result of resolving the reference. This may or may not be what you need.</li>
<li>From a file by offset: <code class="code highlight language-text">PsiFile.findElementAt()</code>. Note: this returns the lowest level element at the specified offset, which is normally a lexer token.
Most likely you should use <code class="code highlight language-text">PsiTreeUtil.getParentOfType()</code> to find the element you really need.</li>
<li>By iterating through a PSI file: using a <code class="code highlight language-text">PsiRecursiveElementWalkingVisitor</code>.</li>
<li>By resolving a reference: <code class="code highlight language-text">PsiReference.resolve()</code></li>
</ul>
<a name="what-can-i-do-with-psi-elements" class="elem-anchor"></a>
<h2>What can I do with PSI elements?<a href="#what-can-i-do-with-psi-elements" class="anchor-link"><span></span></a></h2>
<p>See <a href="/intellij/sdk/docs/basics/psi_cookbook.html"><span>PSI Cook Book</span></a></p>
<div class="last-modified">
Last modified: 30 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,155 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>PSI Files / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/architectural_overview/psi_files">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>PSI Files</h1>
<p>A PSI (Program Structure Interface) file is the root of a structure representing the contents of a file as a hierarchy of elements in a particular programming language.</p>
<p>The <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/psi/PsiFile.java" data-bypass="yes" target="_blank"><span>PsiFile</span></a> class is the common base class for all PSI files, while files in a specific language are usually represented by its subclasses. For example, the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/java/java-psi-api/src/com/intellij/psi/PsiJavaFile.java" data-bypass="yes" target="_blank"><span>PsiJavaFile</span></a> class represents a Java file, and the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/xml/xml-psi-api/src/com/intellij/psi/xml/XmlFile.java" data-bypass="yes" target="_blank"><span>XmlFile</span></a> class represents an XML file.</p>
<p>Unlike <code class="code highlight language-text">VirtualFile</code> and <code class="code highlight language-text">Document</code>, which have application scope (even if multiple projects are open, each file is represented by the same <code class="code highlight language-text">VirtualFile</code> instance), PSI has project scope (the same file is represented by multiple <code class="code highlight language-text">PsiFile</code> instances if the file belongs to multiple projects open at the same time).</p>
<a name="how-do-i-get-a-psi-file" class="elem-anchor"></a>
<h2>How do I get a PSI file?<a href="#how-do-i-get-a-psi-file" class="anchor-link"><span></span></a></h2>
<ul>
<li>From an action: <code class="code highlight language-text">e.getData(LangDataKeys.PSI_FILE)</code>.</li>
<li>From a VirtualFile: <code class="code highlight language-text">PsiManager.getInstance(project).findFile()</code></li>
<li>From a Document: <code class="code highlight language-text">PsiDocumentManager.getInstance(project).getPsiFile()</code></li>
<li>From an element inside the file: <code class="code highlight language-text">psiElement.getContainingFile()</code></li>
<li>To find files with a specific name anywhere in the project, use <code class="code highlight language-text">FilenameIndex.getFilesByName(project, name, scope)</code></li>
</ul>
<a name="what-can-i-do-with-a-psi-file" class="elem-anchor"></a>
<h2>What can I do with a PSI file?<a href="#what-can-i-do-with-a-psi-file" class="anchor-link"><span></span></a></h2>
<p>Most interesting modification operations are performed on the level of individual PSI elements, not files as a whole.</p>
<p>To iterate over the elements in a file, use <code class="code highlight language-text">psiFile.accept(new PsiRecursiveElementWalkingVisitor()...);</code></p>
<a name="where-does-it-a-psi-file-come-from" class="elem-anchor"></a>
<h2>Where does it a PSI file come from?<a href="#where-does-it-a-psi-file-come-from" class="anchor-link"><span></span></a></h2>
<p>As PSI is language-dependent, PSI files are created through the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/lang/Language.java" data-bypass="yes" target="_blank"><span>Language</span></a> object, by using the <code class="code highlight language-text">LanguageParserDefinitions.INSTANCE.forLanguage(language).createFile(fileViewProvider)</code> method.</p>
<p>Like documents, PSI files are created on demand when the PSI is accessed for a particular file.</p>
<a name="how-long-do-psi-files-persist" class="elem-anchor"></a>
<h2>How long do PSI files persist?<a href="#how-long-do-psi-files-persist" class="anchor-link"><span></span></a></h2>
<p>Like documents, PSI files are weakly referenced from the corresponding <code class="code highlight language-text">VirtualFile</code> instances and can be garbage-collected if not referenced by anyone.</p>
<a name="how-do-i-create-a-psi-file" class="elem-anchor"></a>
<h2>How do I create a PSI file?<a href="#how-do-i-create-a-psi-file" class="anchor-link"><span></span></a></h2>
<p>The <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/psi/PsiFileFactory.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">PsiFileFactory</code></span></a><code class="code highlight language-text">.getInstance(project).createFileFromText()</code> method creates an in-memory PSI file with the specified contents.</p>
<p>To save the PSI file to disk, use the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/psi/PsiDirectory.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">PsiDirectory</code></span></a><code class="code highlight language-text">.add()</code> method.</p>
<a name="how-do-i-get-notified-when-psi-files-change" class="elem-anchor"></a>
<h2>How do I get notified when PSI files change?<a href="#how-do-i-get-notified-when-psi-files-change" class="anchor-link"><span></span></a></h2>
<p><code class="code highlight language-text">PsiManager.getInstance(project).addPsiTreeChangeListener()</code> allows you to receive notifications about all changes to the PSI tree of a project.</p>
<a name="how-do-i-extend-psi" class="elem-anchor"></a>
<h2>How do I extend PSI?<a href="#how-do-i-extend-psi" class="anchor-link"><span></span></a></h2>
<p>PSI can be extended to support additional languages through custom language plugins. For more details on developing custom language plugins, see the <a href="/intellij/sdk/docs/reference_guide/custom_language_support.html"><span>Custom Language Support</span></a> reference guide.</p>
<a name="what-are-the-rules-for-working-with-psi" class="elem-anchor"></a>
<h2>What are the rules for working with PSI?<a href="#what-are-the-rules-for-working-with-psi" class="anchor-link"><span></span></a></h2>
<p>Any changes done to the content of PSI files are reflected in documents, so all rules for working with documents (read/write actions, commands, read-only status handling) are in effect.</p>
<div class="last-modified">
Last modified: 26 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,152 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Virtual Files / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/architectural_overview/virtual_file">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Virtual Files</h1>
<p>A virtual file <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java" data-bypass="yes" target="_blank"><span>com.intellij.openapi.vfs.VirtualFile</span></a> is the <em>IntelliJ Platforms</em> representation of a file in a file system (VFS). Most commonly, a virtual file is a file in your local file system. However, the <em>IntelliJ Platform</em> supports multiple pluggable file system implementations, so virtual files can also represent classes in a JAR file, old revisions of files loaded from a version control repository, and so on.</p>
<p>The VFS level deals only with binary content. You can get or set the contents of a <code class="code highlight language-text">VirtualFile</code> as a stream of bytes, but concepts like encodings and line separators are handled on higher system levels.</p>
<a name="how-do-i-get-a-virtual-file" class="elem-anchor"></a>
<h2>How do I get a virtual file?<a href="#how-do-i-get-a-virtual-file" class="anchor-link"><span></span></a></h2>
<ul>
<li>From an action: <code class="code highlight language-text">e.getData(PlatformDataKeys.VIRTUAL_FILE)</code>. If you are interested in multiple selection, you can also use <code class="code highlight language-text">e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY)</code>.</li>
<li>From a path in the local file system: <code class="code highlight language-text">LocalFileSystem.getInstance().findFileByIoFile()</code></li>
<li>From a PSI file: <code class="code highlight language-text">psiFile.getVirtualFile()</code> (may return null if the PSI file exists only in memory)</li>
<li>From a document: <code class="code highlight language-text">FileDocumentManager.getInstance().getFile()</code></li>
</ul>
<a name="what-can-i-do-with-it" class="elem-anchor"></a>
<h2>What can I do with it?<a href="#what-can-i-do-with-it" class="anchor-link"><span></span></a></h2>
<p>Typical file operations are available, such as traverse the file system, get file contents, rename, move, or delete. Recursive iteration should be performed using <code class="code highlight language-text">VfsUtilCore.iterateChildrenRecursively</code> to prevent endless loops caused by recursive symlinks.</p>
<a name="where-does-it-come-from" class="elem-anchor"></a>
<h2>Where does it come from?<a href="#where-does-it-come-from" class="anchor-link"><span></span></a></h2>
<p>The VFS is built incrementally, by scanning the file system up and down starting from the project root. New files appearing in the file system are detected by VFS <em>refreshes</em>. A refresh operation can be initiated programmatically using (<code class="code highlight language-text">VirtualFileManager.getInstance().refresh()</code> or <code class="code highlight language-text">VirtualFile.refresh()</code>). VFS refreshes are also triggered whenever file system watchers receive file system change notifications (available on the Windows and Mac operating systems).</p>
<p>As a plugin developer, you may want to invoke a VFS refresh if you need to access a file that has just been created by an external tool through the IntelliJ Platform APIs.</p>
<a name="how-long-does-a-virtual-file-persist" class="elem-anchor"></a>
<h2>How long does a virtual file persist?<a href="#how-long-does-a-virtual-file-persist" class="anchor-link"><span></span></a></h2>
<p>A particular file on disk is represented by equal <code class="code highlight language-text">VirtualFile</code> instances for the entire lifetime of the IDEA process. There may be several instances corresponding to the same file, and they can be garbage-collected. The file is a <code class="code highlight language-text">UserDataHolder</code>, and the user data is shared between those equal instances. If a file is deleted, its corresponding VirtualFile instance becomes invalid (the <code class="code highlight language-text">isValid()</code> method returns <code class="code highlight language-text">false</code> and operations cause exceptions).</p>
<a name="how-do-i-create-a-virtual-file" class="elem-anchor"></a>
<h2>How do I create a virtual file?<a href="#how-do-i-create-a-virtual-file" class="anchor-link"><span></span></a></h2>
<p>Usually you dont. As a rule, files are created either through the PSI API or through the regular java.io.File API.</p>
<p>If you do need to create a file through VFS, you can use the <code class="code highlight language-text">VirtualFile.createChildData()</code> method to create a <code class="code highlight language-text">VirtualFile</code> instance and the <code class="code highlight language-text">VirtualFile.setBinaryContent()</code> method to write some data to the file.</p>
<a name="how-do-i-get-notified-when-vfs-changes" class="elem-anchor"></a>
<h2>How do I get notified when VFS changes?<a href="#how-do-i-get-notified-when-vfs-changes" class="anchor-link"><span></span></a></h2>
<p>The <code class="code highlight language-text">VirtualFileManager.addVirtualFileListener()</code> method allows you to receive notifications about all changes in the VFS.</p>
<a name="how-do-i-extend-vfs" class="elem-anchor"></a>
<h2>How do I extend VFS?<a href="#how-do-i-extend-vfs" class="anchor-link"><span></span></a></h2>
<p>To provide an alternative file system implementation (for example, an FTP file system), implement the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileSystem.java" data-bypass="yes" target="_blank"><span>VirtualFileSystem</span></a> class (most likely youll also need to implement <code class="code highlight language-text">VirtualFile</code>), and register your implementation as an <a href="/intellij/sdk/docs/basics/plugin_structure/plugin_components.html"><span>application component</span></a>.</p>
<p>To hook into operations performed in the local file system (for example, if you are developing a version control system integration that needs custom rename/move handling), implement the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/platform-api/src/com/intellij/openapi/vfs/LocalFileOperationsHandler.java" data-bypass="yes" target="_blank"><span>LocalFileOperationsHandler</span></a> interface and register it through the<code class="code highlight language-text">LocalFileSystem.registerAuxiliaryFileOperationsHandler</code> method.</p>
<a name="what-are-the-rules-for-working-with-vfs" class="elem-anchor"></a>
<h2>What are the rules for working with VFS?<a href="#what-are-the-rules-for-working-with-vfs" class="anchor-link"><span></span></a></h2>
<p>See <a href="/intellij/sdk/docs/basics/virtual_file_system.html"><span>IntelliJ Platform Virtual File System</span></a> for a detailed description of the VFS architecture and usage guidelines.</p>
<div class="last-modified">
Last modified: 30 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,251 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Check Out And Build Community Edition / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/checkout_and_build_community">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Check Out And Build Community Edition</h1>
<a name="installing-git" class="elem-anchor"></a>
<h2>Installing Git<a href="#installing-git" class="anchor-link"><span></span></a></h2>
<p>The source code of IntelliJ IDEA Community Edition is stored in a Git repository. Therefore, in order to check out the sources, you need to have Git installed. We recommend using the <a href="https://msysgit.github.io" data-bypass="yes" target="_blank"><span>msys git</span></a> distribution on Windows and <a href="http://code.google.com/p/git-osx-installer/" data-bypass="yes" target="_blank"><span>git-osx-installer</span></a> on Mac.</p>
<a name="checking-out-the-code" class="elem-anchor"></a>
<h2>Checking Out the Code<a href="#checking-out-the-code" class="anchor-link"><span></span></a></h2>
<p>You can check out the code either by using IntelliJ IDEA or from the command line.</p>
<p><strong>Checking out from IntelliJ IDEA:</strong></p>
<ul>
<li>Select <strong>VCS | Checkout from Version Control | Git</strong> from the main menu</li>
<li>In the <strong>Git Repository URL</strong> field, enter <code class="code highlight language-text">git://git.jetbrains.org/idea/community.git</code></li>
</ul>
<p><img src="img/check_out_community.png" alt="Check Out Community" /></p>
<p><strong>Checking out from the command line:</strong></p>
<p>Please execute the following command:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_text">git clone --depth 1 git://git.jetbrains.org/idea/community.git idea
</code></pre>
<p>The <a href="https://github.com/JetBrains/intellij-community/tree/master" data-bypass="yes" target="_blank"><span>master</span></a> branch currently contains the code for the most recent development version of IntelliJ IDEA. Source code of older releases of IntelliJ IDEA can be found in the following branches:</p>
<table>
<thead>
<tr>
<th>IntelliJ Product version</th>
<th>Branch name/number</th>
</tr>
</thead>
<tbody>
<tr>
<td>15.0.x</td>
<td><a href="https://github.com/JetBrains/intellij-community/tree/143" data-bypass="yes" target="_blank"><span>143</span></a></td>
</tr>
<tr>
<td>14.1.x</td>
<td><a href="https://github.com/JetBrains/intellij-community/tree/141" data-bypass="yes" target="_blank"><span>141</span></a></td>
</tr>
<tr>
<td>14.0.x</td>
<td><a href="https://github.com/JetBrains/intellij-community/tree/139" data-bypass="yes" target="_blank"><span>139</span></a></td>
</tr>
<tr>
<td>13.1.x</td>
<td><a href="https://github.com/JetBrains/intellij-community/tree/135" data-bypass="yes" target="_blank"><span>135</span></a></td>
</tr>
<tr>
<td>13.0.x</td>
<td><a href="https://github.com/JetBrains/intellij-community/tree/133" data-bypass="yes" target="_blank"><span>133</span></a></td>
</tr>
<tr>
<td>12.0.x</td>
<td><a href="https://github.com/JetBrains/intellij-community/tree/123" data-bypass="yes" target="_blank"><span>123</span></a></td>
</tr>
<tr>
<td>11.1.x</td>
<td><a href="https://github.com/JetBrains/intellij-community/tree/117" data-bypass="yes" target="_blank"><span>117</span></a></td>
</tr>
<tr>
<td>11.0.x</td>
<td><a href="https://github.com/JetBrains/intellij-community/tree/nika" data-bypass="yes" target="_blank"><span>nika</span></a></td>
</tr>
<tr>
<td>10.5.x</td>
<td><a href="https://github.com/JetBrains/intellij-community/tree/xena" data-bypass="yes" target="_blank"><span>xena</span></a></td>
</tr>
<tr>
<td>10.0.x</td>
<td><a href="https://github.com/JetBrains/intellij-community/tree/x0x" data-bypass="yes" target="_blank"><span>x0x</span></a></td>
</tr>
<tr>
<td>9.x</td>
<td><a href="https://github.com/JetBrains/intellij-community/tree/maia" data-bypass="yes" target="_blank"><span>maia</span></a></td>
</tr>
</tbody>
</table>
<p>The source code of stable releases of IntelliJ IDEA Community Edition is also available as a tarball:</p>
<ul>
<li><a href="http://download.jetbrains.com/idea/ideaIC-15.0.1-src.tar.bz2" data-bypass="yes" target="_blank"><span>IntelliJ IDEA Community Edition 15.0.1</span></a></li>
<li><a href="http://download.jetbrains.com/idea/ideaIC-14.1.4-src.tar.bz2" data-bypass="yes" target="_blank"><span>IntelliJ IDEA Community Edition 14.1.4</span></a></li>
<li><a href="http://download.jetbrains.com/idea/ideaIC-13.1.6-src.tar.bz2" data-bypass="yes" target="_blank"><span>IntelliJ IDEA Community Edition 13.1.6</span></a></li>
<li><a href="http://download.jetbrains.com/idea/ideaIC-13.0.4-src.tar.bz2" data-bypass="yes" target="_blank"><span>IntelliJ IDEA Community Edition 13.0.4</span></a></li>
<li><a href="http://download.jetbrains.com/idea/ideaIC-12.1.6-src.tar.bz2" data-bypass="yes" target="_blank"><span>IntelliJ IDEA Community Edition 12.1.6</span></a></li>
<li><a href="http://download.jetbrains.com/idea/ideaIC-12.0.4-src.tar.bz2" data-bypass="yes" target="_blank"><span>IntelliJ IDEA Community Edition 12.0.4</span></a></li>
<li><a href="http://download.jetbrains.com/idea/ideaIC-11.1.4-src.tar.bz2" data-bypass="yes" target="_blank"><span>IntelliJ IDEA Community Edition 11.1.4</span></a></li>
<li><a href="http://download.jetbrains.com/idea/ideaIC-11.0.2-src.tar.bz2" data-bypass="yes" target="_blank"><span>IntelliJ IDEA Community Edition 11.0.2</span></a></li>
<li><a href="http://download.jetbrains.com/idea/ideaIC-10.5.4-src.tar.bz2" data-bypass="yes" target="_blank"><span>IntelliJ IDEA Community Edition 10.5.4</span></a></li>
<li><a href="http://download.jetbrains.com/idea/ideaIC-10.0.3-src.tar.bz2" data-bypass="yes" target="_blank"><span>IntelliJ IDEA Community Edition 10.0.3</span></a></li>
<li><a href="http://download.jetbrains.com/idea/ideaIC-9.0.4-src.tar.bz2" data-bypass="yes" target="_blank"><span>IntelliJ IDEA Community Edition 9.0.4</span></a></li>
</ul>
<a name="forking-on-github" class="elem-anchor"></a>
<h2>Forking on GitHub<a href="#forking-on-github" class="anchor-link"><span></span></a></h2>
<p>As an alternative to checking out the official repository, you can fork the GitHub mirror of the IntelliJ Platform source code, make changes in your own fork, and send us a pull request.</p>
<p>The GitHub mirror can be found at <a href="https://github.com/JetBrains/intellij-community" data-bypass="yes" target="_blank"><span>https://github.com/JetBrains/intellij-community</span></a>.</p>
<a name="building-and-running-from-the-ide" class="elem-anchor"></a>
<h2>Building and Running from the IDE<a href="#building-and-running-from-the-ide" class="anchor-link"><span></span></a></h2>
<p>To develop plugins and applications on the IntelliJ Platform, you can use either <a href="https://www.jetbrains.com/idea/download/" data-bypass="yes" target="_blank"><span>IntelliJ IDEA Community Edition</span></a> or <a href="https://www.jetbrains.com/idea/download/" data-bypass="yes" target="_blank"><span>IntelliJ IDEA Ultimate</span></a>.</p>
<p><strong>Building and running the code</strong></p>
<ul>
<li>
<p>Make sure you have the <a href="https://plugins.jetbrains.com/plugin/1524" data-bypass="yes" target="_blank"><span>Groovy plugin</span></a> enabled by going to <strong>Settings | Plugins</strong> and enabling <strong>Groovy</strong> plugin checkbox.</p>
<p><img src="img/groovy_plugin_enabled.png" alt="Groovy plugin" /></p>
<p>Parts of IntelliJ IDEA are written in Groovy, and you will get compilation errors if you dont have the plugin enabled.</p>
</li>
<li>
<p>Make sure you have the UI Designer plugin enabled. Most of the IntelliJ IDEA platform UI is built using the UI Designer, and the version you build will not run correctly if you dont have the plugin enabled.</p>
<p><img src="img/ui_designer_plugin_enabled.png" alt="UI Designer plugin" /></p>
</li>
<li>Open the directory with the source code as a directory-based project.</li>
<li>
<p>Configure a Java SDK named <em>IDEA jdk</em> (case sensitive), pointing to an installation of JDK 1.8</p>
<p><img src="img/configure_sdk.png" alt="Configure SDK" /></p>
</li>
<li>
<p>Add <code class="code highlight language-text">lib\\tools.jar</code> from the JDK installation directory to the classpath of IDEA JDK</p>
<p><img src="img/tools_jar.png" alt="tools.jar" /></p>
</li>
<li>Use <strong>Build | Make Project</strong> to build the code.</li>
<li>
<p>To run the code, use the <em>IDEA</em> shared run configuration provided by the project.</p>
<p><img src="img/idea_run_configuration.png" alt="IDEA Run Configuration" /></p>
</li>
</ul>
<a name="building-and-running-from-the-command-line" class="elem-anchor"></a>
<h2>Building and Running from the Command Line<a href="#building-and-running-from-the-command-line" class="anchor-link"><span></span></a></h2>
<p>To build the distribution archive of <em>IntelliJ IDEA Community Edition</em>, execute the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/build.xml" data-bypass="yes" target="_blank"><span>build.xml</span></a> Ant build script in the root directory of the source code.</p>
<p><img src="img/ant_build_xml.png" alt="Execute Ant Build Script" /></p>
<p>The results of the build execution can be found at <em>out/artifacts</em>.</p>
<div class="last-modified">
Last modified: 6 January 2016
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

112
basics/getting_started.html Normal file
View File

@ -0,0 +1,112 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Creating Your First Plugin / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/getting_started">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Creating Your First Plugin</h1>
<p>This documentation section will help you get started with developing plugins for the <em>IntelliJ Platform</em>. You can use either <a href="https://www.jetbrains.com/idea/download/" data-bypass="yes" target="_blank"><span>IntelliJ IDEA Community Edition</span></a> or <a href="https://www.jetbrains.com/idea/download/" data-bypass="yes" target="_blank"><span>IntelliJ IDEA Ultimate</span></a> as your IDE. Both include the complete set of plugin development tools. To become more familiar with <em>IntelliJ IDEA</em>, please refer to the <a href="https://www.jetbrains.com/idea/help/" data-bypass="yes" target="_blank"><span>IntelliJ IDEA Web Help</span></a>.</p>
<p>In this section:</p>
<ul>
<li><a href="getting_started/setting_up_environment.html"><span>Setting Up a Development Environment</span></a></li>
<li><a href="getting_started/creating_plugin_project.html"><span>Creating a Plugin Project</span></a></li>
<li><a href="getting_started/build_number_ranges.html"><span>Build Number Ranges</span></a></li>
<li><a href="getting_started/creating_an_action.html"><span>Creating an Action</span></a></li>
<li><a href="getting_started/running_and_debugging_a_plugin.html"><span>Running and Debugging a Plugin</span></a></li>
<li><a href="getting_started/deploying_plugin.html"><span>Deploying a Plugin</span></a></li>
<li><a href="getting_started/plugin_compatibility.html"><span>Plugin Compatibility with IntelliJ Platform Products</span></a></li>
<li><a href="getting_started/publishing_plugin.html"><span>Publishing a plugin to plugin repository</span></a></li>
</ul>
<div class="last-modified">
Last modified: 23 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,248 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Build Number Ranges / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/getting_started/build_number_ranges">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Build Number Ranges</h1>
<p>Use this reference of build number ranges to specify the correct <code class="code highlight language-text">since-build</code> and <code class="code highlight language-text">until-build</code> values in your plugin descriptor.</p>
<p>Starting with IntelliJ IDEA 9 beta, a multi-part build number is used, such as:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_text">IU-90.94
</code></pre>
<p>The number consists of the following parts:</p>
<ul>
<li>Product ID (IC for IDEA Community, IU for IDEA Ultimate, RM for RubyMine, PY for PyCharm, etc.)</li>
<li>Branch number (“90”)</li>
<li>Build number in the branch (“94”)</li>
</ul>
<p>Every time a release branch is created for one of the products based on IntelliJ Platform, the branch number in the release branch is incremented by 1, and the branch number in the trunk is incremented by 2. Accordingly, the trunk always has even branch numbers (90, 92, 94, etc.), while release branches have odd branch numbers (91, 93, etc.). For example, the RubyMine 7 release branch has the branch number 139.</p>
<p>Multi-part build numbers can also be used in the <code class="code highlight language-text">since-build</code> and <code class="code highlight language-text">until-build</code> attributes of <code class="code highlight language-text">idea-version</code>. Usually you should omit the product ID and use only the branch number and build number, for example:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_xml"><span class="nt">&lt;idea-version</span> <span class="na">since-build=</span><span class="s">"94.539"</span><span class="nt">/&gt;</span>
</code></pre>
<p>The following branch numbers are used for IntelliJ Platform-based products and build numbers of recent IDE versions:</p>
<ul>
<li>branch 143 - IntelliJ IDEA 15, WebStorm 11, PyCharm 5, PhpStorm 10, RubyMine 8, AppCode 3.3, CLion 1.2, DataGrip 1.0</li>
<li>branch 141 - IntelliJ IDEA 14.1, WebStorm 10, PyCharm 4.1, Android Studio 1.3</li>
<li>branch 139 - IntelliJ IDEA 14, WebStorm 9, PyCharm 4, PhpStorm 8, RubyMine 7</li>
<li>branch 135 - IntelliJ IDEA 13.1, WebStorm 8</li>
<li>branch 133 - IntelliJ IDEA 13, PyCharm 3.1, WebStorm 7, PhpStorm 7</li>
<li>branch 131 - WebStorm 7, PyCharm 3.0, PhpStorm 7</li>
<li>branch 129 - IntelliJ IDEA 12.1, bug-fix updates for PyCharm 2.7, PhpStorm/WebStorm 6</li>
<li>branch 127 - PhpStorm/WebStorm 6.0, AppCode 2.0</li>
<li>branch 125 - PyCharm 2.7, RubyMine 5.0</li>
<li>branch 123 - IntelliJ IDEA 12
<ul>
<li>12.0 - 123.72</li>
</ul>
</li>
<li>branch 121 - AppCode 1.6, PyCharm 2.6, PhpStorm/WebStorm 5.0</li>
<li>branch 119 - RubyMine 4.5</li>
<li>branch 117 - IntelliJ IDEA 11.1, PyCharm 2.5, RubyMine 4.0.x, AppCode 1.5, PhpStorm/WebStorm 4.0
<ul>
<li>11.1 - 117.105</li>
<li>11.1.1 - 117.117</li>
<li>11.1.2 - 117.418</li>
<li>11.1.3 - 117.798</li>
</ul>
</li>
<li>branch 111 - IntelliJ IDEA 11.0
<ul>
<li>11.0 - 111.69</li>
<li>11.0.1 - 111.167</li>
<li>11.0.2 - 111.277</li>
</ul>
</li>
<li>branch 107 - IDEA 10.5
<ul>
<li>10.5 - 107.105</li>
<li>10.5.1 - 107.322</li>
<li>10.5.2 - 107.587</li>
</ul>
</li>
<li>branch 103 - IDEA 10.0.2+
<ul>
<li>10.0.2 - 103.72</li>
<li>10.0.3 - 103.255</li>
</ul>
</li>
<li>10.0 - 99.18
<ul>
<li>10.0.1 - 99.32</li>
</ul>
</li>
<li>branch 95 - IDEA 9.0.2+
<ul>
<li>9.0.2 - 95.66</li>
<li>9.0.3 - 95.429</li>
<li>9.0.4 - 95.627</li>
<li>branch 99 - IDEA 10.0</li>
</ul>
</li>
<li>branch 93 - IDEA 9.0
<ul>
<li>9.0 - 93.13</li>
<li>9.0.1 - 93.94</li>
</ul>
</li>
</ul>
<hr />
<p>Previous versions of IntelliJ IDEA use linear build numbers, with the following ranges:</p>
<ul>
<li>IntelliJ IDEA 8.1.x - 9500-9999
<ul>
<li>IntelliJ IDEA 8.1 - 9732</li>
</ul>
</li>
<li>IntelliJ IDEA 8.0.x - 9100-9499
<ul>
<li>IntelliJ IDEA 8.0.1 - 9164</li>
</ul>
</li>
<li>IntelliJ IDEA 8.0 - 8000-9099
<ul>
<li>IntelliJ IDEA 8.0M1 - 8664</li>
<li>IntelliJ IDEA 8.0 - 9013</li>
</ul>
</li>
<li>IntelliJ IDEA 7.0.2+ - 7500-7999
<ul>
<li>7.0.2 - 7590</li>
<li>7.0.3 - 7757</li>
<li>7.0.5 - 7971</li>
</ul>
</li>
<li>IntelliJ IDEA 7.0 final - 7200-7499
<ul>
<li>7.0 final - 7361</li>
</ul>
</li>
<li>IntelliJ IDEA 7.0 pre-M2 - 6900-7199
<ul>
<li>7.0 M2 - 7126</li>
</ul>
</li>
<li>IntelliJ IDEA 7.0 pre-M1 - 6500-6899
<ul>
<li>7.0 M1 - 6813</li>
</ul>
</li>
<li>IntelliJ IDEA 6.0.2 branch - 6000-6499
<ul>
<li>6.0.5 - 6180</li>
<li>6.0.6 - 6197</li>
</ul>
</li>
<li>IntelliJ IDEA 6.0 branch - 5000-5999
<ul>
<li>6.0.1 - 5784</li>
</ul>
</li>
<li>IntelliJ IDEA 5.1 branch - 4000-4999
<ul>
<li>5.1.2 - 4267</li>
</ul>
</li>
</ul>
<div class="last-modified">
Last modified: 17 December 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,204 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Creating an action / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/getting_started/creating_an_action">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Creating an action</h1>
<p>Your plugins can customize the IntelliJ Platform UI by adding new items to the menus and toolbars. The IntelliJ Platform provides the class <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnAction.java" data-bypass="yes" target="_blank"><span>AnAction.java</span></a> whose <code class="code highlight language-text">actionPerformed</code> method is called each time you select a menu item or click a toolbar button.</p>
<p>To create custom actions in the <em>IntelliJ Platform</em>, you should perform two basic steps:</p>
<ol>
<li>In your plugin, define an action or a system of actions that add their own items to menus and toolbars.</li>
<li>Register your actions.</li>
</ol>
<p>This topic outlines the above steps. For detailed information and samples, refer to <a href="/intellij/sdk/docs/basics/action_system.html"><span>IntelliJ Platform Action System</span></a>.</p>
<a name="defining-actions" class="elem-anchor"></a>
<h3>Defining actions<a href="#defining-actions" class="anchor-link"><span></span></a></h3>
<p>An action is a class derived from the <code class="code highlight language-text">AnAction</code> class. To define your action, in your plugin, create a Java class derived from the <code class="code highlight language-text">AnAction</code> class. In this class, override the <code class="code highlight language-text">actionPerformed</code> method to be called when a menu item or a toolbar button is selected.</p>
<p>To clarify this procedure, consider the following code snippet that defines the <code class="code highlight language-text">TextBoxes</code> class derived from the <code class="code highlight language-text">AnAction</code> class:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">TextBoxes</span> <span class="kd">extends</span> <span class="n">AnAction</span> <span class="o">{</span>
<span class="c1">// If you register the action from Java code, this constructor is used to set the menu item name</span>
<span class="c1">// (optionally, you can specify the menu description and an icon to display next to the menu item).</span>
<span class="c1">// You can omit this constructor when registering the action in the plugin.xml file.</span>
<span class="kd">public</span> <span class="nf">TextBoxes</span><span class="o">()</span> <span class="o">{</span>
<span class="c1">// Set the menu item name.</span>
<span class="kd">super</span><span class="o">(</span><span class="s">"Text _Boxes"</span><span class="o">);</span>
<span class="c1">// Set the menu item name, description and icon.</span>
<span class="c1">// super("Text _Boxes","Item description",IconLoader.getIcon("/Mypackage/icon.png"));</span>
<span class="o">}</span>
<span class="kd">public</span> <span class="kt">void</span> <span class="nf">actionPerformed</span><span class="o">(</span><span class="n">AnActionEvent</span> <span class="n">event</span><span class="o">)</span> <span class="o">{</span>
<span class="n">Project</span> <span class="n">project</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="na">getData</span><span class="o">(</span><span class="n">PlatformDataKeys</span><span class="o">.</span><span class="na">PROJECT</span><span class="o">);</span>
<span class="n">String</span> <span class="n">txt</span><span class="o">=</span> <span class="n">Messages</span><span class="o">.</span><span class="na">showInputDialog</span><span class="o">(</span><span class="n">project</span><span class="o">,</span> <span class="s">"What is your name?"</span><span class="o">,</span> <span class="s">"Input your name"</span><span class="o">,</span> <span class="n">Messages</span><span class="o">.</span><span class="na">getQuestionIcon</span><span class="o">());</span>
<span class="n">Messages</span><span class="o">.</span><span class="na">showMessageDialog</span><span class="o">(</span><span class="n">project</span><span class="o">,</span> <span class="s">"Hello, "</span> <span class="o">+</span> <span class="n">txt</span> <span class="o">+</span> <span class="s">"!\n I am glad to see you."</span><span class="o">,</span> <span class="s">"Information"</span><span class="o">,</span> <span class="n">Messages</span><span class="o">.</span><span class="na">getInformationIcon</span><span class="o">());</span>
<span class="o">}</span>
<span class="o">}</span>
</code></pre>
<p>Note that optionally, you can define a set of classes derived from the <code class="code highlight language-text">AnAction</code> class. In this case, your plugin will define a system of actions.</p>
<a name="registering-actions" class="elem-anchor"></a>
<h3>Registering actions<a href="#registering-actions" class="anchor-link"><span></span></a></h3>
<p>Once you have defined an action or a system of actions, you must register them to specify the menu items or toolbar buttons associated with actions. You can register actions in one of the following ways:</p>
<ul>
<li>Register actions in the <code class="code highlight language-text">&lt;actions&gt;</code> section of the <code class="code highlight language-text">plugin.xml</code> file.</li>
<li>Register actions from Java code.</li>
</ul>
<p>This section provides some examples that illustrate how to register actions. For more information, refer to <a href="/intellij/sdk/docs/basics/action_system.html"><span>IntelliJ Platform Action System</span></a>.</p>
<a name="registering-actions-in-the-pluginxml-file" class="elem-anchor"></a>
<h4>Registering actions in the plugin.xml file</h4>
<p>To register your actions, make appropriate changes to the <code class="code highlight language-text">&lt;actions&gt;</code> section of the plugin.xml file for your IDEA project. The following fragment of the plugin.xml file adds the Sample Menu group (item) to the main menu. Clicking this item allows you to access <strong>Sample Menu | Text Boxes and Sample Menu | Show Dialog</strong> menu commands:</p>
<p><img src="img/sample_menu.jpg" alt="Sample Menu" /></p>
<pre><code class="code-block__wrapper code-block _highlighted lang_xml"><span class="nt">&lt;actions&gt;</span>
<span class="nt">&lt;group</span> <span class="na">id=</span><span class="s">"MyPlugin.SampleMenu"</span> <span class="na">text=</span><span class="s">"_Sample Menu"</span> <span class="na">description=</span><span class="s">"Sample menu"</span><span class="nt">&gt;</span>
<span class="nt">&lt;add-to-group</span> <span class="na">group-id=</span><span class="s">"MainMenu"</span> <span class="na">anchor=</span><span class="s">"last"</span> <span class="nt">/&gt;</span>
<span class="nt">&lt;action</span> <span class="na">id=</span><span class="s">"Myplugin.Textboxes"</span> <span class="na">class=</span><span class="s">"Mypackage.TextBoxes"</span> <span class="na">text=</span><span class="s">"Text _Boxes"</span> <span class="na">description=</span><span class="s">"A test menu item"</span> <span class="nt">/&gt;</span>
<span class="nt">&lt;action</span> <span class="na">id=</span><span class="s">"Myplugin.Dialogs"</span> <span class="na">class=</span><span class="s">"Mypackage.MyShowDialog"</span> <span class="na">text=</span><span class="s">"Show _Dialog"</span> <span class="na">description=</span><span class="s">"A test menu item"</span> <span class="nt">/&gt;</span>
<span class="nt">&lt;/group&gt;</span>
<span class="nt">&lt;/actions&gt;</span>
</code></pre>
<p>This fragment of the plugin.xml file demonstrates only some elements you can use in the <code class="code highlight language-text">&lt;actions&gt;</code> section to register your actions. For information about all elements designed to register your actions, refer to <a href="/intellij/sdk/docs/basics/action_system.html"><span>IntelliJ Platform Action System</span></a>.</p>
<a name="registering-actions-from-java-code" class="elem-anchor"></a>
<h4>Registering actions from Java code</h4>
<p>Alternatively, you can register your actions from Java code. For more information and samples that illustrate how to register actions from Java code, see <a href="/intellij/sdk/docs/basics/action_system.html"><span>IntelliJ Platform Action System</span></a>.</p>
<a name="quick-creation-of-actions" class="elem-anchor"></a>
<h3>Quick creation of actions<a href="#quick-creation-of-actions" class="anchor-link"><span></span></a></h3>
<p>The IntelliJ Platform provides the <strong>New Action</strong> wizard that suggests a simplified way of creating actions, with all the required infrastructure. The wizard helps you declare the action class and automatically makes appropriate changes to the <code class="code highlight language-text">&lt;actions&gt;</code> section of the plugin.xml file.</p>
<p>Note that you can use this wizard only to add a new action to an existing action group on the main menu or toolbar. If you want to create a new action group, and then add an action to this group, follow instructions earlier in this document.</p>
<p><strong>To create and register an action with the New Action wizard</strong></p>
<ol>
<li>In your project, on the context menu of the destination package click <strong>New</strong> or press <strong>Alt + Insert</strong>.</li>
<li>On the <strong>New</strong> menu, click <strong>Action</strong>.</li>
</ol>
<p><img src="img/new_action_template.png" alt="New Action Template" /></p>
<ol>
<li>On the <strong>New Action</strong> page that opens, fill in the following fields, and then click <strong>OK</strong>:</li>
</ol>
<ul>
<li><strong>Action ID</strong>: Enter the unique ID of the action. Recommended format: <code class="code highlight language-text">PluginName.ID</code></li>
<li><strong>Class Name</strong>: Enter the name of the action class to be created.</li>
<li><strong>Name</strong>: Enter the name of the menu item or tooltip for toolbar button associated with action.</li>
<li><strong>Description</strong>: Optionally, enter the action description. The IDEA status bar indicates this description when focusing the action.</li>
<li>In the <strong>Add to Group</strong> area, under <strong>Groups</strong>, <strong>Actions</strong> and <strong>Anchor</strong>, specify the action group to which to add a newly created action, and the position of the newly created action relative to other existing actions.</li>
<li>In the <strong>Keyboard Shortcuts</strong> area, optionally, specify the first and second keystrokes of the action.</li>
</ul>
<p><img src="img/new_action_page.png" alt="New Action Page" /></p>
<p>The IntelliJ Platform generates a <code class="code highlight language-text">.java</code> file with the specified class name, registers the newly created action in the plugin.xml file, adds a node to the module tree view, and opens the created action class file in the editor.</p>
<div class="last-modified">
Last modified: 30 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,117 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Creating a Plugin Project / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/getting_started/creating_plugin_project">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Creating a Plugin Project</h1>
<p>This section explains how you can create a new plugin project from scratch using the New Project wizard. Optionally, you can import an existing project or import a project from external models. You can also add a new plugin module to an existing <em>IntelliJ Platform</em> project.
For more information, refer to the <a href="https://www.jetbrains.com/idea/help/new-project-wizard.html" data-bypass="yes" target="_blank"><span>IntelliJ IDEA Web Help</span></a>.</p>
<a name="to-create-a-plugin-project" class="elem-anchor"></a>
<h2>To create a plugin project:<a href="#to-create-a-plugin-project" class="anchor-link"><span></span></a></h2>
<ul>
<li>
<p>On the main menu, choose <strong>File | New | Project</strong>. The <em>New Project</em>
wizard starts.</p>
<p><img src="img/new_project_wizard.png" alt="New Project Wizard" /></p>
</li>
<li>Set <em>IntelliJ Platform Plugin</em> project type</li>
<li>Click <strong>Next</strong></li>
<li>Set desired project name</li>
<li>Click <strong>Finish</strong> to generate project structure files</li>
<li>Go to <strong>File | Project Structure</strong> to customize project settings if required</li>
</ul>
<div class="last-modified">
Last modified: 30 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,125 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Deploying a Plugin / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/getting_started/deploying_plugin">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Deploying a Plugin</h1>
<p>Before your custom plugin can be used, it must be deployed: built, installed, and then enabled using Plugin Manager.</p>
<p>To deploy a plugin:</p>
<ul>
<li>Make your project by invoking <strong>Build | Make Project</strong>.</li>
<li>
<p>Prepare your plugin for deployment. In the main menu, select **Build | Prepare Plugin Module <module name="">' for Deployment**.</module></p>
<p><img src="deploying_plugin/img/prepare_plugin_for_deployment.png" alt="Prepare Plugin for Deployment" /></p>
</li>
<li>
<p>If the plugin module does not depend on any libraries, a <code class="code highlight language-text">.jar</code> archive will be created. Otherwise, a <code class="code highlight language-text">.zip</code> archive will be created including all the plugin libraries specified in the project settings.</p>
<p><img src="deploying_plugin/img/jar_saved_notification.png" alt="Jar Saved Notification" /></p>
</li>
<li>
<p>Copy the newly created archive file to the <code class="code highlight language-text">.IntelliJIDEAx0\config\plugins</code> folder, and then restart your IDE so the changes may take effect. To know how to locate your <em>plugins</em> directory, refer to <a href="/intellij/sdk/docs/basics/settings_caches_logs.html"><span>IDE Settings, Caches, Logs, and Plugins</span></a>.</p>
<p><img src="deploying_plugin/img/jar_location.png" alt="Jar File Location" /></p>
</li>
<li>In the main menu, select <strong>File | Settings</strong> to open the Settings dialog box.</li>
<li>In the Settings dialog box, under <strong>IDE Settings</strong>, click <strong>Plugins</strong>.</li>
<li>In the Plugins area, open the <strong>Installed</strong> tab, and then select the check-box next to your plugin name.</li>
<li>When finished, click OK to close the Settings dialog box.</li>
<li>Restart the IDE so that your changes take effect.</li>
</ul>
<div class="last-modified">
Last modified: 30 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

View File

@ -0,0 +1,155 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Plugin Compatibility with IntelliJ Platform Products / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/getting_started/plugin_compatibility">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Plugin Compatibility with IntelliJ Platform Products</h1>
<!--TODO link to sample_plugin file-->
<p>All products based on IntelliJ Platform (IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm, AppCode, etc.) share the same underlying platform API. Thus, a plugin that does not use any Java-specific functionality may be marked as compatible with these other products in addition to IntelliJ IDEA. This is done by specifying <em>module dependencies</em> in the <code class="code highlight language-text">plugin.xml</code> file.</p>
<p>A module dependency is a <code class="code highlight language-text">&lt;depends&gt;</code> tag where the contents of the tag starts with <code class="code highlight language-text">com.intellij.modules</code>.</p>
<p>For example:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_xml"><span class="nt">&lt;idea-plugin</span> <span class="na">version=</span><span class="s">"2"</span><span class="nt">&gt;</span>
...
<span class="nt">&lt;depends&gt;</span>com.intellij.modules.lang<span class="nt">&lt;/depends&gt;</span>
...
<span class="nt">&lt;/idea-plugin&gt;</span>
</code></pre>
<!--TODO link to sample_plugin file-->
<p>If a plugin does not include any module dependency tags in its <code class="code highlight language-text">plugin.xml</code>, its assumed to be a legacy plugin and is loaded only in IntelliJ IDEA.</p>
<p>If the <code class="code highlight language-text">plugin.xml</code> includes one or more such tags, the plugin is loaded if the product contains all of the modules on which the plugin depends.</p>
<p>The following modules are currently available in all products based on IntelliJ Platform:</p>
<ul>
<li><code class="code highlight language-text">com.intellij.modules.platform</code></li>
<li><code class="code highlight language-text">com.intellij.modules.lang</code></li>
<li><code class="code highlight language-text">com.intellij.modules.vcs</code></li>
<li><code class="code highlight language-text">com.intellij.modules.xml</code></li>
<li><code class="code highlight language-text">com.intellij.modules.xdebugger</code></li>
</ul>
<p>The following modules are only available in specific products:</p>
<ul>
<li><code class="code highlight language-text">com.intellij.modules.java</code> - IntelliJ IDEA</li>
<li><code class="code highlight language-text">com.intellij.modules.ultimate</code> - IntelliJ IDEA Ultimate Edition</li>
<li><code class="code highlight language-text">com.intellij.modules.ruby</code> - RubyMine</li>
<li><code class="code highlight language-text">com.intellij.modules.python</code> - PyCharm</li>
<li><code class="code highlight language-text">com.intellij.modules.appcode</code> - AppCode</li>
<li><code class="code highlight language-text">com.intellij.modules.clion</code> - CLion</li>
<li><code class="code highlight language-text">com.intellij.modules.cidr.lang</code> - AppCode, CLion</li>
<li><code class="code highlight language-text">com.intellij.modules.cidr.debugger</code> - AppCode, CLion, RubyMotion</li>
<li><code class="code highlight language-text">com.intellij.modules.androidstudio</code> - Android Studio</li>
</ul>
<p>PhpStorm does not have any modules specific to itself, but it includes the PHP plugin, which you can also use as a dependency: <code class="code highlight language-text">com.jetbrains.php</code></p>
<p>You can also specify optional module dependencies. If your plugin works with all products but provides some Java-specific functionality, you can use a dependency tag like this:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_xml"><span class="nt">&lt;depends</span> <span class="na">optional=</span><span class="s">"true"</span> <span class="na">config-file=</span><span class="s">"my-java-features.xml"</span><span class="nt">&gt;</span>
com.intellij.modules.java
<span class="nt">&lt;/depends&gt;</span>
</code></pre>
<p>Before marking a plugin as compatible with all products, you should verify that it doesnt use any APIs that are specific to IntelliJ IDEA. To do so, create an IntelliJ Platform SDK pointing to an installation of RubyMine, PyCharm, etc., compile your plugin against that SDK, and verify that everything compiles.</p>
<p>The <a href="http://plugins.jetbrains.com/" data-bypass="yes" target="_blank"><span>IntelliJ plugin repository</span></a> automatically detects the products with which a plugin is compatible, based on the rules above, and makes it available to users of those products.</p>
<div class="last-modified">
Last modified: 23 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,114 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Publishing a plugin / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/getting_started/publishing_plugin">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Publishing a plugin</h1>
<p>When your plugin is ready, you can upload it to the <a href="https://plugins.jetbrains.com" data-bypass="yes" target="_blank"><span>IntelliJ Plugin Repository</span></a>. To perform this operation, you must login with your personal JetBrains Account.</p>
<p><strong>To get your JetBrains account</strong></p>
<ol>
<li>Open the <a href="https://account.jetbrains.com" data-bypass="yes" target="_blank"><span>JetBrains Account Center</span></a> and click <strong>Create Account</strong>.</li>
<li>Fill in all fields in the <strong>Create Jetbrains Account</strong> form that opens and click <strong>Register</strong>.</li>
</ol>
<p><strong>To upload your plugin to Intellij Plugin Repository</strong></p>
<ol>
<li><a href="https://plugins.jetbrains.com/space" data-bypass="yes" target="_blank"><span>Login to IntelliJ Plugin Repository</span></a> with your personal JetBrains account.</li>
<li>On your Profile page that opens, click <strong>Add new plugin</strong>.</li>
<li>Fill in the <strong>Add new plugin</strong> form that opens and click the <strong>Add the plugin</strong> button to upload your plugin.</li>
</ol>
<div class="last-modified">
Last modified: 23 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,115 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Running and Debugging a Plugin / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/getting_started/running_and_debugging_a_plugin">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Running and Debugging a Plugin</h1>
<p>The <em>IntelliJ Platform</em> allows you to run and debug a plugin without leaving the IDE. To run or debug the plugin from within <em>IntelliJ IDEA</em>, you need a configured special profile (a Run/Debug configuration) that specifies the class to run, VM parameters and other specific options. In most cases, you can use the default <em>Run/Debug</em> configuration profiles for your plugin projects.</p>
<p>For information on how to change the Run/Debug configuration profile, refer to <a href="http://www.jetbrains.com/idea/help/run-debug-configuration.html" data-bypass="yes" target="_blank"><span>Run/Debug Configuration</span></a> and <a href="http://www.jetbrains.com/idea/help/run-debug-configuration-plugin.html" data-bypass="yes" target="_blank"><span>Run/Debug Configuration: Plugin</span></a> in <em>IntelliJ IDEA</em> Web Help.</p>
<p>Using <em>IntelliJ IDEA</em>s debugger, you can find out the origin of the run-time errors and exceptions.</p>
<p><strong>To debug a plugin</strong></p>
<ul>
<li>Select <strong>Run | Debug</strong> in the main menu, or press <kbd>Shift</kbd> + <kbd>F9</kbd>.</li>
</ul>
<p><strong>To run a plugin</strong></p>
<ul>
<li>Select <strong>Run | Run</strong> in the main menu, or press <kbd>Shift</kbd> + <kbd>F10</kbd>.</li>
</ul>
<div class="last-modified">
Last modified: 30 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,165 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Setting Up a Development Environment / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/getting_started/setting_up_environment">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Setting Up a Development Environment</h1>
<a name="preliminary-steps" class="elem-anchor"></a>
<h3>Preliminary Steps<a href="#preliminary-steps" class="anchor-link"><span></span></a></h3>
<p>Use the following check list to ensure that you are ready to develop your custom plugins.</p>
<ul>
<li><strong>IntelliJ IDEA</strong> version 9.0 or later (either Community Edition or Ultimate) must be installed on your computer.</li>
<li><strong>IntelliJ IDEA CE source code</strong> should be checked out to your local computer. This is not a requirement but will make it much easier for you to debug your plugins. For detailed instructions, refer to <a href="/intellij/sdk/docs/basics/checkout_and_build_community.html"><span>Check Out And Build Community Edition</span></a>.</li>
<li><strong>IntelliJ Platform SDK</strong> must configured for your IDEA project. For more information, see <a href="#configuring-intellij-platform-sdk"><span>Configuring IntelliJ Platform SDK</span></a> below.</li>
</ul>
<a name="configuring-intellij-platform-sdk" class="elem-anchor"></a>
<h3>Configuring IntelliJ Platform SDK<a href="#configuring-intellij-platform-sdk" class="anchor-link"><span></span></a></h3>
<p>To set up your plugin development environment:</p>
<ul>
<li>
<p>Check out the source code of IntelliJ IDEA Community Edition as described in
<a href="/intellij/sdk/docs/basics/checkout_and_build_community.html"><span>Check Out And Build Community Edition</span></a>.</p>
</li>
<li>
<p>Create a new <em>IntelliJ Platform SDK</em> under <strong>File | Project Structure</strong>:</p>
<p><img src="img/create_intellij_idea_sdk.png" alt="Create IntelliJ Platform SDK" /></p>
</li>
<li>
<p>Specify the installation folder of <em>IntelliJ IDEA Community Edition</em> as the home directory.</p>
<p><img src="img/set_home_directory.png" alt="Set Home Directory" /></p>
</li>
<li>
<p>Select the <strong>IDEA jdk</strong> created in <a href="/intellij/sdk/docs/basics/checkout_and_build_community.html"><span>Check Out And Build Community Edition</span></a> as the default Java SDK:</p>
<p><img src="img/set_java_sdk.png" alt="Set IDEA JDK" /></p>
</li>
</ul>
<aside class="warning">
<p> You may use IntelliJ IDEA Ultimate as an alternative, but debugging the core code will only work with the <em>Community Edition</em>.</p>
</aside>
<ul>
<li>
<p>In the Sourcepath tab of the SDK settings, click the <em>Add</em> button:</p>
<p><img src="img/add_sourcepath.png" alt="Add Sourcepath" /></p>
</li>
<li>
<p>Specify the directory into which you have checked out the sources of the <em>Community Edition</em>:</p>
<p><img src="img/community_sources_directory.png" alt="Specify Source Paths" /></p>
</li>
<li>
<p>Select <strong>File | New | Module</strong> and choose the <em>IntelliJ Platform Plugin</em> module type</p>
<p><img src="img/intellij_platform_plugin_module.png" alt="IntelliJ Platform Plugin Module" /></p>
</li>
<li>
<p>Enter your desired plugin name.</p>
</li>
<li>
<p>Go to <strong>File | Project Structure</strong> and select the newly created <em>IntelliJ Platform SDK</em> as the default SDK for the plugin module:</p>
<p><img src="img/set_plugin_module_sdk.png" alt="Set Plugin Module SDK" /></p>
</li>
</ul>
<div class="last-modified">
Last modified: 23 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
basics/img/classes.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 KiB

BIN
basics/img/create-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

BIN
basics/img/create-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
basics/img/create-3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
basics/img/tools_jar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

View File

@ -0,0 +1,110 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Indexing and PSI Stubs / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/indexing_and_psi_stubs">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Indexing and PSI Stubs</h1>
<p>The indexing framework provides a quick way to locate certain elements, e.g. files containing a certain word or methods with a particular name, in large code bases. Plugin developers can use the existing indexes built by the IDE itself, as well as build and use their own indexes.</p>
<p>It supports two main types of indexes:</p>
<ul>
<li><a href="/intellij/sdk/docs/basics/indexing_and_psi_stubs/file_based_indexes.html"><span>File-based indexes</span></a></li>
<li><a href="/intellij/sdk/docs/basics/indexing_and_psi_stubs/stub_indexes.html"><span>Stub indexes</span></a></li>
</ul>
<p>File-based indexes are built directly over the content of files. Stub indexes are built over serialized <em>stub trees</em>. A stub tree for a source file is a subset of its PSI tree which contains only externally visible declarations and is serialized in a compact binary format.</p>
<p>Querying a file-based index gets you the set of files matching a certain condition. Querying a stub index gets you the set of matching PSI elements. Therefore, custom language plugin developers should typically use stub indexes in their plugin implementations.</p>
<div class="last-modified">
Last modified: 24 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,175 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>File-based Indexes / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/indexing_and_psi_stubs/file_based_indexes">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>File-based Indexes</h1>
<p>File-based indexes are based on a Map/Reduce architecture. Each index has a certain type of key and a certain type of value.</p>
<p>The key is whats later used to retrieve data from the index.</p>
<p><em>Example:</em> in the word index the key is the word itself.</p>
<p>The value is arbitrary data which is associated with the key in the index.</p>
<p><em>Example:</em> in the word index the value is a mask indicating in which context the word occurs (code, string literal or comment).</p>
<p>In the simplest case, when we only need to know in what files some data occurs, the value has type <code class="code highlight language-text">Void</code> and is not stored in the index.</p>
<p>When the index implementation indexes a file, it receives the content of a file and returns a map from the keys found in the file to the associated values.</p>
<p>When you access the index, you specify the key that youre interested in and get back the list of files in which the key occurs and the value associated with each file.</p>
<a name="implementing-a-file-based-index" class="elem-anchor"></a>
<h2>Implementing a file based index<a href="#implementing-a-file-based-index" class="anchor-link"><span></span></a></h2>
<p>A fairly simple file-based index implementation is the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormClassIndex.java" data-bypass="yes" target="_blank"><span>UI Designer bound forms index</span></a>. Refer to it as an example to understand this topic better.</p>
<p>Each specific index implementation is a class extending <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndexExtension.java" data-bypass="yes" target="_blank"><span>FileBasedIndexExtension</span></a>. A file based index should be registered in the <code class="code highlight language-text">&lt;fileBasedIndex&gt;</code> extension point.</p>
<p>The implementation of a file based contains of the following main parts:</p>
<ul>
<li><code class="code highlight language-text">getIndexer()</code> returns the indexer class, which is is responsible for actually building a set of key/value pairs based on the file content.</li>
<li>
<p><code class="code highlight language-text">getKeyDescriptor()</code> returns the key descriptor, which is responsible for comparing the keys and storing them in a serialized binary format.</p>
<p>Probably the most commonly used <code class="code highlight language-text">KeyDescriptor</code> implementation is <code class="code highlight language-text">EnumeratorStringDescriptor</code> which is designed for storing identifiers in an efficient way.</p>
</li>
<li><code class="code highlight language-text">getValueExternalizer()</code> returns the value serializer, which takes care of storing values in a serialized binary format.</li>
<li><code class="code highlight language-text">getInputFilter()</code> allows to restrict the indexing only to a certain set of files.</li>
<li><code class="code highlight language-text">getVersion()</code> returns the version of the index implementation. The index is automatically rebuilt if the current version differs from the version of the index implementation used to build the index.</li>
</ul>
<p>If you dont need to associate any value with the files (i.e. your value type is Void), you can simplify the implementation by using <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/indexing-impl/src/com/intellij/util/indexing/ScalarIndexExtension.java" data-bypass="yes" target="_blank"><span>ScalarIndexExtension</span></a> as the base class.</p>
<aside class="note">
<p> The data returned by <code class="code highlight language-text">DataIndexer.map()</code> must depend only on input data passed to the method, and must not depend on any external files. Otherwise your index will not be correctly updated when the external data changes, and you will have stale data in your index.</p>
</aside>
<a name="accessing-a-file-based-index" class="elem-anchor"></a>
<h2>Accessing a file based index<a href="#accessing-a-file-based-index" class="anchor-link"><span></span></a></h2>
<p>Access to file based indexes is performed through the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndex.java" data-bypass="yes" target="_blank"><span>FileBasedIndex</span></a> class.</p>
<p>The following primary operations are supported:</p>
<ul>
<li><code class="code highlight language-text">getAllKeys()</code> and <code class="code highlight language-text">processAllKeys()</code> allow to obtain the list of all keys found in files which are part of the specified project.</li>
</ul>
<aside class="note">
<p> The returned data is guaranteed to contain all keys found in up-to-date project content, but may also contain additional keys not currently found in the project.</p>
</aside>
<ul>
<li><code class="code highlight language-text">getValues()</code> allows to obtain all values associated with a specific key but not the files in which they were found.</li>
<li><code class="code highlight language-text">getContainingFiles()</code> allows to obtain all files in which a specific key was encountered.</li>
<li><code class="code highlight language-text">processValues()</code> allows to iterate though all files in which a specific key was encountered and to access the associated values at the same time.</li>
</ul>
<a name="standard-indexes" class="elem-anchor"></a>
<h2>Standard indexes<a href="#standard-indexes" class="anchor-link"><span></span></a></h2>
<p>The <em>IntelliJ Platform</em> contains a number of the standard file-based indexes. The most useful indexes for plugin developers are:</p>
<ul>
<li>Word index</li>
<li>File name index</li>
</ul>
<p>Generally, the word index should be accessed indirectly, but using the helper methods in the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/indexing-api/src/com/intellij/psi/search/PsiSearchHelper.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">PsiSearchHelper</code></span></a> class.</p>
<p>The second index is <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/indexing-impl/src/com/intellij/psi/search/FilenameIndex.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">FilenameIndex</code></span></a>. It provides a quick way to find all files matching a certain file name. <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/indexing-impl/src/com/intellij/psi/search/FileTypeIndex.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">FileTypeIndex</code></span></a> serves a similar goal: it allows to quickly find all files of a certain file type.</p>
<div class="last-modified">
Last modified: 26 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,163 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Stub Indexes / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/indexing_and_psi_stubs/stub_indexes">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Stub Indexes</h1>
<a name="stub-trees" class="elem-anchor"></a>
<h2>Stub Trees<a href="#stub-trees" class="anchor-link"><span></span></a></h2>
<p>A stub tree is a subset of the PSI tree for a file; it is stored in a compact serialized binary format. The PSI tree for a file can be backed either by the AST (built by parsing the text of the file) or by the stub tree deserialized from disk. Switching between the two is transparent.</p>
<p>The stub tree contains only a subset of the nodes. Typically it contains only the nodes that are needed to resolve the declarations contained in this file from external files. Trying to access any node which is not part of the stub tree, or to perform any operation which cannot be satisfied by the stub tree, e.g. accessing the text of a PSI element, causes file parsing and switches the PSI to AST backing.</p>
<p>Each stub in the stub tree is simply a bean class with no behavior. A stub stores a subset of the state of the corresponding PSI element, like elements name, modifier flags like public or final, etc. The stub also holds a pointer to its parent in the tree and a list of its children stubs.</p>
<p>To support stubs for your custom language, you first need to decide which of the elements of your PSI tree should be stored as stubs. Typically you need to have stubs for things like methods or fields, which are visible from other files. You usually dont need to have stubs for things like statements or local variables, which are not visible externally.</p>
<p>For each element type that you want to store in the stub tree, you need to perform the following steps:</p>
<ul>
<li>Define an interface for the stub, derived from the <code class="code highlight language-text">StubElement</code> interface (<a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/psi/PropertyStub.java" data-bypass="yes" target="_blank"><span>example</span></a>).</li>
<li>Provide an implementation for the interface (<a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertyStubImpl.java" data-bypass="yes" target="_blank"><span>example</span></a>).</li>
<li>Make sure that the interface for the PSI element extends <code class="code highlight language-text">StubBasedPsiElement</code> parameterized by the type of the stub interface (<a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/psi/Property.java" data-bypass="yes" target="_blank"><span>example</span></a>).</li>
<li>Make sure that the implementation class for the PSI element extends <code class="code highlight language-text">StubBasedPsiElementBase</code> parameterized by the type of the stub interface (<a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertyImpl.java" data-bypass="yes" target="_blank"><span>example</span></a><!--#L45-->). Provide both a constructor that accepts an <code class="code highlight language-text">ASTNode</code> and a constructor which accepts a stub.</li>
<li>Create a class which implements <code class="code highlight language-text">IStubElementType</code> and is parameterized with the stub interface and the actual PSI element interface (<a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/parsing/PropertyStubElementType.java" data-bypass="yes" target="_blank"><span>example</span></a>). Implement the <code class="code highlight language-text">createPsi()</code> and <code class="code highlight language-text">createStub()</code> methods for creating PSI from a stub and vice versa. Implement the <code class="code highlight language-text">serialize()</code> and <code class="code highlight language-text">deserialize()</code> methods for storing the data in a binary stream.</li>
<li>Use the class implementing <code class="code highlight language-text">IStubElementType</code> as the element type constant when parsing (<a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/parsing/PropertiesElementTypes.java" data-bypass="yes" target="_blank"><span>example</span></a>).</li>
<li>Make sure that all methods in the PSI element interface access the stub data rather than the PSI tree when appropriate (<a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertyImpl.java" data-bypass="yes" target="_blank"><span>example: Property.getKey() implementation</span></a><!--#L95-->).</li>
</ul>
<p>The following steps need to be performed only once for each language that supports stubs:</p>
<ul>
<li>Change the file element type for your language (the element type that you return from <code class="code highlight language-text">ParserDefinition.getFileNodeType()</code>) to a class that extends <code class="code highlight language-text">IStubFileElementType</code>.</li>
<li>In your <code class="code highlight language-text">plugin.xml</code>, define the <code class="code highlight language-text">&lt;stubElementTypeHolder&gt;</code> extension and specify the interface which contains the <code class="code highlight language-text">IElementType</code> constants used by your languages parser (<a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/plugins/properties/src/META-INF/plugin.xml" data-bypass="yes" target="_blank"><span>example</span></a><!--#L55-->).</li>
</ul>
<p>For serializing string data, e.g. element names, in stubs, we recommend to use <code class="code highlight language-text">StubOutputStream.writeName()</code> and <code class="code highlight language-text">StubInputStream.readName()</code> methods. These methods ensure that each unique identifier is stored only once in the data stream. This reduces the size of the serialized stub tree data.</p>
<p>If you need to change the stored binary format for the stubs (for example, if you want to store some additional data or some new elements), make sure that you advance the stub version returned from <code class="code highlight language-text">IStubFileElementType.getStubVersion()</code> for your language. This will cause the stubs and stub indices to be rebuilt, and will avoid mismatches between the stored data format and the code trying to load it.</p>
<p>By default, if a PSI element extends <code class="code highlight language-text">StubBasedPsiElement</code>, all elements of that type will be stored in the stub tree. If you need more precise control over which elements are stored, override <code class="code highlight language-text">IStubElementType.shouldCreateStub()</code> and return <code class="code highlight language-text">false</code> for elements which should not be included in the stub tree.</p>
<aside class="note">
<p> The exclusion is not recursive: if some elements of the element for which you returned false are also stub-based PSI elements, they will be included in the stub tree.</p>
</aside>
<p>Its essential to make sure that all information stored in the stub tree depends only on the contents of the file for which stubs are being built, and does not depend on any external files. Otherwise the stub tree will not be rebuilt when an external dependency changes, and you will have stale and incorrect data in the stub tree.</p>
<a name="stub-indexes" class="elem-anchor"></a>
<h2>Stub indexes<a href="#stub-indexes" class="anchor-link"><span></span></a></h2>
<p>When building the stub tree, you can at the same time put some data about the stub elements into a number of indexes, which then can be used to find the PSI elements by the corresponding key. Unlike file-based indexes, stub indexes do not support storing custom data as values; the value is always a PSI element. Keys in stub indexes are normally strings (such as class names); other data types are also supported if desired.</p>
<p>A stub index is a class which extends <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/indexing-api/src/com/intellij/psi/stubs/AbstractStubIndex.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">AbstractStubIndex</code></span></a>. In the most common case, when the key type is <code class="code highlight language-text">String</code>, you use a more specific base class, namely <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/indexing-api/src/com/intellij/psi/stubs/StringStubIndexExtension.java" data-bypass="yes" target="_blank"><span>StringStubIndexExtension</span></a>. Stub index implementation classes are registered in the <code class="code highlight language-text">&lt;stubIndex&gt;</code> extension point.</p>
<p>To put data into an index, you implement the method <code class="code highlight language-text">IStubElementType.indexStub()</code> (<a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/psi/impl/java/stubs/JavaClassElementType.java" data-bypass="yes" target="_blank"><span>example: JavaClassElementType.indexStub()</span></a><!--#L189-->). This method accepts an <code class="code highlight language-text">IndexSink</code> as a parameter, and puts in the index ID and the key for each index in which the element should be stored.</p>
<p>To access the data from an index, the following two methods are used:</p>
<ul>
<li><code class="code highlight language-text">AbstractStubIndex.getAllKeys()</code> returns the list of all keys in the specified index for the specified project (for example, the list of all class names found in the project).</li>
<li><code class="code highlight language-text">AbstractStubIndex.get()</code> returns the collection of PSI elements corresponding to a certain key (for example, classes with the specified short name) in the specified scope.</li>
</ul>
<a name="related-forum-discussions" class="elem-anchor"></a>
<h2>Related Forum Discussions<a href="#related-forum-discussions" class="anchor-link"><span></span></a></h2>
<ul>
<li><a href="https://devnet.jetbrains.com/message/5485343" data-bypass="yes" target="_blank"><span>Lifecycle of stub creation</span></a></li>
</ul>
<div class="last-modified">
Last modified: 21 December 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,157 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>IntelliJ Coding Guidelines / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/intellij_coding_guidelines">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>IntelliJ Coding Guidelines</h1>
<p>If you are writing code that you would like to contribute to the IntelliJ Platform (either as a patch or as a plugin), following these guidelines will make it easier for the JetBrains development team to review and accept your changes.</p>
<a name="following-the-latest-source-code" class="elem-anchor"></a>
<h4>Following the Latest Source Code</h4>
<p>If you submit patches, we strongly recommend building your patches against the latest version of the code from the Git repository. The easiest way to do so is to clone the JetBrains Git repository, track your work in Git, and create patches using the “git format-patch” command.</p>
<a name="general-architectural-principles" class="elem-anchor"></a>
<h4>General Architectural Principles</h4>
<p>Please do your best to follow common Java architectural principles. “Effective Java” by Joshua Bloch is a good place to start.</p>
<a name="tests" class="elem-anchor"></a>
<h4>Tests</h4>
<p>Most of the existing functionality of IntelliJ IDEA is covered by functional tests. If the area youre modifying is covered by tests, you must run the tests and make sure that your changes do not introduce any new test failures. Its also strongly recommended that you provide new functional tests that cover the bugs you fix or the new features that you add.</p>
<a name="code-formatting" class="elem-anchor"></a>
<h4>Code Formatting</h4>
<p>Were generally pretty lax about code formatting, but at least the following conventions must be observed:</p>
<ul>
<li>2 space indents in source files</li>
<li><strong>my</strong> prefix for instance variables and <strong>our</strong> prefix for class variables</li>
<li>new source code files must include a copyright statement with the Apache 2 license and the name of the contributor.</li>
</ul>
<p>The easiest way to follow our code formatting guidelines is to reformat your code submissions using the shared code style, which is included in the IntelliJ IDEA Community Edition project directory.</p>
<a name="inspections" class="elem-anchor"></a>
<h4>Inspections</h4>
<p>The IntelliJ IDEA Community Edition project includes a shared inspection profile. We strongly recommend making sure that the code you submit does not contain any warnings highlighted by the inspections configured in that inspection profile.</p>
<a name="javadoc-comments" class="elem-anchor"></a>
<h4>JavaDoc Comments</h4>
<p>If your code adds new OpenAPI interfaces, classes, methods or extension points, you must provide JavaDoc comments describing the parameters and intended usage of the APIs. Providing JavaDoc or other comments for other parts of the code is a good idea but isnt required.</p>
<a name="commits" class="elem-anchor"></a>
<h4>Commits</h4>
<p>To avoid unnecessary work when reviewing your changes, please follow these guidelines:</p>
<ul>
<li>Look through all of your changes in your patch or pull request before you submit it to us. Make sure that everything youve changed is there for a reason.</li>
<li>Please dont include unfinished work to the patch. Make sure that it doesnt include any TODO comments. If you added some code and ended up not needing it, please make sure that you delete it before you submit your patch.</li>
<li>Please dont include any changes that affect formatting, fixing “yellow code” (warnings) or code style along with actual changes that fix a bug or implement a feature. No one likes to leave poor code, but remember that having these changes mixed with each other complicates the process of review.</li>
<li>Please dont fix multiple problems within a single patch or pull request.</li>
<li>Please dont commit your personal changes to configuration files (runConfigurations/IDEA.xml, codeStyleSettings.xml, misc.xml, etc.) unless it is essential for the fix itself.</li>
<li>Please avoid moving or renaming classes unless it is necessary for the fix.</li>
</ul>
<p>The ideal pull request would contain 1 commit with everything needed to fix the bug or implement a feature, but nothing else. “Commit early, commit often” perfectly applies only to local commits, but such “public commits” are hard to review (the reviewer needs either to go commit by commit spending more time to review work-in-progress, or to review all changes at once thus losing valuable information stored in commit messages).</p>
<p>The best would be to commit early, but then to squash all commits into one with a descriptive commit message.</p>
<p>Sometimes several commits for a single issue are also acceptable, but each of these need to be self-contained “steps” to solve the problem.</p>
<div class="last-modified">
Last modified: 7 January 2016
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,240 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Persisting State of Components / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/persisting_state_of_components">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Persisting State of Components</h1>
<p>The <em>IntelliJ Platform</em> provides an API that allows components or services to persist their state between restarts of the IDE. You can use either a simple API to persist a few values, or persist the state of more complicated components using the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/components/PersistentStateComponent.java" data-bypass="yes" target="_blank"><span>PersistentStateComponent</span></a> interface.</p>
<a name="using-propertiescomponent-for-simple-non-roamable-persistence" class="elem-anchor"></a>
<h2>Using PropertiesComponent for simple non-roamable persistence<a href="#using-propertiescomponent-for-simple-non-roamable-persistence" class="anchor-link"><span></span></a></h2>
<p>If the only thing that your plugin needs to persist is a few simple values, the easiest way to do so is to use the <code class="code highlight language-text">com.intellij.ide.util.PropertiesComponent</code> service. It can be used for saving both application level values and project level values (stored in the workspace file). Roaming is disabled for <code class="code highlight language-text">PropertiesComponent</code>, so use it only for temporary, non-roamable properties.</p>
<p>Use the <code class="code highlight language-text">PropertiesComponent.getInstance()</code> method for storing application level values, and the <code class="code highlight language-text">PropertiesComponent.getInstance(Project)</code> method for storing project-level values.</p>
<p>Since all plugins share the same namespace, it is highly recommended to prefix key names (e.g. using your plugin ID).</p>
<a name="using-persistentstatecomponent" class="elem-anchor"></a>
<h2>Using PersistentStateComponent<a href="#using-persistentstatecomponent" class="anchor-link"><span></span></a></h2>
<p>The <code class="code highlight language-text">com.intellij.openapi.components.PersistentStateComponent</code> interface gives you the most flexibility for defining the values to be persisted, their format and storage location. In order to use it, you should mark a service or a component as implementing the <code class="code highlight language-text">PersistentStateComponent</code> interface, define the state class, and specify the storage location using the <code class="code highlight language-text">@com.intellij.openapi.components.State</code> annotation.</p>
<p>Note that instances of extensions cannot persist their state by implementing <code class="code highlight language-text">PersistentStateComponent</code>. If your extension needs to have persistent state, you need to define a separate service responsible for managing that state.</p>
<a name="implementing-the-persistentstatecomponent-interface" class="elem-anchor"></a>
<h3>Implementing the PersistentStateComponent interface<a href="#implementing-the-persistentstatecomponent-interface" class="anchor-link"><span></span></a></h3>
<p>The implementation of <code class="code highlight language-text">PersistentStateComponent</code> needs to be parameterized with the type of the state class. The state class can either be a separate JavaBean class, or the class implementing <code class="code highlight language-text">PersistentStateComponent</code> itself.</p>
<p>In the former case, the instance of the state class is typically stored as a field in the <code class="code highlight language-text">PersistentStateComponent</code> class:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="kd">class</span> <span class="nc">MyService</span> <span class="kd">implements</span> <span class="n">PersistentStateComponent</span><span class="o">&lt;</span><span class="n">MyService</span><span class="o">.</span><span class="na">State</span><span class="o">&gt;</span> <span class="o">{</span>
<span class="kd">class</span> <span class="nc">State</span> <span class="o">{</span>
<span class="kd">public</span> <span class="n">String</span> <span class="n">value</span><span class="o">;</span>
<span class="o">}</span>
<span class="n">State</span> <span class="n">myState</span><span class="o">;</span>
<span class="kd">public</span> <span class="n">State</span> <span class="nf">getState</span><span class="o">()</span> <span class="o">{</span>
<span class="k">return</span> <span class="n">myState</span><span class="o">;</span>
<span class="o">}</span>
<span class="kd">public</span> <span class="kt">void</span> <span class="nf">loadState</span><span class="o">(</span><span class="n">State</span> <span class="n">state</span><span class="o">)</span> <span class="o">{</span>
<span class="n">myState</span> <span class="o">=</span> <span class="n">state</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
</code></pre>
<p>In the latter case, you can use the following pattern to implement <code class="code highlight language-text">getState()</code> and <code class="code highlight language-text">loadState()</code> methods:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="kd">class</span> <span class="nc">MyService</span> <span class="kd">implements</span> <span class="n">PersistentStateComponent</span><span class="o">&lt;</span><span class="n">MyService</span><span class="o">&gt;</span> <span class="o">{</span>
<span class="kd">public</span> <span class="n">String</span> <span class="n">stateValue</span><span class="o">;</span>
<span class="kd">public</span> <span class="n">MyService</span> <span class="nf">getState</span><span class="o">()</span> <span class="o">{</span>
<span class="k">return</span> <span class="k">this</span><span class="o">;</span>
<span class="o">}</span>
<span class="kd">public</span> <span class="kt">void</span> <span class="nf">loadState</span><span class="o">(</span><span class="n">MyService</span> <span class="n">state</span><span class="o">)</span> <span class="o">{</span>
<span class="n">XmlSerializerUtil</span><span class="o">.</span><span class="na">copyBean</span><span class="o">(</span><span class="n">state</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
</code></pre>
<a name="implementing-the-state-class" class="elem-anchor"></a>
<h3>Implementing the state class<a href="#implementing-the-state-class" class="anchor-link"><span></span></a></h3>
<p>The implementation of <code class="code highlight language-text">PersistentStateComponent</code> works by serializing public fields, <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/util/src/com/intellij/util/xmlb/annotations" data-bypass="yes" target="_blank"><span>annotated</span></a> private fields and bean properties into an XML format. The following types of values can be persisted:</p>
<ul>
<li>numbers (both primitive types, such as <code class="code highlight language-text">int</code>, and boxed types, such as <code class="code highlight language-text">Integer</code>)</li>
<li>booleans</li>
<li>strings</li>
<li>collections</li>
<li>maps</li>
<li>enums</li>
</ul>
<p>In order to exclude a public field or bean property from serialization, you can annotate the field or getter with the <code class="code highlight language-text">@com.intellij.util.xmlb.annotations.Transient</code> annotation.</p>
<p>Note that the state class must have a default constructor. It should return the default state of the component (one used if there is nothing persisted in the XML files yet).</p>
<p>State class should have a <code class="code highlight language-text">equals</code> method, but if it is not implemented, state objects will be compared by fields. If you write in Kotlin, use <a href="http://kotlinlang.org/docs/reference/data-classes.html" data-bypass="yes" target="_blank"><span>Data</span></a>.</p>
<a name="defining-the-storage-location" class="elem-anchor"></a>
<h3>Defining the storage location<a href="#defining-the-storage-location" class="anchor-link"><span></span></a></h3>
<p>In order to specify where exactly the persisted values will be stored, you need to add a <code class="code highlight language-text">@State</code> annotation to the <code class="code highlight language-text">PersistentStateComponent</code> class. It has the following fields:</p>
<ul>
<li><code class="code highlight language-text">name</code> (required) - specifies the name of the state (name of the root tag in XML)</li>
<li>One or more of <code class="code highlight language-text">@com.intellij.openapi.components.Storage</code> annotations (required) - specify the storage locations for <code class="code highlight language-text">.ipr</code> and directory-based projects</li>
<li><code class="code highlight language-text">reloadable</code> (optional) - if set to false, complete project reload is required when the XML file is changed externally and the state has changed.</li>
</ul>
<p>The simplest ways of specifying the <code class="code highlight language-text">@Storage</code> annotation are as follows:</p>
<ul>
<li><code class="code highlight language-text">@Storage(id = "other", file = StoragePathMacros.APP_CONFIG + "/yourName.xml")</code> for application level values</li>
<li><code class="code highlight language-text">@Storage(id = "other", file = StoragePathMacros.PROJECT_FILE)</code> for values stored in the project file (for <code class="code highlight language-text">.ipr</code> based projects)</li>
<li><code class="code highlight language-text">@Storage(id = "dir", file = StoragePathMacros.PROJECT_CONFIG_DIR + "/other.xml", scheme = StorageScheme.DIRECTORY_BASED)})</code> for values stored in the project directory (for directory based projects)</li>
<li><code class="code highlight language-text">@Storage(id = "other", file = StoragePathMacros.WORKSPACE_FILE)</code> for values stored in the workspace file</li>
</ul>
<p>The <code class="code highlight language-text">id</code> parameter of the <code class="code highlight language-text">@Storage</code> annotation can be used to exclude specific fields from serialization in specific formats. If you do not need to exclude anything, you can set the <code class="code highlight language-text">id</code> to an arbitrary string value. If you need to specify where the values are stored when the directory-based project format is used, you need to add the second <code class="code highlight language-text">@Storage</code> annotation with the scheme parameter set to <code class="code highlight language-text">StorageScheme.DIRECTORY_BASED</code>, for example:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="nd">@State</span><span class="o">(</span><span class="n">name</span> <span class="o">=</span> <span class="s">"AntConfiguration"</span><span class="o">,</span>
<span class="n">storages</span> <span class="o">=</span> <span class="o">{</span>
<span class="nd">@Storage</span><span class="o">(</span><span class="n">id</span> <span class="o">=</span> <span class="s">"default"</span><span class="o">,</span> <span class="n">file</span> <span class="o">=</span> <span class="n">StoragePathMacros</span><span class="o">.</span><span class="na">PROJECT_FILE</span><span class="o">),</span>
<span class="nd">@Storage</span><span class="o">(</span><span class="n">id</span> <span class="o">=</span> <span class="s">"dir"</span><span class="o">,</span> <span class="n">file</span> <span class="o">=</span> <span class="n">StoragePathMacros</span><span class="o">.</span><span class="na">PROJECT_CONFIG_DIR</span> <span class="o">+</span> <span class="s">"/ant.xml"</span><span class="o">,</span> <span class="n">scheme</span> <span class="o">=</span> <span class="n">StorageScheme</span><span class="o">.</span><span class="na">DIRECTORY_BASED</span><span class="o">)</span>
<span class="o">}</span>
<span class="o">)</span>
</code></pre>
<p>By specifying a different value for the <code class="code highlight language-text">file</code> parameter, you can cause the state to be persisted in a different file. For application level components strongly recommended to use custom file, using of <code class="code highlight language-text">other.xml</code> is deprecated.</p>
<p>The <code class="code highlight language-text">roamingType</code> parameter of the <code class="code highlight language-text">@Storage</code> annotation specifies the roaming type when the Settings Repository plugin is used.</p>
<a name="customizing-the-xml-format-of-persisted-values" class="elem-anchor"></a>
<h2>Customizing the XML format of persisted values<a href="#customizing-the-xml-format-of-persisted-values" class="anchor-link"><span></span></a></h2>
<p>Please consider to use annotation parameters only to achieve backward compatibility. Otherwise feel free to file issues about serialization cosmetics.</p>
<p>If you want to use the default bean serialization but need to customize the storage format in XML (for example, for compatibility with previous versions of your plugin or externally defined XML formats), you can use the <code class="code highlight language-text">@Tag</code>, <code class="code highlight language-text">@Attribute</code>, <code class="code highlight language-text">@Property</code>, <code class="code highlight language-text">@MapAnnotation</code>, <code class="code highlight language-text">@AbstractCollection</code> annotations.</p>
<p>You can look at the source code (<code class="code highlight language-text">com.intellij.util.xmlb</code> package) to get more information about the meaning of these annotations.</p>
<p>If the state that you need to serialize doesnt map cleanly to a JavaBean, you can use <code class="code highlight language-text">org.jdom.Element</code> as the state class. In that case, you can use the <code class="code highlight language-text">getState()</code> method to build an XML element with an arbitrary structure, which will then be saved directly in the state XML file. In the <code class="code highlight language-text">loadState()</code> method, you can deserialize the JDOM element tree using any custom logic. But this way is not recommended and should be avoided.</p>
<a name="persistent-component-lifecycle" class="elem-anchor"></a>
<h2>Persistent component lifecycle<a href="#persistent-component-lifecycle" class="anchor-link"><span></span></a></h2>
<p>The <code class="code highlight language-text">loadState()</code> method is called after the component has been created (only if there is some non-default state persisted for the component), and after the XML file with the persisted state is changed externally (for example, if the project file was updated from the version control system). In the latter case, the component is responsible for updating the UI and other related components according to the changed state.</p>
<p>The <code class="code highlight language-text">getState()</code> method is called every time the settings are saved (for example, on frame deactivation or when closing the IDE). If the state returned from <code class="code highlight language-text">getState()</code> is equal to the default state (obtained by creating the state class with a default constructor), nothing is persisted in the XML. Otherwise, the returned state is serialized in XML and stored.</p>
<a name="legacy-api-jdomexternalizable" class="elem-anchor"></a>
<h2>Legacy API (JDOMExternalizable)<a href="#legacy-api-jdomexternalizable" class="anchor-link"><span></span></a></h2>
<p>Older IDEA components use the <code class="code highlight language-text">JDOMExternalizable</code> interface for persisting state. It uses the <code class="code highlight language-text">readExternal()</code> method for reading the state from a JDOM element, and <code class="code highlight language-text">writeExternal()</code> to write the state to it.</p>
<p><code class="code highlight language-text">JDOMExternalizable</code> implementations can store the state in attributes and sub-elements manually, and/or use the <code class="code highlight language-text">DefaultJDOMExternalizer</code> class to store the values of all public fields automatically.</p>
<p>When the components class implements the <code class="code highlight language-text">JDOMExternalizable</code> interface, the components save their state in the following files:</p>
<ul>
<li>Project level components save their state to the project (<code class="code highlight language-text">.ipr</code>) file. However, if the workspace option in the <code class="code highlight language-text">plugin.xml</code> file is set to <code class="code highlight language-text">true</code>, the component saves its configuration to the workspace (<code class="code highlight language-text">.iws</code>) file instead.</li>
<li>Module level components save their state to the module (<code class="code highlight language-text">.iml</code>) file.</li>
</ul>
<div class="last-modified">
Last modified: 21 December 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,138 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Contributing to the IntelliJ Platform / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/platform_contributions">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Contributing to the IntelliJ Platform</h1>
<a name="participate-in-the-community" class="elem-anchor"></a>
<h4>Participate in the Community</h4>
<ul>
<li><strong>Participate in newsgroups and forums</strong><br />
There are several community <a href="http://www.jetbrains.net/devnet/community/idea" data-bypass="yes" target="_blank"><span>forums and newsgroups</span></a> you can join to discuss IntelliJ IDEA. The forums are an excellent source for users and contributors interested in having technical discussions, answering questions, or resolving potential issues for newcomers.</li>
<li><strong>Link to jetbrains.org</strong><br />
The success of any open source project depends on the number of people who use the product and contribute back to the project. By linking to jetbrains.org, you can increase the chances of a new user or contributor finding out about the project and joining the community. If youre as excited about IntelliJ IDEA Community Edition as we are, you can show it by linking to us. Project logos and other assets are <a href="https://www.jetbrains.com/company/press/" data-bypass="yes" target="_blank"><span>also available</span></a>.</li>
<li><strong>Promote IntelliJ Platform and IntelliJ IDEA Community Edition</strong><br />
Help promote the platform and IDE by using your blog, Twitter, Facebook, or submitting an article to your favorite local magazine. If you are a member of a different open source community, why not mention IntelliJ IDEA on their discussion forums or at conferences? If you love IntelliJ IDEA, dont hold back - speak up! The more developers use IntelliJ IDEA, the more bugs will be caught, the more plug-ins will be written, the more visible the project, and the more benefits the community will get!</li>
</ul>
<a name="help-others-learn" class="elem-anchor"></a>
<h4>Help Others Learn</h4>
<ul>
<li><strong>Write documents</strong><br />
Were always looking for new articles about IntelliJ IDEA features as well as documentation for the IntelliJ Platform. You can write tutorials, how-tos, sample applications, or just share your experience with the IntelliJ Platform. You can publish your documentation on an website or blog, or submit a <a href="/intellij/sdk/docs/CONTRIBUTING.html"><span>pull request</span></a> to the SDK Docs.</li>
<li><strong>Produce screencasts</strong><br />
Screencasts have recently become very popular as a way to show other developers how to use the tool effectively. You can record a screencast about a particular feature or use case you discovered and would like to share it with the community.</li>
</ul>
<a name="contribute-code" class="elem-anchor"></a>
<h4>Contribute Code</h4>
<ul>
<li><strong>File a bug report</strong><br />
Bug reports take little time to file and are very helpful to developers. This is one of the easiest contributions you can make. When you discover a problem with the IDE or the platform, please report it. Make sure you provide information about your environment (OS, JDK version), steps to reproduce the issue, as well as a written description of the problem. You can file a bug in our <a href="http://youtrack.jetbrains.net/issues/IDEA" data-bypass="yes" target="_blank"><span>YouTrack issue tracker</span></a>.
Before submitting an issue, please search for already submitted ones describing the same problem - and if you find one, feel free to vote for it.</li>
<li><strong>Help us triage existing bug reports</strong><br />
Over the years, users have submitted thousands of issues to the IntelliJ issue tracker. Many of the unresolved issues are no longer applicable to the latest version of IntelliJ IDEA, are duplicates, or require additional information to be resolved. Leaving comments notifying about the status of such issues helps the team keep the issue tracker clean and useful for everyone.</li>
<li><strong>Write a plug-in</strong><br />
One of the best ways to contribute a larger piece of code, adding extra functionality to IntelliJ IDEA, is by writing a plug-in. You can submit a plug-in to the <a href="http://plugins.intellij.net/" data-bypass="yes" target="_blank"><span>IntelliJ IDEA plug-in repository</span></a>, making it available for all IntelliJ IDEA users. When writing a plug-in, you have control over the code and dont need to sign the contribution agreement. For more information about writing plug-ins, visit the <a href="http://www.jetbrains.org/display/IJOS/Writing+Plug-ins" data-bypass="yes" target="_blank"><span>plug-in development documentation</span></a>.</li>
<li><strong>Submit a patch</strong><br />
If you would like to improve the code in the IntelliJ Platform or the core functionality of IntelliJ IDEA, you can submit a patch in <a href="http://youtrack.jetbrains.net/issues/IDEA" data-bypass="yes" target="_blank"><span>IntelliJs YouTrack bug database</span></a> . You can either file a new issue with the patch attached, or attach a patch to an issue submitted by another user. When writing a patch, please make sure to follow the <a href="intellij_coding_guidelines.html"><span>IntelliJ Coding Guidelines</span></a>.<br />
Alternatively, you can fork <a href="https://github.com/JetBrains/intellij-community" data-bypass="yes" target="_blank"><span>the IntelliJ IDEA repository on GitHub</span></a>, make the changes in your fork and send us a pull request.
A developer will review your patch and, if it meets the <a href="intellij_coding_guidelines.html"><span>quality criteria</span></a> and fits well with the rest of the code, youll be notified about the acceptance of the patch. You will also need to sign the <a href="http://www.jetbrains.org/display/IJOS/Contributor+Agreement" data-bypass="yes" target="_blank"><span>contribution agreement</span></a> in order to complete your contribution.</li>
<li><strong>Become a commiter and commit code directly</strong>
Developers with a long history of submitting high-quality patches can gain direct commit rights.</li>
</ul>
<div class="last-modified">
Last modified: 7 January 2016
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,110 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Plugin Structure / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/plugin_structure">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Plugin Structure</h1>
<p>Click the following topics to learn more about the plugin system structure and plugin lifecycles:</p>
<ul>
<li><a href="plugin_structure/plugin_content.html"><span>Plugin Content</span></a></li>
<li><a href="plugin_structure/plugin_class_loaders.html"><span>Plugin Class Loaders</span></a></li>
<li><a href="plugin_structure/plugin_components.html"><span>Plugin Components</span></a></li>
<li><a href="plugin_structure/plugin_extensions_and_extension_points.html"><span>Plugin Extensions and Extension Points</span></a></li>
<li><a href="plugin_structure/plugin_actions.html"><span>Plugin Actions</span></a></li>
<li><a href="plugin_structure/plugin_services.html"><span>Plugin Services</span></a></li>
<li><a href="plugin_structure/plugin_configuration_file.html"><span>Plugin Configuration File</span></a></li>
<li><a href="plugin_structure/plugin_dependencies.html"><span>Plugin Dependencies</span></a></li>
</ul>
<div class="last-modified">
Last modified: 23 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,101 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Plugin Actions / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/plugin_structure/plugin_actions">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Plugin Actions</h1>
<p>The <em>Intellij Platform</em> provides the concept of <em>actions</em>. An action is a class, derived from the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnAction.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">AnAction</code></span></a> class, whose <code class="code highlight language-text">actionPerformed</code> method is called when the menu item or toolbar button is selected.</p>
<p>The system of actions allows plugins to add their own items to IDEA menus and toolbars. Actions are organized into groups, which, in turn, can contain other groups. A group of actions can form a toolbar or a menu. Subgroups of the group can form submenus of a menu. You can find detailed information on how to create and register your actions in the <a href="/intellij/sdk/docs/basics/action_system.html"><span>IntelliJ Platform Action System</span></a>.</p>
<div class="last-modified">
Last modified: 30 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,101 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Plugin Class Loaders / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/plugin_structure/plugin_class_loaders">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Plugin Class Loaders</h1>
<p>A separate class loader is used to load the classes of each plugin. This allows each plugin to use a different version of a library, even if the same library is used by the IDE itself or by another plugin.</p>
<p>By default, the main IDE class loader loads classes that were not found in the plugin class loader. However, in the <code class="code highlight language-text">plugin.xml</code> file, you may use the <code class="code highlight language-text">&lt;depends&gt;</code> element to specify that a plugin depends on one or more other plugins. In this case the class loaders of those plugins will be used for classes not found in the current plugin. This allows a plugin to reference classes from other plugins.</p>
<div class="last-modified">
Last modified: 23 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,252 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Plugin Components / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/plugin_structure/plugin_components">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Plugin Components</h1>
<p>Components are the fundamental concept of plugin integration. There are three kinds of components:</p>
<ul>
<li><strong>Application level components</strong> are created and initialized when your IDE starts up. They can be acquired from the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/application/Application.java" data-bypass="yes" target="_blank"><span>Application</span></a> instance by using the <code class="code highlight language-text">getComponent(Class)</code> method.</li>
<li><strong>Project level components</strong> are created for each <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/project/Project.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">Project</code></span></a> instance in the IDE. (Please note that components may be created even for unopened projects.) They can be acquired from the <code class="code highlight language-text">Project</code> instance by using the <code class="code highlight language-text">getComponent(Class)</code> method.</li>
<li><strong>Module level components</strong> are created for each <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/module/Module.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">Module</code></span></a> inside every project loaded in the IDE.
Module level components can be acquired from a <code class="code highlight language-text">Module</code> instance with the <code class="code highlight language-text">getComponent(Class)</code> method.</li>
</ul>
<p>Every component should have interface and implementation classes specified in the configuration file. The interface class will be used for retrieving the component from other components, and the implementation class will be used for component instantiation.</p>
<p>Note that two components of the same level (<a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/application/Application.java" data-bypass="yes" target="_blank"><span>Application</span></a>, <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/project/Project.java" data-bypass="yes" target="_blank"><span>Project</span></a> or <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/module/Module.java" data-bypass="yes" target="_blank"><span>Module</span></a>) cannot have the same interface class. The same class may be specified for both interface and Implementation.</p>
<p>Each component has a unique name which is used for its externalization and other internal needs. The name of a component is returned by its <code class="code highlight language-text">getComponentName()</code> method.</p>
<a name="components-naming-notation" class="elem-anchor"></a>
<h2>Components naming notation<a href="#components-naming-notation" class="anchor-link"><span></span></a></h2>
<p>It is recommended to name components in the form <code class="code highlight language-text">&lt;plugin_name&gt;.&lt;component_name&gt;</code>.</p>
<a name="application-level-components" class="elem-anchor"></a>
<h2>Application level components<a href="#application-level-components" class="anchor-link"><span></span></a></h2>
<p>Optionally, an application level components implementation class may implement the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/components/ApplicationComponent.java" data-bypass="yes" target="_blank"><span>ApplicationComponent</span></a> interface.</p>
<p>An application component that has no dependencies should have a constructor with no parameters which will be used for its instantiation. If an application component depends on other application components, it can specify these components as constructor parameters. The <em>IntelliJ Platform</em> will ensure that the components are instantiated in the correct order to satisfy the dependencies.</p>
<p>Note that application level components must be registered in the <code class="code highlight language-text">&lt;application-components&gt;</code> section of the plugin.xml file (see <a href="plugin_configuration_file.html"><span>Plugin Configuration File</span></a>).</p>
<a name="quick-creation-of-application-components" class="elem-anchor"></a>
<h3>Quick creation of application components<a href="#quick-creation-of-application-components" class="anchor-link"><span></span></a></h3>
<p>The <em>IntelliJ Platform</em> suggests a simplified way to create application components, with all the required infrastructure.</p>
<p>The IntelliJ Platform interface will help you declare the application components implementation class, and will automatically make appropriate changes to the <code class="code highlight language-text">&lt;application-components&gt;</code> section of the <code class="code highlight language-text">plugin.xml</code> file.</p>
<p><strong>To create and register an application component:</strong></p>
<ol>
<li>In your project, open the context menu of the destination package and click <em>New</em> (or press <kbd>Alt</kbd>+<kbd>Insert</kbd>).</li>
<li>In the <em>New</em> menu, click <em>Application Component</em>.</li>
<li>In the <em>New Application Component</em> dialog box that opens, enter the application component name, and then click <em>OK</em>.</li>
</ol>
<p>The <em>IntelliJ Platform</em> will generate a new Java class that implements the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/components/ApplicationComponent.java" data-bypass="yes" target="_blank"><span>ApplicationComponent</span></a> interface. First register the newly created component in the <code class="code highlight language-text">plugin.xml</code> file, then add a node to the module tree view; and open the created application component class file in the editor.</p>
<a name="project-level-components" class="elem-anchor"></a>
<h2>Project level components<a href="#project-level-components" class="anchor-link"><span></span></a></h2>
<p>A project level components implementation class may implement the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/components/ProjectComponent.java" data-bypass="yes" target="_blank"><span>ProjectComponent</span></a> interface.</p>
<p>The constructor of a project level component can have a parameter of the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/project/Project.java" data-bypass="yes" target="_blank"><span>Project</span></a> type, if it needs the project instance. It can also specify other application-level or project-level components as parameters, if it depends on those components.</p>
<p>Note that project level components must be registered in the <code class="code highlight language-text">&lt;project-components&gt;</code> section of the <code class="code highlight language-text">plugin.xml</code> file (see <a href="plugin_configuration_file.html"><span>Plugin Configuration File</span></a>).</p>
<a name="quick-creation-of-project-components" class="elem-anchor"></a>
<h3>Quick creation of project components<a href="#quick-creation-of-project-components" class="anchor-link"><span></span></a></h3>
<p><!--TODO Link to demo source code -->
The <em>IntelliJ Platform</em> suggests a simplified way to create project components, with all the required infrastructure.</p>
<p>The IDEA interface will help you declare the project components implementation class, and will automatically make appropriate changes to the <code class="code highlight language-text">&lt;project-components&gt;</code> section of the <code class="code highlight language-text">plugin.xml</code> file.</p>
<p><strong>To create and register a project component</strong></p>
<ol>
<li>In your project, open the context menu of the destination package and click <em>New</em> (or press <kbd>Alt</kbd>+<kbd>Insert</kbd>).</li>
<li>In the <em>New</em> menu, click <em>Project Component</em>.</li>
<li>In the <em>New Project Component</em> dialog box that opens, enter the project component name, and then click <em>OK</em>.</li>
</ol>
<p>The <em>IntelliJ Platform</em> will generate a new Java class that implements the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/components/ProjectComponent.java" data-bypass="yes" target="_blank"><span>ProjectComponent</span></a> interface; register the newly created component in the <code class="code highlight language-text">plugin.xml</code> file; add a node to the module tree view; and open the created application component class file in the editor.</p>
<a name="module-level-components" class="elem-anchor"></a>
<h2>Module level components<a href="#module-level-components" class="anchor-link"><span></span></a></h2>
<p>Optionally, a module level components implementation class may implement the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/module/ModuleComponent.java" data-bypass="yes" target="_blank"><span>ModuleComponent</span></a> interface.</p>
<p>The constructor of a module level component can have a parameter of the Module type, if it needs the module instance. It can also specify other application level, project level or module level components as parameters, if it depends on those components.</p>
<p>Note that module level components must be registered in the <code class="code highlight language-text">&lt;module-components&gt;</code> section of the <code class="code highlight language-text">plugin.xml</code> file (see <a href="plugin_configuration_file.html"><span>Plugin Configuration File</span></a>).</p>
<a name="quick-creation-of-module-components" class="elem-anchor"></a>
<h3>Quick creation of module components<a href="#quick-creation-of-module-components" class="anchor-link"><span></span></a></h3>
<p>The <em>IntelliJ Platform</em> suggests a simplified way to create module components, with all the required infrastructure.</p>
<p>The IDEA interface will help you declare the module components implementation class, and will automatically make appropriate changes to the <code class="code highlight language-text">&lt;module-components&gt;</code> section of the <code class="code highlight language-text">plugin.xml</code> file.</p>
<p><em>To create and register a module component</em></p>
<ol>
<li>In your project, open the context menu of the destination package and click <em>New</em> (or press <kbd>Alt</kbd>+<kbd>Insert</kbd>).</li>
<li>In the <em>New</em> menu, click <em>Module Component</em>.</li>
<li>In the <em>New Module Component</em> dialog box that opens, enter the module component name, and then click <em>OK</em>.</li>
</ol>
<p>The <em>IntelliJ Platform</em> will generate a new Java class that implements the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/module/ModuleComponent.java" data-bypass="yes" target="_blank"><span>ModuleComponent</span></a> interface; register the newly created component in the <code class="code highlight language-text">plugin.xml</code> file; add a node to the module tree view; and open the created application component class file in the editor.</p>
<a name="persisting-the-state-of-components" class="elem-anchor"></a>
<h2>Persisting the state of components<a href="#persisting-the-state-of-components" class="anchor-link"><span></span></a></h2>
<p>The state of every component will be automatically saved and loaded if the components class implements the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/util/src/com/intellij/openapi/util/JDOMExternalizable.java" data-bypass="yes" target="_blank"><span>JDOMExternalizable</span></a> (deprecated) or <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/components/PersistentStateComponent.java" data-bypass="yes" target="_blank"><span>PersistentStateComponent</span></a> interface.</p>
<p>When the components class implements the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/components/PersistentStateComponent.java" data-bypass="yes" target="_blank"><span>PersistentStateComponent</span></a> interface, the component state is saved in an XML file that you can specify using the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/projectModel-api/src/com/intellij/openapi/components/State.java" data-bypass="yes" target="_blank"><span>@State</span></a> and <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/projectModel-api/src/com/intellij/openapi/components/Storage.java" data-bypass="yes" target="_blank"><span>@Storage</span></a> annotations in your Java code.</p>
<p>When the components class implements the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/util/src/com/intellij/openapi/util/JDOMExternalizable.java" data-bypass="yes" target="_blank"><span>JDOMExternalizable</span></a> interface, the components save their state in the following files:</p>
<ul>
<li>
<p>Project level components save their state to the project (<code class="code highlight language-text">.ipr</code>) file.</p>
<p>However, if the workspace option in the <code class="code highlight language-text">plugin.xml</code> file is set to <code class="code highlight language-text">true</code>, the component saves its configuration to the workspace (<code class="code highlight language-text">.iws</code>) file instead.</p>
</li>
<li>
<p>Module level components save their state to the module (<code class="code highlight language-text">.iml</code>) file.</p>
</li>
</ul>
<p>For more information and samples, refer to <a href="/intellij/sdk/docs/basics/persisting_state_of_components.html"><span>Persisting State of Components</span></a>.</p>
<a name="defaults" class="elem-anchor"></a>
<h2>Defaults<a href="#defaults" class="anchor-link"><span></span></a></h2>
<p>The defaults (a components predefined settings) should be placed in the <code class="code highlight language-text">&lt;component_name&gt;.xml</code> file. Place this file in the plugins classpath in the folder corresponding to the default package. The <code class="code highlight language-text">readExternal()</code> method will be called on the <code class="code highlight language-text">&lt;component&gt;</code> root tag.</p>
<p>If a component has defaults, the <code class="code highlight language-text">readExternal()</code> method is called twice:</p>
<ul>
<li>The first time for defaults</li>
<li>The second time for saved configuration</li>
</ul>
<a name="plugin-components-lifecycle" class="elem-anchor"></a>
<h2>Plugin components lifecycle<a href="#plugin-components-lifecycle" class="anchor-link"><span></span></a></h2>
<p>The components are loaded in the following order:</p>
<ul>
<li>Creation - constructor is invoked.</li>
<li>Initialization - the <code class="code highlight language-text">initComponent</code> method is invoked (if the component implements the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/components/ApplicationComponent.java" data-bypass="yes" target="_blank"><span>ApplicationComponent</span></a> interface).</li>
<li>Configuration - the <code class="code highlight language-text">readExternal</code> method is invoked (if the component implements <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/util/src/com/intellij/openapi/util/JDOMExternalizable.java" data-bypass="yes" target="_blank"><span>JDOMExternalizable</span></a> interface), or the <code class="code highlight language-text">loadState</code> method is invoked (if the component implements <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/components/PersistentStateComponent.java" data-bypass="yes" target="_blank"><span>PersistentStateComponent</span></a> and has non-default persisted state).</li>
<li>For module components, the <code class="code highlight language-text">moduleAdded</code> method of the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/module/ModuleComponent.java" data-bypass="yes" target="_blank"><span>ModuleComponent</span></a> interface is invoked to notify that a module has been added to the project.</li>
<li>For project components, the <code class="code highlight language-text">projectOpened</code> method of the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/components/ProjectComponent.java" data-bypass="yes" target="_blank"><span>ProjectComponent</span></a> interface is invoked to notify that a project has been loaded.</li>
</ul>
<p>The components are unloaded in the following order:</p>
<ul>
<li>Saving configuration - the <code class="code highlight language-text">writeExternal</code> method is invoked (if the component implements the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/util/src/com/intellij/openapi/util/JDOMExternalizable.java" data-bypass="yes" target="_blank"><span>JDOMExternalizable</span></a> interface), or the <code class="code highlight language-text">getState</code> method is invoked (if the component implements PersistentStateComponent).</li>
<li>Disposal - the <code class="code highlight language-text">disposeComponent</code> method is invoked.</li>
</ul>
<p>Note that you should not request any other components using the <code class="code highlight language-text">getComponent()</code> method in the constructor of your component, otherwise youll get an assertion. If you need access to other components when initializing your component, you can specify them as constructor parameters or access them in the <code class="code highlight language-text">initComponent</code> method.</p>
<div class="last-modified">
Last modified: 30 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,218 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Plugin Configuration File - plugin.xml / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/plugin_structure/plugin_configuration_file">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Plugin Configuration File - plugin.xml</h1>
<p>The following is a sample plugin configuration file. This sample showcases and describes all elements that can be used in the plugin.xml file.</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_xml"><span class="c">&lt;!-- url="" specifies the URL of the plugin homepage (displayed in the Welcome Screen and in "Plugins" settings dialog) --&gt;</span>
<span class="nt">&lt;idea-plugin</span> <span class="na">url=</span><span class="s">"http://www.jetbrains.com/idea"</span><span class="nt">&gt;</span>
<span class="c">&lt;!-- Plugin name --&gt;</span>
<span class="nt">&lt;name&gt;</span>VssIntegration<span class="nt">&lt;/name&gt;</span>
<span class="c">&lt;!-- Unique identifier of the plugin.
Cannot be changed between the plugin versions.
If not specified, assumed to be equal to &lt;name&gt;. --&gt;</span>
<span class="nt">&lt;id&gt;</span>VssIntegration<span class="nt">&lt;/id&gt;</span>
<span class="c">&lt;!-- Description of the plugin. --&gt;</span>
<span class="nt">&lt;description&gt;</span>Vss integration plugin<span class="nt">&lt;/description&gt;</span>
<span class="c">&lt;!-- Description of changes in the latest version of the plugin.
Displayed in the "Plugins" settings dialog and in the
plugin repository Web interface. --&gt;</span>
<span class="nt">&lt;change-notes&gt;</span>Initial release of the plugin.<span class="nt">&lt;/change-notes&gt;</span>
<span class="c">&lt;!-- Plugin version --&gt;</span>
<span class="nt">&lt;version&gt;</span>1.0<span class="nt">&lt;/version&gt;</span>
<span class="c">&lt;!-- The vendor of the plugin.
The optional "url" attribute specifies the URL of the vendor homepage.
The optional "email" attribute specifies the e-mail address of the vendor.
The optional "logo" attribute specifies the path within the plugin JAR
to a 16x16 icon to be displayed next to the plugin name in the welcome screen. --&gt;</span>
<span class="nt">&lt;vendor</span> <span class="na">url=</span><span class="s">"http://www.jetbrains.com"</span> <span class="na">email=</span><span class="s">"support@jetbrains.com"</span> <span class="na">logo=</span><span class="s">"icons/plugin.png"</span><span class="nt">&gt;</span>Foo Inc.<span class="nt">&lt;/vendor&gt;</span>
<span class="c">&lt;!-- The unique identifiers of the plugins on which this plugin depends. --&gt;</span>
<span class="nt">&lt;depends&gt;</span>MyFirstPlugin<span class="nt">&lt;/depends&gt;</span>
<span class="c">&lt;!-- Optional dependency on another plugin.
If the plugin with the "MySecondPlugin" ID is installed,
the contents of mysecondplugin.xml (the format of this file
conforms to the format of plugin.xml) will be loaded. --&gt;</span>
<span class="nt">&lt;depends</span> <span class="na">optional=</span><span class="s">"true"</span> <span class="na">config-file=</span><span class="s">"mysecondplugin.xml"</span><span class="nt">&gt;</span>MySecondPlugin<span class="nt">&lt;/depends&gt;</span>
<span class="c">&lt;!-- Allows a plugin to integrate its help system (in JavaHelp format)
with the IDEA help system. The "file" attribute specifies the name
of the JAR file in the "help" subdirectory of the plugin directory.
The "path" attribute specifies the name of the helpset file within
the JAR file.--&gt;</span>
<span class="nt">&lt;helpset</span> <span class="na">file=</span><span class="s">"myhelp.jar"</span> <span class="na">path=</span><span class="s">"/Help.hs"</span> <span class="nt">/&gt;</span>
<span class="c">&lt;!-- Minimum and maximum build of IDEA compatible with the plugin --&gt;</span>
<span class="nt">&lt;idea-version</span> <span class="na">since-build=</span><span class="s">"3000"</span> <span class="na">until-build=</span><span class="s">"3999"</span><span class="nt">/&gt;</span>
<span class="c">&lt;!-- Resource bundle from which the text of plugin descriptions,
action names and etc. will be loaded --&gt;</span>
<span class="nt">&lt;resource-bundle&gt;</span>messages.MyPluginBundle<span class="nt">&lt;/resource-bundle&gt;</span>
<span class="c">&lt;!-- Plugin's application components --&gt;</span>
<span class="nt">&lt;application-components&gt;</span>
<span class="nt">&lt;component&gt;</span>
<span class="c">&lt;!-- Component's interface class --&gt;</span>
<span class="nt">&lt;interface-class&gt;</span>com.foo.Component1Interface<span class="nt">&lt;/interface-class&gt;</span>
<span class="c">&lt;!-- Component's implementation class --&gt;</span>
<span class="nt">&lt;implementation-class&gt;</span>com.foo.impl.Component1Impl<span class="nt">&lt;/implementation-class&gt;</span>
<span class="nt">&lt;/component&gt;</span>
<span class="nt">&lt;/application-components&gt;</span>
<span class="c">&lt;!-- Plugin's project components --&gt;</span>
<span class="nt">&lt;project-components&gt;</span>
<span class="nt">&lt;component&gt;</span>
<span class="c">&lt;!-- Interface and implementation classes are the same --&gt;</span>
<span class="nt">&lt;interface-class&gt;</span>com.foo.Component2<span class="nt">&lt;/interface-class&gt;</span>
<span class="c">&lt;!-- If the "workspace" option is set "true", the component
saves its state to the .iws file instead of the .ipr file.
Note that the &lt;option&gt; element is used only if the component
implements the JDOMExternalizable interface. Otherwise, the
use of the &lt;option&gt; element takes no effect. --&gt;</span>
<span class="nt">&lt;option</span> <span class="na">name=</span><span class="s">"workspace"</span> <span class="na">value=</span><span class="s">"true"</span> <span class="nt">/&gt;</span>
<span class="c">&lt;!-- If the "loadForDefaultProject" tag is present, the project component is instantiated also for the default project. --&gt;</span>
<span class="nt">&lt;loadForDefaultProject&gt;</span>
<span class="nt">&lt;/component&gt;</span>
<span class="nt">&lt;/project-components&gt;</span>
<span class="c">&lt;!-- Plugin's module components --&gt;</span>
<span class="nt">&lt;module-components&gt;</span>
<span class="nt">&lt;component&gt;</span>
<span class="nt">&lt;interface-class&gt;</span>com.foo.Component3<span class="nt">&lt;/interface-class&gt;</span>
<span class="nt">&lt;/component&gt;</span>
<span class="nt">&lt;/module-components&gt;</span>
<span class="c">&lt;!-- Actions --&gt;</span>
<span class="nt">&lt;actions&gt;</span>
<span class="nt">&lt;action</span> <span class="na">id=</span><span class="s">"VssIntegration.GarbageCollection"</span> <span class="na">class=</span><span class="s">"com.foo.impl.CollectGarbage"</span> <span class="na">text=</span><span class="s">"Collect _Garbage"</span> <span class="na">description=</span><span class="s">"Run garbage collector"</span><span class="nt">&gt;</span>
<span class="nt">&lt;keyboard-shortcut</span> <span class="na">first-keystroke=</span><span class="s">"control alt G"</span> <span class="na">second-keystroke=</span><span class="s">"C"</span> <span class="na">keymap=</span><span class="s">"$default"</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/action&gt;</span>
<span class="nt">&lt;/actions&gt;</span>
<span class="c">&lt;!-- Extension points defined by the plugin.
Extension points are registered by a plugin so that other
plugins can provide this plugin with certain data. The
"beanClass" attribute specifies the class the implementations
of which can be used for the extension point. --&gt;</span>
<span class="nt">&lt;extensionPoints&gt;</span>
<span class="nt">&lt;extensionPoint</span> <span class="na">name=</span><span class="s">"testExtensionPoint"</span> <span class="na">beanClass=</span><span class="s">"com.foo.impl.MyExtensionBean"</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/extensionPoints&gt;</span>
<span class="c">&lt;!-- Extensions which the plugin adds to extension points
defined by the IDEA core or by other plugins.
The "defaultExtensionNs " attribute must be set to the
ID of the plugin defining the extension point, or to
"com.intellij" if the extension point is defined by the
IDEA core. The name of the tag within the &lt;extensions&gt;
tag matches the name of the extension point, and the
"implementation" class specifies the name of the class
added to the extension point. --&gt;</span>
<span class="nt">&lt;extensions</span> <span class="na">xmlns=</span><span class="s">"VssIntegration"</span><span class="nt">&gt;</span>
<span class="nt">&lt;testExtensionPoint</span> <span class="na">implementation=</span><span class="s">"com.foo.impl.MyExtensionImpl"</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/extensions&gt;</span>
<span class="nt">&lt;/idea-plugin&gt;</span>
</code></pre>
<div class="last-modified">
Last modified: 23 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,136 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Plugin Content / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/plugin_structure/plugin_content">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Plugin Content</h1>
<p>There are two possible ways of organizing plugin content:</p>
<ol>
<li>
<p>A plugin consisting of one <code class="code highlight language-text">.jar</code> file placed in the plugins directory:</p>
<p>The archive should contain the configuration file (<code class="code highlight language-text">META-INF/plugin.xml</code>) and classes that implement the plugin functionality. The configuration file specifies the plugin name, description, version, vendor, the supported IntelliJ IDEA version, plugin components, actions and action groups, and action user interface placement.</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_text">.IntelliJIDEAx0/
plugins/
sample.jar/
com/foo/...
...
...
META-INF/
plugin.xml
</code></pre>
</li>
<li>
<p>Plugin files located in a <code class="code highlight language-text">.jar</code> file that is placed in the lib folder:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_text">.IntelliJIDEAx0/
plugins/
Sample/
lib/
libfoo.jar
libbar.jar
Sample.jar/
com/foo/...
...
...
META-INF/
plugin.xml
</code></pre>
<p>All jars from the <code class="code highlight language-text">lib</code> folder are automatically added to the classpath.</p>
</li>
</ol>
<div class="last-modified">
Last modified: 15 December 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,117 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Plugin Dependencies / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/plugin_structure/plugin_dependencies">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Plugin Dependencies</h1>
<p>In your plugin, you may depend on classes from other plugins, either bundled, third-party or your own. In order to do so, you need to perform the following two steps:</p>
<ul>
<li>Add the jars of the plugin youre depending on to the classpath of your <em>IntelliJ Platform SDK</em>.</li>
</ul>
<aside class="warning">
<p> Do not add the plugin jars as a library: this will fail at runtime because IntelliJ Platform will load two separate copies of the dependency plugin classes.</p>
</aside>
<ul>
<li>Add a <code class="code highlight language-text">&lt;depends&gt;</code> tag to your plugin.xml, adding the ID of the plugin youre depending on as the contents of the tag.
For example:</li>
</ul>
<pre><code class="code-block__wrapper code-block _highlighted lang_xml"><span class="nt">&lt;depends&gt;</span>org.jetbrains.idea.maven<span class="nt">&lt;/depends&gt;</span>
</code></pre>
<p>To find out the ID of the plugin youre depending on, locate the <code class="code highlight language-text">META-INF/plugin.xml</code> file inside its jar and check the contents of the <code class="code highlight language-text">&lt;id&gt;</code> tag.</p>
<div class="last-modified">
Last modified: 23 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,206 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Plugin Extensions and Extension Points / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/plugin_structure/plugin_extensions_and_extension_points">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Plugin Extensions and Extension Points</h1>
<p>The <em>IntelliJ Platform</em> provides the concept of <em>extensions</em> and <em>extension points</em> that allows a plugin to interact with other plugins or with the IDE itself.</p>
<a name="extension-points" class="elem-anchor"></a>
<h2>Extension points<a href="#extension-points" class="anchor-link"><span></span></a></h2>
<p>If you want your plugin to allow other plugins to extend its functionality, in the plugin, you must declare one or several <em>extension points</em>. Each extension point defines a class or an interface that is allowed to access this point.</p>
<a name="extensions" class="elem-anchor"></a>
<h2>Extensions<a href="#extensions" class="anchor-link"><span></span></a></h2>
<p>If you want your plugin to extend the functionality of other plugins or the <em>IntelliJ Platform</em>, you must declare one or several <em>extensions</em>.</p>
<a name="how-to-declare-extensions-and-extension-points" class="elem-anchor"></a>
<h2>How to declare extensions and extension points<a href="#how-to-declare-extensions-and-extension-points" class="anchor-link"><span></span></a></h2>
<p>You can declare extensions and extension points in the plugin configuration file <code class="code highlight language-text">plugin.xml</code>, within the <code class="code highlight language-text">&lt;extensions&gt;</code> and <code class="code highlight language-text">&lt;extensionPoints&gt;</code> sections, respectively.</p>
<p><strong>To declare an extension point</strong></p>
<p>In the <code class="code highlight language-text">&lt;extensionPoints&gt;</code> section, insert a child element <code class="code highlight language-text">&lt;extensionPoint&gt;</code> that defines the extension point name and the name of a bean class or an interface that is allowed to extend the plugin functionality in the <code class="code highlight language-text">name</code>, <code class="code highlight language-text">beanClass</code> and <code class="code highlight language-text">interface</code> attributes, respectively.</p>
<p>To clarify this procedure, consider the following sample section of the plugin.xml file:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_xml"><span class="nt">&lt;extensionPoints&gt;</span>
<span class="nt">&lt;extensionPoint</span> <span class="na">name=</span><span class="s">"MyExtensionPoint1"</span> <span class="na">beanClass=</span><span class="s">"MyPlugin.MyBeanClass1"</span><span class="nt">&gt;</span>
<span class="nt">&lt;extensionPoint</span> <span class="na">name=</span><span class="s">"MyExtensionPoint2"</span> <span class="na">interface=</span><span class="s">"MyPlugin.MyInterface"</span><span class="nt">&gt;</span>
<span class="nt">&lt;/extensionPoints&gt;</span>
</code></pre>
<ul>
<li>The <code class="code highlight language-text">interface</code> attribute sets an interface the plugin that contributes to the extension point must implement.</li>
<li>The <code class="code highlight language-text">beanClass</code> attribute sets a bean class that specifies one or several properties annotated with the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/xml/dom-openapi/src/com/intellij/util/xml/Attribute.java" data-bypass="yes" target="_blank"><span>@Attribute</span></a> annotation.</li>
</ul>
<p>The plugin that contributes to the extension point will read those properties from the <code class="code highlight language-text">plugin.xml</code> file.</p>
<p>To clarify this, consider the following sample <code class="code highlight language-text">MyBeanClass1</code> bean class used in the above <code class="code highlight language-text">plugin.xml</code> file:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">MyBeanClass1</span> <span class="kd">extends</span> <span class="n">AbstractExtensionPointBean</span> <span class="o">{</span>
<span class="nd">@Attribute</span><span class="o">(</span><span class="s">"key"</span><span class="o">)</span>
<span class="kd">public</span> <span class="n">String</span> <span class="n">key</span><span class="o">;</span>
<span class="nd">@Attribute</span><span class="o">(</span><span class="s">"implementationClass"</span><span class="o">)</span>
<span class="kd">public</span> <span class="n">String</span> <span class="n">implementationClass</span><span class="o">;</span>
<span class="kd">public</span> <span class="n">String</span> <span class="nf">getKey</span><span class="o">()</span> <span class="o">{</span>
<span class="k">return</span> <span class="n">key</span><span class="o">;</span>
<span class="o">}</span>
<span class="kd">public</span> <span class="n">String</span> <span class="nf">getClass</span><span class="o">()</span> <span class="o">{</span>
<span class="k">return</span> <span class="n">implementationClass</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
</code></pre>
<p>Note that to declare an extension designed to access the <code class="code highlight language-text">MyExtensionPoint1</code> extension point, your <code class="code highlight language-text">plugin.xml</code> file must contain the <code class="code highlight language-text">&lt;MyExtensionPoint1&gt;</code> tag with the <code class="code highlight language-text">key</code> and <code class="code highlight language-text">implementationClass</code> attributes set to appropriate values (see sample below).</p>
<p><strong>To declare an extension</strong></p>
<ol>
<li>For the <code class="code highlight language-text">&lt;extensions&gt;</code> element, set the <code class="code highlight language-text">xmlns</code> (deprecated) or <code class="code highlight language-text">defaultExtensionNs</code> attribute to one of the following values:
<ul>
<li><code class="code highlight language-text">com.intellij</code>, if your plugin extends the IntelliJ Platform core functionality.</li>
<li><code class="code highlight language-text">{ID of a plugin}</code>, if your plugin extends a functionality of another plugin.</li>
</ul>
</li>
<li>Add a new child element to the <code class="code highlight language-text">&lt;extensions&gt;</code> element. The child element name must match the name of the extension point you want the extension to access.</li>
<li>Depending on the type of the extension point, do one of the following:
<ul>
<li>If the extension point was declared using the <code class="code highlight language-text">interface</code> attribute, for newly added child element, set the <code class="code highlight language-text">implementation</code> attribute to the name of the class that implements the specified interface.</li>
<li>If the extension point was declared using the <code class="code highlight language-text">beanClass</code> attribute, for newly added child element, set all attributes annotated with the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/xml/dom-openapi/src/com/intellij/util/xml/Attribute.java" data-bypass="yes" target="_blank"><span>@Attribute</span></a> annotations in the specified bean class.</li>
</ul>
</li>
</ol>
<p>To clarify this procedure, consider the following sample section of the <code class="code highlight language-text">plugin.xml</code> file that defines two extensions designed to access the <code class="code highlight language-text">appStarter</code> and <code class="code highlight language-text">applicationConfigurable</code> extension points in the <em>IntelliJ Platform</em> and one extension to access the <code class="code highlight language-text">MyExtensionPoint1</code> extension point in a test plugin:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_xml"><span class="c">&lt;!-- Declare extensions to access extension points in the IntelliJ Platform.
These extension points have been declared using the "interface" attribute.
--&gt;</span>
<span class="nt">&lt;extensions</span> <span class="na">defaultExtensionNs=</span><span class="s">"com.intellij"</span><span class="nt">&gt;</span>
<span class="nt">&lt;appStarter</span> <span class="na">implementation=</span><span class="s">"MyTestPackage.MyTestExtension1"</span> <span class="nt">/&gt;</span>
<span class="nt">&lt;applicationConfigurable</span> <span class="na">implementation=</span><span class="s">"MyTestPackage.MyTestExtension2"</span> <span class="nt">/&gt;</span>
<span class="nt">&lt;/extensions&gt;</span>
<span class="c">&lt;!-- Declare extensions to access extension points in a custom plugin
The MyExtensionPoint1 extension point has been declared using *beanClass* attribute.
--&gt;</span>
<span class="nt">&lt;extensions</span> <span class="na">defaultExtensionNs=</span><span class="s">"MyPluginID"</span><span class="nt">&gt;</span>
<span class="nt">&lt;MyExtensionPoint1</span> <span class="na">key=</span><span class="s">"keyValue"</span> <span class="na">implementationClass=</span><span class="s">"MyTestPackage.MyClassImpl"</span><span class="nt">&gt;&lt;/MyExtensionPoint1&gt;</span>
<span class="nt">&lt;/extensions&gt;</span>
</code></pre>
<a name="how-to-get-the-extension-points-list" class="elem-anchor"></a>
<h2>How to get the extension points list?<a href="#how-to-get-the-extension-points-list" class="anchor-link"><span></span></a></h2>
<p>To get a list of extension points available in the <em>IntelliJ Platform</em> core, consult the <code class="code highlight language-text">&lt;extensionPoints&gt;</code> section of the following XML configuration files:</p>
<ul>
<li><a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/platform-resources/src/META-INF/LangExtensionPoints.xml" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">LangExtensionPoints.xml</code></span></a></li>
<li><a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">PlatformExtensionPoints.xml</code></span></a></li>
<li><a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/platform-resources/src/META-INF/VcsExtensionPoints.xml" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">VcsExtensionPoints.xml</code></span></a></li>
</ul>
<a name="additional-information-and-samples" class="elem-anchor"></a>
<h2>Additional Information and Samples<a href="#additional-information-and-samples" class="anchor-link"><span></span></a></h2>
<p>For samples plugins and detailed instructions on how to create your plugin that contributes to the IDEA core, refer to Customizing the IDEA Settings Dialog and Creation of Tool Windows.</p>
<div class="last-modified">
Last modified: 15 December 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,165 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Plugin Services / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/plugin_structure/plugin_services">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Plugin Services</h1>
<p>The <em>IntelliJ Platform</em> provides the concept of <em>services</em>.</p>
<p>A <em>service</em> is a plugin component loaded on demand, when your plugin calls the <code class="code highlight language-text">getService</code> method of the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/components/ServiceManager.java" data-bypass="yes" target="_blank"><span>ServiceManager</span></a> class.</p>
<p>The <em>IntelliJ Platform</em> ensures that only one instance of a service is loaded even though the service is called several times. A service must have the interface and implementation classes specified in the <code class="code highlight language-text">plugin.xml</code> file. The service implementation class is used for service instantiation.</p>
<p>The <em>IntelliJ Platform</em> offers three types of services: <em>application level</em> services, <em>project level</em> services and <em>module level</em> services.</p>
<a name="how-to-declare-a-service" class="elem-anchor"></a>
<h2>How to Declare a Service?<a href="#how-to-declare-a-service" class="anchor-link"><span></span></a></h2>
<p>To declare a service, you can use the following extension points in the IDEA core:</p>
<ul>
<li><code class="code highlight language-text">applicationService</code>: designed to declare an application level service.</li>
<li><code class="code highlight language-text">projectService</code>: designed to declare a project level service.</li>
<li><code class="code highlight language-text">moduleService</code>: designed to declare a module level service.</li>
</ul>
<p><strong>To declare a service:</strong></p>
<ol>
<li>Add the appropriate child element (<code class="code highlight language-text">&lt;applicationService&gt;</code>, <code class="code highlight language-text">&lt;projectService&gt;</code> or <code class="code highlight language-text">&lt;moduleService&gt;</code>) to the <code class="code highlight language-text">&lt;extensions&gt;</code> section of the plugin.xml file.</li>
<li>For the newly added child element, set the following attributes:
<ul>
<li><code class="code highlight language-text">serviceInterface</code>: specifies the service interface class.</li>
<li><code class="code highlight language-text">serviceImplementation</code>: specifies the service implementation class.</li>
</ul>
</li>
</ol>
<p>Note that the interface and implementation classes can be the same.</p>
<p>To clarify the service declaration procedure, consider the following fragment of the <code class="code highlight language-text">plugin.xml</code> file:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_xml"><span class="nt">&lt;extensions</span> <span class="na">defaultExtensionNs=</span><span class="s">"com.intellij"</span><span class="nt">&gt;</span>
<span class="c">&lt;!-- Declare the application level service --&gt;</span>
<span class="nt">&lt;applicationService</span> <span class="na">serviceInterface=</span><span class="s">"Mypackage.MyServiceInterfaceClass"</span> <span class="na">serviceImplementation=</span><span class="s">"Mypackage.MyServiceImplClass"</span> <span class="nt">/&gt;</span>
<span class="c">&lt;!-- Declare the project level service --&gt;</span>
<span class="nt">&lt;projectService</span> <span class="na">serviceInterface=</span><span class="s">"Mypackage.MyProjectServiceInterfaceClass"</span> <span class="na">serviceImplementation=</span><span class="s">"Mypackage.MyProjectServiceImplClass"</span> <span class="nt">/&gt;</span>
<span class="nt">&lt;/extensions&gt;</span>
</code></pre>
<a name="retrieving-a-service" class="elem-anchor"></a>
<h2>Retrieving a service<a href="#retrieving-a-service" class="anchor-link"><span></span></a></h2>
<p>To instantiate your service, in Java code, use the following syntax:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="n">MyServiceImplClass</span> <span class="n">service</span> <span class="o">=</span> <span class="n">ServiceManager</span><span class="o">.</span><span class="na">getService</span><span class="o">(</span><span class="n">MyServiceImplClass</span><span class="o">.</span><span class="na">class</span><span class="o">);</span>
</code></pre>
<a name="sample-plugin" class="elem-anchor"></a>
<h3>Sample Plugin<a href="#sample-plugin" class="anchor-link"><span></span></a></h3>
<p>This section allows you to download and install a sample plugin illustrating how to create and use a plugin service. This plugin has a project component implementing a service that counts the number of currently opened projects in the IDE. If this number exceeds the maximum allowed number of simultaneously opened projects, the plugin returns an error message and closes the most recently opened project.</p>
<!-- TODO Replace with other plugin URL when available-->
<p><strong>To install and run the sample plugin</strong></p>
<ul>
<li>Download the included sample plugin project located <a href="https://github.com/JetBrains/intellij-sdk-docs/tree/master/code_samples/MaxOpenedProjects" data-bypass="yes" target="_blank"><span>here</span></a>.</li>
<li>Start <em>IntelliJ IDEA</em>, on the starting page, click <em>Open Project</em>, and then use the <em>Open Project</em> dialog box to open the project <em>MaxOpenedProjects</em>.</li>
<li>On the main menu, choose <em>Run | Run</em> or press <kbd>Shift</kbd>+<kbd>F10</kbd>.</li>
<li>If necessary, change the <a href="http://www.jetbrains.com/idea/help/run-debug-configuration-plugin.html" data-bypass="yes" target="_blank"><span>Run/Debug Configurations</span></a>.</li>
</ul>
<div class="last-modified">
Last modified: 3 December 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,406 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Project Structure / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/project_structure">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Project Structure</h1>
<!--TODO split into parts accordingly to the table of contents-->
<p>This topic considers the concept of projects based on <em>IntelliJ Platform</em> and related subjects, such as <em>modules</em>, <em>facets</em>, <em>libraries</em>, <em>SDK</em>. The project structure and Java classes you can use to manage projects and modules have been considered.</p>
<a name="project-and-its-components" class="elem-anchor"></a>
<h2>Project and its components<a href="#project-and-its-components" class="anchor-link"><span></span></a></h2>
<p>This section briefly discusses the IDEA project structure, project components and related terms. For more information about projects and their components, refer to <a href="http://www.jetbrains.com/idea/help/project.html" data-bypass="yes" target="_blank"><span>Project</span></a>, <a href="http://www.jetbrains.com/idea/help/module.html" data-bypass="yes" target="_blank"><span>Module</span></a>, <a href="http://www.jetbrains.com/idea/help/library.html" data-bypass="yes" target="_blank"><span>Library</span></a>, <a href="http://www.jetbrains.com/idea/help/facet.html" data-bypass="yes" target="_blank"><span>Facet</span></a> in the <em>IntelliJ IDEA</em> Web Help.</p>
<a name="project" class="elem-anchor"></a>
<h3>Project<a href="#project" class="anchor-link"><span></span></a></h3>
<p>In the <em>IntelliJ Platform</em>, a <em>project</em> encapsulates all your source code, libraries, and build instructions into a single organizational unit. Everything you do using the <em>IntelliJ Platform SDK</em> is done within the context of a project. A project defines collections referred to as <em>modules</em> and <em>libraries</em>. Depending on the logical and functional requirements to the project, you can create a <em>single-module</em> or a <em>multi-module</em> project.</p>
<a name="module" class="elem-anchor"></a>
<h3>Module<a href="#module" class="anchor-link"><span></span></a></h3>
<p>A <em>module</em> is a discrete unit of functionality that can be run, tested, and debugged independently. Modules includes such things as source code, build scripts, unit tests, deployment descriptors, etc. In the project, each module can use a specific SDK or inherit SDK defined on the project level (see the <a href="/intellij/sdk/docs/reference_guide/project_model/sdk.html"><span>SDK</span></a> section later in this document). A module can depend on other modules of the project.</p>
<a name="library" class="elem-anchor"></a>
<h3>Library<a href="#library" class="anchor-link"><span></span></a></h3>
<p>A <em>library</em> is an archive of compiled code (such as JAR files) that your modules depend on. The <em>IntelliJ Platform</em> supports three types of libraries:</p>
<ul>
<li><strong>Module Library</strong>: the library classes are visible only in this module and the library information is recorded in the module <code class="code highlight language-text">.iml</code> file.</li>
<li><strong>Project Library</strong>: the library classes are visible within the project and the library information is recorded in the project <code class="code highlight language-text">.ipr</code> file or in <code class="code highlight language-text">.idea/libraries</code>.</li>
<li><strong>Global Library</strong>: the library information is recorded in the <code class="code highlight language-text">applicationLibraries.xml</code> file into the <code class="code highlight language-text">~/.IntelliJIdea/config/options</code> directory. Global libraries are similar to project libraries, but are visible for the different projects.</li>
</ul>
<p>For more information about libraries, refer to <a href="http://www.jetbrains.com/idea/help/library.html" data-bypass="yes" target="_blank"><span>Library</span></a>.</p>
<a name="sdk" class="elem-anchor"></a>
<h3>SDK<a href="#sdk" class="anchor-link"><span></span></a></h3>
<p>Every project uses a Software Development Kit (<em>SDK</em>). For Java projects, SDK is referred to as JDK (Java Development Kit).</p>
<p>The SDK determines which API library is used to build the project. If your project is multi-module, the project SDK by default is common for all modules within the project.</p>
<p>Optionally, you can configure individual SDK for each module.</p>
<p>For more information about SDKs, see <a href="https://www.jetbrains.com/idea/help/configuring-global-project-and-module-sdks.html" data-bypass="yes" target="_blank"><span>Configuring Global, Project and Module SDKs</span></a> in the <em>IntelliJ IDEA</em> Web Help.</p>
<a name="facet" class="elem-anchor"></a>
<h3>Facet<a href="#facet" class="anchor-link"><span></span></a></h3>
<p>A <em>facet</em> represents certain configuration, specific for a particular framework/technology, associated with a module. A module can have multiple facets. E.g. Spring specific configuration is stored in a Spring facet.</p>
<p>For more information about facets see <a href="http://www.jetbrains.com/idea/help/facet.html" data-bypass="yes" target="_blank"><span>Facet</span></a> and <a href="http://www.jetbrains.com/idea/help/available-facets-and-their-dependencies.html" data-bypass="yes" target="_blank"><span>Facet Dependencies</span></a> in the <em>IntelliJ IDEA</em> Web Help.</p>
<a name="project-structure" class="elem-anchor"></a>
<h2>Project Structure<a href="#project-structure" class="anchor-link"><span></span></a></h2>
<p>From the plugin developers point of view, a project can be thought of as follows:</p>
<p><img src="project_structure/img/IntelliJIDEA_ProjectStructure.png" alt="Project Structure" /></p>
<p>A <strong>project</strong> consists of one or several <strong>modules</strong>. Each <strong>module</strong> includes the plugin source code and so called <strong>order entries</strong> that refer to <strong>SDK</strong> and <strong>libraries</strong> the module uses. By default, all modules uses the project SDK. In addition, a <strong>module</strong> can optionally have a set of <strong>facets</strong>.</p>
<p>This document explains how you can explore and change the structure of projects using API.</p>
<a name="working-with-projects" class="elem-anchor"></a>
<h2>Working with Projects<a href="#working-with-projects" class="anchor-link"><span></span></a></h2>
<p>This section explains how to complete some common tasks related to management of projects.
The Java classes and interfaces that you can use to explore and change the project contents are discussed.</p>
<a name="how-to-work-with-project-files" class="elem-anchor"></a>
<h3>How to Work with Project Files?<a href="#how-to-work-with-project-files" class="anchor-link"><span></span></a></h3>
<p>The <em>IntelliJ Platform</em> stores the project configuration data in XML files. The list of those files depends on the plugin <a href="http://www.jetbrains.com/idea/help/project.html" data-bypass="yes" target="_blank"><span>project format</span></a>.</p>
<p>For <em>file-based</em> format projects, the information core to the project itself (e.g. location of the component modules, compiler settings, etc.) is stored in the <code class="code highlight language-text">%project_name%.ipr</code> file.</p>
<p>The information about modules the project includes is stored in <code class="code highlight language-text">%module_name%.iml</code> files. Module files are created for each module.</p>
<p>For <em>directory-based</em> format projects, the project and workspace settings are stored in a number of XML files under the <code class="code highlight language-text">%project_home_directory%/.idea</code> directory. Each XML file is responsible for its own set of settings and can be recognized by its name: <code class="code highlight language-text">projectCodeStyle.xml</code>, <code class="code highlight language-text">encodings.xml</code>, <code class="code highlight language-text">vcs.xml</code> etc.</p>
<p>As for the file-based format projects, <code class="code highlight language-text">.iml</code> files describe modules.</p>
<p>To work with projects and project files, you can use the following classes and interfaces:</p>
<ul>
<li><a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/project/Project.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">Project</code></span></a> interface.</li>
<li><a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/projectModel-api/src/com/intellij/openapi/roots/ProjectRootManager.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">ProjectRootManager</code></span></a> abstract class.</li>
<li><a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/projectModel-api/src/com/intellij/openapi/project/ProjectManager.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">ProjectManager</code></span></a> abstract class.</li>
<li><a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/projectModel-api/src/com/intellij/openapi/roots/ProjectFileIndex.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">ProjectFileIndex</code></span></a> interface.</li>
</ul>
<p>Note that you dont need to access project files directly to load or save settings. See <a href="persisting_state_of_components.html"><span>Persisting State of Components</span></a> for more information.</p>
<p>Note that hereafter, the <code class="code highlight language-text">project</code> variable is of the <code class="code highlight language-text">Project</code> type. For example, for the opened project, you can get it from an action: <code class="code highlight language-text">Project project = e.getProject();</code></p>
<a name="how-do-i-get-a-list-of-source-roots-for-all-modules-in-my-project" class="elem-anchor"></a>
<h3>How do I get a list of source roots for all modules in my project?<a href="#how-do-i-get-a-list-of-source-roots-for-all-modules-in-my-project" class="anchor-link"><span></span></a></h3>
<p>Use the <code class="code highlight language-text">ProjectRootManager.getContentSourceRoots()</code> method. To clarify this, consider the following code snippet:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="n">String</span> <span class="n">projectName</span> <span class="o">=</span> <span class="n">project</span><span class="o">.</span><span class="na">getName</span><span class="o">();</span>
<span class="n">StringBuilder</span> <span class="n">sourceRootsList</span> <span class="o">=</span> <span class="k">new</span> <span class="n">StringBuilder</span><span class="o">();</span>
<span class="n">VirtualFile</span><span class="o">[]</span> <span class="n">vFiles</span> <span class="o">=</span> <span class="n">ProjectRootManager</span><span class="o">.</span><span class="na">getInstance</span><span class="o">(</span><span class="n">project</span><span class="o">).</span><span class="na">getContentSourceRoots</span><span class="o">();</span>
<span class="k">for</span> <span class="o">(</span><span class="n">VirtualFile</span> <span class="n">file</span> <span class="o">:</span> <span class="n">vFiles</span><span class="o">)</span> <span class="o">{</span>
<span class="n">sourceRootsList</span><span class="o">.</span><span class="na">append</span><span class="o">(</span><span class="n">file</span><span class="o">.</span><span class="na">getUrl</span><span class="o">()).</span><span class="na">append</span><span class="o">(</span><span class="s">"\n"</span><span class="o">);</span>
<span class="o">}</span>
<span class="n">Messages</span><span class="o">.</span><span class="na">showInfoMessage</span><span class="o">(</span><span class="s">"Source roots for the "</span> <span class="o">+</span> <span class="n">projectName</span> <span class="o">+</span> <span class="s">" plugin:\n"</span> <span class="o">+</span> <span class="n">sourceRootsList</span><span class="o">,</span> <span class="s">"Project Properties"</span><span class="o">);</span>
</code></pre>
<a name="how-do-i-check-whether-a-file-is-related-to-a-project" class="elem-anchor"></a>
<h3>How do I check whether a file is related to a project?<a href="#how-do-i-check-whether-a-file-is-related-to-a-project" class="anchor-link"><span></span></a></h3>
<p>The <em>IntelliJ Platform</em> provides the <code class="code highlight language-text">ProjectFileIndex</code> interface you can use to verify whether a file or directory is related to the specified IDEA project. This section explains how you can use this interface.</p>
<a name="how-do-i-get-an-instance-of-the-projectfileindex-interface" class="elem-anchor"></a>
<h4>How do I get an instance of the ProjectFileIndex interface?</h4>
<p>Use the <code class="code highlight language-text">ProjectRootManager.getFileIndex()</code> method. For example:
<code class="code highlight language-text">ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();</code></p>
<a name="how-do-i-get-a-module-to-which-a-file-belongs" class="elem-anchor"></a>
<h4>How do I get a module to which a file belongs?</h4>
<p>To determine a module in the project in question to which the specified <a href="architectural_overview/virtual_file.html"><span>virtual file</span></a> belongs, use the <code class="code highlight language-text">ProjectFileIndex.getModuleForFile(virtualFile)</code> method:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="n">Module</span> <span class="n">module</span> <span class="o">=</span> <span class="n">ProjectRootManager</span><span class="o">.</span><span class="na">getInstance</span><span class="o">(</span><span class="n">project</span><span class="o">).</span><span class="na">getFileIndex</span><span class="o">().</span><span class="na">getModuleForFile</span><span class="o">(</span><span class="n">virtualFile</span><span class="o">);</span>
</code></pre>
<p>Note that this method returns <code class="code highlight language-text">null</code> if the file does not belong to any module.</p>
<p>You can also use the <code class="code highlight language-text">ProjectFileIndex.getContentRootForFile</code> method to get the module content root to which the specified file or directory belongs:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="n">VirtualFile</span> <span class="n">moduleContentRoot</span> <span class="o">=</span> <span class="n">ProjectRootManager</span><span class="o">.</span><span class="na">getInstance</span><span class="o">(</span><span class="n">project</span><span class="o">).</span><span class="na">getFileIndex</span><span class="o">().</span><span class="na">getContentRootForFile</span><span class="o">(</span><span class="n">virtualFileorDirectory</span><span class="o">);</span>
</code></pre>
<a name="how-do-i-get-the-module-source-root-or-library-source-root-to-which-the-specified-file-or-directory-belongs" class="elem-anchor"></a>
<h4>How do I get the module source root or library source root to which the specified file or directory belongs?</h4>
<p>Use the <code class="code highlight language-text">ProjectFileIndex.getSourceRootForFile</code> method. For example:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="n">VirtualFile</span> <span class="n">moduleSourceRoot</span> <span class="o">=</span> <span class="n">ProjectRootManager</span><span class="o">.</span><span class="na">getInstance</span><span class="o">(</span><span class="n">project</span><span class="o">).</span><span class="na">getFileIndex</span><span class="o">().</span><span class="na">getSourceRootForFile</span><span class="o">(</span><span class="n">virtualFileorDirectory</span><span class="o">);</span>
</code></pre>
<p>Note that this method returns <code class="code highlight language-text">null</code> if the file or directory does not belong to any source root of modules in the project.</p>
<a name="how-do-i-check-whether-a-file-or-directory-is-related-to-the-project-libraries" class="elem-anchor"></a>
<h4>How do I check whether a file or directory is related to the project libraries?</h4>
<p>The <code class="code highlight language-text">ProjectFileIndex</code> interface implements a number of methods you can use to check whether the specified file belongs to the project library classes or library sources.</p>
<p>You can use the following methods:</p>
<ul>
<li><code class="code highlight language-text">ProjectFileIndex.isLibraryClassFile(virtualFile)</code>: Returns <code class="code highlight language-text">true</code> if the specified <code class="code highlight language-text">virtualFile</code> is a compiled class file.</li>
<li><code class="code highlight language-text">ProjectFileIndex.isInLibraryClasses(virtualFileorDirectory)</code>: Returns <code class="code highlight language-text">true</code> if the specified <code class="code highlight language-text">virtualFileorDirectory</code> belongs to library classes.</li>
<li><code class="code highlight language-text">ProjectFileIndex.isInLibrarySource(virtualFileorDirectory)</code>: Returns <code class="code highlight language-text">true</code> if the specified <code class="code highlight language-text">virtualFileorDirectory</code> belongs to library sources.</li>
</ul>
<a name="how-do-i-get-the-project-sdk" class="elem-anchor"></a>
<h4>How do I get the project SDK?</h4>
<ul>
<li>To get the project-level SDK: <code class="code highlight language-text">Sdk projectSDK = ProjectRootManager.getInstance(project).getProjectSdk();</code></li>
<li>To get the project-level SDK name: <code class="code highlight language-text">String projectSDKName = ProjectRootManager.getInstance(project).getProjectSdkName();</code></li>
</ul>
<a name="how-do-i-set-the-project-sdk" class="elem-anchor"></a>
<h4>How do I set the project SDK?</h4>
<ul>
<li>To set the project-level SDK: <code class="code highlight language-text">ProjectRootManager.getInstance(project).setProjectSdk(Sdk jdk);</code></li>
<li>To set the project-level SDK name: <code class="code highlight language-text">ProjectRootManager.getInstance(project).setProjectSdkName(String name);</code></li>
</ul>
<p>Note that by default, the project modules use the project SDK. Optionally, you can configure individual SDK for each module.</p>
<a name="working-with-modules" class="elem-anchor"></a>
<h2>Working with Modules<a href="#working-with-modules" class="anchor-link"><span></span></a></h2>
<p>The <em>IntelliJ Platform</em> provides a number of Java classes and interfaces you can use to work with modules:</p>
<ul>
<li><a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/projectModel-api/src/com/intellij/openapi/module/ModuleManager.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">ModuleManager</code></span></a> abstract class.</li>
<li><a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/module/Module.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">Module</code></span></a> interface.</li>
<li><a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/projectModel-api/src/com/intellij/openapi/roots/ModuleRootManager.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">ModuleRootManager</code></span></a> abstract class.</li>
<li><a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/projectModel-api/src/com/intellij/openapi/roots/ModuleRootModel.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">ModuleRootModel</code></span></a> interface.</li>
<li><a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/lang-api/src/com/intellij/openapi/module/ModuleUtil.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">ModuleUtil</code></span></a> class.</li>
<li><a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/projectModel-api/src/com/intellij/openapi/module/ModifiableModuleModel.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">ModifiableModuleModel</code></span></a> interface.</li>
<li><a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/projectModel-api/src/com/intellij/openapi/roots/ModifiableRootModel.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">ModifiableRootModel</code></span></a> interface.</li>
</ul>
<p>This section discusses how to complete some common tasks related to management of modules.</p>
<a name="how-do-i-get-a-list-of-modules-the-project-includes" class="elem-anchor"></a>
<h3>How do I get a list of modules the project includes?<a href="#how-do-i-get-a-list-of-modules-the-project-includes" class="anchor-link"><span></span></a></h3>
<p>Use the <code class="code highlight language-text">ModuleManager.getModules()</code> method.</p>
<a name="how-do-i-get-dependencies-and-classpath-of-a-module" class="elem-anchor"></a>
<h3>How do I get dependencies and classpath of a module?<a href="#how-do-i-get-dependencies-and-classpath-of-a-module" class="anchor-link"><span></span></a></h3>
<p><em>Order entries</em> include SDK, libraries and other modules the module uses. With the <em>IntelliJ IDEA</em> UI, you can view order entries for a module on the <a href="http://www.jetbrains.com/idea/help/dependencies-tab.html" data-bypass="yes" target="_blank"><span>Dependencies</span></a> tab of the <em>Project Structure</em> dialog box.</p>
<p>To explore the <a href="http://www.jetbrains.com/idea/help/dependencies-tab.html" data-bypass="yes" target="_blank"><span>module dependencies</span></a>, use the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/projectModel-api/src/com/intellij/openapi/roots/OrderEnumerator.java" data-bypass="yes" target="_blank"><span>OrderEnumerator</span></a> class.</p>
<p>The following code snippet illustrates how you can get classpath (classes root of all dependencies) for a module:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="n">VirtualFile</span><span class="o">[]</span> <span class="n">roots</span> <span class="o">=</span> <span class="n">ModuleRootManager</span><span class="o">.</span><span class="na">getInstance</span><span class="o">(</span><span class="n">module</span><span class="o">).</span><span class="na">orderEntries</span><span class="o">().</span><span class="na">classes</span><span class="o">().</span><span class="na">getRoots</span><span class="o">();</span>
</code></pre>
<a name="how-do-i-get-the-sdk-the-module-uses" class="elem-anchor"></a>
<h3>How do I get the SDK the module uses?<a href="#how-do-i-get-the-sdk-the-module-uses" class="anchor-link"><span></span></a></h3>
<p>Use the <code class="code highlight language-text">ModuleRootManager.getSdk()</code> method. This method returns a value of the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/projectModel-api/src/com/intellij/openapi/projectRoots/Sdk.java" data-bypass="yes" target="_blank"><span>Sdk</span></a> type.</p>
<p>The following code snippet illustrates how you can get detailed information on SDK the specified module uses:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="n">ModuleRootManager</span> <span class="n">moduleRootManager</span> <span class="o">=</span> <span class="n">ModuleRootManager</span><span class="o">.</span><span class="na">getInstance</span><span class="o">(</span><span class="n">module</span><span class="o">);</span>
<span class="n">Sdk</span> <span class="n">SDK</span> <span class="o">=</span> <span class="n">moduleRootManager</span><span class="o">.</span><span class="na">getSdk</span><span class="o">();</span>
<span class="n">String</span> <span class="n">jdkInfo</span> <span class="o">=</span> <span class="s">"Module: "</span> <span class="o">+</span> <span class="n">module</span><span class="o">.</span><span class="na">getName</span><span class="o">()</span> <span class="o">+</span> <span class="s">" SDK: "</span> <span class="o">+</span> <span class="n">SDK</span><span class="o">.</span><span class="na">getName</span><span class="o">()</span> <span class="o">+</span> <span class="s">" SDK version: "</span>
<span class="o">+</span> <span class="n">SDK</span><span class="o">.</span><span class="na">getVersionString</span><span class="o">()</span> <span class="o">+</span> <span class="s">" SDK home directory: "</span> <span class="o">+</span> <span class="n">SDK</span><span class="o">.</span><span class="na">getHomePath</span><span class="o">();</span>
</code></pre>
<a name="how-do-i-get-a-list-of-modules-on-which-this-module-directly-depends" class="elem-anchor"></a>
<h3>How do I get a list of modules on which this module directly depends?<a href="#how-do-i-get-a-list-of-modules-on-which-this-module-directly-depends" class="anchor-link"><span></span></a></h3>
<p>Use the <code class="code highlight language-text">ModuleRootManager.getDependencies()</code> method to get an array of the <code class="code highlight language-text">Module</code> type values or the <code class="code highlight language-text">ModuleRootManager.getDependencyModuleNames()</code> to get an array of module names. To clarify, consider the following code snippet:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="n">ModuleRootManager</span> <span class="n">moduleRootManager</span> <span class="o">=</span> <span class="n">ModuleRootManager</span><span class="o">.</span><span class="na">getInstance</span><span class="o">(</span><span class="n">module</span><span class="o">);</span>
<span class="n">Module</span><span class="o">[]</span> <span class="n">dependentModules</span> <span class="o">=</span> <span class="n">moduleRootManager</span><span class="o">.</span><span class="na">getDependencies</span><span class="o">();</span>
<span class="n">String</span><span class="o">[]</span> <span class="n">dependentModulesNames</span> <span class="o">=</span> <span class="n">moduleRootManager</span><span class="o">.</span><span class="na">getDependencyModuleNames</span><span class="o">();</span>
</code></pre>
<a name="how-do-i-get-a-list-of-modules-that-depend-on-this-module" class="elem-anchor"></a>
<h3>How do I get a list of modules that depend on this module?<a href="#how-do-i-get-a-list-of-modules-that-depend-on-this-module" class="anchor-link"><span></span></a></h3>
<p>Use the <code class="code highlight language-text">ModuleManager.getModuleDependentModules(module)</code> method.</p>
<p>Note that you can also check whether a module (<em>module1</em>) depends on another specified module (<em>module2</em>) using the <code class="code highlight language-text">ModuleManager.isModuleDependent</code> method in the following way:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="kt">boolean</span> <span class="n">isDependent</span> <span class="o">=</span> <span class="n">ModuleManager</span><span class="o">.</span><span class="na">getInstance</span><span class="o">(</span><span class="n">project</span><span class="o">).</span><span class="na">isModuleDependent</span><span class="o">(</span><span class="n">module1</span><span class="o">,</span><span class="n">module2</span><span class="o">);</span>
</code></pre>
<a name="how-do-i-get-a-module-to-which-the-specified-file-or-psi-element-belongs" class="elem-anchor"></a>
<h3>How do I get a module to which the specified file or PSI element belongs?<a href="#how-do-i-get-a-module-to-which-the-specified-file-or-psi-element-belongs" class="anchor-link"><span></span></a></h3>
<ul>
<li>
<p>To get the project module to which the specified file belongs, use the <code class="code highlight language-text">ModuleUtil.findModuleForFile()</code> static method.</p>
<p>To clarify, consider the following code snippet:</p>
<p><code class="code highlight language-text">java
String pathToFile = "C:\\users\\firstName.LastName\\plugins\\myPlugin\src\MyAction.java";
VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(pathToFile);
Module module = ModuleUtil.findModuleForFile(virtualFile,myProject);
String moduleName = module == null ? "Module not found" : module.getName();
</code></p>
</li>
<li>
<p>To get the project module to which the specified <a href="architectural_overview/psi_elements.html"><span>PSI element</span></a> belongs, use the <code class="code highlight language-text">ModuleUtil.findModuleForPsiElement(psiElement)</code> method.</p>
</li>
</ul>
<a name="how-do-i-work-with-libraries-available-within-a-module" class="elem-anchor"></a>
<h3>How do I work with libraries available within a module?<a href="#how-do-i-work-with-libraries-available-within-a-module" class="anchor-link"><span></span></a></h3>
<a name="how-do-i-get-a-list-of-libraries-available-within-a-module" class="elem-anchor"></a>
<h4>How do I get a list of libraries available within a module?</h4>
<p>To get the list of libraries, use <code class="code highlight language-text">OrderEnumerator.forEachLibrary</code> method.
To clarify this, consider the following code snippet that illustrates how to output the list of libraries for the specified module:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="kd">final</span> <span class="n">List</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">libraryNames</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;();</span>
<span class="n">ModuleRootManager</span><span class="o">.</span><span class="na">getInstance</span><span class="o">(</span><span class="n">module</span><span class="o">).</span><span class="na">orderEntries</span><span class="o">().</span><span class="na">forEachLibrary</span><span class="o">(</span><span class="k">new</span> <span class="n">Processor</span><span class="o">&lt;</span><span class="n">Library</span><span class="o">&gt;()</span> <span class="o">{</span>
<span class="nd">@Override</span>
<span class="kd">public</span> <span class="kt">boolean</span> <span class="nf">process</span><span class="o">(</span><span class="n">Library</span> <span class="n">library</span><span class="o">)</span> <span class="o">{</span>
<span class="n">libraryNames</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">library</span><span class="o">.</span><span class="na">getName</span><span class="o">());</span>
<span class="k">return</span> <span class="kc">true</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">});</span>
<span class="n">Messages</span><span class="o">.</span><span class="na">showInfoMessage</span><span class="o">(</span><span class="n">StringUtil</span><span class="o">.</span><span class="na">join</span><span class="o">(</span><span class="n">libraryNames</span><span class="o">,</span> <span class="s">"\n"</span><span class="o">),</span> <span class="s">"Libraries in Module"</span><span class="o">);</span>
</code></pre>
<p>This sample code outputs a list of libraries for the <code class="code highlight language-text">module</code> module.</p>
<a name="how-do-i-get-the-library-content" class="elem-anchor"></a>
<h4>How do I get the library content?</h4>
<p>The <code class="code highlight language-text">Library</code> class provides the <code class="code highlight language-text">getUrls</code> method you can use to get a list of source roots and classes the library includes. To clarify, consider the following code snippet:</p>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="n">StringBuilder</span> <span class="n">roots</span> <span class="o">=</span> <span class="k">new</span> <span class="n">StringBuilder</span><span class="o">(</span><span class="s">"The "</span> <span class="o">+</span> <span class="n">lib</span><span class="o">.</span><span class="na">getName</span><span class="o">()</span> <span class="o">+</span> <span class="s">" library includes:\n"</span><span class="o">);</span>
<span class="n">roots</span><span class="o">.</span><span class="na">append</span><span class="o">(</span><span class="s">"Sources:\n"</span><span class="o">);</span>
<span class="k">for</span> <span class="o">(</span><span class="n">String</span> <span class="n">each</span> <span class="o">:</span> <span class="n">lib</span><span class="o">.</span><span class="na">getUrls</span><span class="o">(</span><span class="n">OrderRootType</span><span class="o">.</span><span class="na">SOURCES</span><span class="o">))</span> <span class="o">{</span>
<span class="n">roots</span><span class="o">.</span><span class="na">append</span><span class="o">(</span><span class="n">each</span><span class="o">).</span><span class="na">append</span><span class="o">(</span><span class="s">"\n"</span><span class="o">);</span>
<span class="o">}</span>
<span class="n">roots</span><span class="o">.</span><span class="na">append</span><span class="s">"Classes:\n"</span><span class="o">);</span>
<span class="k">for</span> <span class="o">(</span><span class="n">String</span> <span class="n">each</span> <span class="o">:</span> <span class="n">lib</span><span class="o">.</span><span class="na">getUrls</span><span class="o">(</span><span class="n">OrderRootType</span><span class="o">.</span><span class="na">CLASSES</span><span class="o">))</span> <span class="o">{</span>
<span class="n">strRoots</span><span class="o">.</span><span class="na">append</span><span class="o">(</span><span class="n">each</span><span class="o">).</span><span class="na">append</span><span class="o">(</span><span class="s">"\n"</span><span class="o">);</span>
<span class="o">}</span>
<span class="n">Messages</span><span class="o">.</span><span class="na">showInfoMessage</span><span class="o">(</span><span class="n">roots</span><span class="o">.</span><span class="na">toString</span><span class="o">(),</span> <span class="s">"Library Info"</span><span class="o">);</span>
</code></pre>
<p>In this sample code, <code class="code highlight language-text">lib</code> is of the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/projectModel-api/src/com/intellij/openapi/roots/libraries/Library.java" data-bypass="yes" target="_blank"><span>Library</span></a> type.</p>
<a name="how-do-i-get-a-set-of-facets-the-module-includes" class="elem-anchor"></a>
<h3>How do I get a set of facets the module includes?<a href="#how-do-i-get-a-set-of-facets-the-module-includes" class="anchor-link"><span></span></a></h3>
<p>Use the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/lang-api/src/com/intellij/facet/FacetManager.java" data-bypass="yes" target="_blank"><span>FacetManager</span></a> and <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/lang-api/src/com/intellij/facet/Facet.java" data-bypass="yes" target="_blank"><span>Facet</span></a> classes.</p>
<div class="last-modified">
Last modified: 13 December 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

154
basics/psi_cookbook.html Normal file
View File

@ -0,0 +1,154 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>PSI Cookbook / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/psi_cookbook">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>PSI Cookbook</h1>
<p>This page gives a list of recipes for the most common operations for working with the PSI (Program Structure Interface). Unlike <a href="/intellij/sdk/docs/reference_guide/custom_language_support.html"><span>Developing Custom Language Plugins</span></a>, it talks about working with the PSI of existing languages (such as Java).</p>
<a name="how-do-i-find-a-file-if-i-know-its-name-but-dont-know-the-path" class="elem-anchor"></a>
<h2>How do I find a file if I know its name but dont know the path?<a href="#how-do-i-find-a-file-if-i-know-its-name-but-dont-know-the-path" class="anchor-link"><span></span></a></h2>
<p><code class="code highlight language-text">FilenameIndex.getFilesByName()</code></p>
<a name="how-do-i-find-where-a-particular-psi-element-is-used" class="elem-anchor"></a>
<h2>How do I find where a particular PSI element is used?<a href="#how-do-i-find-where-a-particular-psi-element-is-used" class="anchor-link"><span></span></a></h2>
<p><code class="code highlight language-text">ReferencesSearch.search()</code></p>
<a name="how-do-i-rename-a-psi-element" class="elem-anchor"></a>
<h2>How do I rename a PSI element?<a href="#how-do-i-rename-a-psi-element" class="anchor-link"><span></span></a></h2>
<p><code class="code highlight language-text">RefactoringFactory.createRename()</code></p>
<a name="how-can-i-cause-the-psi-for-a-virtual-file-to-be-rebuilt" class="elem-anchor"></a>
<h2>How can I cause the PSI for a virtual file to be rebuilt?<a href="#how-can-i-cause-the-psi-for-a-virtual-file-to-be-rebuilt" class="anchor-link"><span></span></a></h2>
<p><code class="code highlight language-text">FileContentUtil.reparseFiles()</code></p>
<a name="java-specific" class="elem-anchor"></a>
<h2>Java Specific<a href="#java-specific" class="anchor-link"><span></span></a></h2>
<a name="how-do-i-find-all-inheritors-of-a-class" class="elem-anchor"></a>
<h3>How do I find all inheritors of a class?<a href="#how-do-i-find-all-inheritors-of-a-class" class="anchor-link"><span></span></a></h3>
<p><code class="code highlight language-text">ClassInheritorsSearch.search()</code></p>
<a name="how-do-i-find-a-class-by-qualified-name" class="elem-anchor"></a>
<h3>How do I find a class by qualified name?<a href="#how-do-i-find-a-class-by-qualified-name" class="anchor-link"><span></span></a></h3>
<p><code class="code highlight language-text">JavaPsiFacade.findClass()</code></p>
<a name="how-do-i-find-a-class-by-short-name" class="elem-anchor"></a>
<h3>How do I find a class by short name?<a href="#how-do-i-find-a-class-by-short-name" class="anchor-link"><span></span></a></h3>
<p><code class="code highlight language-text">PsiShortNamesCache.getInstance().getClassesByName()</code></p>
<a name="how-do-i-find-a-superclass-of-a-java-class" class="elem-anchor"></a>
<h3>How do I find a superclass of a Java class?<a href="#how-do-i-find-a-superclass-of-a-java-class" class="anchor-link"><span></span></a></h3>
<p><code class="code highlight language-text">PsiClass.getSuperClass()</code></p>
<a name="how-do-i-get-a-reference-to-the-containing-package-of-a-java-class" class="elem-anchor"></a>
<h3>How do I get a reference to the containing package of a Java class?<a href="#how-do-i-get-a-reference-to-the-containing-package-of-a-java-class" class="anchor-link"><span></span></a></h3>
<pre><code class="code-block__wrapper code-block _highlighted lang_java"><span class="n">PsiJavaFile</span> <span class="n">javaFile</span> <span class="o">=</span> <span class="o">(</span><span class="n">PsiJavaFile</span><span class="o">)</span> <span class="n">psiClass</span><span class="o">.</span><span class="na">getContaningFile</span><span class="o">();</span>
<span class="n">PsiPackage</span> <span class="n">pkg</span> <span class="o">=</span> <span class="n">JavaPsiFacade</span><span class="o">.</span><span class="na">getInstance</span><span class="o">(</span><span class="n">project</span><span class="o">).</span><span class="na">findPackage</span><span class="o">(</span><span class="n">javaFile</span><span class="o">.</span><span class="na">getPackageName</span><span class="o">());</span>
</code></pre>
<a name="how-do-i-find-the-methods-overriding-a-specific-method" class="elem-anchor"></a>
<h3>How do I find the methods overriding a specific method?<a href="#how-do-i-find-the-methods-overriding-a-specific-method" class="anchor-link"><span></span></a></h3>
<p><code class="code highlight language-text">OverridingMethodsSearch.search()</code></p>
<div class="last-modified">
Last modified: 23 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,114 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Run Configurations / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/run_configurations">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Run Configurations</h1>
<p><em>Run Configurations</em> allow users to run a certain type of external processes from within the IDE, e.g. a script, an application, a server, etc. You can provide UI for the user to specify execution options, as well as an option to create a run configuration based on a specific location in the source code.</p>
<a name="architectural-overview" class="elem-anchor"></a>
<h1>Architectural overview<a href="#architectural-overview" class="anchor-link"><span></span></a></h1>
<p>Classes used to manipulate run configurations can be split into the following groups:</p>
<ul>
<li><a href="/intellij/sdk/docs/basics/run_configurations/run_configuration_management.html"><span>Run configuration management</span></a>. This includes creation, persistence, and modification.</li>
<li><a href="/intellij/sdk/docs/basics/run_configurations/run_configuration_execution.html"><span>Execution</span></a>.</li>
</ul>
<p>This diagram shows the main classes:</p>
<p><img src="img/classes.png" alt="Architecture" /></p>
<div class="last-modified">
Last modified: 24 November 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

View File

@ -0,0 +1,155 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Execution / IntelliJ Platform SDK DevGuide</title>
<link rel="stylesheet" href="/intellij/sdk/docs/app/css/styles.min.css">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-72x72.png" sizes="72x72">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-114x114.png" sizes="114x114">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/intellij/sdk/docs/apple-touch-icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/intellij/sdk/docs/apple-touch-icon-precomposed.png">
<!-- normal favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/intellij/sdk/docs/favicon.ico">
<link rel="icon" type="image/png" href="/intellij/sdk/docs/favicon.png">
<link rel="stylesheet" href="/intellij/sdk/docs/styles/styles.css"></head>
<body data-id="basics/run_configurations/run_configuration_execution">
<div class="wrapper">
<section class="panel _nav">
<header class="panel__header">
<div class="container">
<form class="search-box">
<label for="search-box__input" class="search-box__label">
<input type="text" class="search-box__input" id="search-box__input" placeholder="Search IntelliJ Platform SDK DevGuide">
</label>
<div class="search-box__clear" title="Clear"></div>
</form>
</div>
</header>
<nav class="panel__content">
<div class="container _nav">
<menu class="nav-tree"></menu>
</div>
<div class="container _footer panel__footer">
<p><a href="https://youtrack.jetbrains.com/issues/IJSDK">Send feedback</a></p>
<p>&copy; 2000&ndash;2016 <a href="//www.jetbrains.com">JetBrains</a> s.r.o.<br>
All rights reserved.</p>
</div>
</nav>
</section>
<main class="panel _main" role="main">
<header class="panel__header">
<div class="container">
<h3>IntelliJ Platform SDK DevGuide</h3>
<div class="shortcuts-switcher"><label for="switch-shortcuts">Keymap:</label><select id="switch-shortcuts" class="select _shortcuts" height="1">
<option data-group="primary" value="default" selected>Default</option>
<option data-group="primary" value="default_for_gnome">GNOME</option>
<option data-group="primary" value="default_for_kde">KDE</option>
<option data-group="primary" value="default_for_xwin">XWindow</option>
<option data-group="primary" value="emacs">Emacs</option>
<option data-group="primary" value="jbuilder">JBuilder</option>
<option data-group="primary" value="visual_studio">Visual Studio</option>
<option data-group="primary" value="netbeans_6.5">NetBeans 6.5</option>
<option data-group="primary" value="eclipse">Eclipse</option>
<option data-group="secondary" value="mac_os_x_10.5_">OS X 10.5+</option>
<option data-group="secondary" value="mac_os_x">OS X</option>
<option data-group="secondary" value="eclipse_mac_os_x">OS X Eclipse</option></select>
</div>
<div class="panel-trigger"></div>
</div>
</header>
<section class="panel__content">
<div class="container">
<article class="article" data-shortcut-switcher="false">
<h1>Execution</h1>
<p>The standard execution of a run action goes through the following steps:</p>
<ul>
<li>The user selects a <em>run configuration</em> (for example, by choosing one from the run configurations combobox) and an <em>executor</em> (for example, by pressing a toolbar button created by the executor).</li>
<li>The <em>program runner</em> that will actually execute the process is selected, by polling all registered program runners and asking whether they can run the specified run profile with the specified executor ID.</li>
<li>The <code class="code highlight language-text">ExecutionEnvironment</code> object is created. This object aggregates all the settings required to execute the process, as well as the selected <code class="code highlight language-text">ProgramRunner</code>.</li>
<li><code class="code highlight language-text">ProgramRunner.execute()</code> is called, receiving the executor and the execution environment.</li>
</ul>
<p>Implementations of <code class="code highlight language-text">ProgramRunner.execute()</code> go through the following steps to execute the process:</p>
<ul>
<li><code class="code highlight language-text">RunProfile.getState()</code> method is called to create a <code class="code highlight language-text">RunProfileState</code> object, describing a process about to be started. At this stage, the command line parameters, environment variables and other information required to start the process is initialized.</li>
<li><code class="code highlight language-text">RunProfileState.execute()</code> is called. It starts the process, attaches a <code class="code highlight language-text">ProcessHandler</code> to its input and output streams, creates a console to display the process output, and returns an <code class="code highlight language-text">ExecutionResult</code> object aggregating the console and the process handler.</li>
<li>The <code class="code highlight language-text">RunContentBuilder</code> object is created and invoked to display the execution console in a tab of the Run or Debug toolwindow.</li>
</ul>
<a name="executor" class="elem-anchor"></a>
<h2>Executor<a href="#executor" class="anchor-link"><span></span></a></h2>
<p>The <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/lang-api/src/com/intellij/execution/Executor.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">Executor</code></span></a> interface describes a specific way of executing any possible run configuration.</p>
<p>The three default executors provided by the <em>IntelliJ Platform</em> by default are <em>Run</em>, <em>Debug</em> and <em>Run with Coverage</em>. Each executor gets its own toolbar button, which starts the selected run configuration using this executor, and its own context menu item for starting a configuration using this executor.</p>
<p>As a plugin developer, you normally dont need to implement the <code class="code highlight language-text">Executor</code> interface. However, it can be useful, for example, if youre implementing a profiler integration and want to provide the possibility to execute any configuration with profiling.</p>
<a name="running-a-process" class="elem-anchor"></a>
<h2>Running a process<a href="#running-a-process" class="anchor-link"><span></span></a></h2>
<p>The <code class="code highlight language-text">RunProfileState</code> interface comes up in every run configuration implementation as the return value <code class="code highlight language-text">RunProfile.getState()</code>. It describes a process which is ready to be started and holds the information like the command line, current working directory, and environment variables for the process to be started. (The existence of <code class="code highlight language-text">RunProfileState</code> as a separate step in the execution flow allows run configuration extensions and other components to patch the configuration and to modify the parameters before it gets executed.)</p>
<p>The standard base class used as implementation of <code class="code highlight language-text">RunProfileState</code> is <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/lang-api/src/com/intellij/execution/configurations/CommandLineState.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">CommandLineState</code></span></a>. It contains the logic for putting together a running process and a console into an <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/lang-api/src/com/intellij/execution/ExecutionResult.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">ExecutionResult</code></span></a>, but doesnt know anything how the process is actually started. For starting the process, its best to use the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">GeneralCommandLine</code></span></a> class, which takes care of setting up the command line parameters and executing the process.</p>
<p>Alternatively, if the process you need to run is a JVM-based one, you can use the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/java/execution/openapi/src/com/intellij/execution/configurations/JavaCommandLineState.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">JavaCommandLineState</code></span></a> base class. It knows about the command line parameters of the JVM and can take care of details like calculating the classpath for the JVM.</p>
<p>To monitor the execution of a process and capture its output, the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">OSProcessHandler</code></span></a> class is normally used. Once youve created an instance of <code class="code highlight language-text">OSProcessHandler</code> from either a command line or a Process object, you need to call the <code class="code highlight language-text">startNotify()</code> method to start capturing its output. You may also want to attach a <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/platform-api/src/com/intellij/execution/process/ProcessTerminatedListener.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">ProcessTerminatedListener</code></span></a> to the <code class="code highlight language-text">OSProcessHandler</code>, so that the exit status of the process will be displayed in the console.</p>
<a name="displaying-the-process-output" class="elem-anchor"></a>
<h2>Displaying the process output<a href="#displaying-the-process-output" class="anchor-link"><span></span></a></h2>
<p>If youre using <code class="code highlight language-text">CommandLineState</code>, a console view will be automatically created and attached to the output of the process. Alternatively, you can arrange this yourself:</p>
<ul>
<li><code class="code highlight language-text">TextConsoleBuilderFactory.createBuilder(project).getConsole()</code> creates a <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/lang-api/src/com/intellij/execution/ui/ConsoleView.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">ConsoleView</code></span></a> instance</li>
<li><code class="code highlight language-text">ConsoleView.attachToProcess()</code> attaches it to the output of a process.</li>
</ul>
<p>If the process youre running uses ANSI escape codes to color its output, the <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/platform-api/src/com/intellij/execution/process/ColoredProcessHandler.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">ColoredProcessHandler</code></span></a> class will parse it and display the colors in the IntelliJ console.</p>
<p>Console <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/lang-api/src/com/intellij/execution/filters/Filter.java" data-bypass="yes" target="_blank"><span>filters</span></a> allow you to convert certain strings found in the process output to clickable hyperlinks. To attach a filter to the console, use <code class="code highlight language-text">CommandLineState.addConsoleFilters()</code> or, if youre creating a console manually, <code class="code highlight language-text">TextConsoleBuilder.addFilter()</code>.</p>
<p>Two common filter implementations you may want to reuse are <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/lang-api/src/com/intellij/execution/filters/RegexpFilter.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">RegexpFilter</code></span></a> and <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/lang-api/src/com/intellij/execution/filters/UrlFilter.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">UrlFilter</code></span></a>.</p>
<a name="starting-a-run-configuration-from-code" class="elem-anchor"></a>
<h2>Starting a run configuration from code<a href="#starting-a-run-configuration-from-code" class="anchor-link"><span></span></a></h2>
<p>If you have an existing run configuration that you need to execute, the easiest way to do so is to use <a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/lang-impl/src/com/intellij/execution/ProgramRunnerUtil.java" data-bypass="yes" target="_blank"><span><code class="code highlight language-text">ProgramRunnerUtil.executeConfiguration()</code></span></a><!--#L110-->. The method takes a <code class="code highlight language-text">Project</code>, a <code class="code highlight language-text">RunnerAndConfigurationSettings</code>, as well as an <code class="code highlight language-text">Executor</code>. To get the <code class="code highlight language-text">RunnerAndConfigurationSettings</code> for an existing configuration, you can use, for example, <code class="code highlight language-text">RunManager.getConfigurationSettings(ConfigurationType)</code>. As the last parameter, you normally pass either <code class="code highlight language-text">DefaultRunExecutor.getRunExecutorInstance()</code> or <code class="code highlight language-text">DefaultDebugExecutor.getDebugExecutorInstance()</code>.</p>
<div class="last-modified">
Last modified: 21 December 2015
</div>
</article>
<section class="disqus">
<div id="disqus_thread"></div>
</section>
</div>
</section>
</main>
</div>
<script data-main="/intellij/sdk/docs/app/js/main.build" data-baseurl="/intellij/sdk/docs/" src="/intellij/sdk/docs/app/js/vendor/requirejs/require.js"></script>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More