Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
citizenmatt committed Sep 24, 2015
2 parents 07320b9 + 628888d commit ab39230
Show file tree
Hide file tree
Showing 34 changed files with 127 additions and 126 deletions.
2 changes: 1 addition & 1 deletion _SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* [Quick Start Guide](basics.md)
* [Main Types of Plugins](basics/types_of_plugins.md)
* [Creating Your First Plugin](basics/getting_started.md)
* [Setting Up Development Environment](basics/getting_started/setting_up_environment.md)
* [Setting Up a Development Environment](basics/getting_started/setting_up_environment.md)
* [Creating a Plugin Project](basics/getting_started/creating_plugin_project.md)
* [Build Number Ranges](basics/getting_started/build_number_ranges.md)
* [Creating an Action](basics/getting_started/creating_an_action.md)
Expand Down
2 changes: 1 addition & 1 deletion basics/architectural_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Architectural Overview
This topic describes the architecture of IntelliJ Platform from a plugin developer's 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.

Before proceeding please make sure you're familiar with the basic concepts of IntelliJ Platform plugin development. If not, consider starting with the live demo and tutorials at
[http://www.jetbrains.com/idea/plugins/index.html](http://www.jetbrains.com/idea/plugins/index.html)
[www.jetbrains.com/idea/plugins/](http://www.jetbrains.com/idea/plugins/)
and then returning to this document.

The following subjects are covered:
Expand Down
2 changes: 1 addition & 1 deletion basics/architectural_overview/file_view_providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class. For example, to get the PSI tree for XML, use `fileViewProvider.getPsi(St
## How do I extend FVP?

To create a file type that has multiple interspersing trees for different languages, your plugin must contain an extension to the _fileType.fileViewProviderFactory_
[extension point](http://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_extensions_and_extension_points.html)
[extension point](/basics/plugin_structure/plugin_extensions_and_extension_points.html)
available in the IntelliJ Platform core.
This extension point is declared using the
[FileTypeExtensionPoint](https://upsource.jetbrains.com/idea-community/file/1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeExtensionPoint.java)
Expand Down
2 changes: 1 addition & 1 deletion basics/architectural_overview/psi_elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class is the common base class for PSI elements.

* From an action: `e.getData(LangDataKeys.PSI_ELEMENT)`. 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.
* From a file by offset: `PsiFile.findElementAt()`. Note: this returns the lowest level element at the specified offset, which is normally a lexer token.
Most likely you should use PsiTreeUtil.getParentOfType() to find the element you really need.
Most likely you should use `PsiTreeUtil.getParentOfType()` to find the element you really need.
* By iterating through a PSI file: using a `PsiRecursiveElementWalkingVisitor`.
* By resolving a reference: `PsiReference.resolve()`

Expand Down
4 changes: 2 additions & 2 deletions basics/architectural_overview/virtual_file.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ The `VirtualFileManager.addVirtualFileListener()` method allows you to receive n
To provide an alternative file system implementation (for example, an FTP file system), implement the
[VirtualFileSystem](https://upsource.jetbrains.com/idea-community/file/1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileSystem.java)
class (most likely you'll also need to implement `VirtualFile`), and register your implementation as an
[application component](http://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_components.html).
[application component](/basics/plugin_structure/plugin_components.md).
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
[LocalFileOperationsHandler](https://upsource.jetbrains.com/idea-community/file/1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/platform-api/src/com/intellij/openapi/vfs/LocalFileOperationsHandler.java)
interface and register it through the`LocalFileSystem.registerAuxiliaryFileOperationsHandler` method.

#### What are the rules for working with VFS?

See
[IntelliJ Platform Virtual File System](http://www.jetbrains.org/intellij/sdk/docs/basics/virtual_file_system.html)
[IntelliJ Platform Virtual File System](/basics/virtual_file_system.md)
for a detailed description of the VFS architecture and usage guidelines.
6 changes: 3 additions & 3 deletions basics/getting_started/plugin_compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Plugin Compatibility with IntelliJ Platform Products
---

<!--TODO link to sample_plugin file-->
All products based on IntelliJ Platform (IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm and AppCode) share the same underlying platform API.
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 *module dependencies* in the `plugin.xml` file.

Expand All @@ -20,7 +20,7 @@ For example:
```

<!--TODO link to sample_plugin file-->
If a plugin does not include any module dependency tags in its `plugin.xml`, it's assumed to be a legacy plugin and is loaded only in a IntelliJ-Platform-based product.
If a plugin does not include any module dependency tags in its `plugin.xml`, it's assumed to be a legacy plugin and is loaded only in IntelliJ IDEA.

<!--TODO link to sample_plugin file-->
If the `plugin.xml` includes one or more such tags, the plugin is loaded if the product contains all of the modules on which the plugin depends.
Expand Down Expand Up @@ -68,7 +68,7 @@ If your plugin works with all products but provides some Java-specific functiona
</depends>
```

Before marking a plugin as compatible with all products, you should verify that it doesn't use any APIs that are specific to IntelliJ Platform. 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.
Before marking a plugin as compatible with all products, you should verify that it doesn't 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.

The
[IntelliJ plugin repository](http://plugins.jetbrains.com/)
Expand Down
6 changes: 3 additions & 3 deletions basics/getting_started/running_and_debugging_a_plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Running and Debugging a Plugin

*IntelliJ Platform* allows you to run and debug a plugin without leaving the IDE.
To run or debug the plugin from within *IntelliJ IDEA*, 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 *Run\/Debug* configuration profiles for your plugin projects.
In most cases, you can use the default *Run/Debug* configuration profiles for your plugin projects.
For information on how to change the Run/Debug configuration profile, refer to
[Run/Debug Configuration](http://www.jetbrains.com/idea/help/run-debug-configuration.html)
and
Expand All @@ -17,8 +17,8 @@ Using IntelliJ IDEA's debugger, you can find out the origin of the run-time erro

**To debug a plugin**

* Select *Run \| Debug* in the main menu, or press *Shift + F9*.
* Select **Run \| Debug** in the main menu, or press *Shift + F9*.

**To run a plugin**

* Select *Run \| Run* in the main menu, or press *Shift + F10*.
* Select **Run \| Run** in the main menu, or press *Shift + F10*.
6 changes: 3 additions & 3 deletions basics/plugin_structure/plugin_components.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Optionally, application-level component's implementation class may implement the
interface.
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. IntelliJ IDEA will ensure that the components are instantiated in the correct order to satisfy the dependencies.
Note that application-level components must be registered in the `<application-components>` section of the plugin.xml file (see Plugin Configuration File below).
Note that application-level components must be registered in the `<application-components>` section of the plugin.xml file (see [Plugin Configuration File](plugin_configuration_file.md)).

#### Quick creation of application components

Expand Down Expand Up @@ -81,7 +81,7 @@ The constructor of a project-level component can have a parameter of the
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.

Note that project-level components must be registered in the `<project-components>` section of the *plugin.xml* file (see Plugin Configuration File below).
Note that project-level components must be registered in the `<project-components>` section of the *plugin.xml* file (see [Plugin Configuration File](plugin_configuration_file.md)).

#### Quick creation of project components

Expand Down Expand Up @@ -110,7 +110,7 @@ interface.
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.

Note that module-level components must be registered in the `<module-components>` section of the `plugin.xml` file (see Plugin Configuration File below).
Note that module-level components must be registered in the `<module-components>` section of the `plugin.xml` file (see [Plugin Configuration File](plugin_configuration_file.md)).

#### Quick creation of module components

Expand Down
19 changes: 11 additions & 8 deletions basics/project_structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Depending on the logical and functional requirements to the project, you can cre

#### Module

A _module_ 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 SDK section later in this document). A module can depend on other modules of the project.
A _module_ 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 [SDK](/reference_guide/project_model/sdk.html) section later in this document). A module can depend on other modules of the project.

#### Library

Expand Down Expand Up @@ -102,7 +102,7 @@ To work with projects and project files, you can use the following classes and i

Note that you don't need to access project files directly to load or save settings.
See
[Persisting State of Components](http://www.jetbrains.org/intellij/sdk/docs/basics/persisting_state_of_components.html)
[Persisting State of Components](persisting_state_of_components.md)
for more information.

Note that hereafter, the `project` variable is of the `Project` type.
Expand Down Expand Up @@ -139,26 +139,29 @@ Use the `ProjectRootManager.getFileIndex()` method. For example:
##### How do I get a module to which a file belongs?

To determine a module in the project in question to which the specified
[virtual file](http://www.jetbrains.org/intellij/sdk/docs/basics/architectural_overview/virtual_file.html)
[virtual file](architectural_overview/virtual_file.md)
belongs, use the `ProjectFileIndex.getModuleForFile(virtualFile)` method:

```
```java
Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(virtualFile);
```

Note that this method returns `null` if the file does not belong to any module.

You can also use the `ProjectFileIndex.getContentRootForFile` method to get the module content root to which the specified file or directory belongs:

`VirtualFile moduleContentRoot = ProjectRootManager.getInstance(project).getFileIndex().getContentRootForFile(virtualFileorDirectory);`

```java
VirtualFile moduleContentRoot = ProjectRootManager.getInstance(project).getFileIndex().getContentRootForFile(virtualFileorDirectory);
```

##### How do I get the module source root or library source root to which the specified file or directory belongs?

Use the `ProjectFileIndex.getSourceRootForFile` method. For example:

```VirtualFile moduleSourceRoot = ProjectRootManager.getInstance(project).getFileIndex().getSourceRootForFile(virtualFileorDirectory);
```java
VirtualFile moduleSourceRoot = ProjectRootManager.getInstance(project).getFileIndex().getSourceRootForFile(virtualFileorDirectory);
```

Note that this method returns `null` if the file or directory does not belong to any source root of modules in the project.

##### How do I check whether a file or directory is related to the project libraries?
Expand Down Expand Up @@ -271,7 +274,7 @@ String moduleName = module == null ? "Module not found" : module.getName();
```

* To get the project module to which the specified
[PSI element](http://www.jetbrains.org/intellij/sdk/docs/basics/architectural_overview/psi_elements.html)
[PSI element](architectural_overview/psi_elements.md)
belongs, use the `ModuleUtil.findModuleForPsiElement(psiElement)` method.

#### How do I work with libraries available within a module?
Expand Down
2 changes: 1 addition & 1 deletion basics/run_configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Run Configurations
---


Run configurations allow users to run a certain type of external processes from within the IDE, i.e a script, an application, a server, etc.
Run configurations allow users to run a certain type of external processes from within the IDE, i.e. 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 run configuration based on a specific location in the source code.


Expand Down
4 changes: 2 additions & 2 deletions basics/run_configurations/run_configuration_execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The standard execution of a run action goes through the following steps:
The
[Executor](https://upsource.jetbrains.com/idea-community/file/1731d054af4ca27aa827c03929e27eeb0e6a8366/platform/lang-api/src/com/intellij/execution/Executor.java)
interface describes a specific way of executing any possible run configuration.
The three default executors provided by the IntelliJ Platform by default are _Run_, _Debug_ and (in IntelliJ IDEA Ultimate and certain platform-based IDEs) _Run with Coverage_.
The three default executors provided by the IntelliJ Platform by default are _Run_, _Debug_ and _Run with Coverage_.
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.

As a plugin developer, you normally don't need to implement the _Executor_ interface.
Expand Down Expand Up @@ -82,7 +82,7 @@ and
## Starting a Run Configuration from Code

If you have an existing run configuration that you need to execute, the easiest way to do so is to use
[ProgramRunnerUtil.executeConfiguration](https://github.com/JetBrains/intellij-community/blob/master/platform/lang-impl/src/com/intellij/execution/ProgramRunnerUtil.java#L110).
[ProgramRunnerUtil.executeConfiguration()](https://github.com/JetBrains/intellij-community/blob/master/platform/lang-impl/src/com/intellij/execution/ProgramRunnerUtil.java).
The method takes a Project, a RunnerAndConfigurationSettings, as well as an Executor.
To get the RunnerAndConfigurationSettings for an existing configuration, you can use, for example, `RunManager.getConfigurationSettings(ConfigurationType)`.
As the last parameter, you normally pass either `DefaultRunExecutor.getRunExecutorInstance()` or `DefaultDebugExecutor.getDebugExecutorInstance()`.
Loading

0 comments on commit ab39230

Please sign in to comment.