mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-30 18:27:49 +08:00
[docs] change upsource to 2020.1 release, minor edits/cleanups
This commit is contained in:
parent
9508f832d1
commit
51187bb7a1
@ -8,11 +8,11 @@ baseurl: /intellij/sdk/docs/
|
||||
|
||||
description: Documentation for working with and extending the IntelliJ Platform SDK
|
||||
|
||||
# This is tag 193.6494 (2019.3.3)
|
||||
# This is tag 201.6668.121 (2019.1)
|
||||
upsource:
|
||||
server: upsource.jetbrains.com
|
||||
repo: idea-ce
|
||||
commit: e2d423f42b53eafd5c625b93149a0ebc7e49756c
|
||||
commit: 9276f4bbfb20dac51cdc0d675aef80b7f639a378
|
||||
|
||||
github_repo: JetBrains/intellij-sdk-docs
|
||||
youtrack_project: IJSDK
|
||||
|
@ -164,7 +164,7 @@ Additional `override-text` elements could be used to specify additional places w
|
||||
|
||||
#### Action Declaration Reference
|
||||
The places where actions can appear are defined by constants in [`ActionPlaces`](upsource:///platform/platform-api/src/com/intellij/openapi/actionSystem/ActionPlaces.java).
|
||||
Group IDs for the IntelliJ Platform are defined in [PlatformActions](upsource:///platform/platform-resources/src/idea/PlatformActions.xml).
|
||||
Group IDs for the IntelliJ Platform are defined in [`PlatformActions.xml`](upsource:///platform/platform-resources/src/idea/PlatformActions.xml).
|
||||
|
||||
This, and additional information can also be found by using the [Code Completion](https://www.jetbrains.com/help/idea/auto-completing-code.html#invoke-basic-completion), [Quick Definition](https://www.jetbrains.com/help/idea/viewing-reference-information.html#view-definition-symbols) and [Quick Documentation](https://www.jetbrains.com/help/idea/viewing-reference-information.html#inline-quick-documentation) features.
|
||||
|
||||
|
@ -35,7 +35,7 @@ An implementation of a file-based index consists of the following main parts:
|
||||
* `getInputFilter()` allows to restrict the indexing only to a certain set of files.
|
||||
* `getVersion()` 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.
|
||||
|
||||
If you don't need to associate any value with the files (i.e. your value type is Void), you can simplify the implementation by using [`ScalarIndexExtension`](upsource:///platform/indexing-impl/src/com/intellij/util/indexing/ScalarIndexExtension.java) as the base class.
|
||||
If you don't need to associate any value with the files (i.e. your value type is Void), you can simplify the implementation by using [`ScalarIndexExtension`](upsource:///platform/indexing-api/src/com/intellij/util/indexing/ScalarIndexExtension.java) as the base class.
|
||||
|
||||
> **WARNING** The data returned by `DataIndexer.map()` 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.
|
||||
|
||||
@ -66,4 +66,4 @@ The *IntelliJ Platform* contains a number of standard file-based indexes. The mo
|
||||
|
||||
Generally, the word index should be accessed indirectly by using helper methods of the [`PsiSearchHelper`](upsource:///platform/indexing-api/src/com/intellij/psi/search/PsiSearchHelper.java) class.
|
||||
|
||||
The second index is [`FilenameIndex`](upsource:///platform/indexing-impl/src/com/intellij/psi/search/FilenameIndex.java). It provides a quick way to find all files matching a certain file name. [`FileTypeIndex`](upsource:///platform/indexing-impl/src/com/intellij/psi/search/FileTypeIndex.java) serves a similar goal: it allows to quickly find all files of a certain file type.
|
||||
The second index is [`FilenameIndex`](upsource:///platform/indexing-api/src/com/intellij/psi/search/FilenameIndex.java). It provides a quick way to find all files matching a certain file name. [`FileTypeIndex`](upsource:///platform/indexing-api/src/com/intellij/psi/search/FileTypeIndex.java) serves a similar goal: it allows to quickly find all files of a certain file type.
|
||||
|
@ -3,7 +3,7 @@ title: Persisting State of Components
|
||||
---
|
||||
<!-- 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 *IntelliJ Platform* 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 [`PersistentStateComponent`](upsource:///platform/core-api/src/com/intellij/openapi/components/PersistentStateComponent.java) interface.
|
||||
The *IntelliJ Platform* 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 [`PersistentStateComponent`](upsource:///platform/projectModel-api/src/com/intellij/openapi/components/PersistentStateComponent.java) interface.
|
||||
|
||||
> **WARNING** If you need to persist sensitive data like passwords, please see [Persisting Sensitive Data](persisting_sensitive_data.md).
|
||||
|
||||
|
@ -30,4 +30,4 @@ Any `Configurable` which depends on dynamic extension points must implement `Con
|
||||
Application, project and module services declared with `overrides="true"` are not allowed.
|
||||
|
||||
## Plugin Load/Unload Events
|
||||
Register `com.intellij.ide.plugins.DynamicPluginListener` [listener](plugin_listeners.md) to receive updates on plugin load/unload events.
|
||||
Register [`com.intellij.ide.plugins.DynamicPluginListener`](upsource:///platform/platform-impl/src/com/intellij/ide/plugins/DynamicPlugins.kt) [listener](plugin_listeners.md) to receive updates on plugin load/unload events.
|
@ -49,4 +49,4 @@ Two common filter implementations you may want to reuse are [`RegexpFilter`](ups
|
||||
|
||||
## 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()`](upsource:///platform/lang-impl/src/com/intellij/execution/ProgramRunnerUtil.java)<!--#L110-->. The method takes a [`Project`](upsource:///platform/core-api/src/com/intellij/openapi/project/Project.java), a [`RunnerAndConfigurationSettings`](upsource:///platform/lang-api/src/com/intellij/execution/RunnerAndConfigurationSettings.java), as well as an [`Executor`](upsource:///platform/lang-api/src/com/intellij/execution/Executor.java). 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()`.
|
||||
If you have an existing run configuration that you need to execute, the easiest way to do so is to use [`ProgramRunnerUtil.executeConfiguration()`](upsource:///platform/execution-impl/src/com/intellij/execution/ProgramRunnerUtil.java)<!--#L110-->. The method takes a [`Project`](upsource:///platform/core-api/src/com/intellij/openapi/project/Project.java), a [`RunnerAndConfigurationSettings`](upsource:///platform/lang-api/src/com/intellij/execution/RunnerAndConfigurationSettings.java), as well as an [`Executor`](upsource:///platform/lang-api/src/com/intellij/execution/Executor.java). 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()`.
|
||||
|
@ -20,7 +20,7 @@ Every type there is represented as an instance of [`ConfigurationType`](upsource
|
||||
<configurationType implementation="org.jetbrains.plugins.gradle.service.execution.GradleExternalTaskConfigurationType" />
|
||||
```
|
||||
|
||||
The easiest way to implement this interface is to use the [`ConfigurationTypeBase`](upsource:////platform/lang-api/src/com/intellij/execution/configurations/runConfigurationType.kt) base class. In order to use it, you need to inherit from it and to provide the configuration type parameters (ID, name, description and icon) as constructor parameters. In addition to that, you need to call the [`addFactory()`](upsource:///platform/lang-api/src/com/intellij/execution/configurations/ConfigurationTypeBase.java)<!--#L46--> method to add a configuration factory.
|
||||
The easiest way to implement this interface is to use the [`ConfigurationTypeBase`](upsource:///platform/lang-api/src/com/intellij/execution/configurations/runConfigurationType.kt) base class. In order to use it, you need to inherit from it and to provide the configuration type parameters (ID, name, description and icon) as constructor parameters. In addition to that, you need to call the [`addFactory()`](upsource:///platform/lang-api/src/com/intellij/execution/configurations/ConfigurationTypeBase.java)<!--#L46--> method to add a configuration factory.
|
||||
|
||||
## Configuration factory
|
||||
|
||||
@ -75,7 +75,7 @@ Most run configurations contain references to classes, files or directories in t
|
||||
|
||||
In order to support that, your run configuration needs to implement the [`RefactoringListenerProvider`](upsource:///platform/lang-api/src/com/intellij/execution/configurations/RefactoringListenerProvider.java) interface.
|
||||
|
||||
In your implementation of `getRefactoringElementListener()`, you need to check whether the element being refactored is the one that your run configuration refers to, and if it is, you return a [`RefactoringElementListener`](upsource:///platform/lang-api/src/com/intellij/refactoring/listeners/RefactoringElementListener.java) that updates your configuration according to the new name and location of the element.
|
||||
In your implementation of `getRefactoringElementListener()`, you need to check whether the element being refactored is the one that your run configuration refers to, and if it is, you return a [`RefactoringElementListener`](upsource:///platform/analysis-api/src/com/intellij/refactoring/listeners/RefactoringElementListener.java) that updates your configuration according to the new name and location of the element.
|
||||
|
||||
## Creating configurations from context
|
||||
|
||||
@ -84,12 +84,12 @@ interface and to register it as `<runConfigurationProducer>` in your `plugin.xml
|
||||
|
||||
The two main methods that you need to implement are:
|
||||
|
||||
* `setupConfigurationFromContext` receives a blank configuration of your type and a `ConfigurationContext` containing information about a source code location (accessible by calling `getLocation()` or `getPsiLocation()`). Your implementation needs to check whether the location is applicable for your configuration type (for example, if it's in a file of the language you're supporting). If not, you need to return false, and if it is, you need to put the correct context-specific settings into the run configuration and return true.
|
||||
* `isConfigurationFromContext` checks if the specified configuration of your type was created from the specified context. Implementing this method allows you to reuse an existing run configuration which is applicable to the current context instead of creating a new one and possibly ignoring the customisations the user has performed in the existing one.
|
||||
* `setupConfigurationFromContext()` receives a blank configuration of your type and a `ConfigurationContext` containing information about a source code location (accessible by calling `getLocation()` or `getPsiLocation()`). Your implementation needs to check whether the location is applicable for your configuration type (for example, if it's in a file of the language you're supporting). If not, you need to return false, and if it is, you need to put the correct context-specific settings into the run configuration and return true.
|
||||
* `isConfigurationFromContext()` checks if the specified configuration of your type was created from the specified context. Implementing this method allows you to reuse an existing run configuration which is applicable to the current context instead of creating a new one and possibly ignoring the customisations the user has performed in the existing one.
|
||||
|
||||
Note that, in order to support automatic naming of configurations created from context, your configuration should use
|
||||
[`LocatableConfigurationBase`](upsource:///platform/lang-api/src/com/intellij/execution/configurations/LocatableConfigurationBase.java) as the base class.
|
||||
|
||||
## Running from the gutter
|
||||
|
||||
Take a look at `RunLineMarkerContributor` and its implementations.
|
||||
Take a look at [`RunLineMarkerContributor`](upsource:///platform/execution-impl/src/com/intellij/execution/lineMarker/RunLineMarkerContributor.java) and its implementations.
|
||||
|
@ -56,7 +56,7 @@ Synchronous refreshes can cause deadlocks in some cases, depending on which lock
|
||||
|
||||
All changes happening in the virtual file system, either as a result of refresh operations or caused by user's actions, are reported as _virtual file system events_. VFS events are always fired in the event dispatch thread, and in a write action.
|
||||
|
||||
The most efficient way to listen to VFS events is to implement the `BulkFileListener` interface and to subscribe with it to the [`VirtualFileManager.VFS_CHANGES`](upsource:///platform/core-api/src/com/intellij/openapi/vfs/VirtualFileManager.java)<!--#L34--> topic.
|
||||
The most efficient way to listen to VFS events is to implement [`BulkFileListener`](upsource:///platform/core-api/src/com/intellij/openapi/vfs/newvfs/BulkFileListener.java) and to subscribe with it to the [`VirtualFileManager.VFS_CHANGES`](upsource:///platform/core-api/src/com/intellij/openapi/vfs/VirtualFileManager.java)<!--#L34--> topic.
|
||||
A non-blocking variant [`AsyncFileListener`](upsource:///platform/core-api/src/com/intellij/openapi/vfs/AsyncFileListener.java) is also available in 2019.2 or later.
|
||||
See [How do I get notified when VFS changes?](/basics/architectural_overview/virtual_file.md#how-do-i-get-notified-when-vfs-changes) for implementation details.
|
||||
|
||||
|
@ -16,7 +16,7 @@ either on the reference at the caret location or on a dummy reference that would
|
||||
This method needs to return an array of objects containing either strings,
|
||||
[`PsiElement`](upsource:///platform/core-api/src/com/intellij/psi/PsiElement.java)
|
||||
instances or instances of the
|
||||
[`LookupElement`](upsource:///platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElement.java)
|
||||
[`LookupElement`](upsource:///platform/analysis-api/src/com/intellij/codeInsight/lookup/LookupElement.java)
|
||||
class (see [Lookup Items](#lookup-items) below).
|
||||
If a
|
||||
[`PsiElement`](upsource:///platform/core-api/src/com/intellij/psi/PsiElement.java)
|
||||
|
@ -43,7 +43,7 @@ interface allows you to entirely replace the UI and workflow of the rename refac
|
||||
at all.
|
||||
|
||||
**Example**:
|
||||
[`RenameHandler`](upsource:///plugins/properties/src/com/intellij/lang/properties/refactoring/rename/ResourceBundleFromEditorRenameHandler.java)
|
||||
[`RenameHandler`](upsource:///plugins/properties/properties-resource-bundle-editor/src/com/intellij/lang/properties/refactoring/rename/ResourceBundleFromEditorRenameHandler.java)
|
||||
for renaming a resource bundle in the
|
||||
[Properties language plugin](upsource:///plugins/properties)
|
||||
|
||||
|
@ -6,17 +6,11 @@ title: Syntax Highlighting and Error Highlighting
|
||||
The class used to specify how a particular range of text should be highlighted is called
|
||||
[`TextAttributesKey`](upsource:///platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java).
|
||||
An instance of this class is created for every distinct type of item which should be highlighted (keyword, number, string and so on).
|
||||
The
|
||||
[`TextAttributesKey`](upsource:///platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java)
|
||||
defines the default attributes which are applied to items of the corresponding type (for example, keywords are bold, numbers are blue, strings are bold and green).
|
||||
The mapping of the
|
||||
[`TextAttributesKey`](upsource:///platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java)
|
||||
to specific attributes used in an editor is defined by the
|
||||
The `TextAttributesKey` defines the default attributes which are applied to items of the corresponding type (for example, keywords are bold, numbers are blue, strings are bold and green).
|
||||
The mapping of the `TextAttributesKey` to specific attributes used in an editor is defined by the
|
||||
[`EditorColorsScheme`](upsource:///platform/editor-ui-api/src/com/intellij/openapi/editor/colors/EditorColorsScheme.java)
|
||||
class, and can be configured by the user if the plugin provides an appropriate configuration interface.
|
||||
Highlighting from multiple
|
||||
[`TextAttributesKey`](upsource:///platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java)
|
||||
items can be layered - for example, one key may define an item's boldness and another its color.
|
||||
Highlighting from multiple `TextAttributesKey` items can be layered - for example, one key may define an item's boldness and another its color.
|
||||
|
||||
**Note:**
|
||||
New functionality about Language Defaults and support for additional color schemes as detailed in
|
||||
@ -30,12 +24,8 @@ The syntax and error highlighting is performed on multiple levels: Lexer, Parser
|
||||
The first level of syntax highlighting is based on the lexer output, and is provided through the
|
||||
[`SyntaxHighlighter`](upsource:///platform/editor-ui-api/src/com/intellij/openapi/fileTypes/SyntaxHighlighter.java)
|
||||
interface.
|
||||
The syntax highlighter returns the
|
||||
[`TextAttributesKey`](upsource:///platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java)
|
||||
instances for each token type which needs special highlighting.
|
||||
For highlighting lexer errors, the standard
|
||||
[`TextAttributesKey`](upsource:///platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java)
|
||||
for bad characters
|
||||
The syntax highlighter returns the `TextAttributesKey` instances for each token type which needs special highlighting.
|
||||
For highlighting lexer errors, the standard `TextAttributesKey` for bad characters
|
||||
[`HighlighterColors.BAD_CHARACTER`](upsource:///platform/editor-ui-api/src/com/intellij/openapi/editor/HighlighterColors.java)
|
||||
can be used.
|
||||
|
||||
@ -98,7 +88,7 @@ interface for converting the output of the external tool into editor highlightin
|
||||
|
||||
The plugin can also provide a configuration interface to allow the user to configure the colors used for highlighting specific items.
|
||||
In order to do that, it should provide an implementation of
|
||||
[`ColorSettingPage`](upsource:///platform/lang-api/src/com/intellij/openapi/options/colors/ColorSettingsPage.java)
|
||||
[`ColorSettingPage`](upsource:///platform/platform-api/src/com/intellij/openapi/options/colors/ColorSettingsPage.java)
|
||||
and register it in the `com.intellij.colorSettingsPage` extension point.
|
||||
|
||||
The _Export to HTML_ feature uses the same syntax highlighting mechanism as the editor, so it will work automatically for custom languages which provide a syntax highlighter.
|
||||
|
@ -45,15 +45,15 @@ Or in order to just open it in a separate window:
|
||||
|
||||
## API
|
||||
|
||||
### `com.intellij.ui.jcef.JBCefApp`
|
||||
### [`com.intellij.ui.jcef.JBCefApp`](upsource:///platform/platform-api/src/com/intellij/ui/jcef/JBCefApp.java)
|
||||
Performs JCEF auto-initialization, manages its lifecycle, and provides `JBCefClient` instances.
|
||||
|
||||
### `com.intellij.ui.jcef.JBCefClient`
|
||||
### [`com.intellij.ui.jcef.JBCefClient`](upsource:///platform/platform-api/src/com/intellij/ui/jcef/JBCefClient.java)
|
||||
Is tied to every browser component explicitly or implicitly. Used for adding handlers to the associated browser.
|
||||
The same instance can be shared among multiple browsers. It is up to the developer to use a shared or per-browser instance, depending on the handlers' logic.
|
||||
If a client was created explicitly, it should be disposed by the developer; otherwise, it is disposed automatically following the associated browser instance disposal.
|
||||
|
||||
### `com.intellij.ui.jcef.JBCefBrowser`
|
||||
### [`com.intellij.ui.jcef.JBCefBrowser`](upsource:///platform/platform-api/src/com/intellij/ui/jcef/JBCefBrowser.java)
|
||||
Provides the browser UI component:
|
||||
|
||||
```java
|
||||
@ -87,7 +87,7 @@ The simplest way to add a browser component to your UI:
|
||||
myPanel.add(new JBCefBrowser(“https://www.jetbrains.com”).getComponent());
|
||||
```
|
||||
|
||||
### `com.intellij.ui.jcef.JBCefJSQuery`
|
||||
### [`com.intellij.ui.jcef.JBCefJSQuery`](upsource:///platform/platform-api/src/com/intellij/ui/jcef/JBCefJSQuery.java)
|
||||
|
||||
Provides JS query callback mechanism.
|
||||
|
||||
|
@ -67,7 +67,7 @@ implementations are invoked only once for each typed character.
|
||||
If those handlers need to support multiple carets, they will need to implement that explicitly.
|
||||
|
||||
[`EditorModificationUtil`](upsource:///platform/platform-api/src/com/intellij/openapi/editor/EditorModificationUtil.java).
|
||||
_typeInStringAtCaretHonorMultipleCarets_ utility method is available to do the most common task in this case — inserting the same text into all caret positions and/or moving all carets relatively to their current position.
|
||||
`typeInStringAtCaretHonorMultipleCarets()` method is available to do the most common task in this case — inserting the same text into all caret positions and/or moving all carets relatively to their current position.
|
||||
Examples of its usage:
|
||||
|
||||
* [`TypedAction`](upsource:///platform/platform-api/src/com/intellij/openapi/editor/actionSystem/TypedAction.java).
|
||||
@ -91,5 +91,3 @@ Existing actions inheriting from
|
||||
To support multiple carets, one should inherit
|
||||
[`MultiCaretCodeInsightAction`](upsource:///platform/lang-impl/src/com/intellij/codeInsight/actions/MultiCaretCodeInsightAction.java)
|
||||
instead (each caret might have a different editor and PSI instance, so using the old API is not possible).
|
||||
It is available since IDEA 14.
|
||||
|
||||
|
@ -19,7 +19,7 @@ A particular type of programmatically defined libraries is [Predefined Libraries
|
||||
{:toc}
|
||||
|
||||
## Accessing Libraries and Jars
|
||||
Package [libraries](upsource:///platform/projectModel-api/src/com/intellij/openapi/roots/libraries) provides functionality for working with project libraries and jars.
|
||||
Package [`libraries`](upsource:///platform/projectModel-api/src/com/intellij/openapi/roots/libraries) provides functionality for working with project libraries and jars.
|
||||
|
||||
### Getting a List of Libraries a Module Depends On
|
||||
To get the list of libraries that a module depends on, use `OrderEnumerator.forEachLibrary` as follows.
|
||||
|
@ -30,8 +30,8 @@ To work with projects and project files, use the following classes and interface
|
||||
* [`ProjectManager`](upsource:///platform/projectModel-api/src/com/intellij/openapi/project/ProjectManager.java)
|
||||
* [`ProjectFileIndex`](upsource:///platform/projectModel-api/src/com/intellij/openapi/roots/ProjectFileIndex.java)
|
||||
|
||||
Other classes for working with the project model are located in the [projectModel-api.openapi](upsource:///platform/projectModel-api/src/com/intellij/openapi) package.
|
||||
Basic API classes and interfaces for the concepts of [project](upsource:///platform/core-api/src/com/intellij/openapi/project/Project.java), [module](upsource:///platform/core-api/src/com/intellij/openapi/module/Module.java), [application](upsource:///platform/core-api/src/com/intellij/openapi/application/Application.java) and [component](upsource:///platform/core-api/src/com/intellij/openapi/components/ProjectComponent.java) are placed in the [core-api.openapi](upsource:///platform/core-api/src/com/intellij/openapi) package.
|
||||
Other classes for working with the project model are located in the [`projectModel-api.openapi`](upsource:///platform/projectModel-api/src/com/intellij/openapi) package.
|
||||
Basic API classes and interfaces for the concepts of [`Project`](upsource:///platform/core-api/src/com/intellij/openapi/project/Project.java), [`Module`](upsource:///platform/core-api/src/com/intellij/openapi/module/Module.java) and [`Application`](upsource:///platform/core-api/src/com/intellij/openapi/application/Application.java) are placed in the [`core-api.openapi`](upsource:///platform/core-api/src/com/intellij/openapi) package.
|
||||
|
||||
### Getting a List of Source Roots for All Modules in a Project
|
||||
Use the `ProjectRootManager.getContentSourceRoots()` method. To clarify this, consider the following code snippet:
|
||||
@ -62,8 +62,8 @@ Note that this method returns `null` if the file or directory does not belong to
|
||||
### Checking Whether a File or Directory Is Related to the Project Libraries
|
||||
The [`ProjectFileIndex`](upsource:///platform/projectModel-api/src/com/intellij/openapi/roots/ProjectFileIndex.java) interface implements a number of methods you can use to check whether the specified file belongs to the project library classes or library sources:
|
||||
* `isLibraryClassFile()`: Returns `true` if the specified `virtualFile` is a compiled class file.
|
||||
* `isInLibraryClasses()`: Returns `true` if the specified `virtualFileorDirectory` belongs to library classes.
|
||||
* `isInLibrarySource()`: Returns `true` if the specified `virtualFileorDirectory` belongs to library sources.
|
||||
* `isInLibraryClasses()`: Returns `true` if the specified `virtualFileOrDirectory` belongs to library classes.
|
||||
* `isInLibrarySource()`: Returns `true` if the specified `virtualFileOrDirectory` belongs to library sources.
|
||||
|
||||
### Getting the Project SDK
|
||||
Note that by default, the project modules use the project SDK.
|
||||
@ -71,10 +71,10 @@ Optionally, you can configure an individual SDK for each module.
|
||||
See [SDK](sdk.md) for more details.
|
||||
|
||||
## Changing the Project Structure
|
||||
Utility classes used for modifying the project structure can be found in the package [projectModel-impl.openapi](upsource:///platform/projectModel-impl/src/com/intellij/openapi). 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
|
||||
Utility classes used for modifying the project structure can be found in the package [`projectModel-impl.openapi`](upsource:///platform/projectModel-impl/src/com/intellij/openapi). 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](/basics/architectural_overview/general_threading_rules.md#readwrite-lock).
|
||||
|
||||
Refer to the [`project_model`](https://github.com/JetBrains/intellij-sdk-docs/blob/master/code_samples/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-docs/blob/master/code_samples/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](/reference_guide/messaging_infrastructure.md) and the `ProjectTopics.PROJECT_ROOTS` topic:
|
||||
|
@ -18,7 +18,7 @@ New module type should be derived from the class
|
||||
## Project Wizard
|
||||
|
||||
Main utilities to configure a custom project wizard can be found in the package
|
||||
[lang-api.ide.util.projectWizard](upsource:///platform/lang-api/src/com/intellij/ide/util/projectWizard).
|
||||
[`lang-api.ide.util.projectWizard`](upsource:///platform/lang-api/src/com/intellij/ide/util/projectWizard).
|
||||
These classes and interfaces serve the following purposes:
|
||||
|
||||
* Modification of the configuration wizard view
|
||||
|
@ -16,7 +16,7 @@ public class DemoFramework extends FrameworkTypeEx {
|
||||
|
||||
## 2. 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-docs/blob/master/code_samples/framework_basics/src/main/resources/META-INF/plugin.xml)
|
||||
[`plugin.xml`](https://github.com/JetBrains/intellij-sdk-docs/blob/master/code_samples/framework_basics/src/main/resources/META-INF/plugin.xml)
|
||||
configuration file:
|
||||
|
||||
```xml
|
||||
|
@ -49,13 +49,13 @@ The `groupDisplayId` parameter of the
|
||||
constructor specifies a notification type.
|
||||
The user can choose the display type corresponding to each notification type under `Settings | Appearance and Behavior | Notifications`.
|
||||
To specify the preferred display type, you need to use
|
||||
[`NotificationGroup`](upsource:///platform/platform-api/src/com/intellij/notification/NotificationGroup.java)
|
||||
[`NotificationGroup`](upsource:///platform/platform-api/src/com/intellij/notification/NotificationGroup.kt)
|
||||
to create notifications.
|
||||
|
||||
#### Example
|
||||
|
||||
Simple use of notifications using
|
||||
[`NotificationGroup`](upsource:///platform/platform-api/src/com/intellij/notification/NotificationGroup.java).
|
||||
[`NotificationGroup`](upsource:///platform/platform-api/src/com/intellij/notification/NotificationGroup.kt).
|
||||
|
||||
```java
|
||||
public class MyGroovyDSLErrorsNotifier {
|
||||
@ -74,7 +74,7 @@ public class MyGroovyDSLErrorsNotifier {
|
||||
```
|
||||
|
||||
Usage of the class with
|
||||
[`NotificationGroup`](upsource:///platform/platform-api/src/com/intellij/notification/NotificationGroup.java)
|
||||
[`NotificationGroup`](upsource:///platform/platform-api/src/com/intellij/notification/NotificationGroup.kt)
|
||||
above.
|
||||
|
||||
```java
|
||||
|
Loading…
x
Reference in New Issue
Block a user