mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-29 17:57:53 +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.EditorActionHandler;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorActionManager;
|
import com.intellij.openapi.editor.actionSystem.EditorActionManager;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Anna Bulenkova
|
* @author Anna Bulenkova
|
||||||
*/
|
*/
|
||||||
public class EditorHandlerIllustration extends AnAction {
|
public class EditorHandlerIllustration extends AnAction {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(AnActionEvent anActionEvent) {
|
public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
|
||||||
final Editor editor = anActionEvent.getRequiredData(CommonDataKeys.EDITOR);
|
final Editor editor = anActionEvent.getRequiredData(CommonDataKeys.EDITOR);
|
||||||
EditorActionManager actionManager = EditorActionManager.getInstance();
|
EditorActionManager actionManager = EditorActionManager.getInstance();
|
||||||
//Insert one more caret below the active caret
|
//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());
|
actionHandler.execute(editor, editor.getCaretModel().getCurrentCaret(), anActionEvent.getDataContext());
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void update(final AnActionEvent e) {
|
public void update(@NotNull final AnActionEvent anActionEvent) {
|
||||||
//Set visible if at least one caret is available
|
//Set visible if at least one caret is available
|
||||||
final Project project = e.getData(CommonDataKeys.PROJECT);
|
final Project project = anActionEvent.getData(CommonDataKeys.PROJECT);
|
||||||
final Editor editor = e.getData(CommonDataKeys.EDITOR);
|
final Editor editor = anActionEvent.getData(CommonDataKeys.EDITOR);
|
||||||
e.getPresentation().setVisible((project != null && editor != null && !editor.getCaretModel().getAllCarets().isEmpty()));
|
anActionEvent.getPresentation().setVisible((project != null && editor != null && !editor.getCaretModel().getAllCarets().isEmpty()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user