mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
remove getInstance()
from API mention
This commit is contained in:
parent
2a36f8fa3a
commit
207a78a3b2
@ -15,9 +15,9 @@ Contents of a `VirtualFile` are treated as a stream of bytes, but concepts like
|
||||
| Context | API |
|
||||
|----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [Action](basic_action_system.md) | [`AnActionEvent.getData(PlatformDataKeys.VIRTUAL_FILE)`](upsource:///platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnActionEvent.java)<br/>[`AnActionEvent.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY)`](upsource:///platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnActionEvent.java) for multiple selection |
|
||||
| [Document](documents.md) | [`FileDocumentManager.getInstance().getFile()`](upsource:///platform/core-api/src/com/intellij/openapi/fileEditor/FileDocumentManager.java) |
|
||||
| [Document](documents.md) | [`FileDocumentManager.getFile()`](upsource:///platform/core-api/src/com/intellij/openapi/fileEditor/FileDocumentManager.java) |
|
||||
| [PSI File](psi_files.md) | [`PsiFile.getVirtualFile()`](upsource:///platform/core-api/src/com/intellij/psi/PsiFile.java) (may return `null` if the PSI file exists only in memory) |
|
||||
| Local File System Path | [`LocalFileSystem.getInstance().findFileByIoFile()`](upsource:///platform/analysis-api/src/com/intellij/openapi/vfs/LocalFileSystem.java)<br/>[`VirtualFileManager.findFileByNioPath()`/`refreshAndFindFileByNioPath()`](upsource:///platform/core-api/src/com/intellij/openapi/vfs/VirtualFileManager.java) (2020.2+) |
|
||||
| Local File System Path | [`LocalFileSystem.findFileByIoFile()`](upsource:///platform/analysis-api/src/com/intellij/openapi/vfs/LocalFileSystem.java)<br/>[`VirtualFileManager.findFileByNioPath()`/`refreshAndFindFileByNioPath()`](upsource:///platform/core-api/src/com/intellij/openapi/vfs/VirtualFileManager.java) (2020.2+) |
|
||||
|
||||
## What can I do with it?
|
||||
|
||||
|
@ -15,7 +15,7 @@ Unlike a [`VirtualFile`](upsource:///platform/core-api/src/com/intellij/openapi/
|
||||
The main difference between a `FilePath` and a [`java.io.File`](https://docs.oracle.com/javase/8/docs/api/java/io/File.html) is that a `FilePath` caches the `VirtualFile` corresponding to the path, so it can be retrieved without doing a VFS search.
|
||||
|
||||
To create instances of `FilePath`, the [`VcsContextFactory`](upsource:///platform/vcs-api/src/com/intellij/openapi/vcs/actions/VcsContextFactory.java) API is used.
|
||||
It can be accessed as`PeerFactory.getInstance().getVcsContextFactory()`
|
||||
It can be accessed as `PeerFactory.getVcsContextFactory()`.
|
||||
|
||||
`FilePath` representing paths in a VCS repository, rather than local paths, are created using `VcsContextFactory.createFilePathOnNonLocal()`.
|
||||
The `FilePath.isNonLocal()` method returns `true` for such files.
|
||||
|
@ -25,8 +25,8 @@ Several commonly needed customization implementations exist, including:
|
||||
A common use case for `EditorTextField` is entering the name of a Java class or package.
|
||||
This can be accomplished with the following steps:
|
||||
|
||||
* Use [`JavaCodeFragmentFactory.getInstance().createReferenceCodeFragment()`](upsource:///java/java-psi-api/src/com/intellij/psi/JavaCodeFragmentFactory.java) to create a code fragment representing the class or package name;
|
||||
* Call [`PsiDocumentManager.getInstance().getDocument()`](upsource:///platform/core-api/src/com/intellij/psi/PsiDocumentManager.java) to get the document corresponding to the code fragment;
|
||||
* Use [`JavaCodeFragmentFactory.createReferenceCodeFragment()`](upsource:///java/java-psi-api/src/com/intellij/psi/JavaCodeFragmentFactory.java) to create a code fragment representing the class or package name;
|
||||
* Call [`PsiDocumentManager.getDocument()`](upsource:///platform/core-api/src/com/intellij/psi/PsiDocumentManager.java) to get the document corresponding to the code fragment;
|
||||
* Pass the returned document to the [`EditorTextField`](upsource:///platform/platform-impl/src/com/intellij/ui/EditorTextField.java) constructor or its `setDocument()` method.
|
||||
|
||||
```java
|
||||
|
Loading…
x
Reference in New Issue
Block a user