1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-08-13 23:17:06 +02:00

Convert QuitHandler to kotlin

This commit is contained in:
Alex Plate
2019-02-15 17:02:57 +03:00
parent 9054f48f88
commit 08168a7877
2 changed files with 41 additions and 46 deletions
src/com/maddyhome/idea/vim/ex/handler

@@ -1,46 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.ex.handler;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.ex.CommandHandler;
import com.maddyhome.idea.vim.ex.CommandName;
import com.maddyhome.idea.vim.ex.ExCommand;
import org.jetbrains.annotations.NotNull;
/**
*
*/
public class QuitHandler extends CommandHandler {
public QuitHandler() {
super(new CommandName[]{
new CommandName("q", "uit"),
new CommandName("clo", "se"),
new CommandName("hid", "e")
}, ARGUMENT_OPTIONAL | DONT_REOPEN);
}
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull ExCommand cmd) {
VimPlugin.getFile().closeFile(editor, context);
return true;
}
}

@@ -0,0 +1,41 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.ex.handler
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.ex.CommandHandler
import com.maddyhome.idea.vim.ex.ExCommand
import com.maddyhome.idea.vim.ex.commands
import com.maddyhome.idea.vim.ex.flags
class QuitHandler : CommandHandler(
commands {
+"q" withOptional "uit"
+"clo" withOptional "se"
+"hid" withOptional "e"
},
flags(CommandHandler.ARGUMENT_OPTIONAL, CommandHandler.DONT_REOPEN)
) {
override fun execute(editor: Editor, context: DataContext, cmd: ExCommand): Boolean {
VimPlugin.getFile().closeFile(editor, context)
return true
}
}