mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-27 16:57:49 +08:00
[code + md] getting the active editor
This commit is contained in:
parent
3e9a8cadf8
commit
8ace7fde95
@ -16,8 +16,10 @@ public class EditorIllustration extends AnAction {
|
||||
}
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
//Get required data keys
|
||||
final Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
final Editor editor = e.getData(CommonDataKeys.EDITOR);
|
||||
//Set visibility only in case of existing project and editor and if some text in the editor is selected
|
||||
e.getPresentation().setVisible((project != null && editor != null && editor.getSelectionModel().hasSelection()));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user