clarify e -> AnActionEvent

This commit is contained in:
Yann Cébron 2022-03-15 11:28:06 +01:00
parent 51536e8813
commit 9dfdd8b740
3 changed files with 3 additions and 3 deletions

View File

@ -13,7 +13,7 @@ The [`PsiElement`](upsource:///platform/core-api/src/com/intellij/psi/PsiElement
## How do I get a PSI element?
* From an Action: `e.getData(CommonDataKeys.PSI_ELEMENT)`.
* From an Action: `AnActionEvent.getData(CommonDataKeys.PSI_ELEMENT)`.
Note: if an editor is currently open and the element under caret is a [reference](psi_references.md), this will return the result of resolving the reference.
This may or may not be what you need.
* From a file by offset: `PsiFile.findElementAt()`.

View File

@ -10,7 +10,7 @@ Unlike `VirtualFile` and `Document`, which have application scope (even if multi
## How do I get a PSI file?
* From an Action: `e.getData(CommonDataKeys.PSI_FILE)`.
* From an Action: `AnActionEvent.getData(CommonDataKeys.PSI_FILE)`.
* From a VirtualFile: `PsiManager.getInstance(project).findFile()`
* From a Document: `PsiDocumentManager.getInstance(project).getPsiFile()`
* From an element inside the file: `PsiElement.getContainingFile()`

View File

@ -13,7 +13,7 @@ Contents of a `VirtualFile` are treated as a stream of bytes, but concepts like
## How do I get a virtual file?
#### From an Action
`e.getData(PlatformDataKeys.VIRTUAL_FILE)` or `e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY)` for multiple selection
`AnActionEvent.getData(PlatformDataKeys.VIRTUAL_FILE)` or `AnActionEvent.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY)` for multiple selection
#### From Path in Local File System
- `LocalFileSystem.getInstance().findFileByIoFile()`