mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
caret listeners API change (IDEA-80056)
This commit is contained in:
@@ -129,14 +129,14 @@ public interface CaretModel {
|
||||
int getOffset();
|
||||
|
||||
/**
|
||||
* Adds a listener for receiving notifications about caret movement.
|
||||
* Adds a listener for receiving notifications about caret movement and caret addition/removal
|
||||
*
|
||||
* @param listener the listener instance.
|
||||
*/
|
||||
void addCaretListener(@NotNull CaretListener listener);
|
||||
|
||||
/**
|
||||
* Removes a listener for receiving notifications about caret movement.
|
||||
* Removes a listener for receiving notifications about caret movement and caret addition/removal
|
||||
*
|
||||
* @param listener the listener instance.
|
||||
*/
|
||||
|
||||
+11
-16
@@ -15,21 +15,16 @@
|
||||
*/
|
||||
package com.intellij.openapi.editor.event;
|
||||
|
||||
/**
|
||||
* In addition to caret movement event received by CaretListener instances, these listeners will also get caret creation/destroying events.
|
||||
*
|
||||
* @see CaretListener
|
||||
* @see com.intellij.openapi.editor.CaretModel#addCaretListener(CaretListener)
|
||||
* @see EditorEventMulticaster#addCaretListener(CaretListener)
|
||||
*/
|
||||
public interface MultipleCaretListener extends CaretListener {
|
||||
/**
|
||||
* Called when a new caret was added to the document.
|
||||
*/
|
||||
void caretAdded(CaretEvent e);
|
||||
public abstract class CaretAdapter implements CaretListener {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a caret was removed from the document.
|
||||
*/
|
||||
void caretRemoved(CaretEvent e);
|
||||
@Override
|
||||
public void caretAdded(CaretEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void caretRemoved(CaretEvent e) {
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,7 @@ package com.intellij.openapi.editor.event;
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* Allows to receive notifications about caret movement.
|
||||
* Allows to receive notifications about caret movement, and caret additions/removal
|
||||
*
|
||||
* @see com.intellij.openapi.editor.CaretModel#addCaretListener(CaretListener)
|
||||
* @see EditorEventMulticaster#addCaretListener(CaretListener)
|
||||
@@ -30,4 +30,14 @@ public interface CaretListener extends EventListener {
|
||||
* @param e the event containing information about the caret movement.
|
||||
*/
|
||||
void caretPositionChanged(CaretEvent e);
|
||||
|
||||
/**
|
||||
* Called when a new caret was added to the document.
|
||||
*/
|
||||
void caretAdded(CaretEvent e);
|
||||
|
||||
/**
|
||||
* Called when a caret was removed from the document.
|
||||
*/
|
||||
void caretRemoved(CaretEvent e);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,6 +24,7 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.HighlighterColors;
|
||||
import com.intellij.openapi.editor.LogicalPosition;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.editor.event.CaretAdapter;
|
||||
import com.intellij.openapi.editor.event.CaretEvent;
|
||||
import com.intellij.openapi.editor.event.CaretListener;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
@@ -56,7 +56,7 @@ public class ClickNavigator {
|
||||
}
|
||||
});
|
||||
|
||||
CaretListener listener = new CaretListener() {
|
||||
CaretListener listener = new CaretAdapter() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
setSelectedItem(HighlighterColors.TEXT.getExternalName(), true);
|
||||
@@ -98,7 +98,7 @@ public class ClickNavigator {
|
||||
final boolean isBackgroundImportant) {
|
||||
addMouseMotionListener(view, highlighter, data, isBackgroundImportant);
|
||||
|
||||
CaretListener listener = new CaretListener() {
|
||||
CaretListener listener = new CaretAdapter() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
navigate(view, true, e.getNewPosition(), highlighter, data, isBackgroundImportant);
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.editor.*;
|
||||
import com.intellij.openapi.editor.colors.CodeInsightColors;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.editor.event.CaretAdapter;
|
||||
import com.intellij.openapi.editor.event.CaretEvent;
|
||||
import com.intellij.openapi.editor.event.CaretListener;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
@@ -80,7 +81,7 @@ public class SimpleEditorPreview implements PreviewPanel{
|
||||
if (navigatable) {
|
||||
addMouseMotionListener(myEditor, page.getHighlighter(), myHighlightData, false);
|
||||
|
||||
CaretListener listener = new CaretListener() {
|
||||
CaretListener listener = new CaretAdapter() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
navigate(myEditor, true, e.getNewPosition(), page.getHighlighter(), myHighlightData, false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -253,7 +253,7 @@ public abstract class CompletionPhase implements Disposable {
|
||||
CompletionServiceImpl.setCompletionPhase(NoCompletion);
|
||||
}
|
||||
};
|
||||
final CaretListener caretListener = new CaretListener() {
|
||||
final CaretListener caretListener = new CaretAdapter() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
CompletionServiceImpl.setCompletionPhase(NoCompletion);
|
||||
@@ -341,7 +341,7 @@ public abstract class CompletionPhase implements Disposable {
|
||||
}
|
||||
};
|
||||
|
||||
caretListener = new CaretListener() {
|
||||
caretListener = new CaretAdapter() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
if (!TypedAction.isTypedActionInProgress()) {
|
||||
|
||||
@@ -176,7 +176,7 @@ public class DaemonListeners implements Disposable {
|
||||
}
|
||||
}, this);
|
||||
|
||||
eventMulticaster.addCaretListener(new CaretListener() {
|
||||
eventMulticaster.addCaretListener(new CaretAdapter() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
final Editor editor = e.getEditor();
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -354,7 +354,7 @@ public class QuickDocOnMouseOverManager {
|
||||
}
|
||||
}
|
||||
|
||||
private class MyCaretListener implements CaretListener {
|
||||
private class MyCaretListener extends CaretAdapter {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
allowUpdateFromContext(true);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,7 +42,7 @@ public class BraceHighlighter implements StartupActivity {
|
||||
public void runActivity(@NotNull final Project project) {
|
||||
final EditorEventMulticaster eventMulticaster = EditorFactory.getInstance().getEventMulticaster();
|
||||
|
||||
CaretListener myCaretListener = new CaretListener() {
|
||||
CaretListener myCaretListener = new CaretAdapter() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
myAlarm.cancelAllRequests();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,10 +25,7 @@ import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.RangeMarker;
|
||||
import com.intellij.openapi.editor.ScrollType;
|
||||
import com.intellij.openapi.editor.event.CaretEvent;
|
||||
import com.intellij.openapi.editor.event.CaretListener;
|
||||
import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.editor.event.*;
|
||||
import com.intellij.openapi.editor.impl.EditorImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
@@ -177,7 +174,7 @@ public class ParameterInfoController implements Disposable {
|
||||
List<ParameterInfoController> allControllers = getAllControllers(myEditor);
|
||||
allControllers.add(this);
|
||||
|
||||
myEditorCaretListener = new CaretListener(){
|
||||
myEditorCaretListener = new CaretAdapter(){
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
myAlarm.cancelAllRequests();
|
||||
|
||||
@@ -868,7 +868,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
}
|
||||
}, this);
|
||||
|
||||
final CaretListener caretListener = new CaretListener() {
|
||||
final CaretListener caretListener = new CaretAdapter() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
if (!myChangeGuard && !myFinishing) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -250,7 +250,7 @@ public class CtrlMouseHandler extends AbstractProjectComponent {
|
||||
EditorEventMulticaster eventMulticaster = editorFactory.getEventMulticaster();
|
||||
eventMulticaster.addEditorMouseListener(myEditorMouseAdapter, project);
|
||||
eventMulticaster.addEditorMouseMotionListener(myEditorMouseMotionListener, project);
|
||||
eventMulticaster.addCaretListener(new CaretListener() {
|
||||
eventMulticaster.addCaretListener(new CaretAdapter() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
if (myHint != null) {
|
||||
|
||||
+1
-1
@@ -170,7 +170,7 @@ public class IncrementalSearchHandler {
|
||||
};
|
||||
document.addDocumentListener(documentListener[0]);
|
||||
|
||||
caretListener[0] = new CaretListener() {
|
||||
caretListener[0] = new CaretAdapter() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
PerHintSearchData data = hint.getUserData(SEARCH_DATA_IN_HINT_KEY);
|
||||
|
||||
@@ -34,10 +34,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.*;
|
||||
import com.intellij.openapi.editor.colors.EditorColors;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.event.CaretEvent;
|
||||
import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.editor.event.MultipleCaretListener;
|
||||
import com.intellij.openapi.editor.event.*;
|
||||
import com.intellij.openapi.editor.ex.DocumentEx;
|
||||
import com.intellij.openapi.editor.markup.HighlighterLayer;
|
||||
import com.intellij.openapi.editor.markup.HighlighterTargetArea;
|
||||
@@ -86,7 +83,7 @@ public class TemplateState implements Disposable {
|
||||
private boolean myDocumentChanged = false;
|
||||
|
||||
@Nullable private CommandAdapter myCommandListener;
|
||||
@Nullable private MultipleCaretListener myCaretListener;
|
||||
@Nullable private CaretListener myCaretListener;
|
||||
|
||||
private final List<TemplateEditingListener> myListeners = ContainerUtil.createLockFreeCopyOnWriteList();
|
||||
private DocumentAdapter myEditorDocumentListener;
|
||||
@@ -146,7 +143,7 @@ public class TemplateState implements Disposable {
|
||||
}
|
||||
};
|
||||
|
||||
myCaretListener = new MultipleCaretListener() {
|
||||
myCaretListener = new CaretAdapter() {
|
||||
@Override
|
||||
public void caretAdded(CaretEvent e) {
|
||||
if (isMultiCaretMode()) {
|
||||
@@ -160,9 +157,6 @@ public class TemplateState implements Disposable {
|
||||
finishTemplateEditing(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {}
|
||||
};
|
||||
|
||||
if (myEditor != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -627,7 +627,7 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
|
||||
myCurrentEditor = editor;
|
||||
}
|
||||
EmptyAction.registerActionShortcuts(editor.getComponent(), myConsoleEditor.getComponent());
|
||||
editor.getCaretModel().addCaretListener(new CaretListener() {
|
||||
editor.getCaretModel().addCaretListener(new CaretAdapter() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
queueUiUpdate(false);
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.intellij.openapi.editor.actionSystem.EditorActionManager;
|
||||
import com.intellij.openapi.editor.actions.IncrementalFindAction;
|
||||
import com.intellij.openapi.editor.colors.EditorColors;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.event.CaretAdapter;
|
||||
import com.intellij.openapi.editor.event.CaretEvent;
|
||||
import com.intellij.openapi.editor.event.CaretListener;
|
||||
import com.intellij.openapi.editor.ex.DocumentEx;
|
||||
@@ -752,7 +753,7 @@ public class FindUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
private static class MyListener implements CaretListener {
|
||||
private static class MyListener extends CaretAdapter {
|
||||
private final Editor myEditor;
|
||||
private final RangeHighlighter mySegmentHighlighter;
|
||||
|
||||
@@ -818,7 +819,7 @@ public class FindUtil {
|
||||
position = HintManager.ABOVE;
|
||||
}
|
||||
}
|
||||
CaretListener listener = new CaretListener() {
|
||||
CaretListener listener = new CaretAdapter() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
editor.putUserData(KEY, null);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.intellij.injected.editor;
|
||||
|
||||
import com.intellij.openapi.editor.*;
|
||||
import com.intellij.openapi.editor.event.CaretAdapter;
|
||||
import com.intellij.openapi.editor.event.CaretEvent;
|
||||
import com.intellij.openapi.editor.event.CaretListener;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
@@ -103,7 +104,7 @@ public class CaretModelWindow implements CaretModel {
|
||||
private final ListenerWrapperMap<CaretListener> myCaretListeners = new ListenerWrapperMap<CaretListener>();
|
||||
@Override
|
||||
public void addCaretListener(@NotNull final CaretListener listener) {
|
||||
CaretListener wrapper = new CaretListener() {
|
||||
CaretListener wrapper = new CaretAdapter() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
if (!myEditorWindow.getDocument().isValid()) return; // injected document can be destroyed by now
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,7 +34,6 @@ import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.application.AccessToken;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -1211,7 +1210,7 @@ public class PsiViewerDialog extends DialogWrapper implements DataProvider, Disp
|
||||
myEditor.setHighlighter(EditorHighlighterFactory.getInstance().createEditorHighlighter(myProject, lightFile));
|
||||
}
|
||||
|
||||
private class EditorListener implements CaretListener, SelectionListener, DocumentListener {
|
||||
private class EditorListener extends CaretAdapter implements SelectionListener, DocumentListener {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
if (!available() || myEditor.getSelectionModel().hasSelection()) return;
|
||||
|
||||
+11
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -165,6 +165,16 @@ public class DiffPreviewPanel implements PreviewPanel {
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
select(MergeSearchHelper.findChangeAt(e, getMergePanel(), myIndex));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void caretAdded(CaretEvent e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void caretRemoved(CaretEvent e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,10 +21,7 @@ import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.editor.LogicalPosition;
|
||||
import com.intellij.openapi.editor.event.CaretEvent;
|
||||
import com.intellij.openapi.editor.event.CaretListener;
|
||||
import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.editor.event.*;
|
||||
import com.intellij.openapi.editor.impl.CaretModelImpl;
|
||||
import com.intellij.openapi.editor.impl.EditorImpl;
|
||||
import com.intellij.openapi.util.Key;
|
||||
@@ -163,7 +160,7 @@ public abstract class MethodSignatureEditor<M extends PsiElement> extends Editor
|
||||
CodeStyleManager.getInstance(getProject()).reformatText(myFile, range.getStartOffset(), range.getEndOffset());
|
||||
}
|
||||
});
|
||||
editor.getCaretModel().addCaretListener(new CaretListener() {
|
||||
editor.getCaretModel().addCaretListener(new CaretAdapter() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
createFromString();
|
||||
|
||||
@@ -104,7 +104,7 @@ public class HintManagerImpl extends HintManager implements Disposable {
|
||||
myAnActionListener = new MyAnActionListener();
|
||||
actionManagerEx.addAnActionListener(myAnActionListener);
|
||||
|
||||
myCaretMoveListener = new CaretListener() {
|
||||
myCaretMoveListener = new CaretAdapter() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
hideHints(HIDE_BY_ANY_KEY, false, false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -143,6 +143,14 @@ public class SelectInEditorManagerImpl extends SelectInEditorManager implements
|
||||
releaseAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void caretAdded(CaretEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void caretRemoved(CaretEvent e) {
|
||||
}
|
||||
|
||||
private void releaseAll() {
|
||||
if (mySegmentHighlighter != null && myEditor != null){
|
||||
mySegmentHighlighter.dispose();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -64,4 +64,14 @@ public class CurrentLineMarker implements CaretListener {
|
||||
if (isHiden()) return;
|
||||
set();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void caretAdded(CaretEvent e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void caretRemoved(CaretEvent e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.intellij.openapi.editor.colors.EditorColors;
|
||||
import com.intellij.openapi.editor.event.CaretEvent;
|
||||
import com.intellij.openapi.editor.event.CaretListener;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.editor.event.MultipleCaretListener;
|
||||
import com.intellij.openapi.editor.ex.DocumentBulkUpdateListener;
|
||||
import com.intellij.openapi.editor.ex.PrioritizedDocumentListener;
|
||||
import com.intellij.openapi.editor.impl.event.DocumentEventImpl;
|
||||
@@ -47,8 +46,7 @@ import java.util.*;
|
||||
public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener, Disposable {
|
||||
private final EditorImpl myEditor;
|
||||
|
||||
private final EventDispatcher<MultipleCaretListener> myCaretListeners = EventDispatcher.create(MultipleCaretListener.class);
|
||||
private final Map<CaretListener, MultipleCaretListener> myListenerMap = new HashMap<CaretListener, MultipleCaretListener>();
|
||||
private final EventDispatcher<CaretListener> myCaretListeners = EventDispatcher.create(CaretListener.class);
|
||||
private final boolean mySupportsMultipleCarets = Registry.is("editor.allow.multiple.carets");
|
||||
|
||||
private TextAttributes myTextAttributes;
|
||||
@@ -201,38 +199,12 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
|
||||
|
||||
@Override
|
||||
public void addCaretListener(@NotNull final CaretListener listener) {
|
||||
MultipleCaretListener newListener;
|
||||
if (listener instanceof MultipleCaretListener) {
|
||||
newListener = (MultipleCaretListener)listener;
|
||||
}
|
||||
else {
|
||||
newListener = new MultipleCaretListener() {
|
||||
@Override
|
||||
public void caretAdded(CaretEvent e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void caretRemoved(CaretEvent e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
listener.caretPositionChanged(e);
|
||||
}
|
||||
};
|
||||
}
|
||||
myListenerMap.put(listener, newListener);
|
||||
myCaretListeners.addListener(newListener);
|
||||
myCaretListeners.addListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCaretListener(@NotNull CaretListener listener) {
|
||||
MultipleCaretListener newListener = myListenerMap.remove(listener);
|
||||
if (newListener != null) {
|
||||
myCaretListeners.removeListener(newListener);
|
||||
}
|
||||
myCaretListeners.removeListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -393,7 +393,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
myFoldingModel.addListener(mySoftWrapModel, myCaretModel);
|
||||
|
||||
myIndentsModel = new IndentsModelImpl(this);
|
||||
myCaretModel.addCaretListener(new MultipleCaretListener() {
|
||||
myCaretModel.addCaretListener(new CaretListener() {
|
||||
@Nullable private LightweightHint myCurrentHint = null;
|
||||
@Nullable private IndentGuideDescriptor myCurrentCaretGuide = null;
|
||||
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ public class IdeDocumentHistoryImpl extends IdeDocumentHistory implements Projec
|
||||
};
|
||||
eventMulticaster.addDocumentListener(documentListener, myProject);
|
||||
|
||||
CaretListener caretListener = new CaretListener() {
|
||||
CaretListener caretListener = new CaretAdapter() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
onCaretPositionChanged(e);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -124,6 +124,14 @@ public class PositionPanel extends EditorBasedWidget implements StatusBarWidget.
|
||||
updatePosition(e.getEditor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void caretAdded(CaretEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void caretRemoved(CaretEvent e) {
|
||||
}
|
||||
|
||||
private void updatePosition(final Editor editor) {
|
||||
if (editor == null) {
|
||||
myText = "";
|
||||
|
||||
+2
-2
@@ -19,8 +19,8 @@ import com.intellij.ide.util.treeView.smartTree.*;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.editor.event.CaretAdapter;
|
||||
import com.intellij.openapi.editor.event.CaretEvent;
|
||||
import com.intellij.openapi.editor.event.CaretListener;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -71,7 +71,7 @@ public abstract class TextEditorBasedStructureViewModel implements StructureView
|
||||
myPsiFile = file;
|
||||
|
||||
if (editor != null) {
|
||||
EditorFactory.getInstance().getEventMulticaster().addCaretListener(new CaretListener() {
|
||||
EditorFactory.getInstance().getEventMulticaster().addCaretListener(new CaretAdapter() {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
if (e.getEditor().equals(myEditor)) {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -78,7 +78,7 @@ public class MavenMergingUpdateQueue extends MergingUpdateQueue {
|
||||
try {
|
||||
EditorEventMulticaster multicaster = EditorFactory.getInstance().getEventMulticaster();
|
||||
|
||||
multicaster.addCaretListener(new CaretListener() {
|
||||
multicaster.addCaretListener(new CaretAdapter() {
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
MavenMergingUpdateQueue.this.restartTimer();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,6 +26,7 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.LogicalPosition;
|
||||
import com.intellij.openapi.editor.ScrollType;
|
||||
import com.intellij.openapi.editor.colors.EditorFontType;
|
||||
import com.intellij.openapi.editor.event.CaretAdapter;
|
||||
import com.intellij.openapi.editor.event.CaretEvent;
|
||||
import com.intellij.openapi.editor.event.CaretListener;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
@@ -103,7 +104,7 @@ public class BreadcrumbsXmlWrapper implements BreadcrumbsItemListener<Breadcrumb
|
||||
|
||||
myInfoProvider = findInfoProvider(findViewProvider(myFile, myProject));
|
||||
|
||||
final CaretListener caretListener = new CaretListener() {
|
||||
final CaretListener caretListener = new CaretAdapter() {
|
||||
public void caretPositionChanged(final CaretEvent e) {
|
||||
if (myUserCaretChange) {
|
||||
queueUpdate(editor);
|
||||
|
||||
Reference in New Issue
Block a user