Search in sources :

Example 1 with EditorGotoLineNumberDialog

use of com.intellij.ide.util.EditorGotoLineNumberDialog in project intellij-community by JetBrains.

the class GotoLineAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    final Project project = e.getData(CommonDataKeys.PROJECT);
    final Editor editor = e.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE);
    if (Boolean.TRUE.equals(e.getData(PlatformDataKeys.IS_MODAL_CONTEXT))) {
        GotoLineNumberDialog dialog = new EditorGotoLineNumberDialog(project, editor);
        dialog.show();
    } else {
        CommandProcessor processor = CommandProcessor.getInstance();
        processor.executeCommand(project, () -> {
            GotoLineNumberDialog dialog = new EditorGotoLineNumberDialog(project, editor);
            dialog.show();
            IdeDocumentHistory.getInstance(project).includeCurrentCommandAsNavigation();
        }, IdeBundle.message("command.go.to.line"), null);
    }
}
Also used : EditorGotoLineNumberDialog(com.intellij.ide.util.EditorGotoLineNumberDialog) GotoLineNumberDialog(com.intellij.ide.util.GotoLineNumberDialog) Project(com.intellij.openapi.project.Project) EditorGotoLineNumberDialog(com.intellij.ide.util.EditorGotoLineNumberDialog) CommandProcessor(com.intellij.openapi.command.CommandProcessor) Editor(com.intellij.openapi.editor.Editor)

Aggregations

EditorGotoLineNumberDialog (com.intellij.ide.util.EditorGotoLineNumberDialog)1 GotoLineNumberDialog (com.intellij.ide.util.GotoLineNumberDialog)1 CommandProcessor (com.intellij.openapi.command.CommandProcessor)1 Editor (com.intellij.openapi.editor.Editor)1 Project (com.intellij.openapi.project.Project)1