Introduce wrapper for EditorFactoryListener to warn about compatibility issues
This commit is contained in:
+2
-7
@@ -28,9 +28,9 @@ import com.intellij.openapi.editor.RangeMarker
|
||||
import com.intellij.openapi.editor.event.CaretEvent
|
||||
import com.intellij.openapi.editor.event.CaretListener
|
||||
import com.intellij.openapi.editor.event.EditorFactoryEvent
|
||||
import com.intellij.openapi.editor.event.EditorFactoryListener
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.Key
|
||||
import org.jetbrains.kotlin.idea.util.compat.EditorFactoryListenerWrapper
|
||||
|
||||
class LookupCancelWatcher(val project: Project) : ProjectComponent {
|
||||
private class Reminiscence(editor: Editor, offset: Int) {
|
||||
@@ -105,17 +105,12 @@ class LookupCancelWatcher(val project: Project) : ProjectComponent {
|
||||
|
||||
override fun initComponent() {
|
||||
EditorFactory.getInstance().addEditorFactoryListener(
|
||||
object : EditorFactoryListener {
|
||||
object : EditorFactoryListenerWrapper {
|
||||
override fun editorReleased(event: EditorFactoryEvent) {
|
||||
if (lastReminiscence?.editor == event.editor) {
|
||||
lastReminiscence!!.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
override fun editorCreated(event: EditorFactoryEvent) {
|
||||
// BUNCH: 182 Has default implementation since 183
|
||||
// Do nothing
|
||||
}
|
||||
},
|
||||
project
|
||||
)
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.util.compat;
|
||||
|
||||
import com.intellij.openapi.editor.event.EditorFactoryEvent;
|
||||
import com.intellij.openapi.editor.event.EditorFactoryListener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
// Default implementation for interface methods were added in 183.
|
||||
// BUNCH: 182
|
||||
@SuppressWarnings("IncompatibleAPI")
|
||||
public interface EditorFactoryListenerWrapper extends EditorFactoryListener {
|
||||
@Override
|
||||
default void editorCreated(@NotNull EditorFactoryEvent event) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void editorReleased(@NotNull EditorFactoryEvent event) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress("IncompatibleAPI")
|
||||
|
||||
package org.jetbrains.kotlin.idea.util.compat
|
||||
|
||||
import com.intellij.openapi.editor.event.EditorFactoryListener
|
||||
|
||||
// Default implementation for interface methods were added in 183.
|
||||
// BUNCH: 182
|
||||
typealias EditorFactoryListenerWrapper = EditorFactoryListener
|
||||
Reference in New Issue
Block a user