mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-29 17:57:53 +08:00
fix upsource links for 2019.3
This commit is contained in:
parent
bb62670f72
commit
3c1ff6671d
@ -39,15 +39,15 @@ The `VirtualFileManager.addVirtualFileListener()` method allows you to receive n
|
||||
|
||||
## Are there any utilities for analyzing and manipulating virtual files?
|
||||
|
||||
[`VfsUtil`](upsource:///platform/core-api/src/com/intellij/openapi/vfs/VfsUtil.java) and [`VfsUtilCore`](upsource:///platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java) provide utility methods for analyzing files in the Virtual File System.
|
||||
[`VfsUtil`](upsource:///platform/analysis-api/src/com/intellij/openapi/vfs/VfsUtil.java) and [`VfsUtilCore`](upsource:///platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java) provide utility methods for analyzing files in the Virtual File System.
|
||||
|
||||
You can use [`ProjectLocator`](upsource:///platform/core-api/src/com/intellij/openapi/project/ProjectLocator.java) to find the projects that contain a given virtual file.
|
||||
You can use [`ProjectLocator`](upsource:///platform/projectModel-api/src/com/intellij/openapi/project/ProjectLocator.java) to find the projects that contain a given virtual file.
|
||||
|
||||
## How do I extend VFS?
|
||||
|
||||
To provide an alternative file system implementation (for example, an FTP file system), implement the [VirtualFileSystem](upsource:///platform/core-api/src/com/intellij/openapi/vfs/VirtualFileSystem.java) class (most likely you'll also need to implement `VirtualFile`), and register your implementation as an [application component](/basics/plugin_structure/plugin_components.md).
|
||||
|
||||
To hook into operations performed in the local file system (for example, if you are developing a version control system integration that needs custom rename/move handling), implement the [LocalFileOperationsHandler](upsource:///platform/platform-api/src/com/intellij/openapi/vfs/LocalFileOperationsHandler.java) interface and register it through the`LocalFileSystem.registerAuxiliaryFileOperationsHandler` method.
|
||||
To hook into operations performed in the local file system (for example, if you are developing a version control system integration that needs custom rename/move handling), implement the [LocalFileOperationsHandler](upsource:///platform/analysis-api/src/com/intellij/openapi/vfs/LocalFileOperationsHandler.java) interface and register it through the`LocalFileSystem.registerAuxiliaryFileOperationsHandler` method.
|
||||
|
||||
## What are the rules for working with VFS?
|
||||
|
||||
|
@ -73,7 +73,7 @@ If a component has defaults, the `readExternal()` method is called twice:
|
||||
The components are loaded in the following order:
|
||||
|
||||
* Creation - constructor is invoked.
|
||||
* Initialization - the `initComponent` method is invoked (if the component implements the [BaseComponent](upsource:///platform/core-api/src/com/intellij/openapi/components/BaseComponent.java) interface).
|
||||
* Initialization - the `initComponent` method is invoked (if the component implements the [BaseComponent](upsource:///platform/extensions/src/com/intellij/openapi/components/BaseComponent.java) interface).
|
||||
* Configuration - the `readExternal` method is invoked (if the component implements [JDOMExternalizable](upsource:///platform/util/src/com/intellij/openapi/util/JDOMExternalizable.java) interface), or the `loadState` method is invoked (if the component implements [PersistentStateComponent](upsource:///platform/projectModel-api/src/com/intellij/openapi/components/PersistentStateComponent.java) and has non-default persisted state).
|
||||
* For module components, the `moduleAdded` method of the [ModuleComponent](upsource:///platform/projectModel-api/src/com/intellij/openapi/module/ModuleComponent.java) interface is invoked to notify that a module has been added to the project.
|
||||
* For project components, the `projectOpened` method of the [ProjectComponent](upsource:///platform/core-api/src/com/intellij/openapi/components/ProjectComponent.java) interface is invoked to notify that a project has been loaded.
|
||||
|
@ -27,11 +27,11 @@ As a plugin developer, you normally don't need to implement the `Executor` inter
|
||||
|
||||
The `RunProfileState` interface comes up in every run configuration implementation as the return value `RunProfile.getState()`. It describes a process which is ready to be started and holds the information like the command line, current working directory, and environment variables for the process to be started. (The existence of `RunProfileState` as a separate step in the execution flow allows run configuration extensions and other components to patch the configuration and to modify the parameters before it gets executed.)
|
||||
|
||||
The standard base class used as implementation of `RunProfileState` is [`CommandLineState`](upsource:///platform/lang-api/src/com/intellij/execution/configurations/CommandLineState.java). It contains the logic for putting together a running process and a console into an [`ExecutionResult`](upsource:///platform/lang-api/src/com/intellij/execution/ExecutionResult.java), but doesn't know anything how the process is actually started. For starting the process, it's best to use the [`GeneralCommandLine`](upsource:///platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java) class, which takes care of setting up the command line parameters and executing the process.
|
||||
The standard base class used as implementation of `RunProfileState` is [`CommandLineState`](upsource:///platform/lang-api/src/com/intellij/execution/configurations/CommandLineState.java). It contains the logic for putting together a running process and a console into an [`ExecutionResult`](upsource:///platform/lang-api/src/com/intellij/execution/ExecutionResult.java), but doesn't know anything how the process is actually started. For starting the process, it's best to use the [`GeneralCommandLine`](upsource:///platform/platform-util-io/src/com/intellij/execution/configurations/GeneralCommandLine.java) class, which takes care of setting up the command line parameters and executing the process.
|
||||
|
||||
Alternatively, if the process you need to run is a JVM-based one, you can use the [`JavaCommandLineState`](upsource:///java/execution/openapi/src/com/intellij/execution/configurations/JavaCommandLineState.java) base class. It knows about the command line parameters of the JVM and can take care of details like calculating the classpath for the JVM.
|
||||
|
||||
To monitor the execution of a process and capture its output, the [`OSProcessHandler`](upsource:///platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java) class is normally used. Once you've created an instance of `OSProcessHandler` from either a command line or a Process object, you need to call the `startNotify()` method to start capturing its output. You may also want to attach a [`ProcessTerminatedListener`](upsource:///platform/platform-api/src/com/intellij/execution/process/ProcessTerminatedListener.java) to the `OSProcessHandler`, so that the exit status of the process will be displayed in the console.
|
||||
To monitor the execution of a process and capture its output, the [`OSProcessHandler`](upsource:///platform/platform-util-io/src/com/intellij/execution/process/OSProcessHandler.java) class is normally used. Once you've created an instance of `OSProcessHandler` from either a command line or a Process object, you need to call the `startNotify()` method to start capturing its output. You may also want to attach a [`ProcessTerminatedListener`](upsource:///platform/platform-api/src/com/intellij/execution/process/ProcessTerminatedListener.java) to the `OSProcessHandler`, so that the exit status of the process will be displayed in the console.
|
||||
|
||||
## Displaying the process output
|
||||
|
||||
@ -40,7 +40,7 @@ If you're using `CommandLineState`, a console view will be automatically created
|
||||
* `TextConsoleBuilderFactory.createBuilder(project).getConsole()` creates a [`ConsoleView`](upsource:///platform/lang-api/src/com/intellij/execution/ui/ConsoleView.java) instance
|
||||
* `ConsoleView.attachToProcess()` attaches it to the output of a process.
|
||||
|
||||
If the process you're running uses ANSI escape codes to color its output, the [`ColoredProcessHandler`](upsource:///platform/platform-api/src/com/intellij/execution/process/ColoredProcessHandler.java) class will parse it and display the colors in the IntelliJ console.
|
||||
If the process you're running uses ANSI escape codes to color its output, the [`ColoredProcessHandler`](upsource:///platform/platform-impl/src/com/intellij/execution/process/ColoredProcessHandler.java) class will parse it and display the colors in the IntelliJ console.
|
||||
|
||||
Console [filters](upsource:///platform/lang-api/src/com/intellij/execution/filters/Filter.java) allow you to convert certain strings found in the process output to clickable hyperlinks. To attach a filter to the console, use `CommandLineState.addConsoleFilters()` or, if you're creating a console manually, `TextConsoleBuilder.addFilter()`.
|
||||
|
||||
|
@ -19,7 +19,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
|
||||
|
||||
|
@ -42,11 +42,11 @@ From the point of view of the caller, refresh operations can be either synchrono
|
||||
|
||||
Both synchronous and asynchronous refreshes can be initiated from any thread. If a refresh is initiated from a background thread, the calling thread must not hold a read action, because otherwise a deadlock would occur. See [IntelliJ Platform Architectural Overview](/basics/architectural_overview/general_threading_rules.md) for more details on the threading model and read/write actions.
|
||||
|
||||
The same threading requirements also apply to functions like [LocalFileSystem.refreshAndFindFileByPath()](upsource:///platform/platform-api/src/com/intellij/openapi/vfs/LocalFileSystem.java), which perform a partial refresh if the file with the specified path is not found in the snapshot.
|
||||
The same threading requirements also apply to functions like [LocalFileSystem.refreshAndFindFileByPath()](upsource:///platform/analysis-api/src/com/intellij/openapi/vfs/LocalFileSystem.java), which perform a partial refresh if the file with the specified path is not found in the snapshot.
|
||||
|
||||
In nearly all cases, using asynchronous refreshes is strongly preferred. If there is some code that needs to be executed after the refresh is complete, the code should be passed as a `postRunnable` parameter to one of the refresh methods:
|
||||
|
||||
* [RefreshQueue.createSession()](upsource:///platform/platform-api/src/com/intellij/openapi/vfs/newvfs/RefreshQueue.java)<!--#L36-->
|
||||
* [RefreshQueue.createSession()](upsource:///platform/analysis-api/src/com/intellij/openapi/vfs/newvfs/RefreshQueue.java)<!--#L36-->
|
||||
* [VirtualFile.refresh()](upsource:///platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java)<!--#L681-->
|
||||
|
||||
Synchronous refreshes can cause deadlocks in some cases, depending on which locks are held by the thread invoking the refresh operation.
|
||||
|
@ -96,7 +96,7 @@ EP: `com.intellij.declarationRangeHandler`
|
||||
|
||||
[DeclarationRangeHandler](upsource:///platform/lang-api/src/com/intellij/codeInsight/hint/DeclarationRangeHandler.java)
|
||||
provides *View \| Context Info* for custom languages with structure view implementation based on a
|
||||
[TreeBasedStructureViewBuilder](upsource:///platform/structure-view-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java).
|
||||
[TreeBasedStructureViewBuilder](upsource:///platform/editor-ui-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java).
|
||||
|
||||
|
||||
### Spellchecking
|
||||
|
@ -30,13 +30,13 @@ which collects all declarations passed to its `processDeclarations()` method and
|
||||
### Contributor-based Completion
|
||||
|
||||
Implementing the
|
||||
[CompletionContributor](upsource:///platform/lang-api/src/com/intellij/codeInsight/completion/CompletionContributor.java)
|
||||
[CompletionContributor](upsource:///platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionContributor.java)
|
||||
interface gives you the greatest control over the operation of code completion for your language.
|
||||
|
||||
> **NOTE** Note that the JavaDoc of that class contains a detailed FAQ for implementing code completion.
|
||||
|
||||
The core scenario of using
|
||||
[CompletionContributor](upsource:///platform/lang-api/src/com/intellij/codeInsight/completion/CompletionContributor.java)
|
||||
[CompletionContributor](upsource:///platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionContributor.java)
|
||||
consists of calling the `extend()` method and passing in the *pattern* specifying the context in which this completion variant is applicable, as well as a *completion provider* which generates the items to show in the completion list.
|
||||
|
||||
Keep in mind that the pattern is checked against the leaf PSI element. If you
|
||||
@ -52,10 +52,10 @@ for completing keywords in MANIFEST.MF files.
|
||||
|
||||
#### Lookup Items
|
||||
Items shown in the completion list are represented by 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)
|
||||
interface.
|
||||
These instances are normally created through the
|
||||
[LookupElementBuilder](upsource:///platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java)
|
||||
[LookupElementBuilder](upsource:///platform/analysis-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java)
|
||||
class.
|
||||
|
||||
For every lookup element, you can specify the following attributes:
|
||||
|
@ -3,10 +3,10 @@ title: Documentation
|
||||
---
|
||||
|
||||
To provide different kinds of documentation support (tooltips on **Ctrl-hover**, quick documentation popup etc.), the plugin needs to provide an implementation of the
|
||||
[DocumentationProvider](upsource:///platform/lang-api/src/com/intellij/lang/documentation/DocumentationProvider.java)
|
||||
[DocumentationProvider](upsource:///platform/analysis-api/src/com/intellij/lang/documentation/DocumentationProvider.java)
|
||||
interface and register it in the `lang.documentationProvider` extension point.
|
||||
A standard base class for such implementations is available in the class
|
||||
[AbstractDocumentationProvider](upsource:///platform/lang-api/src/com/intellij/lang/documentation/AbstractDocumentationProvider.java).
|
||||
[AbstractDocumentationProvider](upsource:///platform/analysis-api/src/com/intellij/lang/documentation/AbstractDocumentationProvider.java).
|
||||
|
||||
**Example**:
|
||||
[DocumentationProvider](upsource:///plugins/properties/src/com/intellij/lang/properties/PropertiesDocumentationProvider.java)
|
||||
|
@ -52,6 +52,6 @@ The implementation of `StructureViewTreeElement.getChildren()` needs to be match
|
||||
The latter method returns an array of `PsiElement`\-derived classes which can be shown as structure view elements, and is used to select the Structure View item matching the cursor position when the structure view is first opened or when the `Autoscroll from source` option is used.
|
||||
|
||||
**Example:**
|
||||
[StructureViewElement](upsource:///plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java)
|
||||
[StructureViewTreeElement](upsource:///plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/PropertyStructureViewElement.java)
|
||||
for
|
||||
[Properties language plugin](upsource:///plugins/properties/)
|
||||
|
@ -105,7 +105,7 @@ public void doChange(Context context) {
|
||||
*Existing resources*
|
||||
|
||||
* *MessageBus* instances are available via
|
||||
[ComponentManager.getMessageBus()](upsource:///platform/core-api/src/com/intellij/openapi/components/ComponentManager.java)<!--#L85-->
|
||||
[ComponentManager.getMessageBus()](upsource:///platform/extensions/src/com/intellij/openapi/components/ComponentManager.java)<!--#L85-->
|
||||
(many standard interfaces implement it, e.g.
|
||||
[Application](upsource:///platform/core-api/src/com/intellij/openapi/application/Application.java),
|
||||
[Project](upsource:///platform/core-api/src/com/intellij/openapi/project/Project.java);
|
||||
|
@ -15,7 +15,7 @@ The best way to deal with icons and other image resources is to put them to a de
|
||||
|
||||

|
||||
|
||||
The `getIcon()` method of [`com.intellij.openapi.util.IconLoader`](upsource:///platform/util/src/com/intellij/openapi/util/IconLoader.java) can be used to access the icons. Then define a class or an interface with icon constants in a top-level package called `icons`:
|
||||
The `getIcon()` method of [`IconLoader`](upsource:///platform/util/ui/src/com/intellij/openapi/util/IconLoader.java) can be used to access the icons. Then define a class or an interface with icon constants in a top-level package called `icons`:
|
||||
|
||||
```java
|
||||
package icons;
|
||||
|
@ -68,9 +68,9 @@ The position of the toolbar above or below the list depends on the platform unde
|
||||
To use a toolbar decorator:
|
||||
|
||||
* If you need to support removing and reordering of items in a list box, make sure the model of your list implements the
|
||||
[EditableModel](upsource:///platform/util/src/com/intellij/util/ui/EditableModel.java)
|
||||
[EditableModel](upsource:///platform/util/ui/src/com/intellij/util/ui/EditableModel.java)
|
||||
interface.
|
||||
[CollectionListModel](upsource:///platform/platform-api/src/com/intellij/ui/CollectionListModel.java)
|
||||
[CollectionListModel](upsource:///platform/util/ui/src/com/intellij/ui/CollectionListModel.java)
|
||||
is a handy model class that implements this interface.
|
||||
|
||||
* Call
|
||||
|
@ -51,6 +51,6 @@ You can let the IntelliJ Platform automatically choose the position based on the
|
||||
> **NOTE** The `show()` methods return immediately and do not wait for the popup to be closed.
|
||||
|
||||
If you need to perform some action when the popup is closed, you can either attach a listener to it using the `addListener()` method, override a method of the popup contents such as
|
||||
[PopupStep.onChosen()](upsource:///platform/platform-api/src/com/intellij/openapi/ui/popup/PopupStep.java),
|
||||
[PopupStep.onChosen()](upsource:///platform/core-ui/src/openapi/ui/popup/PopupStep.java),
|
||||
or attach an event handler to your own component within the popup.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user