mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-03-02 16:22:31 +01:00
Extracted EventFacade.addEditorFactoryListener()
This commit is contained in:
parent
a810f95101
commit
fd0be10492
src/com/maddyhome/idea/vim
@ -1,10 +1,13 @@
|
||||
package com.maddyhome.idea.vim;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionManager;
|
||||
import com.intellij.openapi.editor.actionSystem.TypedAction;
|
||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
||||
import com.intellij.openapi.editor.event.DocumentListener;
|
||||
import com.intellij.openapi.editor.event.EditorFactoryListener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -44,6 +47,10 @@ public class EventFacade {
|
||||
document.removeDocumentListener(listener);
|
||||
}
|
||||
|
||||
public void addEditorFactoryListener(@NotNull EditorFactoryListener listener, @NotNull Disposable parentDisposable) {
|
||||
EditorFactory.getInstance().addEditorFactoryListener(listener, parentDisposable);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private TypedAction getTypedAction() {
|
||||
return EditorActionManager.getInstance().getTypedAction();
|
||||
|
@ -437,7 +437,7 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
|
||||
DocumentManager.getInstance().addDocumentListener(new MarkGroup.MarkUpdater());
|
||||
DocumentManager.getInstance().addDocumentListener(new SearchGroup.DocumentSearchListener());
|
||||
|
||||
EditorFactory.getInstance().addEditorFactoryListener(new EditorFactoryAdapter() {
|
||||
EventFacade.getInstance().addEditorFactoryListener(new EditorFactoryAdapter() {
|
||||
@Override
|
||||
public void editorCreated(@NotNull EditorFactoryEvent event) {
|
||||
final Editor editor = event.getEditor();
|
||||
|
@ -73,7 +73,7 @@ public class ChangeGroup {
|
||||
public ChangeGroup() {
|
||||
// We want to know when a user clicks the mouse somewhere in the editor so we can clear any
|
||||
// saved text for the current insert mode.
|
||||
EditorFactory.getInstance().addEditorFactoryListener(new EditorFactoryAdapter() {
|
||||
EventFacade.getInstance().addEditorFactoryListener(new EditorFactoryAdapter() {
|
||||
public void editorCreated(@NotNull EditorFactoryEvent event) {
|
||||
Editor editor = event.getEditor();
|
||||
editor.addEditorMouseListener(listener);
|
||||
|
@ -30,6 +30,7 @@ import com.intellij.openapi.editor.event.EditorFactoryAdapter;
|
||||
import com.intellij.openapi.editor.event.EditorFactoryEvent;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.maddyhome.idea.vim.EventFacade;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.common.Jump;
|
||||
import com.maddyhome.idea.vim.common.Mark;
|
||||
@ -50,7 +51,7 @@ public class MarkGroup {
|
||||
* Creates the class
|
||||
*/
|
||||
public MarkGroup() {
|
||||
EditorFactory.getInstance().addEditorFactoryListener(new EditorFactoryAdapter() {
|
||||
EventFacade.getInstance().addEditorFactoryListener(new EditorFactoryAdapter() {
|
||||
public void editorReleased(@NotNull EditorFactoryEvent event) {
|
||||
// Save off the last caret position of the file before it is closed
|
||||
Editor editor = event.getEditor();
|
||||
|
@ -29,6 +29,7 @@ import com.intellij.openapi.fileEditor.TextEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.maddyhome.idea.vim.EventFacade;
|
||||
import com.maddyhome.idea.vim.KeyHandler;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.action.motion.MotionEditorAction;
|
||||
@ -65,7 +66,7 @@ public class MotionGroup {
|
||||
* Create the group
|
||||
*/
|
||||
public MotionGroup() {
|
||||
EditorFactory.getInstance().addEditorFactoryListener(new EditorFactoryAdapter() {
|
||||
EventFacade.getInstance().addEditorFactoryListener(new EditorFactoryAdapter() {
|
||||
public void editorCreated(@NotNull EditorFactoryEvent event) {
|
||||
final Editor editor = event.getEditor();
|
||||
// This ridiculous code ensures that a lot of events are processed BEFORE we finally start listening
|
||||
|
Loading…
Reference in New Issue
Block a user