public class CommonDataKeys
extends java.lang.Object
AnActionEvent.getData(DataKey)
in AnAction.update(AnActionEvent)
/AnAction.actionPerformed(AnActionEvent)
implementations.com.intellij.openapi.actionSystem.PlatformDataKeys}
,
com.intellij.openapi.actionSystem.LangDataKeys}
Modifier and Type | Field and Description |
---|---|
static DataKey<Caret> |
CARET
Returns caret instance (in host or injected editor, depending on context).
|
static DataKey<Editor> |
EDITOR
Returns currently focused editor instance.
|
static DataKey<Editor> |
EDITOR_EVEN_IF_INACTIVE
Returns editor even if focus currently is in find bar.
|
static DataKey<java.lang.Boolean> |
EDITOR_VIRTUAL_SPACE
Returns whether the current location relates to a virtual space in an editor.
|
static DataKey<Editor> |
HOST_EDITOR
Returns reference to host editor instance, in case
EDITOR key is referring to an injected editor. |
static DataKey<Navigatable> |
NAVIGATABLE
Returns
Navigatable instance. |
static DataKey<Navigatable[]> |
NAVIGATABLE_ARRAY
Returns several navigatables, e.g.
|
static DataKey<Project> |
PROJECT |
static DataKey<PsiElement> |
PSI_ELEMENT
Returns
PsiElement instance. |
static DataKey<PsiFile> |
PSI_FILE
Returns currently selected
PsiFile instance. |
static DataKey<VirtualFile> |
VIRTUAL_FILE
Returns
VirtualFile instance. |
static DataKey<VirtualFile[]> |
VIRTUAL_FILE_ARRAY
Returns several
VirtualFile instances, e.g. |
Constructor and Description |
---|
CommonDataKeys() |
public static final DataKey<Editor> EDITOR
HOST_EDITOR
,
EDITOR_EVEN_IF_INACTIVE
public static final DataKey<Editor> HOST_EDITOR
EDITOR
key is referring to an injected editor.public static final DataKey<Caret> CARET
public static final DataKey<Editor> EDITOR_EVEN_IF_INACTIVE
public static final DataKey<Navigatable> NAVIGATABLE
Navigatable
instance.
If DataContext
has a value for PSI_ELEMENT
key which implements Navigatable
it will automatically
return it for this key if explicit value isn't provided.public static final DataKey<Navigatable[]> NAVIGATABLE_ARRAY
DataContext
has a value for NAVIGATABLE
key it will automatically return single-element array for this
key if explicit value isn't provided so there is no need to perform such wrapping by hand.public static final DataKey<VirtualFile> VIRTUAL_FILE
VirtualFile
instance.
Note that if DataContext
has a value for PSI_FILE
key it will automatically return the corresponding VirtualFile
for this key if explicit value isn't provided. Also it'll return the containing file if a value for PSI_ELEMENT
key is provided.public static final DataKey<VirtualFile[]> VIRTUAL_FILE_ARRAY
VirtualFile
instances, e.g. if several elements are selected in a component.
Note that if DataContext
doesn't have an explicit value for this key it will automatically collect VirtualFile
instances
corresponding to values provided for VIRTUAL_FILE
, PSI_FILE
, PSI_ELEMENT
and other keys and return the array
containing unique instances of the found files.public static final DataKey<PsiElement> PSI_ELEMENT
PsiElement
instance.public static final DataKey<PsiFile> PSI_FILE
PsiFile
instance.
Note that if DataContext
has a value for VIRTUAL_FILE
key it will automatically return the corresponding PsiFile
for this key if explicit value isn't provided. Also it'll return the containing file if a value for PSI_ELEMENT
key is provided.public static final DataKey<java.lang.Boolean> EDITOR_VIRTUAL_SPACE
EditorSettings.setVirtualSpace(boolean)