Update branch names from master to main

This commit is contained in:
Jakub Chrzanowski 2021-01-14 16:19:22 +01:00
parent 03b8ac5276
commit b699f802b1
35 changed files with 104 additions and 104 deletions

View File

@ -4,7 +4,7 @@ title: Contributing to the IntelliJ Platform SDK
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
This document describes our contribution guidelines for the open-source IntelliJ Platform SDK documentation and sample code.
Before you begin contributing content to the SDK, please read this page thoroughly as well as the [Code of Conduct](/CODE_OF_CONDUCT.md) and [License](https://github.com/JetBrains/intellij-sdk-docs/blob/master/LICENSE.txt) documents.
Before you begin contributing content to the SDK, please read this page thoroughly as well as the [Code of Conduct](/CODE_OF_CONDUCT.md) and [License](https://github.com/JetBrains/intellij-sdk-docs/blob/main/LICENSE.txt) documents.
For information about contributing to the IntelliJ Platform itself, please visit [Contributing to the IntelliJ Platform](/basics/platform_contributions.md).
Here are some useful things to know before authoring SDK content and submitting your Pull Request.
@ -17,7 +17,7 @@ Once set up, running the site is as easy as calling `rake preview`.
Alternatively, the site can also be hosted in a [Docker container](https://www.docker.com).
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 [`Dockerfile`](https://github.com/JetBrains/intellij-sdk-docs/blob/master/Dockerfile).
Docker maintains this container, building it based on the instructions in the [`Dockerfile`](https://github.com/JetBrains/intellij-sdk-docs/blob/main/Dockerfile).
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 [published site](https://www.jetbrains.org/intellij/sdk/docs/index.html), so it is a known working environment.

View File

@ -21,7 +21,7 @@
<og-twitter>@JBPlatform</og-twitter>
<og-image>https://resources.jetbrains.com/storage/products/jetbrains/img/meta/preview.png</og-image>
<enable-browser-edits>true</enable-browser-edits>
<browser-edits-url>https://github.com/JetBrains/intellij-sdk-docs/edit/master/</browser-edits-url>
<browser-edits-url>https://github.com/JetBrains/intellij-sdk-docs/edit/main/</browser-edits-url>
<images-prefix-override>images/</images-prefix-override>
<upsource-commit-hash>4b94ba01122752d7576eb9d69638b6e89d1671b7</upsource-commit-hash>
<upsource-repo-name>idea-ce</upsource-repo-name>

View File

@ -3,7 +3,7 @@
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
This document describes our contribution guidelines for the open source IntelliJ Platform SDK documentation and sample code.
Before you begin contributing content to the SDK, please read this page thoroughly as well as the [Code of Conduct](CODE_OF_CONDUCT.md) and [License](https://github.com/JetBrains/intellij-sdk-docs/blob/master/LICENSE.txt) documents.
Before you begin contributing content to the SDK, please read this page thoroughly as well as the [Code of Conduct](CODE_OF_CONDUCT.md) and [License](https://github.com/JetBrains/intellij-sdk-docs/blob/main/LICENSE.txt) documents.
For information about contributing to the IntelliJ Platform itself, please visit [Contributing to the IntelliJ Platform](platform_contributions.md).
Here are some useful things to know before authoring SDK content and submitting your Pull Request.
@ -13,7 +13,7 @@ Here are some useful things to know before authoring SDK content and submitting
This site runs via [Jekyll](https://jekyllrb.com), 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 `rake preview`.
Alternatively, the site can also be hosted in a [Docker container](https://www.docker.com). 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 [`Dockerfile`](https://github.com/JetBrains/intellij-sdk-docs/blob/master/Dockerfile). 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 [published site](https://www.jetbrains.org/intellij/sdk/docs/index.html), so it is a known working environment.
Alternatively, the site can also be hosted in a [Docker container](https://www.docker.com). 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 [`Dockerfile`](https://github.com/JetBrains/intellij-sdk-docs/blob/main/Dockerfile). 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 [published site](https://www.jetbrains.org/intellij/sdk/docs/index.html), so it is a known working environment.
### Developing Documentation with Docker
@ -126,4 +126,4 @@ Before creating or altering content, please consult these guides:
Always test documentation changes using a [preview](#building-and-previewing-the-site) of the site.
* [SDK Code Sample Guidelines](sdk_code_guidelines.md).
Conventions for code sample organization, project settings, and naming conventions are described in this document.
Always test code changes by building and testing the SDK code sample.
Always test code changes by building and testing the SDK code sample.

View File

@ -55,4 +55,4 @@ PsiMethod containingMethod = PsiTreeUtil.getParentOfType(element, PsiMethod.clas
PsiClass containingClass = containingMethod.getContainingClass();
```
To see how the navigation works in practice, please refer to the [code sample](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/psi_demo/src/main/java/org/intellij/sdk/psi/PsiNavigationDemoAction.java).
To see how the navigation works in practice, please refer to the [code sample](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/psi_demo/src/main/java/org/intellij/sdk/psi/PsiNavigationDemoAction.java).

View File

@ -89,7 +89,7 @@ If the action's availability changes in the absence of these events, then call [
>
{type="note"}
An example of enabling a menu action based on whether a project is open is demonstrated in [`PopupDialogAction.update()`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/action_basics/src/main/java/org/intellij/sdk/action/PopupDialogAction.java) method.
An example of enabling a menu action based on whether a project is open is demonstrated in [`PopupDialogAction.update()`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/action_basics/src/main/java/org/intellij/sdk/action/PopupDialogAction.java) method.
### Overriding the AnAction.actionPerformed Method
When the user selects an enabled action, be it from a menu or toolbar, the action's `AnAction.actionPerformed()` method is called.
@ -100,7 +100,7 @@ For example, the `actionPerformed()` method can modify, remove, or add PSI eleme
The code that executes in the `AnAction.actionPerformed()` method should execute efficiently, but it does not have to meet the same stringent requirements as the `update()` method.
An example of inspecting PSI elements is demonstrated in the SDK code sample `action_basics` [`PopupDialogAction.actionPerformed()`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/action_basics/src/main/java/org/intellij/sdk/action/PopupDialogAction.java) method.
An example of inspecting PSI elements is demonstrated in the SDK code sample `action_basics` [`PopupDialogAction.actionPerformed()`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/action_basics/src/main/java/org/intellij/sdk/action/PopupDialogAction.java) method.
### Action IDs
Every action and action group has a unique identifier.
@ -185,7 +185,7 @@ To exclude a group from appearing in **Help \| Find Action** results (e.g., _New
#### Localizing Actions and Groups
Action and group localization use resource bundles containing property files named `*Bundle.properties`, each file consisting of `key=value` pairs.
The [`action_basics`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/action_basics) plugin demonstrates using a resource bundle to localize the group and action entries added to the Editor Popup Menu.
The [`action_basics`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/action_basics) plugin demonstrates using a resource bundle to localize the group and action entries added to the Editor Popup Menu.
When localizing actions and groups, the `text` and `description` attributes are not declared in `plugin.xml`.
Instead, those attribute values vary depending on the locale and get declared in a resource bundle.
@ -367,4 +367,4 @@ To get a Swing component from such an object, call the respective `getComponent(
If an action toolbar is attached to a specific component (for example, a panel in a tool window), call `ActionToolbar.setTargetComponent()` and pass the related component's instance as a parameter.
Setting the target ensures that the toolbar buttons' state depends on the state of the related component, not on the current focus location within the IDE frame.
See [Toolbar](https://jetbrains.design/intellij/controls/toolbar/) in _IntelliJ Platform UI Guidelines_ for an overview.
See [Toolbar](https://jetbrains.design/intellij/controls/toolbar/) in _IntelliJ Platform UI Guidelines_ for an overview.

View File

@ -125,7 +125,7 @@ If this number exceeds the maximum number of simultaneously opened projects allo
**To install and run the sample plugin**
* Download the included sample plugin project located [here](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/max_opened_projects).
* Download the included sample plugin project located [here](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/max_opened_projects).
* Start *IntelliJ IDEA*, on the starting page, click *Open Project*, and then use the *Open Project* dialog box to open the project.
* On the main menu, choose *Run \| Run* or press <kbd>Shift</kbd>+<kbd>F10</kbd>.
* If necessary, change the [Run/Debug Configurations](https://www.jetbrains.com/help/idea/run-debug-configuration-plugin.html).
* If necessary, change the [Run/Debug Configurations](https://www.jetbrains.com/help/idea/run-debug-configuration-plugin.html).

View File

@ -3,7 +3,7 @@
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
This document describes our contribution guidelines for the open-source IntelliJ Platform SDK documentation and sample code.
Before you begin contributing content to the SDK, please read this page thoroughly as well as the [Code of Conduct](intellij-sdk-docs-original_CODE_OF_CONDUCT.md) and [License](https://github.com/JetBrains/intellij-sdk-docs/blob/master/LICENSE.txt) documents.
Before you begin contributing content to the SDK, please read this page thoroughly as well as the [Code of Conduct](intellij-sdk-docs-original_CODE_OF_CONDUCT.md) and [License](https://github.com/JetBrains/intellij-sdk-docs/blob/main/LICENSE.txt) documents.
For information about contributing to the IntelliJ Platform itself, please visit [Contributing to the IntelliJ Platform](platform_contributions.md).
Here are some useful things to know before authoring SDK content and submitting your Pull Request.
@ -16,7 +16,7 @@ Once set up, running the site is as easy as calling `rake preview`.
Alternatively, the site can also be hosted in a [Docker container](https://www.docker.com).
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 [`Dockerfile`](https://github.com/JetBrains/intellij-sdk-docs/blob/master/Dockerfile).
Docker maintains this container, building it based on the instructions in the [`Dockerfile`](https://github.com/JetBrains/intellij-sdk-docs/blob/main/Dockerfile).
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 [published site](https://www.jetbrains.org/intellij/sdk/docs/index.html), so it is a known working environment.
@ -147,4 +147,4 @@ Before creating or altering content, please consult these guides:
Always test documentation changes using a [preview](#building-and-previewing-the-site) of the site.
* [SDK Code Sample Guidelines](sdk_code_guidelines.md).
Conventions for code sample organization, project settings, and naming conventions are described in this document.
Always test code changes by building and testing the SDK code sample.
Always test code changes by building and testing the SDK code sample.

View File

@ -4,7 +4,7 @@ This page lists notable additions and updates to the SDK documentation and code
Follow [JBPlatform](https://twitter.com/JBPlatform/) on Twitter and visit [JetBrains Platform Blog](https://blog.jetbrains.com/platform/) for the latest announcements.
See [Recently Updated](recently_updated.md) ([RSS](https://github.com/JetBrains/intellij-sdk-docs/commits/master.atom)) for a detailed changelog.
See [Recently Updated](recently_updated.md) ([RSS](https://github.com/JetBrains/intellij-sdk-docs/commits/main.atom)) for a detailed changelog.
## 2020
@ -50,7 +50,7 @@ JCEF Support (_Experimental Feature_)
### February-20
All Code Samples converted to Gradle
: [All samples](https://github.com/JetBrains/intellij-sdk-docs/tree/master/code_samples) now use the [recommended solution](gradle_build_system.md) of setting up plugin projects.
: [All samples](https://github.com/JetBrains/intellij-sdk-docs/tree/main/code_samples) now use the [recommended solution](gradle_build_system.md) of setting up plugin projects.
### January-20
@ -83,4 +83,4 @@ New page: Optimizing Performance
### May-19
New Page: Kotlin UI DSL
: [Describes preferred way](kotlin_ui_dsl.md) of building UI/dialogs for IntelliJ Platform 2019.2 and later.
: [Describes preferred way](kotlin_ui_dsl.md) of building UI/dialogs for IntelliJ Platform 2019.2 and later.

View File

@ -3,7 +3,7 @@
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
This document describes the coding guidelines used for authoring open-source IntelliJ Platform SDK code samples.
Before you begin, please read this page thoroughly, as well as the [Code of Conduct](intellij-sdk-docs-original_CODE_OF_CONDUCT.md) and [License](https://github.com/JetBrains/intellij-sdk-docs/blob/master/LICENSE.txt) documents.
Before you begin, please read this page thoroughly, as well as the [Code of Conduct](intellij-sdk-docs-original_CODE_OF_CONDUCT.md) and [License](https://github.com/JetBrains/intellij-sdk-docs/blob/main/LICENSE.txt) documents.
For information about contributing to the IntelliJ Platform itself, visit [Contributing to the IntelliJ Platform](platform_contributions.md).
## Objectives
@ -37,7 +37,7 @@ Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source
```
> The copyright statement must appear at the top of every source file.
> Use the [IntelliJ Platform SDK](https://github.com/JetBrains/intellij-sdk-docs/tree/master/.idea/copyright) copyright profile.
> Use the [IntelliJ Platform SDK](https://github.com/JetBrains/intellij-sdk-docs/tree/main/.idea/copyright) copyright profile.
>
{type="note"}
@ -179,4 +179,4 @@ Here the term "IDE" means the IntelliJ Platform-based IDE in which the plugin is
* The correct information about the plugin should display in the **Preferences \| Plugins** panel.
* If applicable, the plugin UI, such as tool windows, menu additions, etc. should display correctly.
* The functionality of the plugin should be tested with a sample file.
* If applicable, the plugin should pass unit tests.
* If applicable, the plugin should pass unit tests.

View File

@ -3,7 +3,7 @@
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
This document describes the writing style used in authoring open-source IntelliJ Platform SDK documentation.
Before you begin, please read this page thoroughly, as well as the [Code of Conduct](intellij-sdk-docs-original_CODE_OF_CONDUCT.md) and [License](https://github.com/JetBrains/intellij-sdk-docs/blob/master/LICENSE.txt) documents.
Before you begin, please read this page thoroughly, as well as the [Code of Conduct](intellij-sdk-docs-original_CODE_OF_CONDUCT.md) and [License](https://github.com/JetBrains/intellij-sdk-docs/blob/main/LICENSE.txt) documents.
For information about contributing to the IntelliJ Platform itself, please visit [Contributing to the IntelliJ Platform](platform_contributions.md).
First and foremost, we should keep in mind our audience and their objectives:
@ -207,7 +207,7 @@ The styles available for callouts are:
This callout is reserved for essential points and concepts.
* WARNING - Information that is critical for the user to understand to prevent failures or errors.
> TODO/todo comments are discouraged in the master branch of `intellij-sdk-docs`.
> TODO/todo comments are discouraged in the main branch of `intellij-sdk-docs`.
> There are always exceptions, but the best practice is to resolve all TODOs before the final review.
> If immediate resolution isn't possible, write a YouTrack [SDK Issue](https://youtrack.jetbrains.com/issues/IJSDK) that captures the TODO and remove the comment from the document.
>
@ -270,4 +270,4 @@ The contents can be split into "parts" by separating the list into several lists
If a node doesn't 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 as a placeholder for a documentation item.
A placeholder is useful to keep track of what should be documented, but hasn't yet, and can be helpful to show readers that the topic exists, but isn't yet documented (Pull Requests always welcome!).
A placeholder is useful to keep track of what should be documented, but hasn't yet, and can be helpful to show readers that the topic exists, but isn't yet documented (Pull Requests always welcome!).

View File

@ -29,7 +29,7 @@ Click on an entry in the table's *Attribute* column to go to the documentation a
The dependency on the PyCharm APIs must be declared in the `plugin.xml` file.
As described in [Configuring the plugin.xml File](dev_alternate_products.md#configuring-pluginxml), the `<depends>` tags must declare `com.intellij.modules.python`.
See the SDK code sample [`pycharm_basics`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/product_specific/pycharm_basics/) for an example configuration.
See the SDK code sample [`pycharm_basics`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/product_specific/pycharm_basics/) for an example configuration.
Please note that this code sample must be imported into Gradle explicitly, as it is not included in the `_gradleCompositeBuild`.
## Available PyCharm APIs
@ -43,4 +43,4 @@ These are considered stable APIs, but care should be taken to test your plugin w
## Open Source Plugins for PyCharm
When learning new development configurations, it is helpful to have some representative projects for reference:
* [Flake8 Support](https://github.com/jansorg/pycharm-flake8) Adds support for flake8's # noqa comments in PyCharm.
* [Flake8 Support](https://github.com/jansorg/pycharm-flake8) Adds support for flake8's # noqa comments in PyCharm.

View File

@ -9,7 +9,7 @@ E.g. Spring Framework specific configuration is stored in a Spring facet.
For more information about facets see [Adding Support for Frameworks and Technologies](https://www.jetbrains.com/help/idea/adding-support-for-frameworks-and-technologies.html) and the help page for the [Facets dialog](https://www.jetbrains.com/help/idea/facet-page.html) in the IntelliJ IDEA Web Help.
## Facet Basics Sample
Please see [Facet Basics](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/facet_basics) sample plugin project.
Please see [Facet Basics](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/facet_basics) sample plugin project.
## Working with Facets
@ -17,4 +17,4 @@ Please see [Facet Basics](https://github.com/JetBrains/intellij-sdk-code-samples
To create, search and access the list of facets for a module use [`FacetManager`](upsource:///platform/lang-api/src/com/intellij/facet/FacetManager.java).
### Facet-Based Tool Window
A [tool window](tool_windows.md) dependent on the existence of given facet(s) can be registered via `com.intellij.facet.toolWindow` extension point.
A [tool window](tool_windows.md) dependent on the existence of given facet(s) can be registered via `com.intellij.facet.toolWindow` extension point.

View File

@ -70,7 +70,7 @@ To create a library, perform the following steps:
* For a module-level library, commit the modifiable model returned by `ModuleRootManager.getInstance(module).getModifiableModel()`.
For module-level libraries, you can also use simplified APIs in the [`ModuleRootModificationUtil`](upsource:///platform/projectModel-api/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java) class to add a library with a single API call.
You can find an example of using these APIs in the [project_model](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/project_model/src/main/java/org/intellij/sdk/project/model/ModificationAction.java) code sample.
You can find an example of using these APIs in the [project_model](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/project_model/src/main/java/org/intellij/sdk/project/model/ModificationAction.java) code sample.
### Adding Contents or Modifying a Library
To add or change the roots of a library, you need to perform the following steps:
@ -99,13 +99,13 @@ You can use the following methods:
ProjectFileIndex.isInLibrarySource(virtualFileorDirectory)
```
See the [project_model](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/project_model/src/main/java/org/intellij/sdk/project/model/ProjectFileIndexSampleAction.java) to see how the method mentioned above can be applied.
See the [project_model](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/project_model/src/main/java/org/intellij/sdk/project/model/ProjectFileIndexSampleAction.java) to see how the method mentioned above can be applied.
More details on libraries can be found in the [plugin_model](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/project_model/src/main/java/org/intellij/sdk/project/model/LibrariesAction.java) code sample.
More details on libraries can be found in the [plugin_model](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/project_model/src/main/java/org/intellij/sdk/project/model/LibrariesAction.java) code sample.
## Predefined Libraries
EP: `com.intellij.additionalLibraryRootsProvider`
[`AdditionalLibraryRootsProvider`](upsource:///platform/projectModel-impl/src/com/intellij/openapi/roots/AdditionalLibraryRootsProvider.java)
Allows providing synthetic/predefined libraries ([`SyntheticLibrary`](upsource:///platform/projectModel-impl/src/com/intellij/openapi/roots/SyntheticLibrary.java)) in a project without exposing them in the model.
By default, they're also hidden from UI.
By default, they're also hidden from UI.

View File

@ -77,7 +77,7 @@ Utility classes used for modifying the project structure can be found in the pac
Its [`roots`](upsource:///platform/projectModel-impl/src/com/intellij/openapi/roots/) subpackage contains instances and utilities intended for work with project and module source roots, including [`ModuleRootModificationUtil`](upsource:///platform/projectModel-api/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java) and [`ProjectRootUtil`](upsource:///platform/projectModel-impl/src/com/intellij/openapi/projectRoots/impl/ProjectRootUtil.java).
Project structure changes need to be performed in a [write action](general_threading_rules.md#read-write-lock).
Refer to the [project_model](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/project_model/src/main/java/org/intellij/sdk/project/model/ModificationAction.java) code sample to learn how project structure modification can be implemented.
Refer to the [project_model](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/project_model/src/main/java/org/intellij/sdk/project/model/ModificationAction.java) code sample to learn how project structure modification can be implemented.
## Receiving Notifications About Project Structure Changes
To receive notifications about changes in project structure (modules or libraries being added or removed, module dependencies being changed, and so on), use the [message bus](messaging_infrastructure.md) and the `ProjectTopics.PROJECT_ROOTS` topic:
@ -90,4 +90,4 @@ project.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new Mod
});
```
The event only notifies that something has changed; if more details are needed about what changes have occurred, keep a copy of the state of the project structure model which is relevant, and to compare it with the state after the change.
The event only notifies that something has changed; if more details are needed about what changes have occurred, keep a copy of the state of the project structure model which is relevant, and to compare it with the state after the change.

View File

@ -42,7 +42,7 @@ Sdk projectSdk = ProjectRootManager.getInstance(project).getProjectSdk();
ProjectRootManager.getInstance(project).setProjectSdkName(String name);
```
See the [project_model](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/project_model/src/main/java/org/intellij/sdk/project/model/ProjectSdkAction.java) code sample to get more familiar with SDK manipulation toolset.
See the [project_model](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/project_model/src/main/java/org/intellij/sdk/project/model/ProjectSdkAction.java) code sample to get more familiar with SDK manipulation toolset.
## Available SDKs
@ -71,4 +71,4 @@ Although "SDK" is available in most JetBrains products, `ProjectJdksEditor` is s
The recommended way of managing "SDK" settings is to create a [`CustomStepProjectGenerator`](upsource:///platform/lang-impl/src/com/intellij/ide/util/projectWizard/CustomStepProjectGenerator.java) implementation and save settings in a [`PersistentStateComponent`](persisting_state_of_components.md).
## Assisting in Setting Up an SDK
Register the implementation of [`ProjectSdkSetupValidator`](upsource:///platform/lang-impl/src/com/intellij/codeInsight/daemon/ProjectSdkSetupValidator.java) in extension point `com.intellij.projectSdkSetupValidator` to provide quick fix.
Register the implementation of [`ProjectSdkSetupValidator`](upsource:///platform/lang-impl/src/com/intellij/codeInsight/daemon/ProjectSdkSetupValidator.java) in extension point `com.intellij.projectSdkSetupValidator` to provide quick fix.

View File

@ -7,4 +7,4 @@ By registering actions, you can add your own menu items, toolbar buttons and key
* [Creating Actions](working_with_custom_actions.md)
* [Grouping Actions](grouping_action.md)
The source code for the [`action_basics`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/action_basics) code sample is used throughout this tutorial.
The source code for the [`action_basics`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/action_basics) code sample is used throughout this tutorial.

View File

@ -4,7 +4,7 @@
If an implementation requires several actions, or there are simply too many actions that overload the menu, the actions can be placed into groups.
This tutorial demonstrates adding an action to an existing group, creating a new action group, and action groups with a variable number of actions.
The sample code discussed in this tutorial is from the code sample [`action_basics`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/code_samples/action_basics).
The sample code discussed in this tutorial is from the code sample [`action_basics`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/code_samples/action_basics).
Some content in this tutorial assumes the reader is familiar with the tutorial for [Creating Actions](working_with_custom_actions.md).
@ -31,7 +31,7 @@ See [Registering Actions in plugin.xml](basic_action_system.md#registering-actio
### Binding Action Groups to UI Components
The following sample shows how to use an `<add-to-group>` element to place a custom action group relative to an entry in the **Tools** menu.
The attribute `relative-to-action` references the action `id` for `PopupDialogAction`, not a native IntelliJ menu entry.
Rather `PopupDialogAction` is defined in the same [`plugin.xml`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/action_basics/src/main/resources/META-INF/plugin.xml) file.
Rather `PopupDialogAction` is defined in the same [`plugin.xml`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/action_basics/src/main/resources/META-INF/plugin.xml) file.
This group is placed after the single entry for the action `PopupDialogAction`, as defined in the tutorial [Creating Actions](working_with_custom_actions.md#registering-an-action-with-the-new-action-form).
```xml
@ -88,7 +88,7 @@ As an example, extend [`DefaultActionGroup`](upsource:///platform/platform-api/s
```
### Registering the Custom Action Group
As in the case with the static action group, the action `<group>` should be declared in the `<actions>` section of the `plugin.xml` file, for example, the [action_basics](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/action_basics/src/main/resources/META-INF/plugin.xml) plugin.
As in the case with the static action group, the action `<group>` should be declared in the `<actions>` section of the `plugin.xml` file, for example, the [action_basics](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/action_basics/src/main/resources/META-INF/plugin.xml) plugin.
For demonstration purposes, this implementation will use localization.
The `<group>` element declaration below shows:
@ -129,7 +129,7 @@ In the `<action>` element declaration below:
</group>
```
Now the translations for the `text` and `description` attributes must be provided in the resource bundle [`BasicActionsBundle.properties`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/action_basics/src/main/resources/messages/BasicActionsBundle.properties) file according to [Localizing Actions and Groups](basic_action_system.md#localizing-actions-and-groups).
Now the translations for the `text` and `description` attributes must be provided in the resource bundle [`BasicActionsBundle.properties`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/action_basics/src/main/resources/messages/BasicActionsBundle.properties) file according to [Localizing Actions and Groups](basic_action_system.md#localizing-actions-and-groups).
Note there are two sets of `text` and `description` translations, one for the action and one for the group.
Conceivably, there could be another set of translations for the action if it used the `<override-text>` attribute.
@ -169,7 +169,7 @@ The set of actions in the `ActionGroup` is dynamically defined.
### Creating Variable Action Group
To create a group of actions with a variable number of actions, extend `ActionGroup`.
For example, as in the `action_basics` class [`DynamicActionGroup`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/action_basics/src/main/java/org/intellij/sdk/action/DynamicActionGroup.java) code:
For example, as in the `action_basics` class [`DynamicActionGroup`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/action_basics/src/main/java/org/intellij/sdk/action/DynamicActionGroup.java) code:
```java
public class DynamicActionGroup extends ActionGroup {
@ -177,7 +177,7 @@ public class DynamicActionGroup extends ActionGroup {
```
### Registering a Variable Action Group
To register the dynamic menu group, a `<group>` attribute needs to be placed in the `<actions>` section of [`plugin`.xml](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/action_basics/src/main/resources/META-INF/plugin.xml).
To register the dynamic menu group, a `<group>` attribute needs to be placed in the `<actions>` section of [`plugin`.xml](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/action_basics/src/main/resources/META-INF/plugin.xml).
When enabled, this group appears at the entry just below the [Static Grouped Actions](#binding-action-groups-to-ui-components) in the **Tools** menu:
```xml
@ -211,4 +211,4 @@ public class DynamicActionGroup extends ActionGroup {
After providing the implementation of `DynamicActionGroup` and making it return a non-empty array of actions, the third position in the **Tools** menu will contain a new group of actions:
![Dynamic Action Group](dynamic_action_group.png){width="600"}
![Dynamic Action Group](dynamic_action_group.png){width="600"}

View File

@ -15,7 +15,7 @@ Classes that extend it should override `AnAction.update()`, and must override `A
* The `update()` method implements the code that enables or disables an action.
* The `actionPerformed()` method implements the code that executes when an action is invoked by the user.
As an example, [`PopupDialogAction`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/action_basics/src/main/java/org/intellij/sdk/action/PopupDialogAction.java) overrides `AnAction` for the `action_basics` code sample.
As an example, [`PopupDialogAction`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/action_basics/src/main/java/org/intellij/sdk/action/PopupDialogAction.java) overrides `AnAction` for the `action_basics` code sample.
```java
public class PopupDialogAction extends AnAction {
@ -97,7 +97,7 @@ An action declaration can be added manually to the `plugin.xml` file.
An exhaustive list of declaration elements and attributes is presented in [Registering Actions in plugin.xml](basic_action_system.md#registering-actions-in-pluginxml).
Attributes are added by selecting them from the **New Action** form, or by editing the registration declaration directly in the plugin.xml file.
The `<action>` declaration for `PopupDialogAction` in the `action_basics` [plugin.xml](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/action_basics/src/main/resources/META-INF/plugin.xml) file.
The `<action>` declaration for `PopupDialogAction` in the `action_basics` [plugin.xml](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/action_basics/src/main/resources/META-INF/plugin.xml) file.
It also contains an attribute for an [`Icon`](work_with_icons_and_images.md) and encloses elements declaring text overrides, keyboard and mouse shortcuts, and to which menu group the action should be added.
The full declaration is:
@ -202,4 +202,4 @@ Otherwise, overriding constructors for `AnAction` is not required.
## Testing the Custom Action
After compiling and running the plugin project and invoking the action, the dialog will pop up:
![Action performed](action_performed.png){width="800"}
![Action performed](action_performed.png){width="800"}

View File

@ -4,7 +4,7 @@
The IntelliJ Platform provides tools designed for static code analysis called _code inspections_, which help the user maintain and clean up code without actually executing it.
Custom code inspections can be implemented as IntelliJ Platform plugins.
Examples of the plugin approach are the IntelliJ Platform SDK code samples [inspection_basics](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/inspection_basics) and [comparing_references_inspection](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/comparing_references_inspection).
Examples of the plugin approach are the IntelliJ Platform SDK code samples [inspection_basics](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/inspection_basics) and [comparing_references_inspection](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/comparing_references_inspection).
In addition, the comparing_references_inspection code sample demonstrates implementing a unit test.
You can also create custom inspections through the IntelliJ IDEA user interface.
@ -14,7 +14,7 @@ See [Inspections](https://jetbrains.design/intellij/text/inspections/) topic in
## Creating an Inspection Plugin
The [comparing_references_inspection](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/comparing_references_inspection) code sample adds a new inspection to the **Java | Probable Bugs** group in the [Inspections list](https://www.jetbrains.com/help/idea/inspections-settings.html).
The [comparing_references_inspection](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/comparing_references_inspection) code sample adds a new inspection to the **Java | Probable Bugs** group in the [Inspections list](https://www.jetbrains.com/help/idea/inspections-settings.html).
The inspection reports when the `==` or `!=` operator is used between Java expressions of reference types.
It illustrates the components for a custom inspection plugin:
* Describing an [inspection](#plugin-configuration-file) in the plugin configuration file.
@ -42,13 +42,13 @@ The overall approach works for inspections aimed at other languages as well.
* Use the `implementationClass` text as the [target of a class search](https://www.jetbrains.com/help/idea/searching-everywhere.html#Searching_Everywhere.xml) in the _intellij_community_ codebase to find the implementation.
## Creating an Inspection
The [comparing_references_inspection](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/comparing_references_inspection) code sample reports when the `==` or `!=` operators are used between Java expressions of reference types.
The [comparing_references_inspection](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/comparing_references_inspection) code sample reports when the `==` or `!=` operators are used between Java expressions of reference types.
The user can apply a quick fix to change `a==b` to `a.equals(b)`, or `a!=b` to `!a.equals(b)`.
The details of the `comparing_references_inspection` implementation illustrate the components of an inspection plugin.
### Plugin Configuration File
The `comparing_references_inspection` is described as a `<localInspection>` extension point in the `comparing_references_inspection` plugin configuration ([`plugin.xml`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/comparing_references_inspection/src/main/resources/META-INF/plugin.xml)) file.
The `comparing_references_inspection` is described as a `<localInspection>` extension point in the `comparing_references_inspection` plugin configuration ([`plugin.xml`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/comparing_references_inspection/src/main/resources/META-INF/plugin.xml)) file.
There exist two types of inspection extensions:
* The `com.intellij.localInspection` extension point is used for inspections that operate on one file at a time, and also operate "on-the-fly" as the user edits the file.
@ -62,7 +62,7 @@ Note that some attributes are not displayed to the user, so they are never local
If required, inspections can define all of the attribute information (except `implementationClass`) by overriding methods in the inspection implementation class (not recommended in general).
### Inspection Implementation Java Class
Inspection implementations for Java files, like [`ComparingReferencesInspection`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/comparing_references_inspection/src/main/java/org/intellij/sdk/codeInspection/ComparingReferencesInspection.java), are often based on the Java class [`AbstractBaseJavaLocalInspectionTool`](upsource:///java/java-analysis-api/src/com/intellij/codeInspection/AbstractBaseJavaLocalInspectionTool.java).
Inspection implementations for Java files, like [`ComparingReferencesInspection`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/comparing_references_inspection/src/main/java/org/intellij/sdk/codeInspection/ComparingReferencesInspection.java), are often based on the Java class [`AbstractBaseJavaLocalInspectionTool`](upsource:///java/java-analysis-api/src/com/intellij/codeInspection/AbstractBaseJavaLocalInspectionTool.java).
The `AbstractBaseJavaLocalInspectionTool` implementation class offers methods to inspect Java classes, fields, and methods.
More generally, `localInspection` types are based on the class [`LocalInspectionTool`](upsource:///platform/analysis-api/src/com/intellij/codeInspection/LocalInspectionTool.java).
@ -142,11 +142,11 @@ In the case of `comparing_references_inspection` the test files are `Eq.java` /
The `comparing_references_inspection` tests run the inspection on the `*.java` files, implement the quick fix, and compare the results with the respective `*.after.java` files.
## Running the Comparing References Inspection Code Sample
The [comparing_references_inspection](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/comparing_references_inspection) code sample adds a new inspection to the **Java | Probable Bugs** group in the [Inspections list](https://www.jetbrains.com/help/idea/inspections-settings.html).
The [comparing_references_inspection](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/comparing_references_inspection) code sample adds a new inspection to the **Java | Probable Bugs** group in the [Inspections list](https://www.jetbrains.com/help/idea/inspections-settings.html).
The inspection reports when the `==` or `!=` operator is used between Java expressions of reference types.
To run the sample plugin:
* Start **IntelliJ IDEA**, open the `intellij-sdk-docs` project, and highlight the [comparing_references_inspection](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/comparing_references_inspection) module.
* Start **IntelliJ IDEA**, open the `intellij-sdk-docs` project, and highlight the [comparing_references_inspection](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/comparing_references_inspection) module.
* Open the [Project Structure](https://www.jetbrains.com/help/idea/project-structure-dialog.html) dialog and ensure that the project settings are valid for your environment.
* If necessary, modify the [Run/Debug Configurations](https://www.jetbrains.com/idea/webhelp/run-debug-configuration-plugin.html) for the `comparing_references_inspection` module.
* Run the plugin by choosing **Run** on the main menu.
@ -184,4 +184,4 @@ with the code:
```java
return (str1.equals(str2));
```
```

View File

@ -2,7 +2,7 @@
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
This topic describes the [conditional_operator_intention](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/conditional_operator_intention), a sample plugin that adds a new [intention action](https://www.jetbrains.com/help/idea/intention-actions.html) to the IntelliJ Platform Intentions list.
This topic describes the [conditional_operator_intention](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/conditional_operator_intention), a sample plugin that adds a new [intention action](https://www.jetbrains.com/help/idea/intention-actions.html) to the IntelliJ Platform Intentions list.
In addition, the sample plugin contains a JUnit-based test.
## About Intention Actions
@ -22,7 +22,7 @@ You can view a list of all available intention actions using the [Intention List
## Techniques Used
The [conditional_operator_intention](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/conditional_operator_intention) sample plugin illustrates the use of the following techniques:
The [conditional_operator_intention](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/conditional_operator_intention) sample plugin illustrates the use of the following techniques:
- How to analyze a [PSI tree](psi_files.md).
- How to find a Java token of interest in the PSI tree.
@ -75,4 +75,4 @@ if ((n>=0)) {
The sample plugin contains the `ConditionalOperatorConverterTest` Java class and the test data in the `test/testData/` directory.
To perform the plugin test, run the `ConditionalOperatorConverterTest.testIntention()` method.
For detailed information about testing and all related procedures, refer to [Testing](https://www.jetbrains.com/help/idea/performing-tests.html) in the **IntelliJ IDEA** Web Help.
For detailed information about testing and all related procedures, refer to [Testing](https://www.jetbrains.com/help/idea/performing-tests.html) in the **IntelliJ IDEA** Web Help.

View File

@ -17,7 +17,7 @@ The `SimpleLanguage` class is defined in the `org.intellij.sdk.language` package
{src="simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLanguage.java"}
## Define an Icon
The [icon](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/simple_language_plugin/src/main/resources/icons/jar-gray.png) for the Simple Language is defined by the `SimpleIcons` class.
The [icon](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/simple_language_plugin/src/main/resources/icons/jar-gray.png) for the Simple Language is defined by the `SimpleIcons` class.
There is nothing uniquely Simple Language-specific about [defining the icon](work_with_icons_and_images.md) itself.
The definition follows a pattern similar to defining, e.g., `SdkIcons`.
@ -69,4 +69,4 @@ The `SimpleFileTypeFactory` is registered using the `com.intellij.openapi.fileTy
Create an empty file with the extension `*.simple`, and IntelliJ IDEA automatically associates it with our language.
Note the appearance of the Simple Language file icon next to the `test.simple` file in the **Project Tool Window**, and the editor tab for the file.
![File Type Factory](file_type_factory.png){width="800"}
![File Type Factory](file_type_factory.png){width="800"}

View File

@ -19,7 +19,7 @@ A new overload of `createProperty()` creates a new `key`-`value` pair for Simple
## Define an Intention Action
The `SimpleCreatePropertyQuickFix` creates a property in the file chosen by the user - in this case, a Java file containing a `prefix:key` - and navigate to this property after creation.
Under the hood, `SimpleCreatePropertyQuickFix` is an Intention Action.
For a more in-depth example of an Intention Action, see [`conditional_operator_intention`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/conditional_operator_intention).
For a more in-depth example of an Intention Action, see [`conditional_operator_intention`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/conditional_operator_intention).
```java
```
@ -47,4 +47,4 @@ Add the new value `jetbrains.com` for the new `website.url` key.
![New Property](new_property.png)
Now switch back to the Java file; the new key is highlighted as valid.
Now switch back to the Java file; the new key is highlighted as valid.

View File

@ -9,7 +9,7 @@ In this tutorial we will add support for a [.properties](https://en.wikipedia.or
>
{type="tip"}
The example plugin used in this tutorial is the [`simple_language_plugin`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/simple_language_plugin) code sample.
The example plugin used in this tutorial is the [`simple_language_plugin`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/simple_language_plugin) code sample.
This a step-by-step tutorial, and it requires completing each step, in order:
* [1. Prerequisites](prerequisites.md)
@ -29,4 +29,4 @@ This a step-by-step tutorial, and it requires completing each step, in order:
* [15. Formatter](formatter.md)
* [16. Code Style Settings](code_style_settings.md)
* [17. Commenter](commenter.md)
* [18. Quick Fix](quick_fix.md)
* [18. Quick Fix](quick_fix.md)

View File

@ -12,7 +12,7 @@ For operations that require access to the PSI please see the [PSI Cookbook](psi_
**See also:**
The following are referenced in the tutorial:
* The [editor_basics](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/editor_basics/) plugin code sample,
* The [editor_basics](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/editor_basics/) plugin code sample,
* [editor-ui-api package](upsource:///platform/editor-ui-api),
* Those not found in editor-ui-api package:
* [`EditorActionManager`](upsource:///platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionManager.java),
@ -22,4 +22,4 @@ The following are referenced in the tutorial:
**Related topics:**
* [Action System](action_system.md)
* [Threading Issues](general_threading_rules.md)
* [Threading Issues](general_threading_rules.md)

View File

@ -9,13 +9,13 @@ Every caret has a set of properties describing its position in one of several co
This tutorial describes how to access information about the caret(s) in an editor.
## Introduction
In this tutorial, the [editor_basics](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/editor_basics) code sample is used to explore caret positions.
In this tutorial, the [editor_basics](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/editor_basics) code sample is used to explore caret positions.
In particular, the **Caret Position** action added by `editor_basics` to the editor context menu is used to retrieve information about the current caret position.
A keyboard shortcut can also initiate the action.
![Editor Basics Menu](basics.png){width="600"}
The source code for the Java class behind the menu action is [EditorAreaIllustration](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/editor_basics/src/main/java/org/intellij/sdk/editor/EditorAreaIllustration.java).
The source code for the Java class behind the menu action is [EditorAreaIllustration](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/editor_basics/src/main/java/org/intellij/sdk/editor/EditorAreaIllustration.java).
The focus of discussion will be the `EditorAreaIllustration.actionPerformed()` method.
For more information about creating action classes, see the [Actions Tutorial](action_system.md) which covers the topic in depth.
@ -208,4 +208,4 @@ public class EditorAreaIllustration extends AnAction {
}
}
```
```

View File

@ -5,22 +5,22 @@
The previous tutorial [Editor Coordinate Systems](coordinates_system.md) described working with caret coordinate systems in an editor window.
Caret position was discussed in terms of Logical Position, Visual Position, and Offset.
This tutorial introduces the Editor Action system, which handles actions activated by keystroke events in the editor.
Two classes from the [editor_basics](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/editor_basics) code sample are used to illustrate:
Two classes from the [editor_basics](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/editor_basics) code sample are used to illustrate:
* Using an IntelliJ Platform [`EditorActionHandler`](upsource:///platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionHandler.java) to manipulate a caret.
* Creating and registering a custom [`TypedActionHandler`](upsource:///platform/platform-api/src/com/intellij/openapi/editor/actionSystem/TypedActionHandler.java) to intercept keystrokes and change the document.
## Using an IntelliJ Platform EditorActionHandler
In this portion of the tutorial, the [editor_basics](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/editor_basics) code sample is used to demonstrate cloning an existing caret.
In this portion of the tutorial, the [editor_basics](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/editor_basics) code sample is used to demonstrate cloning an existing caret.
A custom action class will use `EditorActionManager` to access a specific `EditorActionHandler` for caret cloning.
The `editor_basics` code sample adds an **Editor Add Caret** menu item to the editor context menu:
![Editor Basics Menu](basics.png){width="600"}
### Creating the Menu Action Class
The source code for the Java action class is [EditorHandlerIllustration](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/editor_basics/src/main/java/org/intellij/sdk/editor/EditorHandlerIllustration.java), a subclass of `AnAction`.
The source code for the Java action class is [EditorHandlerIllustration](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/editor_basics/src/main/java/org/intellij/sdk/editor/EditorHandlerIllustration.java), a subclass of `AnAction`.
For more information about creating action classes, see the [Actions Tutorial](action_system.md) which covers the topic in depth.
The `EditorHandlerIllustration` action is registered in the _editor_basic_ [`plugin.xml`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/editor_basics/src/main/resources/META-INF/plugin.xml) file.
The `EditorHandlerIllustration` action is registered in the _editor_basic_ [`plugin.xml`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/editor_basics/src/main/resources/META-INF/plugin.xml) file.
Note that this action class is registered to appear on the Editor context menu.
```xml
@ -141,4 +141,4 @@ public class EditorHandlerIllustration extends AnAction {
Placing the registration code in the `EditorHandlerIllustration` class is somewhat arbitrary in the sense that the registration of `MyTypedHandler` has nothing to do with the `EditorHandlerIllustration` class.
However, the `EditorHandlerIllustration` class is convenient because as an action it gets instantiated at application startup.
On instantiation, the `static` block of code in `EditorHandlerIllustration` gets evaluated.
In the `editor_basics` code sample any of the `AnAction` derived classes would work for registering `MyTypedHandler`.
In the `editor_basics` code sample any of the `AnAction` derived classes would work for registering `MyTypedHandler`.

View File

@ -9,16 +9,16 @@ Using information about the caret, replace selected text in a document with a st
The approach in this tutorial relies heavily on creating and registering actions.
To review the fundamentals of creating and registering actions, refer to the [Actions Tutorial](action_system.md).
Multiple examples are used from the [editor_basics](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/editor_basics) plugin code sample from the IntelliJ Platform SDK.
Multiple examples are used from the [editor_basics](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/editor_basics) plugin code sample from the IntelliJ Platform SDK.
It may be helpful to open that project in an IntelliJ Platform-based IDE, build the project, run it, select some text in the editor, and invoke the **Editor Replace Text** menu item on the editor context menu.
![Editor Basics Menu](basics.png){width="600"}
## Creating a New Menu Action
In this example, we access the `Editor` from an action.
The source code for the Java class in this example is [EditorIllustrationAction](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/editor_basics/src/main/java/org/intellij/sdk/editor/EditorIllustrationAction.java).
The source code for the Java class in this example is [EditorIllustrationAction](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/editor_basics/src/main/java/org/intellij/sdk/editor/EditorIllustrationAction.java).
To register the action, we must add the corresponding elements to the `<actions>` section of the plugin configuration file [plugin.xml](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/editor_basics/src/main/resources/META-INF/plugin.xml).
To register the action, we must add the corresponding elements to the `<actions>` section of the plugin configuration file [plugin.xml](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/editor_basics/src/main/resources/META-INF/plugin.xml).
For more information, refer to the [Registering Actions](working_with_custom_actions.md#registering-a-custom-action) section of the Actions Tutorial.
The `EditorIllustrationAction` action is registered in the group `EditorPopupMenu` so it will be available from the context menu when focus is on the editor:
@ -142,4 +142,4 @@ public class EditorIllustrationAction extends AnAction {
primaryCaret.removeSelection();
}
}
```
```

View File

@ -3,10 +3,10 @@
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
The following tutorial shows how to support a custom framework type for a project and make this framework type embedded in a project wizard as a UI component.
The examples in this tutorial rely heavily on the [framework_basics](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/framework_basics) code sample.
The examples in this tutorial rely heavily on the [framework_basics](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/framework_basics) code sample.
## Creating a New Framework
In oder to make a custom framework available and configurable for a project the [`FrameworkTypeEx`](upsource:///java/idea-ui/src/com/intellij/framework/FrameworkTypeEx.java) class needs to be extended, in this example to make the [DemoFramework](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/framework_basics/src/main/java/org/intellij/sdk/framework/DemoFramework.java) class.
In oder to make a custom framework available and configurable for a project the [`FrameworkTypeEx`](upsource:///java/idea-ui/src/com/intellij/framework/FrameworkTypeEx.java) class needs to be extended, in this example to make the [DemoFramework](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/framework_basics/src/main/java/org/intellij/sdk/framework/DemoFramework.java) class.
```java
public class DemoFramework extends FrameworkTypeEx {
@ -14,7 +14,7 @@ public class DemoFramework extends FrameworkTypeEx {
```
## Registering Framework
The newly created framework class should be registered as an extension point by adding `com.intellij.framework.type` extension in [`plugin.xml`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/framework_basics/src/main/resources/META-INF/plugin.xml) configuration file:
The newly created framework class should be registered as an extension point by adding `com.intellij.framework.type` extension in [`plugin.xml`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/framework_basics/src/main/resources/META-INF/plugin.xml) configuration file:
```xml
<extensions defaultExtensionNs="com.intellij">
@ -97,4 +97,4 @@ public FrameworkSupportInModuleProvider createProvider() {
After compiling and running the code sample above an extra option for configuring the newly created Demo custom framework should be available in the Project Wizard:
![Custom Framework Support](custom_framework.png)
![Custom Framework Support](custom_framework.png)

View File

@ -7,7 +7,7 @@ However, sometimes the Predefined Functions are not enough.
This tutorial illustrates how to add custom functions to an IntelliJ Platform plugin and make them available for use by Live Templates.
As an example, a function is created to convert a selection to Title Case.
Refer to the SDK code sample [`live_templates`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/live_templates).
Refer to the SDK code sample [`live_templates`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/live_templates).
## Implementing a New Function
Under the hood, the predefined functions for Live Templates are called _macros_.
@ -24,7 +24,7 @@ Three `TitleCaseMacro` methods are of particular interest:
{src="live_templates/src/main/java/org/intellij/sdk/liveTemplates/TitleCaseMacro.java"}
## Adding a Live Template
Using the procedures previously discussed for [Template Creation](template_support.md#template-creation) and [Export the Live Template](template_support.md#export-the-live-template), add a Live Template to the [Markdown.xml](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/live_templates/src/main/resources/liveTemplates) file for the plugin.
Using the procedures previously discussed for [Template Creation](template_support.md#template-creation) and [Export the Live Template](template_support.md#export-the-live-template), add a Live Template to the [Markdown.xml](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/live_templates/src/main/resources/liveTemplates) file for the plugin.
The XML representation of an example Live Template using the new `titleCase` function is listed below.
There is only one variable, `TITLE`.
@ -65,4 +65,4 @@ Now verify the plugin is working correctly.
Test that the Live Template works by entering <kbd>m</kbd> or <kbd>return</kbd>.
The text will change to have each word capitalized:
![Converted to title case](applied_titleCase.png){width="700"}
![Converted to title case](applied_titleCase.png){width="700"}

View File

@ -6,7 +6,7 @@ This tutorial illustrates how to add default Custom Live Templates to an Intelli
In addition, the tutorial discusses how to export existing Live Templates, and bundle them within a plugin.
Any Live Template that can be created and exported can be added to a plugin by following the Template Creation, Export, and Extension Point Registration processes.
This tutorial uses the SDK code sample [`live_templates`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/live_templates).
This tutorial uses the SDK code sample [`live_templates`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/live_templates).
## Template Creation
Get started by [creating a new Live Template](https://www.jetbrains.com/idea/help/creating-and-editing-live-templates.html) within the IntelliJ Platform-based IDE:
@ -47,7 +47,7 @@ The export produces a file called `Markdown.xml` with the following contents:
The display `name` can also provide localized variants by specifying `key` and `resource-bundle` attributes additionally (2020.3 and later).
Copy this file into the [plugin's resources folder](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/live_templates/src/main/resources/liveTemplates).
Copy this file into the [plugin's resources folder](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/live_templates/src/main/resources/liveTemplates).
## Implement TemplateContextType
A [`TemplateContextType`](upsource:///platform/analysis-api/src/com/intellij/codeInsight/template/TemplateContextType.java) tells the IntelliJ Platform where the Live Template is applicable: Markdown files.
@ -137,4 +137,4 @@ Using the `com.intellij.defaultLiveTemplatesProvider` and `com.intellij.liveTemp
Now verify the plugin is working correctly.
Run the plugin in a Development Instance and verify there is a new entry under **Settings/Preferenes \| Live Templates \| Markdown \| \{ (SDK: New link reference)**.
Finally, create a new file `test.md` and confirm that the Live Template works by entering a <kbd>{</kbd> character and then pressing <kbd>Tab</kbd>.
Finally, create a new file `test.md` and confirm that the Live Template works by entering a <kbd>{</kbd> character and then pressing <kbd>Tab</kbd>.

View File

@ -12,7 +12,7 @@ Create an empty plugin project as described in [Creating a Plugin Project](getti
## Register a New ConfigurationType
Add new `configurationType` extension to the [plugin.xml](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/run_configuration/src/main/resources/META-INF/plugin.xml)
Add new `configurationType` extension to the [plugin.xml](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/run_configuration/src/main/resources/META-INF/plugin.xml)
```xml
<extensions defaultExtensionNs="com.intellij">
@ -159,4 +159,4 @@ Refer to [Running and Debugging a Plugin](running_and_debugging_a_plugin.md).
After going through the steps described above you can create a custom Run Configuration from your plugin.
![New Run Configuration Type](new_run_configuration.png)
![New Run Configuration Type](new_run_configuration.png)

View File

@ -8,11 +8,11 @@ The IDE displays the Settings in response to a user choosing **Settings/Preferen
Custom Settings are displayed and function just like those native to the IDE.
## Overview of a Custom Settings Implementation
Using the SDK code sample [`settings`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/settings), this tutorial illustrates the steps to create custom Application-level Settings.
Using the SDK code sample [`settings`](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/settings), this tutorial illustrates the steps to create custom Application-level Settings.
Many IntelliJ Platform Settings implementations use fewer classes, but the `settings` code sample factors the functionality into three classes for clarity:
* The [`AppSettingsConfigurable`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/settings/src/main/java/org/intellij/sdk/settings/AppSettingsConfigurable.java) is analogous to a Controller in the MVC model - it interacts with the other two Settings classes and the IntelliJ Platform,
* The [`AppSettingsState`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/settings/src/main/java/org/intellij/sdk/settings/AppSettingsState.java) is like a Model because it stores the Settings persistently,
* The [`AppSettingsComponent`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/settings/src/main/java/org/intellij/sdk/settings/AppSettingsComponent.java) is similar to a View because it displays and captures edits to the values of the Settings.
* The [`AppSettingsConfigurable`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/settings/src/main/java/org/intellij/sdk/settings/AppSettingsConfigurable.java) is analogous to a Controller in the MVC model - it interacts with the other two Settings classes and the IntelliJ Platform,
* The [`AppSettingsState`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/settings/src/main/java/org/intellij/sdk/settings/AppSettingsState.java) is like a Model because it stores the Settings persistently,
* The [`AppSettingsComponent`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/settings/src/main/java/org/intellij/sdk/settings/AppSettingsComponent.java) is similar to a View because it displays and captures edits to the values of the Settings.
The structure of the implementation is the same for Project Settings, but there are minor differences in the [`Configurable` implementation](settings_guide.md#constructors) and [Extension Point (EP) declaration](settings_guide.md#declaring-project-settings).
@ -59,7 +59,7 @@ See [`PersistentStateComponent`](upsource:///platform/projectModel-api/src/com/i
One static convenience method has been added - `AppSettingState.getInstance()` - which allows `AppSettingsConfigurable` to easily acquire a reference to `AppSettingState`.
## The AppSettingsComponent Class
The role of the [`AppSettingsComponent`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/settings/src/main/java/org/intellij/sdk/settings/AppSettingsComponent.java) is to provide a `JPanel` for the custom Settings to the IDE Settings Dialog.
The role of the [`AppSettingsComponent`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/settings/src/main/java/org/intellij/sdk/settings/AppSettingsComponent.java) is to provide a `JPanel` for the custom Settings to the IDE Settings Dialog.
The `AppSettingsComponent` has-a `JPanel`, and is responsible for its lifetime.
The `AppSettingsComponent` is instantiated by `AppSettingsConfigurable`.
@ -75,7 +75,7 @@ The constructor builds the `JPanel` using the convenient [`FormBuilder`](upsourc
The rest of the class are simple accessors and mutators to encapsulate the UI components used on the `JPanel`.
## The AppSettingsConfigurable Class
The methods of [`AppSettingsConfigurable`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/settings/src/main/java/org/intellij/sdk/settings/AppSettingsConfigurable.java) are called by the IntelliJ Platform, and `AppSettingsConfigurable` in turn interacts with `AppSettingsComponent` and `AppSettingState`.
The methods of [`AppSettingsConfigurable`](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/settings/src/main/java/org/intellij/sdk/settings/AppSettingsConfigurable.java) are called by the IntelliJ Platform, and `AppSettingsConfigurable` in turn interacts with `AppSettingsComponent` and `AppSettingState`.
### Declaring the AppSettingsConfigurable
As described in [Declaring Application Settings](settings_guide.md#declaring-application-settings), the `com.intellij.applicationConfigurable` is used as the EP.
@ -116,4 +116,4 @@ Exit the Development Instance.
Open the file `SdkSettingsPlugin.xml` to see the Settings persistently stored.
In this demonstration the file resides in `code_samples/settings/build/idea-sandbox/config/options/`, but see [IDE Development Instances](ide_development_instance.md) for the general Development Instance case, or [Default IDE directories](https://www.jetbrains.com/help/idea/tuning-the-ide.html#default-dirs) if you are testing the `settings` plugin directly in an IDE.
!["Persisted Settings"](settings_persisted.png){width="600"}
!["Persisted Settings"](settings_persisted.png){width="600"}

View File

@ -14,7 +14,7 @@ See [Creating a Plugin Project](gradle_prerequisites.md).
## Register Custom TreeStructure Provider
Add new *treeStructureProvider* extension to the [plugin.xml](https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/tree_structure_provider/src/main/resources/META-INF/plugin.xml)
Add new *treeStructureProvider* extension to the [plugin.xml](https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/tree_structure_provider/src/main/resources/META-INF/plugin.xml)
```java
<extensions defaultExtensionNs="com.intellij">
@ -60,4 +60,4 @@ After going through the steps described above you can see only text files and di
![Text Files](text_only.png)
Check out [plugin source code](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/tree_structure_provider) and build the project to see how TreeStructureView provider works in practice.
Check out [plugin source code](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/tree_structure_provider) and build the project to see how TreeStructureView provider works in practice.

View File

@ -21,4 +21,4 @@ As an example, the plugin implemented in the [Custom Language Support Tutorial](
* [9. Commenter Test](commenter_test.md)
* [10. Reference Test](reference_test.md)
The plugin and test code can be found in the [simple_language_plugin](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/simple_language_plugin) code sample.
The plugin and test code can be found in the [simple_language_plugin](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/simple_language_plugin) code sample.

View File

@ -64,12 +64,12 @@ If closing tabs is enabled in general, a plugin can disable closing of specific
## Sample Plugin
To clarify how to develop plugins that create tool windows, consider the **toolWindow** sample plugin available in the [code_samples](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/tool_window) directory of the SDK documentation.
To clarify how to develop plugins that create tool windows, consider the **toolWindow** sample plugin available in the [code_samples](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/tool_window) directory of the SDK documentation.
This plugin creates the **Sample Calendar** tool window that displays the system date, time and time zone.
**To run the toolWindow plugin**
1. Start **IntelliJ IDEA** and open the **tool_window** project saved into the [code_samples/tool_window](https://github.com/JetBrains/intellij-sdk-code-samples/tree/master/tool_window) directory.
1. Start **IntelliJ IDEA** and open the **tool_window** project saved into the [code_samples/tool_window](https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/tool_window) directory.
2. Ensure that the project settings are valid for the environment.
If necessary, modify the project settings.
To view or modify the project settings, open the [Project Structure](https://www.jetbrains.com/help/idea/project-structure-dialog.html) dialog.
@ -79,4 +79,4 @@ This plugin creates the **Sample Calendar** tool window that displays the system
The plugin creates the **Sample Calendar** tool window.
When opened, this tool window is similar to the following screen:
![Sample Calendar](sample_calendar.png)
![Sample Calendar](sample_calendar.png)