mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-27 16:57:49 +08:00
[code] cleanup - annotations, naming
This commit is contained in:
parent
d9e9086887
commit
0d533e7c07
@ -8,13 +8,14 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Anna Bulenkova
|
||||
*/
|
||||
public class EditorHandlerIllustration extends AnAction {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent anActionEvent) {
|
||||
public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
|
||||
final Editor editor = anActionEvent.getRequiredData(CommonDataKeys.EDITOR);
|
||||
EditorActionManager actionManager = EditorActionManager.getInstance();
|
||||
//Insert one more caret below the active caret
|
||||
@ -22,10 +23,10 @@ public class EditorHandlerIllustration extends AnAction {
|
||||
actionHandler.execute(editor, editor.getCaretModel().getCurrentCaret(), anActionEvent.getDataContext());
|
||||
}
|
||||
@Override
|
||||
public void update(final AnActionEvent e) {
|
||||
public void update(@NotNull final AnActionEvent anActionEvent) {
|
||||
//Set visible if at least one caret is available
|
||||
final Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
final Editor editor = e.getData(CommonDataKeys.EDITOR);
|
||||
e.getPresentation().setVisible((project != null && editor != null && !editor.getCaretModel().getAllCarets().isEmpty()));
|
||||
final Project project = anActionEvent.getData(CommonDataKeys.PROJECT);
|
||||
final Editor editor = anActionEvent.getData(CommonDataKeys.EDITOR);
|
||||
anActionEvent.getPresentation().setVisible((project != null && editor != null && !editor.getCaretModel().getAllCarets().isEmpty()));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user