1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-07-31 03:59:07 +02:00

Convert number package to kt

This commit is contained in:
Alex Plate 2019-11-25 11:31:27 +03:00
parent 07dbad8c70
commit 3a90cf0e7b
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F
6 changed files with 114 additions and 190 deletions

View File

@ -15,35 +15,25 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.change.change.number
package com.maddyhome.idea.vim.action.change.change.number;
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
class ChangeNumberDecAction : ChangeEditorActionHandler.ForEachCaret() {
override val type: Command.Type = Command.Type.CHANGE
public class ChangeNumberDecAction extends ChangeEditorActionHandler.ForEachCaret {
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public boolean execute(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
return VimPlugin.getChange().changeNumber(editor, caret, -count);
override fun execute(editor: Editor,
caret: Caret,
context: DataContext,
count: Int,
rawCount: Int,
argument: Argument?): Boolean {
return VimPlugin.getChange().changeNumber(editor, caret, -count)
}
}

View File

@ -15,35 +15,25 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.change.change.number
package com.maddyhome.idea.vim.action.change.change.number;
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
class ChangeNumberIncAction : ChangeEditorActionHandler.ForEachCaret() {
override val type: Command.Type = Command.Type.CHANGE
public class ChangeNumberIncAction extends ChangeEditorActionHandler.ForEachCaret {
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public boolean execute(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
return VimPlugin.getChange().changeNumber(editor, caret, count);
override fun execute(editor: Editor,
caret: Caret,
context: DataContext,
count: Int,
rawCount: Int,
argument: Argument?): Boolean {
return VimPlugin.getChange().changeNumber(editor, caret, count)
}
}

View File

@ -15,44 +15,30 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.change.change.number
package com.maddyhome.idea.vim.action.change.change.number;
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.group.visual.VimSelection
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
class ChangeVisualNumberAvalancheDecAction : VisualOperatorActionHandler.ForEachCaret() {
override val type: Command.Type = Command.Type.CHANGE
import java.util.EnumSet;
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
final public class ChangeVisualNumberAvalancheDecAction extends VisualOperatorActionHandler.ForEachCaret {
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
}
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
override fun executeAction(editor: Editor,
caret: Caret,
context: DataContext,
cmd: Command,
range: VimSelection): Boolean {
return VimPlugin.getChange()
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), -cmd.getCount(), true);
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), -cmd.count, true)
}
}

View File

@ -15,44 +15,30 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.change.change.number
package com.maddyhome.idea.vim.action.change.change.number;
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.group.visual.VimSelection
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
class ChangeVisualNumberAvalancheIncAction : VisualOperatorActionHandler.ForEachCaret() {
override val type: Command.Type = Command.Type.CHANGE
import java.util.EnumSet;
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
final public class ChangeVisualNumberAvalancheIncAction extends VisualOperatorActionHandler.ForEachCaret {
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
}
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
override fun executeAction(editor: Editor,
caret: Caret,
context: DataContext,
cmd: Command,
range: VimSelection): Boolean {
return VimPlugin.getChange()
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), cmd.getCount(), true);
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), cmd.count, true)
}
}

View File

@ -15,44 +15,30 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.change.change.number
package com.maddyhome.idea.vim.action.change.change.number;
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.group.visual.VimSelection
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
class ChangeVisualNumberDecAction : VisualOperatorActionHandler.ForEachCaret() {
override val type: Command.Type = Command.Type.CHANGE
import java.util.EnumSet;
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
final public class ChangeVisualNumberDecAction extends VisualOperatorActionHandler.ForEachCaret {
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
}
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
override fun executeAction(editor: Editor,
caret: Caret,
context: DataContext,
cmd: Command,
range: VimSelection): Boolean {
return VimPlugin.getChange()
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), -cmd.getCount(), false);
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), -cmd.count, false)
}
}

View File

@ -15,44 +15,30 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.change.change.number
package com.maddyhome.idea.vim.action.change.change.number;
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.group.visual.VimSelection
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
class ChangeVisualNumberIncAction : VisualOperatorActionHandler.ForEachCaret() {
override val type: Command.Type = Command.Type.CHANGE
import java.util.EnumSet;
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
final public class ChangeVisualNumberIncAction extends VisualOperatorActionHandler.ForEachCaret {
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
}
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
override fun executeAction(editor: Editor,
caret: Caret,
context: DataContext,
cmd: Command,
range: VimSelection): Boolean {
return VimPlugin.getChange()
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), cmd.getCount(), false);
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), cmd.count, false)
}
}