1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-02-28 02:45:59 +01:00

Massive reformat code according to the IntellIJ IDEA default Java formatting settings

This commit is contained in:
Oleg Shpynov 2011-03-10 12:51:21 +03:00
parent 581720bf20
commit 914e158530
417 changed files with 29019 additions and 33665 deletions
src/com/maddyhome/idea/vim
KeyHandler.javaVimPlugin.javaVimSettings.javaVimTypedActionHandler.java
action
AbstractDelegateAction.javaAbstractDelegateEditorAction.javaDelegateAction.javaExEntryAction.javaOriginalDelegateAction.javaPassThruDelegateAction.javaPassThruDelegateEditorAction.javaResetModeAction.javaTxActionWrapper.java
change
RedoAction.javaRepeatChangeAction.javaRepeatExCommandAction.javaUndoAction.java
change
delete
insert
shift
copy
ex

File diff suppressed because it is too large Load Diff

View File

@ -70,427 +70,428 @@ import java.util.ArrayList;
public class VimPlugin implements ApplicationComponent, JDOMExternalizable//, Configurable
{
private static VimPlugin instance;
private VimTypedActionHandler vimHandler;
private RegisterActions actions;
private boolean isBlockCursor = false;
private boolean isSmoothScrolling = false;
//private ImageIcon icon;
//private VimSettingsPanel settingsPanel;
//private VimSettings settings;
private static VimPlugin instance;
private VimTypedActionHandler vimHandler;
private RegisterActions actions;
private boolean isBlockCursor = false;
private boolean isSmoothScrolling = false;
//private ImageIcon icon;
//private VimSettingsPanel settingsPanel;
//private VimSettings settings;
private boolean enabled = true;
private static Logger LOG = Logger.getInstance(VimPlugin.class.getName());
private boolean enabled = true;
private static Logger LOG = Logger.getInstance(VimPlugin.class.getName());
/**
* Creates the Vim Plugin
*/
public VimPlugin() {
LOG.debug("VimPlugin ctr");
/**
* Creates the Vim Plugin
*/
public VimPlugin() {
LOG.debug("VimPlugin ctr");
/*
java.net.URL resource = getClass().getResource("/icons/vim32x32.png");
if (resource != null)
{
icon = new ImageIcon(resource);
/*
java.net.URL resource = getClass().getResource("/icons/vim32x32.png");
if (resource != null)
{
icon = new ImageIcon(resource);
}
*/
instance = this;
}
public static VimPlugin getInstance() {
return instance;
}
/**
* Supplies the name of the plugin
*
* @return The plugin name
*/
@NotNull
public String getComponentName() {
return "VimPlugin";
}
/**
* Initialize the Vim Plugin. This plugs the vim key handler into the editor action mananger.
*/
public void initComponent() {
LOG.debug("initComponent");
EditorActionManager manager = EditorActionManager.getInstance();
TypedAction action = manager.getTypedAction();
// Replace the default key handler with the Vim key handler
vimHandler = new VimTypedActionHandler(action.getHandler());
action.setupHandler(vimHandler);
// Add some listeners so we can handle special events
setupListeners();
getActions();
LOG.debug("done");
}
/**
* This sets up some listeners so we can handle various events that occur
*/
private void setupListeners() {
DocumentManager.getInstance().addDocumentListener(new MarkGroup.MarkUpdater());
DocumentManager.getInstance().addDocumentListener(new UndoManager.DocumentChangeListener());
if (ApiHelper.supportsColorSchemes()) {
DocumentManager.getInstance().addDocumentListener(new SearchGroup.DocumentSearchListener());
}
DocumentManager.getInstance().init();
EditorFactory.getInstance().addEditorFactoryListener(new EditorFactoryAdapter() {
public void editorCreated(EditorFactoryEvent event) {
isBlockCursor = event.getEditor().getSettings().isBlockCursor();
isSmoothScrolling = event.getEditor().getSettings().isAnimatedScrolling();
if (VimPlugin.isEnabled()) {
event.getEditor().getSettings().setBlockCursor(!CommandState.inInsertMode(event.getEditor()));
event.getEditor().getSettings().setAnimatedScrolling(false);
}
*/
instance = this;
}
EditorData.initializeEditor(event.getEditor());
//if (EditorData.getVirtualFile(event.getEditor()) == null)
//{
DocumentManager.getInstance().addListeners(event.getEditor().getDocument());
//}
}
public static VimPlugin getInstance() {
return instance;
}
public void editorReleased(EditorFactoryEvent event) {
EditorData.uninitializeEditor(event.getEditor());
event.getEditor().getSettings().setAnimatedScrolling(isSmoothScrolling);
DocumentManager.getInstance().removeListeners(event.getEditor().getDocument());
}
});
/**
* Supplies the name of the plugin
*
* @return The plugin name
*/
@NotNull
public String getComponentName() {
return "VimPlugin";
}
/**
* Initialize the Vim Plugin. This plugs the vim key handler into the editor action mananger.
*/
public void initComponent() {
LOG.debug("initComponent");
EditorActionManager manager = EditorActionManager.getInstance();
TypedAction action = manager.getTypedAction();
// Replace the default key handler with the Vim key handler
vimHandler = new VimTypedActionHandler(action.getHandler());
action.setupHandler(vimHandler);
// Add some listeners so we can handle special events
setupListeners();
getActions();
LOG.debug("done");
}
/**
* This sets up some listeners so we can handle various events that occur
*/
private void setupListeners() {
DocumentManager.getInstance().addDocumentListener(new MarkGroup.MarkUpdater());
DocumentManager.getInstance().addDocumentListener(new UndoManager.DocumentChangeListener());
// Since the Vim plugin custom actions aren't available to the call to <code>initComponent()</code>
// we need to force the generation of the key map when the first project is opened.
ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
public void projectOpened(Project project) {
FileEditorManagerListener l = new ChangeGroup.InsertCheck();
listeners.add(l);
l = new MotionGroup.MotionEditorChange();
listeners.add(l);
l = new FileGroup.SelectionCheck();
listeners.add(l);
if (ApiHelper.supportsColorSchemes()) {
DocumentManager.getInstance().addDocumentListener(new SearchGroup.DocumentSearchListener());
l = new SearchGroup.EditorSelectionCheck();
listeners.add(l);
}
DocumentManager.getInstance().init();
EditorFactory.getInstance().addEditorFactoryListener(new EditorFactoryAdapter() {
public void editorCreated(EditorFactoryEvent event) {
isBlockCursor = event.getEditor().getSettings().isBlockCursor();
isSmoothScrolling = event.getEditor().getSettings().isAnimatedScrolling();
for (FileEditorManagerListener listener : listeners) {
FileEditorManager.getInstance(project).addFileEditorManagerListener(listener);
}
if (VimPlugin.isEnabled()) {
event.getEditor().getSettings().setBlockCursor(!CommandState.inInsertMode(event.getEditor()));
event.getEditor().getSettings().setAnimatedScrolling(false);
}
EditorData.initializeEditor(event.getEditor());
//if (EditorData.getVirtualFile(event.getEditor()) == null)
//{
DocumentManager.getInstance().addListeners(event.getEditor().getDocument());
//}
}
public void editorReleased(EditorFactoryEvent event) {
EditorData.uninitializeEditor(event.getEditor());
event.getEditor().getSettings().setAnimatedScrolling(isSmoothScrolling);
DocumentManager.getInstance().removeListeners(event.getEditor().getDocument());
}
});
// Since the Vim plugin custom actions aren't available to the call to <code>initComponent()</code>
// we need to force the generation of the key map when the first project is opened.
ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
public void projectOpened(Project project) {
FileEditorManagerListener l = new ChangeGroup.InsertCheck();
listeners.add(l);
l = new MotionGroup.MotionEditorChange();
listeners.add(l);
l = new FileGroup.SelectionCheck();
listeners.add(l);
if (ApiHelper.supportsColorSchemes()) {
l = new SearchGroup.EditorSelectionCheck();
listeners.add(l);
}
for (FileEditorManagerListener listener : listeners) {
FileEditorManager.getInstance(project).addFileEditorManagerListener(listener);
}
//DocumentManager.getInstance().openProject(project);
/*
ToolWindowManager mgr = ToolWindowManager.getInstance(project);
ToolWindow win = mgr.registerToolWindow("VIM", VimToolWindow.getInstance(), ToolWindowAnchor.BOTTOM);
setupToolWindow(win);
toolWindows.put(project, win);
*/
}
public void projectClosed(Project project) {
for (FileEditorManagerListener listener : listeners) {
FileEditorManager.getInstance(project).removeFileEditorManagerListener(listener);
}
listeners.clear();
//DocumentManager.getInstance().closeProject(project);
/*
toolWindows.remove(project);
ToolWindowManager mgr = ToolWindowManager.getInstance(project);
mgr.unregisterToolWindow("VIM");
*/
}
ArrayList<FileEditorManagerListener> listeners = new ArrayList<FileEditorManagerListener>();
});
CommandProcessor.getInstance().addCommandListener(DelegateCommandListener.getInstance());
//DocumentManager.getInstance().openProject(project);
/*
ApplicationManager.getApplication().addApplicationListener(new ApplicationAdapter() {
public void applicationExiting()
{
LOG.debug("application exiting");
}
public void writeActionStarted(Object action)
{
LOG.debug("writeActionStarted=" + action);
}
public void writeActionFinished(Object action)
{
LOG.debug("writeActionFinished=" + action);
}
});
ToolWindowManager mgr = ToolWindowManager.getInstance(project);
ToolWindow win = mgr.registerToolWindow("VIM", VimToolWindow.getInstance(), ToolWindowAnchor.BOTTOM);
setupToolWindow(win);
toolWindows.put(project, win);
*/
}
}
/**
* This shuts down the Vim plugin. All we need to do is reinstall the original key handler
*/
public void disposeComponent() {
LOG.debug("disposeComponent");
setEnabled(false);
EditorActionManager manager = EditorActionManager.getInstance();
TypedAction action = manager.getTypedAction();
action.setupHandler(vimHandler.getOriginalTypedHandler());
LOG.debug("done");
}
/**
* This is called by the framework to load custom configuration data. The data is stored in
* <code>$HOME/.IntelliJIdea/config/options/other.xml</code> though this is handled by the openAPI.
*
* @param element The element specific to the Vim Plugin. All the plugin's custom state information is children of
* this element.
* @throws InvalidDataException if any of the configuration data is invalid
*/
public void readExternal(Element element) throws InvalidDataException {
LOG.debug("readExternal");
// Restore whether the plugin is enabled or not
Element state = element.getChild("state");
if (state != null) {
enabled = Boolean.valueOf(state.getAttributeValue("enabled"));
public void projectClosed(Project project) {
for (FileEditorManagerListener listener : listeners) {
FileEditorManager.getInstance(project).removeFileEditorManagerListener(listener);
}
CommandGroups.getInstance().readData(element);
//KeyParser.getInstance().readData(element);
}
listeners.clear();
/**
* This is called by the framework to store custom configuration data. The data is stored in
* <code>$HOME/.IntelliJIdea/config/options/other.xml</code> though this is handled by the openAPI.
*
* @param element The element specific to the Vim Plugin. All the plugin's custom state information is children of
* this element.
* @throws WriteExternalException if unable to save and of the configuration data
*/
public void writeExternal(Element element) throws WriteExternalException {
LOG.debug("writeExternal");
// Save whether the plugin is enabled or not
Element elem = new Element("state");
elem.setAttribute("enabled", Boolean.toString(enabled));
element.addContent(elem);
//DocumentManager.getInstance().closeProject(project);
CommandGroups.getInstance().saveData(element);
//KeyParser.getInstance().saveData(element);
}
/**
* Indicates whether the user has enabled or disabled the plugin
*
* @return true if the Vim plugin is enabled, false if not
*/
public static boolean isEnabled() {
return getInstance().enabled;
}
public static void setEnabled(boolean set) {
if (!set) {
getInstance().turnOffPlugin();
}
getInstance().enabled = set;
if (set) {
getInstance().turnOnPlugin();
}
}
/**
* Inidicate to the user that an error has occurred. Just beep.
*/
public static void indicateError() {
if (!Options.getInstance().isSet("visualbell")) {
Toolkit.getDefaultToolkit().beep();
}
}
public static void showMode(String msg) {
showMessage(msg);
}
public static void showMessage(String msg) {
/*
for (Iterator iterator = toolWindows.values().iterator(); iterator.hasNext();)
{
ToolWindow window = (ToolWindow)iterator.next();
window.setTitle(msg);
}
toolWindows.remove(project);
ToolWindowManager mgr = ToolWindowManager.getInstance(project);
mgr.unregisterToolWindow("VIM");
*/
ProjectManager pm = ProjectManager.getInstance();
Project[] projs = pm.getOpenProjects();
for (Project proj : projs) {
StatusBar bar = WindowManager.getInstance().getStatusBar(proj);
if (msg == null || msg.length() == 0) {
bar.setInfo("");
} else {
bar.setInfo("VIM - " + msg);
}
}
}
}
public void turnOnPlugin() {
KeyHandler.getInstance().fullReset(null);
//RegisterActions.getInstance().enable();
setCursors(true);
setSmoothScrolling(false);
ArrayList<FileEditorManagerListener> listeners = new ArrayList<FileEditorManagerListener>();
});
CommandGroups.getInstance().getMotion().turnOn();
}
public void turnOffPlugin() {
KeyHandler.getInstance().fullReset(null);
//RegisterActions.getInstance().disable();
setCursors(isBlockCursor);
setSmoothScrolling(isSmoothScrolling);
CommandGroups.getInstance().getMotion().turnOff();
}
private void setCursors(boolean isBlock) {
Editor[] editors = EditorFactory.getInstance().getAllEditors();
for (Editor editor : editors) {
editor.getSettings().setBlockCursor(isBlock);
}
}
private void setSmoothScrolling(boolean isOn) {
Editor[] editors = EditorFactory.getInstance().getAllEditors();
for (Editor editor : editors) {
editor.getSettings().setAnimatedScrolling(isOn);
}
}
CommandProcessor.getInstance().addCommandListener(DelegateCommandListener.getInstance());
/*
public String getDisplayName()
{
return "Vim";
}
public Icon getIcon()
{
return icon;
}
public String getHelpTopic()
{
return null;
}
public JComponent createComponent()
{
if (settingsPanel == null)
ApplicationManager.getApplication().addApplicationListener(new ApplicationAdapter() {
public void applicationExiting()
{
settingsPanel = new VimSettingsPanel();
LOG.debug("application exiting");
}
return settingsPanel.getMainComponent();
}
public boolean isModified()
{
if (settingsPanel != null)
public void writeActionStarted(Object action)
{
return settingsPanel.isModified(getSettings());
LOG.debug("writeActionStarted=" + action);
}
return false;
}
public void apply() throws ConfigurationException
{
VimSettings set = settingsPanel.getOptions();
if (set.isEnabled() != VimPlugin.isEnabled())
public void writeActionFinished(Object action)
{
VimPlugin.setEnabled(set.isEnabled());
LOG.debug("writeActionFinished=" + action);
}
KeyParser.getInstance().setChoices(set.getChoices());
settings = set;
}
public void reset()
{
if (settingsPanel != null)
{
settingsPanel.setOptions(getSettings(), KeyParser.getInstance().getConflicts());
}
}
public void disposeUIResources()
{
}
});
*/
}
/**
* This shuts down the Vim plugin. All we need to do is reinstall the original key handler
*/
public void disposeComponent() {
LOG.debug("disposeComponent");
setEnabled(false);
EditorActionManager manager = EditorActionManager.getInstance();
TypedAction action = manager.getTypedAction();
action.setupHandler(vimHandler.getOriginalTypedHandler());
LOG.debug("done");
}
/**
* This is called by the framework to load custom configuration data. The data is stored in
* <code>$HOME/.IntelliJIdea/config/options/other.xml</code> though this is handled by the openAPI.
*
* @param element The element specific to the Vim Plugin. All the plugin's custom state information is children of
* this element.
* @throws InvalidDataException if any of the configuration data is invalid
*/
public void readExternal(Element element) throws InvalidDataException {
LOG.debug("readExternal");
// Restore whether the plugin is enabled or not
Element state = element.getChild("state");
if (state != null) {
enabled = Boolean.valueOf(state.getAttributeValue("enabled"));
}
CommandGroups.getInstance().readData(element);
//KeyParser.getInstance().readData(element);
}
/**
* This is called by the framework to store custom configuration data. The data is stored in
* <code>$HOME/.IntelliJIdea/config/options/other.xml</code> though this is handled by the openAPI.
*
* @param element The element specific to the Vim Plugin. All the plugin's custom state information is children of
* this element.
* @throws WriteExternalException if unable to save and of the configuration data
*/
public void writeExternal(Element element) throws WriteExternalException {
LOG.debug("writeExternal");
// Save whether the plugin is enabled or not
Element elem = new Element("state");
elem.setAttribute("enabled", Boolean.toString(enabled));
element.addContent(elem);
CommandGroups.getInstance().saveData(element);
//KeyParser.getInstance().saveData(element);
}
/**
* Indicates whether the user has enabled or disabled the plugin
*
* @return true if the Vim plugin is enabled, false if not
*/
public static boolean isEnabled() {
return getInstance().enabled;
}
public static void setEnabled(boolean set) {
if (!set) {
getInstance().turnOffPlugin();
}
getInstance().enabled = set;
if (set) {
getInstance().turnOnPlugin();
}
}
/**
* Inidicate to the user that an error has occurred. Just beep.
*/
public static void indicateError() {
if (!Options.getInstance().isSet("visualbell")) {
Toolkit.getDefaultToolkit().beep();
}
}
public static void showMode(String msg) {
showMessage(msg);
}
public static void showMessage(String msg) {
/*
public VimSettings getSettings()
for (Iterator iterator = toolWindows.values().iterator(); iterator.hasNext();)
{
if (settings == null)
{
settings = new VimSettings();
settings.setChoices(KeyParser.getInstance().getChoices());
}
settings.setEnabled(isEnabled());
return settings;
ToolWindow window = (ToolWindow)iterator.next();
window.setTitle(msg);
}
*/
ProjectManager pm = ProjectManager.getInstance();
Project[] projs = pm.getOpenProjects();
for (Project proj : projs) {
StatusBar bar = WindowManager.getInstance().getStatusBar(proj);
if (msg == null || msg.length() == 0) {
bar.setInfo("");
}
else {
bar.setInfo("VIM - " + msg);
}
}
}
private RegisterActions getActions() {
if (actions == null) {
actions = RegisterActions.getInstance();
/*
if (VimPlugin.isEnabled())
{
actions.enable();
}
*/
CommandParser.getInstance().registerHandlers();
}
public void turnOnPlugin() {
KeyHandler.getInstance().fullReset(null);
//RegisterActions.getInstance().enable();
setCursors(true);
setSmoothScrolling(false);
return actions;
CommandGroups.getInstance().getMotion().turnOn();
}
public void turnOffPlugin() {
KeyHandler.getInstance().fullReset(null);
//RegisterActions.getInstance().disable();
setCursors(isBlockCursor);
setSmoothScrolling(isSmoothScrolling);
CommandGroups.getInstance().getMotion().turnOff();
}
private void setCursors(boolean isBlock) {
Editor[] editors = EditorFactory.getInstance().getAllEditors();
for (Editor editor : editors) {
editor.getSettings().setBlockCursor(isBlock);
}
}
private void setSmoothScrolling(boolean isOn) {
Editor[] editors = EditorFactory.getInstance().getAllEditors();
for (Editor editor : editors) {
editor.getSettings().setAnimatedScrolling(isOn);
}
}
/*
public String getDisplayName()
{
return "Vim";
}
public Icon getIcon()
{
return icon;
}
public String getHelpTopic()
{
return null;
}
public JComponent createComponent()
{
if (settingsPanel == null)
{
settingsPanel = new VimSettingsPanel();
}
return settingsPanel.getMainComponent();
}
public boolean isModified()
{
if (settingsPanel != null)
{
return settingsPanel.isModified(getSettings());
}
return false;
}
public void apply() throws ConfigurationException
{
VimSettings set = settingsPanel.getOptions();
if (set.isEnabled() != VimPlugin.isEnabled())
{
VimPlugin.setEnabled(set.isEnabled());
}
KeyParser.getInstance().setChoices(set.getChoices());
settings = set;
}
public void reset()
{
if (settingsPanel != null)
{
settingsPanel.setOptions(getSettings(), KeyParser.getInstance().getConflicts());
}
}
public void disposeUIResources()
{
}
*/
/*
public VimSettings getSettings()
{
if (settings == null)
{
settings = new VimSettings();
settings.setChoices(KeyParser.getInstance().getChoices());
}
settings.setEnabled(isEnabled());
return settings;
}
*/
private RegisterActions getActions() {
if (actions == null) {
actions = RegisterActions.getInstance();
/*
if (VimPlugin.isEnabled())
{
actions.enable();
}
*/
CommandParser.getInstance().registerHandlers();
}
return actions;
}
/**
* This class is used to handle the Vim Plugin enabled/disabled toggle. This is most likely used as a menu option
* but could also be used as a toolbar item.
*/
public static class VimPluginToggleAction extends ToggleAction implements DumbAware {
/**
* Indicates if the toggle is on or off
*
* @param event The event that triggered the action
* @return true if the toggle is on, false if off
*/
public boolean isSelected(AnActionEvent event) {
return VimPlugin.isEnabled();
}
/**
* This class is used to handle the Vim Plugin enabled/disabled toggle. This is most likely used as a menu option
* but could also be used as a toolbar item.
* Specifies whether the toggle should be on or off
*
* @param event The event that triggered the action
* @param b The new state - true is on, false is off
*/
public static class VimPluginToggleAction extends ToggleAction implements DumbAware {
/**
* Indicates if the toggle is on or off
*
* @param event The event that triggered the action
* @return true if the toggle is on, false if off
*/
public boolean isSelected(AnActionEvent event) {
return VimPlugin.isEnabled();
}
/**
* Specifies whether the toggle should be on or off
*
* @param event The event that triggered the action
* @param b The new state - true is on, false is off
*/
public void setSelected(AnActionEvent event, boolean b) {
VimPlugin.setEnabled(b);
}
public void setSelected(AnActionEvent event, boolean b) {
VimPlugin.setEnabled(b);
}
}
}

View File

@ -21,67 +21,56 @@ package com.maddyhome.idea.vim;
import java.util.HashSet;
public class VimSettings
{
public boolean isEnabled()
{
return enabled;
public class VimSettings {
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public HashSet getChoices() {
return choices;
}
public void setChoices(HashSet choices) {
this.choices = choices;
}
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
public void setEnabled(boolean enabled)
{
this.enabled = enabled;
final VimSettings that = (VimSettings)o;
if (enabled != that.enabled) {
return false;
}
public HashSet getChoices()
{
return choices;
}
return choices.equals(that.choices);
}
public void setChoices(HashSet choices)
{
this.choices = choices;
}
public int hashCode() {
int result;
result = (enabled ? 1 : 0);
result = 29 * result + choices.hashCode();
return result;
}
public boolean equals(Object o)
{
if (this == o)
{
return true;
}
if (o == null || getClass() != o.getClass())
{
return false;
}
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("VimSettings");
sb.append("{enabled=").append(enabled);
sb.append(", choices=").append(choices);
sb.append('}');
return sb.toString();
}
final VimSettings that = (VimSettings)o;
if (enabled != that.enabled)
{
return false;
}
return choices.equals(that.choices);
}
public int hashCode()
{
int result;
result = (enabled ? 1 : 0);
result = 29 * result + choices.hashCode();
return result;
}
public String toString()
{
final StringBuffer sb = new StringBuffer();
sb.append("VimSettings");
sb.append("{enabled=").append(enabled);
sb.append(", choices=").append(choices);
sb.append('}');
return sb.toString();
}
private boolean enabled;
private HashSet choices = new HashSet();
private boolean enabled;
private HashSet choices = new HashSet();
}

View File

@ -23,64 +23,59 @@ import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
import javax.swing.KeyStroke;
import javax.swing.*;
/**
* This handler accepts all regular keystrokes and passes them on to the Vim Key handler
*/
public class VimTypedActionHandler implements TypedActionHandler
{
/**
* Creates an instance of the key handler
* @param origHandler The original key handler
*/
public VimTypedActionHandler(TypedActionHandler origHandler)
{
this.origHandler = origHandler;
handler = KeyHandler.getInstance();
handler.setOriginalHandler(origHandler);
public class VimTypedActionHandler implements TypedActionHandler {
/**
* Creates an instance of the key handler
*
* @param origHandler The original key handler
*/
public VimTypedActionHandler(TypedActionHandler origHandler) {
this.origHandler = origHandler;
handler = KeyHandler.getInstance();
handler.setOriginalHandler(origHandler);
}
/**
* Gives the original key handler
*
* @return The original key handler
*/
public TypedActionHandler getOriginalTypedHandler() {
return origHandler;
}
/**
* All characters typed into an editor will get sent to this handler. Only letters, numbers, and punctuation
* are sent here. Keys like Tab, Enter, Home, Backspace, etc. and all Control-Letter etc. argType keys are not
* sent by Idea to this handler.
*
* @param editor The editor the character was typed into
* @param charTyped The character that was typed
* @param context The data context
*/
public void execute(Editor editor, char charTyped, DataContext context) {
// If the plugin is disabled we simply resend the character to the original handler
if (!VimPlugin.isEnabled()) {
origHandler.execute(editor, charTyped, context);
return;
}
/**
* Gives the original key handler
* @return The original key handler
*/
public TypedActionHandler getOriginalTypedHandler()
{
return origHandler;
try {
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), context);
}
/**
* All characters typed into an editor will get sent to this handler. Only letters, numbers, and punctuation
* are sent here. Keys like Tab, Enter, Home, Backspace, etc. and all Control-Letter etc. argType keys are not
* sent by Idea to this handler.
* @param editor The editor the character was typed into
* @param charTyped The character that was typed
* @param context The data context
*/
public void execute(Editor editor, char charTyped, DataContext context)
{
// If the plugin is disabled we simply resend the character to the original handler
if (!VimPlugin.isEnabled())
{
origHandler.execute(editor, charTyped, context);
return;
}
try
{
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), context);
}
catch (Throwable e)
{
logger.error(e);
}
catch (Throwable e) {
logger.error(e);
}
}
private TypedActionHandler origHandler;
private KeyHandler handler;
private TypedActionHandler origHandler;
private KeyHandler handler;
private static Logger logger = Logger.getInstance(VimTypedActionHandler.class.getName());
private static Logger logger = Logger.getInstance(VimTypedActionHandler.class.getName());
}

View File

@ -22,33 +22,27 @@ package com.maddyhome.idea.vim.action;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.diagnostic.Logger;
public abstract class AbstractDelegateAction extends AnAction implements DelegateAction
{
protected AbstractDelegateAction()
{
public abstract class AbstractDelegateAction extends AnAction implements DelegateAction {
protected AbstractDelegateAction() {
}
protected AbstractDelegateAction(AnAction origAction) {
setOrigAction(origAction);
}
public void setOrigAction(AnAction origAction) {
if (logger.isDebugEnabled()) {
logger.debug("origAction=" + origAction);
}
this.origAction = origAction;
copyFrom(origAction);
}
protected AbstractDelegateAction(AnAction origAction)
{
setOrigAction(origAction);
}
public AnAction getOrigAction() {
return origAction;
}
public void setOrigAction(AnAction origAction)
{
if (logger.isDebugEnabled())
{
logger.debug("origAction=" + origAction);
}
this.origAction = origAction;
copyFrom(origAction);
}
private AnAction origAction;
public AnAction getOrigAction()
{
return origAction;
}
private AnAction origAction;
private static Logger logger = Logger.getInstance(AbstractDelegateAction.class.getName());
private static Logger logger = Logger.getInstance(AbstractDelegateAction.class.getName());
}

View File

@ -23,35 +23,29 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
public abstract class AbstractDelegateEditorAction extends EditorAction implements DelegateAction
{
protected AbstractDelegateEditorAction(EditorActionHandler handler)
{
super(handler);
public abstract class AbstractDelegateEditorAction extends EditorAction implements DelegateAction {
protected AbstractDelegateEditorAction(EditorActionHandler handler) {
super(handler);
}
protected AbstractDelegateEditorAction(EditorActionHandler handler, EditorAction origAction) {
this(handler);
setOrigAction(origAction);
}
public void setOrigAction(AnAction origAction) {
if (logger.isDebugEnabled()) {
logger.debug("origAction=" + origAction);
}
this.origAction = origAction;
copyFrom(origAction);
}
protected AbstractDelegateEditorAction(EditorActionHandler handler, EditorAction origAction)
{
this(handler);
setOrigAction(origAction);
}
public AnAction getOrigAction() {
return origAction;
}
public void setOrigAction(AnAction origAction)
{
if (logger.isDebugEnabled())
{
logger.debug("origAction=" + origAction);
}
this.origAction = origAction;
copyFrom(origAction);
}
private AnAction origAction;
public AnAction getOrigAction()
{
return origAction;
}
private AnAction origAction;
private static Logger logger = Logger.getInstance(AbstractDelegateEditorAction.class.getName());
private static Logger logger = Logger.getInstance(AbstractDelegateEditorAction.class.getName());
}

View File

@ -21,8 +21,8 @@ package com.maddyhome.idea.vim.action;
import com.intellij.openapi.actionSystem.AnAction;
public interface DelegateAction
{
void setOrigAction(AnAction origAction);
AnAction getOrigAction();
public interface DelegateAction {
void setOrigAction(AnAction origAction);
AnAction getOrigAction();
}

View File

@ -19,31 +19,26 @@ package com.maddyhome.idea.vim.action;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.DataContext;
/**
*
*/
public class ExEntryAction extends EditorAction
{
public ExEntryAction()
{
super(new Handler());
}
public class ExEntryAction extends EditorAction {
public ExEntryAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd)
{
CommandGroups.getInstance().getProcess().startExCommand(editor, context, cmd);
private static class Handler extends AbstractEditorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd) {
CommandGroups.getInstance().getProcess().startExCommand(editor, context, cmd);
return true;
}
return true;
}
}
}

View File

@ -21,10 +21,8 @@ package com.maddyhome.idea.vim.action;
import com.intellij.openapi.actionSystem.AnActionEvent;
public class OriginalDelegateAction extends AbstractDelegateAction
{
public void actionPerformed(AnActionEvent event)
{
getOrigAction().actionPerformed(event);
}
public class OriginalDelegateAction extends AbstractDelegateAction {
public void actionPerformed(AnActionEvent event) {
getOrigAction().actionPerformed(event);
}
}

View File

@ -25,49 +25,39 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.KeyHandler;
import com.maddyhome.idea.vim.VimPlugin;
import com.intellij.openapi.actionSystem.DataContext;
import javax.swing.*;
import java.awt.event.KeyEvent;
import javax.swing.KeyStroke;
public class PassThruDelegateAction extends AbstractDelegateAction
{
public PassThruDelegateAction(KeyStroke stroke)
{
this.stroke = stroke;
public class PassThruDelegateAction extends AbstractDelegateAction {
public PassThruDelegateAction(KeyStroke stroke) {
this.stroke = stroke;
}
public void actionPerformed(AnActionEvent event) {
if (logger.isDebugEnabled()) {
logger.debug("actionPerformed key=" + stroke);
}
public void actionPerformed(AnActionEvent event)
{
if (logger.isDebugEnabled())
{
logger.debug("actionPerformed key=" + stroke);
}
final Editor editor = event.getData(PlatformDataKeys.EDITOR); // API change - don't merge
if (editor == null || !VimPlugin.isEnabled())
{
getOrigAction().actionPerformed(event);
}
else if (event.getInputEvent() instanceof KeyEvent)
{
KeyStroke key = KeyStroke.getKeyStrokeForEvent((KeyEvent)event.getInputEvent());
if (logger.isDebugEnabled())
{
logger.debug("event = KeyEvent: " + key);
}
KeyHandler.getInstance().handleKey(editor, key, event.getDataContext());
}
else
{
if (logger.isDebugEnabled())
{
logger.debug("event is a " + event.getInputEvent().getClass().getName());
}
KeyHandler.getInstance().handleKey(editor, stroke, event.getDataContext());
}
final Editor editor = event.getData(PlatformDataKeys.EDITOR); // API change - don't merge
if (editor == null || !VimPlugin.isEnabled()) {
getOrigAction().actionPerformed(event);
}
else if (event.getInputEvent() instanceof KeyEvent) {
KeyStroke key = KeyStroke.getKeyStrokeForEvent((KeyEvent)event.getInputEvent());
if (logger.isDebugEnabled()) {
logger.debug("event = KeyEvent: " + key);
}
KeyHandler.getInstance().handleKey(editor, key, event.getDataContext());
}
else {
if (logger.isDebugEnabled()) {
logger.debug("event is a " + event.getInputEvent().getClass().getName());
}
KeyHandler.getInstance().handleKey(editor, stroke, event.getDataContext());
}
}
private KeyStroke stroke;
private KeyStroke stroke;
private static Logger logger = Logger.getInstance(PassThruDelegateAction.class.getName());
private static Logger logger = Logger.getInstance(PassThruDelegateAction.class.getName());
}

View File

@ -25,48 +25,38 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.maddyhome.idea.vim.KeyHandler;
import com.maddyhome.idea.vim.VimPlugin;
import com.intellij.openapi.actionSystem.DataContext;
import javax.swing.KeyStroke;
import javax.swing.*;
public class PassThruDelegateEditorAction extends AbstractDelegateEditorAction
{
public PassThruDelegateEditorAction(KeyStroke stroke, EditorActionHandler origHandler)
{
super(new MyHandler(stroke, origHandler));
public class PassThruDelegateEditorAction extends AbstractDelegateEditorAction {
public PassThruDelegateEditorAction(KeyStroke stroke, EditorActionHandler origHandler) {
super(new MyHandler(stroke, origHandler));
}
private static Logger logger = Logger.getInstance(PassThruDelegateEditorAction.class.getName());
private static class MyHandler extends EditorActionHandler {
public MyHandler(KeyStroke stroke, EditorActionHandler handler) {
this.stroke = stroke;
this.origHandler = handler;
}
private static Logger logger = Logger.getInstance(PassThruDelegateEditorAction.class.getName());
private static class MyHandler extends EditorActionHandler
{
public MyHandler(KeyStroke stroke, EditorActionHandler handler)
{
this.stroke = stroke;
this.origHandler = handler;
public void execute(Editor editor, DataContext dataContext) {
if (logger.isDebugEnabled()) {
logger.debug("actionPerformed key=" + stroke);
}
if (editor == null || !VimPlugin.isEnabled()) {
origHandler.execute(editor, dataContext);
}
else {
if (logger.isDebugEnabled()) {
logger.debug("event = KeyEvent: " + stroke);
}
public void execute(Editor editor, DataContext dataContext)
{
if (logger.isDebugEnabled())
{
logger.debug("actionPerformed key=" + stroke);
}
if (editor == null || !VimPlugin.isEnabled())
{
origHandler.execute(editor, dataContext);
}
else
{
if (logger.isDebugEnabled())
{
logger.debug("event = KeyEvent: " + stroke);
}
KeyHandler.getInstance().handleKey(editor, stroke, dataContext);
}
}
private KeyStroke stroke;
private EditorActionHandler origHandler;
KeyHandler.getInstance().handleKey(editor, stroke, dataContext);
}
}
private KeyStroke stroke;
private EditorActionHandler origHandler;
}
}

View File

@ -25,10 +25,8 @@ import com.maddyhome.idea.vim.handler.ResetModeHandler;
/**
*
*/
public class ResetModeAction extends EditorAction
{
public ResetModeAction()
{
super(new ResetModeHandler());
}
public class ResetModeAction extends EditorAction {
public ResetModeAction() {
super(new ResetModeHandler());
}
}

View File

@ -30,45 +30,37 @@ import com.maddyhome.idea.vim.undo.UndoManager;
/**
*
*/
public class TxActionWrapper extends AbstractDelegateAction
{
public TxActionWrapper()
{
public class TxActionWrapper extends AbstractDelegateAction {
public TxActionWrapper() {
}
public TxActionWrapper(AnAction origAction) {
super(origAction);
}
public void actionPerformed(AnActionEvent event) {
logger.debug("actionPerformed");
final Editor editor = event.getData(PlatformDataKeys.EDITOR); // API change - don't merge
if (editor == null || !VimPlugin.isEnabled()) {
getOrigAction().actionPerformed(event);
}
else {
boolean doTx = !UndoManager.getInstance().inCommand(editor);
logger.debug("doTx = " + doTx);
if (doTx) {
UndoManager.getInstance().endCommand(editor);
UndoManager.getInstance().beginCommand(editor);
}
public TxActionWrapper(AnAction origAction)
{
super(origAction);
getOrigAction().actionPerformed(event);
if (doTx) {
UndoManager.getInstance().endCommand(editor);
UndoManager.getInstance().beginCommand(editor);
}
}
}
public void actionPerformed(AnActionEvent event)
{
logger.debug("actionPerformed");
final Editor editor = event.getData(PlatformDataKeys.EDITOR); // API change - don't merge
if (editor == null || !VimPlugin.isEnabled())
{
getOrigAction().actionPerformed(event);
}
else
{
boolean doTx = !UndoManager.getInstance().inCommand(editor);
logger.debug("doTx = " + doTx);
if (doTx)
{
UndoManager.getInstance().endCommand(editor);
UndoManager.getInstance().beginCommand(editor);
}
getOrigAction().actionPerformed(event);
if (doTx)
{
UndoManager.getInstance().endCommand(editor);
UndoManager.getInstance().beginCommand(editor);
}
}
}
private static Logger logger = Logger.getInstance(TxActionWrapper.class.getName());
private static Logger logger = Logger.getInstance(TxActionWrapper.class.getName());
}

View File

@ -19,31 +19,27 @@ package com.maddyhome.idea.vim.action.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
import com.maddyhome.idea.vim.undo.UndoManager;
/**
*/
public class RedoAction extends EditorAction
{
public RedoAction()
{
super(new Handler());
}
public class RedoAction extends EditorAction {
public RedoAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd)
{
UndoManager.getInstance().endCommand(editor);
boolean res = UndoManager.getInstance().redo(editor, context);
UndoManager.getInstance().beginCommand(editor);
private static class Handler extends AbstractEditorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd) {
UndoManager.getInstance().endCommand(editor);
boolean res = UndoManager.getInstance().redo(editor, context);
UndoManager.getInstance().beginCommand(editor);
return res;
}
return res;
}
}
}

View File

@ -19,6 +19,7 @@ package com.maddyhome.idea.vim.action.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.KeyHandler;
@ -27,66 +28,54 @@ import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
import com.maddyhome.idea.vim.key.KeyParser;
import com.maddyhome.idea.vim.undo.UndoManager;
/**
*/
public class RepeatChangeAction extends EditorAction
{
public RepeatChangeAction()
{
super(new Handler());
}
public class RepeatChangeAction extends EditorAction {
public RepeatChangeAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, Command command)
{
CommandState state = CommandState.getInstance(editor);
Command cmd = state.getLastChangeCommand();
if (cmd != null)
{
if (command.getRawCount() > 0)
{
cmd.setCount(command.getCount());
Argument arg = cmd.getArgument();
if (arg != null)
{
Command mot = arg.getMotion();
if (mot != null)
{
mot.setCount(0);
}
}
}
Command save = state.getCommand();
state.setCommand(cmd);
state.pushState(CommandState.MODE_REPEAT, 0, KeyParser.MAPPING_NORMAL);
char reg = CommandGroups.getInstance().getRegister().getCurrentRegister();
CommandGroups.getInstance().getRegister().selectRegister(state.getLastChangeRegister());
try
{
KeyHandler.executeAction(cmd.getAction(), context);
UndoManager.getInstance().endCommand(editor);
UndoManager.getInstance().beginCommand(editor);
}
catch (Exception e)
{
// oops
}
state.popState();
state.setCommand(save);
state.saveLastChangeCommand(cmd);
CommandGroups.getInstance().getRegister().selectRegister(reg);
return true;
}
else
{
return false;
private static class Handler extends AbstractEditorActionHandler {
public boolean execute(Editor editor, DataContext context, Command command) {
CommandState state = CommandState.getInstance(editor);
Command cmd = state.getLastChangeCommand();
if (cmd != null) {
if (command.getRawCount() > 0) {
cmd.setCount(command.getCount());
Argument arg = cmd.getArgument();
if (arg != null) {
Command mot = arg.getMotion();
if (mot != null) {
mot.setCount(0);
}
}
}
Command save = state.getCommand();
state.setCommand(cmd);
state.pushState(CommandState.MODE_REPEAT, 0, KeyParser.MAPPING_NORMAL);
char reg = CommandGroups.getInstance().getRegister().getCurrentRegister();
CommandGroups.getInstance().getRegister().selectRegister(state.getLastChangeRegister());
try {
KeyHandler.executeAction(cmd.getAction(), context);
UndoManager.getInstance().endCommand(editor);
UndoManager.getInstance().beginCommand(editor);
}
catch (Exception e) {
// oops
}
state.popState();
state.setCommand(save);
state.saveLastChangeCommand(cmd);
CommandGroups.getInstance().getRegister().selectRegister(reg);
return true;
}
else {
return false;
}
}
}
}

View File

@ -19,36 +19,30 @@ package com.maddyhome.idea.vim.action.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.ex.CommandParser;
import com.maddyhome.idea.vim.ex.ExException;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class RepeatExCommandAction extends EditorAction
{
public RepeatExCommandAction()
{
super(new Handler());
}
public class RepeatExCommandAction extends EditorAction {
public RepeatExCommandAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, Command command)
{
int count = command.getCount();
try
{
return CommandParser.getInstance().processLastCommand(editor, context, count);
}
catch (ExException e)
{
return false;
}
}
private static class Handler extends AbstractEditorActionHandler {
public boolean execute(Editor editor, DataContext context, Command command) {
int count = command.getCount();
try {
return CommandParser.getInstance().processLastCommand(editor, context, count);
}
catch (ExException e) {
return false;
}
}
}
}

View File

@ -19,31 +19,27 @@ package com.maddyhome.idea.vim.action.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
import com.maddyhome.idea.vim.undo.UndoManager;
/**
*/
public class UndoAction extends EditorAction
{
public UndoAction()
{
super(new Handler());
}
public class UndoAction extends EditorAction {
public UndoAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd)
{
UndoManager.getInstance().endCommand(editor);
boolean res = UndoManager.getInstance().undo(editor, context);
UndoManager.getInstance().beginCommand(editor);
private static class Handler extends AbstractEditorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd) {
UndoManager.getInstance().endCommand(editor);
boolean res = UndoManager.getInstance().undo(editor, context);
UndoManager.getInstance().beginCommand(editor);
return res;
}
return res;
}
}
}

View File

@ -19,28 +19,25 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ChangeCaseLowerMotionAction extends EditorAction
{
public ChangeCaseLowerMotionAction()
{
super(new Handler());
}
public class ChangeCaseLowerMotionAction extends EditorAction {
public ChangeCaseLowerMotionAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().changeCaseMotion(editor, context, count, rawCount,
CharacterHelper.CASE_LOWER, argument);
}
}}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeCaseMotion(editor, context, count, rawCount,
CharacterHelper.CASE_LOWER, argument);
}
}
}

View File

@ -19,6 +19,7 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
@ -26,23 +27,18 @@ import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ChangeCaseLowerVisualAction extends EditorAction
{
public ChangeCaseLowerVisualAction()
{
super(new Handler());
}
public class ChangeCaseLowerVisualAction extends EditorAction {
public ChangeCaseLowerVisualAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
return CommandGroups.getInstance().getChange().changeCaseRange(editor, context, range, CharacterHelper.CASE_LOWER);
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
return CommandGroups.getInstance().getChange().changeCaseRange(editor, context, range, CharacterHelper.CASE_LOWER);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ChangeCaseToggleCharacterAction extends EditorAction
{
public ChangeCaseToggleCharacterAction()
{
super(new Handler());
}
public class ChangeCaseToggleCharacterAction extends EditorAction {
public ChangeCaseToggleCharacterAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().changeCaseToggleCharacter(editor, context, count);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeCaseToggleCharacter(editor, context, count);
}
}
}

View File

@ -19,29 +19,25 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ChangeCaseToggleMotionAction extends EditorAction
{
public ChangeCaseToggleMotionAction()
{
super(new Handler());
}
public class ChangeCaseToggleMotionAction extends EditorAction {
public ChangeCaseToggleMotionAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().changeCaseMotion(editor, context, count, rawCount,
CharacterHelper.CASE_TOGGLE, argument);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeCaseMotion(editor, context, count, rawCount,
CharacterHelper.CASE_TOGGLE, argument);
}
}
}

View File

@ -19,6 +19,7 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
@ -26,22 +27,17 @@ import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ChangeCaseToggleVisualAction extends EditorAction
{
public ChangeCaseToggleVisualAction()
{
super(new Handler());
}
public class ChangeCaseToggleVisualAction extends EditorAction {
public ChangeCaseToggleVisualAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
return CommandGroups.getInstance().getChange().changeCaseRange(editor, context, range, CharacterHelper.CASE_TOGGLE);
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
return CommandGroups.getInstance().getChange().changeCaseRange(editor, context, range, CharacterHelper.CASE_TOGGLE);
}
}
}

View File

@ -19,29 +19,25 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ChangeCaseUpperMotionAction extends EditorAction
{
public ChangeCaseUpperMotionAction()
{
super(new Handler());
}
public class ChangeCaseUpperMotionAction extends EditorAction {
public ChangeCaseUpperMotionAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().changeCaseMotion(editor, context, count, rawCount,
CharacterHelper.CASE_UPPER, argument);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeCaseMotion(editor, context, count, rawCount,
CharacterHelper.CASE_UPPER, argument);
}
}
}

View File

@ -19,6 +19,7 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
@ -26,22 +27,17 @@ import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ChangeCaseUpperVisualAction extends EditorAction
{
public ChangeCaseUpperVisualAction()
{
super(new Handler());
}
public class ChangeCaseUpperVisualAction extends EditorAction {
public ChangeCaseUpperVisualAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
return CommandGroups.getInstance().getChange().changeCaseRange(editor, context, range, CharacterHelper.CASE_UPPER);
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
return CommandGroups.getInstance().getChange().changeCaseRange(editor, context, range, CharacterHelper.CASE_UPPER);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ChangeCharacterAction extends EditorAction
{
public ChangeCharacterAction()
{
super(new Handler());
}
public class ChangeCharacterAction extends EditorAction {
public ChangeCharacterAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().changeCharacter(editor, context, count, argument.getCharacter());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeCharacter(editor, context, count, argument.getCharacter());
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ChangeCharactersAction extends EditorAction
{
public ChangeCharactersAction()
{
super(new Handler());
}
public class ChangeCharactersAction extends EditorAction {
public ChangeCharactersAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().changeCharacters(editor, context, count);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeCharacters(editor, context, count);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ChangeEndOfLineAction extends EditorAction
{
public ChangeEndOfLineAction()
{
super(new Handler());
}
public class ChangeEndOfLineAction extends EditorAction {
public ChangeEndOfLineAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().changeEndOfLine(editor, context, count);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeEndOfLine(editor, context, count);
}
}
}

View File

@ -19,30 +19,26 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.ex.LineRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
import com.maddyhome.idea.vim.helper.EditorHelper;
/**
*/
public class ChangeLastGlobalSearchReplaceAction extends EditorAction
{
public ChangeLastGlobalSearchReplaceAction()
{
super(new Handler());
}
public class ChangeLastGlobalSearchReplaceAction extends EditorAction {
public ChangeLastGlobalSearchReplaceAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
LineRange range = new LineRange(0, EditorHelper.getLineCount(editor) - 1);
return CommandGroups.getInstance().getSearch().searchAndReplace(editor, context, range, "s", "//~/&");
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
LineRange range = new LineRange(0, EditorHelper.getLineCount(editor) - 1);
return CommandGroups.getInstance().getSearch().searchAndReplace(editor, context, range, "s", "//~/&");
}
}
}

View File

@ -19,31 +19,27 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.ex.LineRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
import com.maddyhome.idea.vim.helper.EditorHelper;
/**
*/
public class ChangeLastSearchReplaceAction extends EditorAction
{
public ChangeLastSearchReplaceAction()
{
super(new Handler());
}
public class ChangeLastSearchReplaceAction extends EditorAction {
public ChangeLastSearchReplaceAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
int line = EditorHelper.getCurrentLogicalLine(editor);
LineRange range = new LineRange(line, line);
return CommandGroups.getInstance().getSearch().searchAndReplace(editor, context, range, "s", "//~/");
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
int line = EditorHelper.getCurrentLogicalLine(editor);
LineRange range = new LineRange(line, line);
return CommandGroups.getInstance().getSearch().searchAndReplace(editor, context, range, "s", "//~/");
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ChangeLineAction extends EditorAction
{
public ChangeLineAction()
{
super(new Handler());
}
public class ChangeLineAction extends EditorAction {
public ChangeLineAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().changeLine(editor, context, count);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeLine(editor, context, count);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ChangeMotionAction extends EditorAction
{
public ChangeMotionAction()
{
super(new Handler());
}
public class ChangeMotionAction extends EditorAction {
public ChangeMotionAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().changeMotion(editor, context, count, rawCount, argument);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeMotion(editor, context, count, rawCount, argument);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ChangeNumberDecAction extends EditorAction
{
public ChangeNumberDecAction()
{
super(new Handler());
}
public class ChangeNumberDecAction extends EditorAction {
public ChangeNumberDecAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().changeNumber(editor, context, -count);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeNumber(editor, context, -count);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ChangeNumberIncAction extends EditorAction
{
public ChangeNumberIncAction()
{
super(new Handler());
}
public class ChangeNumberIncAction extends EditorAction {
public ChangeNumberIncAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().changeNumber(editor, context, count);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeNumber(editor, context, count);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ChangeReplaceAction extends EditorAction
{
public ChangeReplaceAction()
{
super(new Handler());
}
public class ChangeReplaceAction extends EditorAction {
public ChangeReplaceAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().changeReplace(editor, context);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeReplace(editor, context);
}
}
}

View File

@ -19,29 +19,25 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ChangeVisualAction extends EditorAction
{
public ChangeVisualAction()
{
super(new Handler());
}
public class ChangeVisualAction extends EditorAction {
public ChangeVisualAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
int mode = range.isMultiple() ? Command.FLAG_MOT_BLOCKWISE : Command.FLAG_MOT_INCLUSIVE;
return CommandGroups.getInstance().getChange().changeRange(editor, context, range, mode);
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
int mode = range.isMultiple() ? Command.FLAG_MOT_BLOCKWISE : Command.FLAG_MOT_INCLUSIVE;
return CommandGroups.getInstance().getChange().changeRange(editor, context, range, mode);
}
}
}

View File

@ -19,29 +19,25 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ChangeVisualCharacterAction extends EditorAction
{
public ChangeVisualCharacterAction()
{
super(new Handler());
}
public class ChangeVisualCharacterAction extends EditorAction {
public ChangeVisualCharacterAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
return CommandGroups.getInstance().getChange().changeCharacterRange(editor, context, range,
cmd.getArgument().getCharacter());
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
return CommandGroups.getInstance().getChange().changeCharacterRange(editor, context, range,
cmd.getArgument().getCharacter());
}
}
}

View File

@ -19,32 +19,28 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
import com.maddyhome.idea.vim.helper.EditorHelper;
/**
*/
public class ChangeVisualLinesAction extends EditorAction
{
public ChangeVisualLinesAction()
{
super(new Handler());
}
public class ChangeVisualLinesAction extends EditorAction {
public ChangeVisualLinesAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return CommandGroups.getInstance().getChange().changeRange(editor, context, range, Command.FLAG_MOT_LINEWISE);
}
return CommandGroups.getInstance().getChange().changeRange(editor, context, range, Command.FLAG_MOT_LINEWISE);
}
}
}

View File

@ -19,51 +19,43 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
import com.maddyhome.idea.vim.helper.EditorHelper;
/**
*/
public class ChangeVisualLinesEndAction extends EditorAction
{
public ChangeVisualLinesEndAction()
{
super(new Handler());
}
public class ChangeVisualLinesEndAction extends EditorAction {
public ChangeVisualLinesEndAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
if (range.isMultiple())
{
int[] starts = range.getStartOffsets();
int[] ends = range.getEndOffsets();
for (int i = 0; i < starts.length; i++)
{
if (ends[i] > starts[i])
{
ends[i] = EditorHelper.getLineEndForOffset(editor, starts[i]);
}
}
range = new TextRange(starts, ends);
return CommandGroups.getInstance().getChange().changeRange(editor, context, range,
Command.FLAG_MOT_BLOCKWISE);
}
else
{
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return CommandGroups.getInstance().getChange().changeRange(editor, context, range, Command.FLAG_MOT_LINEWISE);
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
if (range.isMultiple()) {
int[] starts = range.getStartOffsets();
int[] ends = range.getEndOffsets();
for (int i = 0; i < starts.length; i++) {
if (ends[i] > starts[i]) {
ends[i] = EditorHelper.getLineEndForOffset(editor, starts[i]);
}
}
range = new TextRange(starts, ends);
return CommandGroups.getInstance().getChange().changeRange(editor, context, range,
Command.FLAG_MOT_BLOCKWISE);
}
else {
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return CommandGroups.getInstance().getChange().changeRange(editor, context, range, Command.FLAG_MOT_LINEWISE);
}
}
}
}

View File

@ -19,29 +19,25 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class FilterCountLinesAction extends EditorAction
{
public FilterCountLinesAction()
{
super(new Handler());
}
public class FilterCountLinesAction extends EditorAction {
public FilterCountLinesAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd)
{
CommandGroups.getInstance().getProcess().startFilterCommand(editor, context, cmd);
private static class Handler extends AbstractEditorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd) {
CommandGroups.getInstance().getProcess().startFilterCommand(editor, context, cmd);
return true;
}
return true;
}
}
}

View File

@ -19,6 +19,7 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.LogicalPosition;
import com.intellij.openapi.editor.actionSystem.EditorAction;
@ -27,50 +28,41 @@ import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.group.MotionGroup;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class FilterMotionAction extends EditorAction
{
public FilterMotionAction()
{
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd)
{
TextRange range = MotionGroup.getMotionRange(editor, context, cmd.getCount(), cmd.getRawCount(),
cmd.getArgument(), false, false);
if (range == null)
{
return false;
}
LogicalPosition current = editor.getCaretModel().getLogicalPosition();
LogicalPosition start = editor.offsetToLogicalPosition(range.getStartOffset());
LogicalPosition end = editor.offsetToLogicalPosition(range.getEndOffset());
if (current.line != start.line)
{
MotionGroup.moveCaret(editor, context, range.getStartOffset());
}
int count;
if (start.line < end.line)
{
count = end.line - start.line + 1;
}
else
{
count = 1;
}
Command command = new Command(count, null, null, 0, 0);
CommandGroups.getInstance().getProcess().startFilterCommand(editor, context, command);
return true;
}
public class FilterMotionAction extends EditorAction {
public FilterMotionAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd) {
TextRange range = MotionGroup.getMotionRange(editor, context, cmd.getCount(), cmd.getRawCount(),
cmd.getArgument(), false, false);
if (range == null) {
return false;
}
LogicalPosition current = editor.getCaretModel().getLogicalPosition();
LogicalPosition start = editor.offsetToLogicalPosition(range.getStartOffset());
LogicalPosition end = editor.offsetToLogicalPosition(range.getEndOffset());
if (current.line != start.line) {
MotionGroup.moveCaret(editor, context, range.getStartOffset());
}
int count;
if (start.line < end.line) {
count = end.line - start.line + 1;
}
else {
count = 1;
}
Command command = new Command(count, null, null, 0, 0);
CommandGroups.getInstance().getProcess().startFilterCommand(editor, context, command);
return true;
}
}
}

View File

@ -19,30 +19,26 @@ package com.maddyhome.idea.vim.action.change.change;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class FilterVisualLinesAction extends EditorAction
{
public FilterVisualLinesAction()
{
super(new Handler());
}
public class FilterVisualLinesAction extends EditorAction {
public FilterVisualLinesAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd)
{
CommandGroups.getInstance().getProcess().startFilterCommand(editor, context, cmd);
CommandGroups.getInstance().getMotion().resetVisual(editor);
private static class Handler extends AbstractEditorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd) {
CommandGroups.getInstance().getProcess().startFilterCommand(editor, context, cmd);
CommandGroups.getInstance().getMotion().resetVisual(editor);
return true;
}
return true;
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.delete;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class DeleteCharacterAction extends EditorAction
{
public DeleteCharacterAction()
{
super(new Handler());
}
public class DeleteCharacterAction extends EditorAction {
public DeleteCharacterAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().deleteCharacter(editor, context, 1);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().deleteCharacter(editor, context, 1);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.delete;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class DeleteCharacterLeftAction extends EditorAction
{
public DeleteCharacterLeftAction()
{
super(new Handler());
}
public class DeleteCharacterLeftAction extends EditorAction {
public DeleteCharacterLeftAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().deleteCharacter(editor, context, -count);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().deleteCharacter(editor, context, -count);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.delete;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class DeleteCharacterRightAction extends EditorAction
{
public DeleteCharacterRightAction()
{
super(new Handler());
}
public class DeleteCharacterRightAction extends EditorAction {
public DeleteCharacterRightAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().deleteCharacter(editor, context, count);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().deleteCharacter(editor, context, count);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.delete;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class DeleteEndOfLineAction extends EditorAction
{
public DeleteEndOfLineAction()
{
super(new Handler());
}
public class DeleteEndOfLineAction extends EditorAction {
public DeleteEndOfLineAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().deleteEndOfLine(editor, context, count);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().deleteEndOfLine(editor, context, count);
}
}
}

View File

@ -19,32 +19,27 @@ package com.maddyhome.idea.vim.action.change.delete;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class DeleteJoinLinesAction extends EditorAction
{
public DeleteJoinLinesAction()
{
super(new Handler());
}
public class DeleteJoinLinesAction extends EditorAction {
public DeleteJoinLinesAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
if (editor.isOneLineMode())
{
return false;
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
return CommandGroups.getInstance().getChange().deleteJoinLines(editor, context, count, false);
}
return CommandGroups.getInstance().getChange().deleteJoinLines(editor, context, count, false);
}
}
}

View File

@ -19,32 +19,27 @@ package com.maddyhome.idea.vim.action.change.delete;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class DeleteJoinLinesSpacesAction extends EditorAction
{
public DeleteJoinLinesSpacesAction()
{
super(new Handler());
}
public class DeleteJoinLinesSpacesAction extends EditorAction {
public DeleteJoinLinesSpacesAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
if (editor.isOneLineMode())
{
return false;
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
return CommandGroups.getInstance().getChange().deleteJoinLines(editor, context, count, true);
}
return CommandGroups.getInstance().getChange().deleteJoinLines(editor, context, count, true);
}
}
}

View File

@ -19,33 +19,28 @@ package com.maddyhome.idea.vim.action.change.delete;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class DeleteJoinVisualLinesAction extends EditorAction
{
public DeleteJoinVisualLinesAction()
{
super(new Handler());
}
public class DeleteJoinVisualLinesAction extends EditorAction {
public DeleteJoinVisualLinesAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
if (editor.isOneLineMode())
{
return false;
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
if (editor.isOneLineMode()) {
return false;
}
return CommandGroups.getInstance().getChange().deleteJoinRange(editor, context, range, false);
}
return CommandGroups.getInstance().getChange().deleteJoinRange(editor, context, range, false);
}
}
}

View File

@ -19,33 +19,28 @@ package com.maddyhome.idea.vim.action.change.delete;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class DeleteJoinVisualLinesSpacesAction extends EditorAction
{
public DeleteJoinVisualLinesSpacesAction()
{
super(new Handler());
}
public class DeleteJoinVisualLinesSpacesAction extends EditorAction {
public DeleteJoinVisualLinesSpacesAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
if (editor.isOneLineMode())
{
return false;
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
if (editor.isOneLineMode()) {
return false;
}
return CommandGroups.getInstance().getChange().deleteJoinRange(editor, context, range, true);
}
return CommandGroups.getInstance().getChange().deleteJoinRange(editor, context, range, true);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.delete;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class DeleteLineAction extends EditorAction
{
public DeleteLineAction()
{
super(new Handler());
}
public class DeleteLineAction extends EditorAction {
public DeleteLineAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().deleteLine(editor, context, count);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().deleteLine(editor, context, count);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.delete;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class DeleteMotionAction extends EditorAction
{
public DeleteMotionAction()
{
super(new Handler());
}
public class DeleteMotionAction extends EditorAction {
public DeleteMotionAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getChange().deleteMotion(editor, context, count, rawCount, argument, false);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().deleteMotion(editor, context, count, rawCount, argument, false);
}
}
}

View File

@ -19,6 +19,7 @@ package com.maddyhome.idea.vim.action.change.delete;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
@ -26,30 +27,24 @@ import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
import com.maddyhome.idea.vim.helper.EditorHelper;
/**
*/
public class DeleteVisualAction extends EditorAction
{
public DeleteVisualAction()
{
super(new Handler());
}
public class DeleteVisualAction extends EditorAction {
public DeleteVisualAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
int mode = CommandState.getInstance(editor).getSubMode();
if (mode == Command.FLAG_MOT_LINEWISE)
{
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
int mode = CommandState.getInstance(editor).getSubMode();
if (mode == Command.FLAG_MOT_LINEWISE) {
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
}
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range, mode, false);
}
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range, mode, false);
}
}
}

View File

@ -19,6 +19,7 @@ package com.maddyhome.idea.vim.action.change.delete;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
@ -26,35 +27,28 @@ import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
import com.maddyhome.idea.vim.helper.EditorHelper;
/**
*/
public class DeleteVisualLinesAction extends EditorAction
{
public DeleteVisualLinesAction()
{
super(new Handler());
}
public class DeleteVisualLinesAction extends EditorAction {
public DeleteVisualLinesAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
int mode = CommandState.getInstance(editor).getSubMode();
if (mode == Command.FLAG_MOT_BLOCKWISE)
{
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range, mode, false);
}
else
{
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
int mode = CommandState.getInstance(editor).getSubMode();
if (mode == Command.FLAG_MOT_BLOCKWISE) {
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range, mode, false);
}
else {
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range,
Command.FLAG_MOT_LINEWISE, false);
}
}
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range,
Command.FLAG_MOT_LINEWISE, false);
}
}
}
}

View File

@ -19,52 +19,44 @@ package com.maddyhome.idea.vim.action.change.delete;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
import com.maddyhome.idea.vim.helper.EditorHelper;
/**
*/
public class DeleteVisualLinesEndAction extends EditorAction
{
public DeleteVisualLinesEndAction()
{
super(new Handler());
}
public class DeleteVisualLinesEndAction extends EditorAction {
public DeleteVisualLinesEndAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
if (range.isMultiple())
{
int[] starts = range.getStartOffsets();
int[] ends = range.getEndOffsets();
for (int i = 0; i < starts.length; i++)
{
if (ends[i] > starts[i])
{
ends[i] = EditorHelper.getLineEndForOffset(editor, starts[i]);
}
}
range = new TextRange(starts, ends);
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range,
Command.FLAG_MOT_BLOCKWISE, false);
}
else
{
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range,
Command.FLAG_MOT_LINEWISE, false);
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
if (range.isMultiple()) {
int[] starts = range.getStartOffsets();
int[] ends = range.getEndOffsets();
for (int i = 0; i < starts.length; i++) {
if (ends[i] > starts[i]) {
ends[i] = EditorHelper.getLineEndForOffset(editor, starts[i]);
}
}
range = new TextRange(starts, ends);
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range,
Command.FLAG_MOT_BLOCKWISE, false);
}
else {
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range,
Command.FLAG_MOT_LINEWISE, false);
}
}
}
}

View File

@ -19,29 +19,25 @@ package com.maddyhome.idea.vim.action.change.insert;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertAfterCursorAction extends EditorAction
{
public InsertAfterCursorAction()
{
super(new Handler());
}
public class InsertAfterCursorAction extends EditorAction {
public InsertAfterCursorAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
CommandGroups.getInstance().getChange().insertAfterCursor(editor, context);
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
CommandGroups.getInstance().getChange().insertAfterCursor(editor, context);
return true;
}
return true;
}
}
}

View File

@ -19,29 +19,25 @@ package com.maddyhome.idea.vim.action.change.insert;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertAfterLineEndAction extends EditorAction
{
public InsertAfterLineEndAction()
{
super(new Handler());
}
public class InsertAfterLineEndAction extends EditorAction {
public InsertAfterLineEndAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
CommandGroups.getInstance().getChange().insertAfterLineEnd(editor, context);
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
CommandGroups.getInstance().getChange().insertAfterLineEnd(editor, context);
return true;
}
return true;
}
}
}

View File

@ -19,29 +19,25 @@ package com.maddyhome.idea.vim.action.change.insert;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertAtPreviousInsertAction extends EditorAction
{
public InsertAtPreviousInsertAction()
{
super(new Handler());
}
public class InsertAtPreviousInsertAction extends EditorAction {
public InsertAtPreviousInsertAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
CommandGroups.getInstance().getChange().insertAtPreviousInsert(editor, context);
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
CommandGroups.getInstance().getChange().insertAtPreviousInsert(editor, context);
return true;
}
return true;
}
}
}

View File

@ -19,29 +19,25 @@ package com.maddyhome.idea.vim.action.change.insert;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertBeforeCursorAction extends EditorAction
{
public InsertBeforeCursorAction()
{
super(new Handler());
}
public class InsertBeforeCursorAction extends EditorAction {
public InsertBeforeCursorAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
CommandGroups.getInstance().getChange().insertBeforeCursor(editor, context);
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
CommandGroups.getInstance().getChange().insertBeforeCursor(editor, context);
return true;
}
return true;
}
}
}

View File

@ -19,29 +19,25 @@ package com.maddyhome.idea.vim.action.change.insert;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertBeforeFirstNonBlankAction extends EditorAction
{
public InsertBeforeFirstNonBlankAction()
{
super(new Handler());
}
public class InsertBeforeFirstNonBlankAction extends EditorAction {
public InsertBeforeFirstNonBlankAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
CommandGroups.getInstance().getChange().insertBeforeFirstNonBlank(editor, context);
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
CommandGroups.getInstance().getChange().insertBeforeFirstNonBlank(editor, context);
return true;
}
return true;
}
}
}

View File

@ -19,32 +19,27 @@ package com.maddyhome.idea.vim.action.change.insert;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertCharacterAboveCursorAction extends EditorAction
{
public InsertCharacterAboveCursorAction()
{
super(new Handler());
}
public class InsertCharacterAboveCursorAction extends EditorAction {
public InsertCharacterAboveCursorAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd)
{
if (editor.isOneLineMode())
{
return false;
}
private static class Handler extends AbstractEditorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd) {
if (editor.isOneLineMode()) {
return false;
}
return CommandGroups.getInstance().getChange().insertCharacterAroundCursor(editor, context, -1);
}
return CommandGroups.getInstance().getChange().insertCharacterAroundCursor(editor, context, -1);
}
}
}

View File

@ -19,32 +19,27 @@ package com.maddyhome.idea.vim.action.change.insert;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertCharacterBelowCursorAction extends EditorAction
{
public InsertCharacterBelowCursorAction()
{
super(new Handler());
}
public class InsertCharacterBelowCursorAction extends EditorAction {
public InsertCharacterBelowCursorAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd)
{
if (editor.isOneLineMode())
{
return false;
}
private static class Handler extends AbstractEditorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd) {
if (editor.isOneLineMode()) {
return false;
}
return CommandGroups.getInstance().getChange().insertCharacterAroundCursor(editor, context, 1);
}
return CommandGroups.getInstance().getChange().insertCharacterAroundCursor(editor, context, 1);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.insert;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertDeleteInsertedTextAction extends EditorAction
{
public InsertDeleteInsertedTextAction()
{
super(new Handler());
}
public class InsertDeleteInsertedTextAction extends EditorAction {
public InsertDeleteInsertedTextAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, Command cmd)
{
return CommandGroups.getInstance().getChange().insertDeleteInsertedText(editor, context);
}
private static class Handler extends AbstractEditorActionHandler {
public boolean execute(Editor editor, DataContext context, Command cmd) {
return CommandGroups.getInstance().getChange().insertDeleteInsertedText(editor, context);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.insert;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertDeletePreviousWordAction extends EditorAction
{
public InsertDeletePreviousWordAction()
{
super(new Handler());
}
public class InsertDeletePreviousWordAction extends EditorAction {
public InsertDeletePreviousWordAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, Command cmd)
{
return CommandGroups.getInstance().getChange().insertDeletePreviousWord(editor, context);
}
private static class Handler extends AbstractEditorActionHandler {
public boolean execute(Editor editor, DataContext context, Command cmd) {
return CommandGroups.getInstance().getChange().insertDeletePreviousWord(editor, context);
}
}
}

View File

@ -24,27 +24,21 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertEnterAction extends EditorAction
{
public InsertEnterAction()
{
super(new Handler());
}
public class InsertEnterAction extends EditorAction {
public InsertEnterAction() {
super(new Handler());
}
private static class Handler extends EditorActionHandler
{
public void execute(Editor editor, DataContext context)
{
if (editor.isOneLineMode())
{
return;
}
private static class Handler extends EditorActionHandler {
public void execute(Editor editor, DataContext context) {
if (editor.isOneLineMode()) {
return;
}
CommandGroups.getInstance().getChange().processEnter(editor, context);
}
CommandGroups.getInstance().getChange().processEnter(editor, context);
}
}
}

View File

@ -24,22 +24,17 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertExitModeAction extends EditorAction
{
public InsertExitModeAction()
{
super(new Handler());
}
public class InsertExitModeAction extends EditorAction {
public InsertExitModeAction() {
super(new Handler());
}
private static class Handler extends EditorActionHandler
{
public void execute(Editor editor, DataContext context)
{
CommandGroups.getInstance().getChange().processEscape(editor, context);
}
private static class Handler extends EditorActionHandler {
public void execute(Editor editor, DataContext context) {
CommandGroups.getInstance().getChange().processEscape(editor, context);
}
}
}

View File

@ -24,22 +24,17 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertHelpAction extends EditorAction
{
public InsertHelpAction()
{
super(new Handler());
}
public class InsertHelpAction extends EditorAction {
public InsertHelpAction() {
super(new Handler());
}
private static class Handler extends EditorActionHandler
{
public void execute(Editor editor, DataContext context)
{
CommandGroups.getInstance().getChange().insertHelp(editor, context);
}
private static class Handler extends EditorActionHandler {
public void execute(Editor editor, DataContext context) {
CommandGroups.getInstance().getChange().insertHelp(editor, context);
}
}
}

View File

@ -24,22 +24,17 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertInsertAction extends EditorAction
{
public InsertInsertAction()
{
super(new Handler());
}
public class InsertInsertAction extends EditorAction {
public InsertInsertAction() {
super(new Handler());
}
private static class Handler extends EditorActionHandler
{
public void execute(Editor editor, DataContext context)
{
CommandGroups.getInstance().getChange().processInsert(editor, context);
}
private static class Handler extends EditorActionHandler {
public void execute(Editor editor, DataContext context) {
CommandGroups.getInstance().getChange().processInsert(editor, context);
}
}
}

View File

@ -19,29 +19,25 @@ package com.maddyhome.idea.vim.action.change.insert;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertLineStartAction extends EditorAction
{
public InsertLineStartAction()
{
super(new Handler());
}
public class InsertLineStartAction extends EditorAction {
public InsertLineStartAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
CommandGroups.getInstance().getChange().insertLineStart(editor, context);
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
CommandGroups.getInstance().getChange().insertLineStart(editor, context);
return true;
}
return true;
}
}
}

View File

@ -19,34 +19,29 @@ package com.maddyhome.idea.vim.action.change.insert;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertNewLineAboveAction extends EditorAction
{
public InsertNewLineAboveAction()
{
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
if (editor.isOneLineMode())
{
return false;
}
CommandGroups.getInstance().getChange().insertNewLineAbove(editor, context);
return true;
}
public class InsertNewLineAboveAction extends EditorAction {
public InsertNewLineAboveAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
CommandGroups.getInstance().getChange().insertNewLineAbove(editor, context);
return true;
}
}
}

View File

@ -19,34 +19,29 @@ package com.maddyhome.idea.vim.action.change.insert;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertNewLineBelowAction extends EditorAction
{
public InsertNewLineBelowAction()
{
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
if (editor.isOneLineMode())
{
return false;
}
CommandGroups.getInstance().getChange().insertNewLineBelow(editor, context);
return true;
}
public class InsertNewLineBelowAction extends EditorAction {
public InsertNewLineBelowAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
CommandGroups.getInstance().getChange().insertNewLineBelow(editor, context);
return true;
}
}
}

View File

@ -24,22 +24,17 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertPreviousInsertAction extends EditorAction
{
public InsertPreviousInsertAction()
{
super(new Handler());
}
public class InsertPreviousInsertAction extends EditorAction {
public InsertPreviousInsertAction() {
super(new Handler());
}
private static class Handler extends EditorActionHandler
{
public void execute(Editor editor, DataContext context)
{
CommandGroups.getInstance().getChange().insertPreviousInsert(editor, context, false);
}
private static class Handler extends EditorActionHandler {
public void execute(Editor editor, DataContext context) {
CommandGroups.getInstance().getChange().insertPreviousInsert(editor, context, false);
}
}
}

View File

@ -24,22 +24,17 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertPreviousInsertExitAction extends EditorAction
{
public InsertPreviousInsertExitAction()
{
super(new Handler());
}
public class InsertPreviousInsertExitAction extends EditorAction {
public InsertPreviousInsertExitAction() {
super(new Handler());
}
private static class Handler extends EditorActionHandler
{
public void execute(Editor editor, DataContext context)
{
CommandGroups.getInstance().getChange().insertPreviousInsert(editor, context, true);
}
private static class Handler extends EditorActionHandler {
public void execute(Editor editor, DataContext context) {
CommandGroups.getInstance().getChange().insertPreviousInsert(editor, context, true);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.change.insert;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertRegisterAction extends EditorAction
{
public InsertRegisterAction()
{
super(new Handler());
}
public class InsertRegisterAction extends EditorAction {
public InsertRegisterAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, Command cmd)
{
return CommandGroups.getInstance().getChange().insertRegister(editor, context, cmd.getArgument().getCharacter());
}
private static class Handler extends AbstractEditorActionHandler {
public boolean execute(Editor editor, DataContext context, Command cmd) {
return CommandGroups.getInstance().getChange().insertRegister(editor, context, cmd.getArgument().getCharacter());
}
}
}

View File

@ -24,22 +24,17 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class InsertSingleCommandAction extends EditorAction
{
public InsertSingleCommandAction()
{
super(new Handler());
}
public class InsertSingleCommandAction extends EditorAction {
public InsertSingleCommandAction() {
super(new Handler());
}
private static class Handler extends EditorActionHandler
{
public void execute(Editor editor, DataContext context)
{
CommandGroups.getInstance().getChange().processSingleCommand(editor, context);
}
private static class Handler extends EditorActionHandler {
public void execute(Editor editor, DataContext context) {
CommandGroups.getInstance().getChange().processSingleCommand(editor, context);
}
}
}

View File

@ -19,33 +19,28 @@ package com.maddyhome.idea.vim.action.change.insert;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class VisualBlockAppendAction extends EditorAction
{
public VisualBlockAppendAction()
{
super(new Handler());
}
public class VisualBlockAppendAction extends EditorAction {
public VisualBlockAppendAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
if (editor.isOneLineMode())
{
return false;
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
if (editor.isOneLineMode()) {
return false;
}
return CommandGroups.getInstance().getChange().blockInsert(editor, context, range, true);
}
return CommandGroups.getInstance().getChange().blockInsert(editor, context, range, true);
}
}
}

View File

@ -19,33 +19,28 @@ package com.maddyhome.idea.vim.action.change.insert;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class VisualBlockInsertAction extends EditorAction
{
public VisualBlockInsertAction()
{
super(new Handler());
}
public class VisualBlockInsertAction extends EditorAction {
public VisualBlockInsertAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
if (editor.isOneLineMode())
{
return false;
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
if (editor.isOneLineMode()) {
return false;
}
return CommandGroups.getInstance().getChange().blockInsert(editor, context, range, false);
}
return CommandGroups.getInstance().getChange().blockInsert(editor, context, range, false);
}
}
}

View File

@ -19,29 +19,25 @@ package com.maddyhome.idea.vim.action.change.shift;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class AutoIndentLinesAction extends EditorAction
{
public AutoIndentLinesAction()
{
super(new Handler());
}
public class AutoIndentLinesAction extends EditorAction {
public AutoIndentLinesAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
CommandGroups.getInstance().getChange().autoIndentLines(editor, context, count);
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
CommandGroups.getInstance().getChange().autoIndentLines(editor, context, count);
return true;
}
return true;
}
}
}

View File

@ -19,29 +19,25 @@ package com.maddyhome.idea.vim.action.change.shift;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ShiftLeftLinesAction extends EditorAction
{
public ShiftLeftLinesAction()
{
super(new Handler());
}
public class ShiftLeftLinesAction extends EditorAction {
public ShiftLeftLinesAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
CommandGroups.getInstance().getChange().indentLines(editor, context, count, -1);
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
CommandGroups.getInstance().getChange().indentLines(editor, context, count, -1);
return true;
}
return true;
}
}
}

View File

@ -19,29 +19,25 @@ package com.maddyhome.idea.vim.action.change.shift;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ShiftLeftMotionAction extends EditorAction
{
public ShiftLeftMotionAction()
{
super(new Handler());
}
public class ShiftLeftMotionAction extends EditorAction {
public ShiftLeftMotionAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
CommandGroups.getInstance().getChange().indentMotion(editor, context, count, rawCount, argument, -1);
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
CommandGroups.getInstance().getChange().indentMotion(editor, context, count, rawCount, argument, -1);
return true;
}
return true;
}
}
}

View File

@ -19,30 +19,26 @@ package com.maddyhome.idea.vim.action.change.shift;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ShiftLeftVisualAction extends EditorAction
{
public ShiftLeftVisualAction()
{
super(new Handler());
}
public class ShiftLeftVisualAction extends EditorAction {
public ShiftLeftVisualAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
CommandGroups.getInstance().getChange().indentRange(editor, context, range, cmd.getCount(), -1);
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
CommandGroups.getInstance().getChange().indentRange(editor, context, range, cmd.getCount(), -1);
return true;
}
return true;
}
}
}

View File

@ -19,29 +19,25 @@ package com.maddyhome.idea.vim.action.change.shift;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ShiftRightLinesAction extends EditorAction
{
public ShiftRightLinesAction()
{
super(new Handler());
}
public class ShiftRightLinesAction extends EditorAction {
public ShiftRightLinesAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
CommandGroups.getInstance().getChange().indentLines(editor, context, count, 1);
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
CommandGroups.getInstance().getChange().indentLines(editor, context, count, 1);
return true;
}
return true;
}
}
}

View File

@ -19,29 +19,25 @@ package com.maddyhome.idea.vim.action.change.shift;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ShiftRightMotionAction extends EditorAction
{
public ShiftRightMotionAction()
{
super(new Handler());
}
public class ShiftRightMotionAction extends EditorAction {
public ShiftRightMotionAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
CommandGroups.getInstance().getChange().indentMotion(editor, context, count, rawCount, argument, 1);
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
CommandGroups.getInstance().getChange().indentMotion(editor, context, count, rawCount, argument, 1);
return true;
}
return true;
}
}
}

View File

@ -19,30 +19,26 @@ package com.maddyhome.idea.vim.action.change.shift;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ShiftRightVisualAction extends EditorAction
{
public ShiftRightVisualAction()
{
super(new Handler());
}
public class ShiftRightVisualAction extends EditorAction {
public ShiftRightVisualAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
CommandGroups.getInstance().getChange().indentRange(editor, context, range, cmd.getCount(), 1);
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
CommandGroups.getInstance().getChange().indentRange(editor, context, range, cmd.getCount(), 1);
return true;
}
return true;
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.copy;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class PutTextAfterCursorAction extends EditorAction
{
public PutTextAfterCursorAction()
{
super(new Handler());
}
public class PutTextAfterCursorAction extends EditorAction {
public PutTextAfterCursorAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getCopy().putTextAfterCursor(editor, context, count, true, false);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getCopy().putTextAfterCursor(editor, context, count, true, false);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.copy;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class PutTextAfterCursorActionMoveCursor extends EditorAction
{
public PutTextAfterCursorActionMoveCursor()
{
super(new Handler());
}
public class PutTextAfterCursorActionMoveCursor extends EditorAction {
public PutTextAfterCursorActionMoveCursor() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getCopy().putTextAfterCursor(editor, context, count, true, true);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getCopy().putTextAfterCursor(editor, context, count, true, true);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.copy;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class PutTextAfterCursorNoIndentAction extends EditorAction
{
public PutTextAfterCursorNoIndentAction()
{
super(new Handler());
}
public class PutTextAfterCursorNoIndentAction extends EditorAction {
public PutTextAfterCursorNoIndentAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getCopy().putTextAfterCursor(editor, context, count, false, false);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getCopy().putTextAfterCursor(editor, context, count, false, false);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.copy;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class PutTextBeforeCursorAction extends EditorAction
{
public PutTextBeforeCursorAction()
{
super(new Handler());
}
public class PutTextBeforeCursorAction extends EditorAction {
public PutTextBeforeCursorAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getCopy().putTextBeforeCursor(editor, context, count, true, false);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getCopy().putTextBeforeCursor(editor, context, count, true, false);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.copy;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class PutTextBeforeCursorActionMoveCursor extends EditorAction
{
public PutTextBeforeCursorActionMoveCursor()
{
super(new Handler());
}
public class PutTextBeforeCursorActionMoveCursor extends EditorAction {
public PutTextBeforeCursorActionMoveCursor() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getCopy().putTextBeforeCursor(editor, context, count, true, true);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getCopy().putTextBeforeCursor(editor, context, count, true, true);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.copy;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class PutTextBeforeCursorNoIndentAction extends EditorAction
{
public PutTextBeforeCursorNoIndentAction()
{
super(new Handler());
}
public class PutTextBeforeCursorNoIndentAction extends EditorAction {
public PutTextBeforeCursorNoIndentAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler
{
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
{
return CommandGroups.getInstance().getCopy().putTextBeforeCursor(editor, context, count, false, false);
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getCopy().putTextBeforeCursor(editor, context, count, false, false);
}
}
}

View File

@ -19,28 +19,24 @@ package com.maddyhome.idea.vim.action.copy;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class PutVisualTextAction extends EditorAction
{
public PutVisualTextAction()
{
super(new Handler());
}
public class PutVisualTextAction extends EditorAction {
public PutVisualTextAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
return CommandGroups.getInstance().getCopy().putVisualRange(editor, context, range, cmd.getCount(), true, false);
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
return CommandGroups.getInstance().getCopy().putVisualRange(editor, context, range, cmd.getCount(), true, false);
}
}
}

View File

@ -19,28 +19,24 @@ package com.maddyhome.idea.vim.action.copy;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class PutVisualTextMoveCursorAction extends EditorAction
{
public PutVisualTextMoveCursorAction()
{
super(new Handler());
}
public class PutVisualTextMoveCursorAction extends EditorAction {
public PutVisualTextMoveCursorAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
return CommandGroups.getInstance().getCopy().putVisualRange(editor, context, range, cmd.getCount(), true, true);
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
return CommandGroups.getInstance().getCopy().putVisualRange(editor, context, range, cmd.getCount(), true, true);
}
}
}

View File

@ -19,28 +19,24 @@ package com.maddyhome.idea.vim.action.copy;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class PutVisualTextNoIndentAction extends EditorAction
{
public PutVisualTextNoIndentAction()
{
super(new Handler());
}
public class PutVisualTextNoIndentAction extends EditorAction {
public PutVisualTextNoIndentAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
return CommandGroups.getInstance().getCopy().putVisualRange(editor, context, range, cmd.getCount(), false, false);
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
return CommandGroups.getInstance().getCopy().putVisualRange(editor, context, range, cmd.getCount(), false, false);
}
}
}

View File

@ -19,29 +19,25 @@ package com.maddyhome.idea.vim.action.copy;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*
*/
public class SelectRegisterAction extends EditorAction
{
public SelectRegisterAction()
{
super(new Handler());
}
public class SelectRegisterAction extends EditorAction {
public SelectRegisterAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
return CommandGroups.getInstance().getRegister().selectRegister(cmd.getArgument().getCharacter());
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
return CommandGroups.getInstance().getRegister().selectRegister(cmd.getArgument().getCharacter());
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.copy;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class YankLineAction extends EditorAction
{
public YankLineAction()
{
super(new Handler());
}
public class YankLineAction extends EditorAction {
public YankLineAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd)
{
return CommandGroups.getInstance().getCopy().yankLine(editor, context, cmd.getCount());
}
private static class Handler extends AbstractEditorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd) {
return CommandGroups.getInstance().getCopy().yankLine(editor, context, cmd.getCount());
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.copy;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class YankMotionAction extends EditorAction
{
public YankMotionAction()
{
super(new Handler());
}
public class YankMotionAction extends EditorAction {
public YankMotionAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd)
{
return CommandGroups.getInstance().getCopy().yankMotion(editor, context, cmd.getCount(), cmd.getRawCount(), cmd.getArgument());
}
private static class Handler extends AbstractEditorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd) {
return CommandGroups.getInstance().getCopy().yankMotion(editor, context, cmd.getCount(), cmd.getRawCount(), cmd.getArgument());
}
}
}

View File

@ -19,6 +19,7 @@ package com.maddyhome.idea.vim.action.copy;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
@ -26,23 +27,18 @@ import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class YankVisualAction extends EditorAction
{
public YankVisualAction()
{
super(new Handler());
}
public class YankVisualAction extends EditorAction {
public YankVisualAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
return CommandGroups.getInstance().getCopy().yankRange(editor, context, range,
CommandState.getInstance(editor).getSubMode(), true);
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
return CommandGroups.getInstance().getCopy().yankRange(editor, context, range,
CommandState.getInstance(editor).getSubMode(), true);
}
}
}

View File

@ -19,6 +19,7 @@ package com.maddyhome.idea.vim.action.copy;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
@ -26,35 +27,28 @@ import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
import com.maddyhome.idea.vim.helper.EditorHelper;
/**
*/
public class YankVisualLinesAction extends EditorAction
{
public YankVisualLinesAction()
{
super(new Handler());
}
public class YankVisualLinesAction extends EditorAction {
public YankVisualLinesAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
{
int mode = CommandState.getInstance(editor).getSubMode();
if (mode == Command.FLAG_MOT_BLOCKWISE)
{
return CommandGroups.getInstance().getCopy().yankRange(editor, context, range, mode, true);
}
else
{
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
int mode = CommandState.getInstance(editor).getSubMode();
if (mode == Command.FLAG_MOT_BLOCKWISE) {
return CommandGroups.getInstance().getCopy().yankRange(editor, context, range, mode, true);
}
else {
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return CommandGroups.getInstance().getCopy().yankRange(editor, context, range, Command.FLAG_MOT_LINEWISE,
true);
}
}
return CommandGroups.getInstance().getCopy().yankRange(editor, context, range, Command.FLAG_MOT_LINEWISE,
true);
}
}
}
}

View File

@ -19,30 +19,26 @@ package com.maddyhome.idea.vim.action.ex;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
import javax.swing.KeyStroke;
import javax.swing.*;
/**
*/
public class BackspaceAction extends EditorAction
{
public BackspaceAction()
{
super(new Handler());
}
public class BackspaceAction extends EditorAction {
public BackspaceAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd)
{
return CommandGroups.getInstance().getProcess().processExKey(editor, context,
(KeyStroke)cmd.getKeys().get(0), false);
}
private static class Handler extends AbstractEditorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd) {
return CommandGroups.getInstance().getProcess().processExKey(editor, context,
(KeyStroke)cmd.getKeys().get(0), false);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.ex;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class CancelExEntryAction extends EditorAction
{
public CancelExEntryAction()
{
super(new Handler());
}
public class CancelExEntryAction extends EditorAction {
public CancelExEntryAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd)
{
return CommandGroups.getInstance().getProcess().cancelExEntry(editor, context);
}
private static class Handler extends AbstractEditorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd) {
return CommandGroups.getInstance().getProcess().cancelExEntry(editor, context);
}
}
}

View File

@ -19,27 +19,23 @@ package com.maddyhome.idea.vim.action.ex;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
/**
*/
public class ProcessExEntryAction extends EditorAction
{
public ProcessExEntryAction()
{
super(new Handler());
}
public class ProcessExEntryAction extends EditorAction {
public ProcessExEntryAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler
{
protected boolean execute(Editor editor, DataContext context, Command cmd)
{
return CommandGroups.getInstance().getProcess().processExEntry(editor, context);
}
private static class Handler extends AbstractEditorActionHandler {
protected boolean execute(Editor editor, DataContext context, Command cmd) {
return CommandGroups.getInstance().getProcess().processExEntry(editor, context);
}
}
}

Some files were not shown because too many files have changed in this diff Show More