mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
mark EnterHandlerDelegateAdapter obsolete and clean up its usages
GitOrigin-RevId: 18180910770bf4c1e7b21e42970adb2d7bb602b0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a05b34f76e
commit
6787fe130e
+3
-3
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.editorActions;
|
||||
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate;
|
||||
import com.intellij.injected.editor.DocumentWindow;
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
@@ -22,7 +22,7 @@ import com.intellij.psi.util.PsiLiteralUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class JavaEnterInInjectedTextBlockHandler extends EnterHandlerDelegateAdapter {
|
||||
public final class JavaEnterInInjectedTextBlockHandler implements EnterHandlerDelegate {
|
||||
private @Nullable RangeMarker myRangeMarker;
|
||||
private @Nullable String myPreviousIndent;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.javadoc;
|
||||
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
import com.intellij.codeInsight.CodeInsightSettings;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.CaretModel;
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public final class EnterInJavadocParamDescriptionHandler extends EnterHandlerDelegateAdapter {
|
||||
public final class EnterInJavadocParamDescriptionHandler implements EnterHandlerDelegate {
|
||||
|
||||
private final JavadocHelper myHelper = JavadocHelper.getInstance();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.javadoc;
|
||||
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate;
|
||||
import com.intellij.codeInsight.javadoc.JavaDocUtil;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class JavaDocMarkdownEnterHandler extends EnterHandlerDelegateAdapter {
|
||||
public class JavaDocMarkdownEnterHandler implements EnterHandlerDelegate {
|
||||
private static final String JAVADOC_MARKDOWN_PREFIX = "/// ";
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.javadoc;
|
||||
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate;
|
||||
import com.intellij.injected.editor.EditorWindow;
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
@@ -22,7 +22,7 @@ import com.intellij.util.text.CharArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class JavadocSnippetEnterHandler extends EnterHandlerDelegateAdapter {
|
||||
public final class JavadocSnippetEnterHandler implements EnterHandlerDelegate {
|
||||
|
||||
@Override
|
||||
public Result preprocessEnter(@NotNull PsiFile file,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.json.editor;
|
||||
|
||||
import com.intellij.codeInsight.editorActions.EnterHandler;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate;
|
||||
import com.intellij.json.JsonElementTypes;
|
||||
import com.intellij.json.JsonLanguage;
|
||||
import com.intellij.json.psi.*;
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static com.intellij.json.split.JsonBackendExtensionSuppressorKt.shouldDoNothingInBackendMode;
|
||||
|
||||
public final class JsonEnterHandler extends EnterHandlerDelegateAdapter {
|
||||
public final class JsonEnterHandler implements EnterHandlerDelegate {
|
||||
@Override
|
||||
public Result preprocessEnter(@NotNull PsiFile file,
|
||||
@NotNull Editor editor,
|
||||
|
||||
@@ -3101,7 +3101,7 @@ e:com.intellij.codeInsight.editorActions.emacs.EmacsProcessingHandler$Result
|
||||
- s:valueOf(java.lang.String):com.intellij.codeInsight.editorActions.emacs.EmacsProcessingHandler$Result
|
||||
- s:values():com.intellij.codeInsight.editorActions.emacs.EmacsProcessingHandler$Result[]
|
||||
c:com.intellij.codeInsight.editorActions.enter.BaseIndentEnterHandler
|
||||
- com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter
|
||||
- com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate
|
||||
- <init>(com.intellij.lang.Language,com.intellij.psi.tree.TokenSet,com.intellij.psi.tree.IElementType,java.lang.String,com.intellij.psi.tree.TokenSet):V
|
||||
- <init>(com.intellij.lang.Language,com.intellij.psi.tree.TokenSet,com.intellij.psi.tree.IElementType,java.lang.String,com.intellij.psi.tree.TokenSet,Z):V
|
||||
- p:getNewIndent(com.intellij.psi.PsiFile,com.intellij.openapi.editor.Document,java.lang.CharSequence):java.lang.String
|
||||
@@ -3109,7 +3109,7 @@ c:com.intellij.codeInsight.editorActions.enter.BaseIndentEnterHandler
|
||||
- preprocessEnter(com.intellij.psi.PsiFile,com.intellij.openapi.editor.Editor,com.intellij.openapi.util.Ref,com.intellij.openapi.util.Ref,com.intellij.openapi.actionSystem.DataContext,com.intellij.openapi.editor.actionSystem.EditorActionHandler):com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate$Result
|
||||
- p:shouldSkipWithResult(com.intellij.psi.PsiFile,com.intellij.openapi.editor.Editor,com.intellij.openapi.actionSystem.DataContext):com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate$Result
|
||||
c:com.intellij.codeInsight.editorActions.enter.EnterAfterUnmatchedBraceHandler
|
||||
- com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter
|
||||
- com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate
|
||||
- <init>():V
|
||||
- p:calculateOffsetToInsertClosingBrace(com.intellij.psi.PsiFile,java.lang.CharSequence,I):com.intellij.openapi.util.Pair
|
||||
- p:calculateOffsetToInsertClosingBraceInsideElement(com.intellij.psi.PsiElement):I
|
||||
@@ -3135,7 +3135,7 @@ c:com.intellij.codeInsight.editorActions.enter.EnterBetweenBracesDelegate
|
||||
- p:isBracePair(C,C):Z
|
||||
- isInComment(com.intellij.psi.PsiFile,com.intellij.openapi.editor.Editor,I):Z
|
||||
c:com.intellij.codeInsight.editorActions.enter.EnterBetweenBracesFinalHandler
|
||||
- com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter
|
||||
- com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate
|
||||
- ps:ourDefaultBetweenDelegate:com.intellij.codeInsight.editorActions.enter.EnterBetweenBracesDelegate
|
||||
- <init>():V
|
||||
- ps:getLanguageImplementation(com.intellij.lang.Language):com.intellij.codeInsight.editorActions.enter.EnterBetweenBracesDelegate
|
||||
@@ -3158,8 +3158,8 @@ a:com.intellij.codeInsight.editorActions.enter.EnterBetweenBracesNoCommitDelegat
|
||||
com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate
|
||||
- sf:EP_NAME:com.intellij.openapi.extensions.ExtensionPointName
|
||||
- invokeInsideIndent(I,com.intellij.openapi.editor.Editor,com.intellij.openapi.actionSystem.DataContext):Z
|
||||
- a:postProcessEnter(com.intellij.psi.PsiFile,com.intellij.openapi.editor.Editor,com.intellij.openapi.actionSystem.DataContext):com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate$Result
|
||||
- a:preprocessEnter(com.intellij.psi.PsiFile,com.intellij.openapi.editor.Editor,com.intellij.openapi.util.Ref,com.intellij.openapi.util.Ref,com.intellij.openapi.actionSystem.DataContext,com.intellij.openapi.editor.actionSystem.EditorActionHandler):com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate$Result
|
||||
- postProcessEnter(com.intellij.psi.PsiFile,com.intellij.openapi.editor.Editor,com.intellij.openapi.actionSystem.DataContext):com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate$Result
|
||||
- preprocessEnter(com.intellij.psi.PsiFile,com.intellij.openapi.editor.Editor,com.intellij.openapi.util.Ref,com.intellij.openapi.util.Ref,com.intellij.openapi.actionSystem.DataContext,com.intellij.openapi.editor.actionSystem.EditorActionHandler):com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate$Result
|
||||
e:com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate$Result
|
||||
- java.lang.Enum
|
||||
- sf:Continue:com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate$Result
|
||||
@@ -3180,7 +3180,7 @@ f:com.intellij.codeInsight.editorActions.enter.EnterInCommentUtil
|
||||
- s:getTodoTextOffset(java.lang.CharSequence,I,I):I
|
||||
- s:isTodoText(java.lang.CharSequence,I,I):Z
|
||||
c:com.intellij.codeInsight.editorActions.enter.EnterInStringLiteralHandler
|
||||
- com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter
|
||||
- com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate
|
||||
- <init>():V
|
||||
- p:getJavaLikeQuoteHandler(com.intellij.openapi.editor.Editor,com.intellij.psi.PsiElement):com.intellij.codeInsight.editorActions.JavaLikeQuoteHandler
|
||||
- p:isInStringLiteral(com.intellij.openapi.editor.Editor,com.intellij.codeInsight.editorActions.JavaLikeQuoteHandler,I):Z
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.editorActions.enter;
|
||||
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
@@ -30,7 +30,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* @author oleg
|
||||
*/
|
||||
public class BaseIndentEnterHandler extends EnterHandlerDelegateAdapter {
|
||||
public class BaseIndentEnterHandler implements EnterHandlerDelegate {
|
||||
private final Language myLanguage;
|
||||
private final TokenSet myIndentTokens;
|
||||
private final IElementType myLineCommentType;
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public final class EnterAfterJavadocTagHandler extends EnterHandlerDelegateAdapter {
|
||||
public final class EnterAfterJavadocTagHandler implements EnterHandlerDelegate {
|
||||
|
||||
private static final Context NOT_MATCHED_CONTEXT = new Context();
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package com.intellij.codeInsight.editorActions.enter;
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class EnterAfterUnmatchedBraceHandler extends EnterHandlerDelegateAdapter {
|
||||
public class EnterAfterUnmatchedBraceHandler implements EnterHandlerDelegate {
|
||||
private static final Logger LOG = Logger.getInstance(EnterAfterUnmatchedBraceHandler.class);
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package com.intellij.codeInsight.editorActions.enter;
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* Please, don't extend the class.
|
||||
* Use the {@code EnterBetweenBracesDelegate} language-specific implementation instead.
|
||||
*/
|
||||
public class EnterBetweenBracesFinalHandler extends EnterHandlerDelegateAdapter {
|
||||
public class EnterBetweenBracesFinalHandler implements EnterHandlerDelegate {
|
||||
@Override
|
||||
public Result preprocessEnter(final @NotNull PsiFile file,
|
||||
@NotNull Editor editor,
|
||||
|
||||
+18
-5
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package com.intellij.codeInsight.editorActions.enter;
|
||||
|
||||
@@ -78,9 +78,16 @@ public interface EnterHandlerDelegate {
|
||||
* performed
|
||||
* </table>
|
||||
*/
|
||||
Result preprocessEnter(final @NotNull PsiFile file, final @NotNull Editor editor, final @NotNull Ref<Integer> caretOffset,
|
||||
final @NotNull Ref<Integer> caretAdvance, final @NotNull DataContext dataContext,
|
||||
final @Nullable EditorActionHandler originalHandler);
|
||||
default Result preprocessEnter(
|
||||
final @NotNull PsiFile file,
|
||||
final @NotNull Editor editor,
|
||||
final @NotNull Ref<Integer> caretOffset,
|
||||
final @NotNull Ref<Integer> caretAdvance,
|
||||
final @NotNull DataContext dataContext,
|
||||
final @Nullable EditorActionHandler originalHandler
|
||||
) {
|
||||
return Result.Continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called at the end of Enter handling after line feed insertion and indentation adjustment.
|
||||
@@ -103,5 +110,11 @@ public interface EnterHandlerDelegate {
|
||||
* @see DataContext
|
||||
* @see com.intellij.psi.PsiDocumentManager
|
||||
*/
|
||||
Result postProcessEnter(@NotNull PsiFile file, @NotNull Editor editor, @NotNull DataContext dataContext);
|
||||
default Result postProcessEnter(
|
||||
@NotNull PsiFile file,
|
||||
@NotNull Editor editor,
|
||||
@NotNull DataContext dataContext
|
||||
) {
|
||||
return Result.Continue;
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -1,3 +1,4 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.editorActions.enter;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
@@ -5,8 +6,13 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.ApiStatus.Obsolete;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Implement {@link EnterHandlerDelegate} directly
|
||||
*/
|
||||
@Obsolete
|
||||
public class EnterHandlerDelegateAdapter implements EnterHandlerDelegate {
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package com.intellij.codeInsight.editorActions.enter;
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public final class EnterInBlockCommentHandler extends EnterHandlerDelegateAdapter {
|
||||
public final class EnterInBlockCommentHandler implements EnterHandlerDelegate {
|
||||
private static final String WHITESPACE = " \t";
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package com.intellij.codeInsight.editorActions.enter;
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public final class EnterInLineCommentHandler extends EnterHandlerDelegateAdapter {
|
||||
public final class EnterInLineCommentHandler implements EnterHandlerDelegate {
|
||||
private static final String WHITESPACE = " \t";
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package com.intellij.codeInsight.editorActions.enter;
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class EnterInStringLiteralHandler extends EnterHandlerDelegateAdapter {
|
||||
public class EnterInStringLiteralHandler implements EnterHandlerDelegate {
|
||||
@Override
|
||||
public Result preprocessEnter(final @NotNull PsiFile file, final @NotNull Editor editor, @NotNull Ref<Integer> caretOffsetRef,
|
||||
final @NotNull Ref<Integer> caretAdvanceRef, final @NotNull DataContext dataContext,
|
||||
|
||||
+2
-3
@@ -1,9 +1,8 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.editorconfig.language.codeinsight.actions
|
||||
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate.Result
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter
|
||||
import com.intellij.openapi.actionSystem.DataContext
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.editor.ScrollType
|
||||
@@ -15,7 +14,7 @@ import org.editorconfig.language.psi.EditorConfigElementTypes
|
||||
import org.editorconfig.language.psi.EditorConfigPsiFile
|
||||
|
||||
// Those functions look somewhat C-ish...
|
||||
internal class EnterInEditorConfigFileHandler : EnterHandlerDelegateAdapter() {
|
||||
internal class EnterInEditorConfigFileHandler : EnterHandlerDelegate {
|
||||
override fun preprocessEnter(
|
||||
file: PsiFile,
|
||||
editor: Editor,
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.groovy.editor.actions;
|
||||
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
import com.intellij.codeInsight.CodeInsightSettings;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
@@ -45,7 +45,7 @@ import org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.*;
|
||||
|
||||
public final class GroovyEnterHandler extends EnterHandlerDelegateAdapter {
|
||||
public final class GroovyEnterHandler implements EnterHandlerDelegate {
|
||||
|
||||
private static final TokenSet GSTRING_TOKENS = TokenSet.create(GroovyTokenTypes.mGSTRING_BEGIN, GroovyTokenTypes.mGSTRING_CONTENT,
|
||||
GroovyTokenTypes.mGSTRING_END, STRING_DQ, STRING_TDQ);
|
||||
|
||||
+2
-4
@@ -1,10 +1,9 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.jetbrains.kotlin.idea.editor
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightSettings
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter
|
||||
import com.intellij.openapi.actionSystem.DataContext
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.editor.Editor
|
||||
@@ -26,7 +25,6 @@ import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.isSingleQuoted
|
||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||
import kotlin.jvm.java
|
||||
|
||||
internal fun getElementAtOffsetIgnoreWhitespaceBefore(file: PsiFile, offset: Int): PsiElement? {
|
||||
val element = file.findElementAt(offset)
|
||||
@@ -37,7 +35,7 @@ internal fun getElementAtOffsetIgnoreWhitespaceBefore(file: PsiFile, offset: Int
|
||||
}
|
||||
|
||||
|
||||
class KotlinEnterHandler : EnterHandlerDelegateAdapter() {
|
||||
class KotlinEnterHandler : EnterHandlerDelegate {
|
||||
companion object {
|
||||
private val LOG = Logger.getInstance(KotlinEnterHandler::class.java)
|
||||
private val FORCE_INDENT_IN_LAMBDA_AFTER = TokenSet.create(KtTokens.ARROW, KtTokens.LBRACE)
|
||||
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.jetbrains.kotlin.idea.editor
|
||||
|
||||
import com.intellij.application.options.CodeStyle
|
||||
import com.intellij.codeInsight.CodeInsightSettings
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate.Result
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter
|
||||
import com.intellij.injected.editor.EditorWindow
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||
import com.intellij.openapi.actionSystem.DataContext
|
||||
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.psi.psiUtil.isSingleQuoted
|
||||
import org.jetbrains.kotlin.psi.psiUtil.parents
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||
|
||||
class KotlinMultilineStringEnterHandler : EnterHandlerDelegateAdapter() {
|
||||
class KotlinMultilineStringEnterHandler : EnterHandlerDelegate {
|
||||
private var wasInMultilineString: Boolean = false
|
||||
private var whiteSpaceAfterCaret: String = ""
|
||||
private var isInBrace = false
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.intellij.plugins.markdown.editor
|
||||
|
||||
import com.intellij.application.options.CodeStyle
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate.Result
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter
|
||||
import com.intellij.lang.injection.InjectedLanguageManager
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||
import com.intellij.openapi.actionSystem.DataContext
|
||||
@@ -27,7 +27,7 @@ import org.intellij.plugins.markdown.util.MarkdownPsiUtil
|
||||
* It generates blockquotes on `enter`.
|
||||
* Also it stops indentation when there is >= 2 new lines after text
|
||||
*/
|
||||
internal class MarkdownEnterHandler : EnterHandlerDelegateAdapter() {
|
||||
internal class MarkdownEnterHandler : EnterHandlerDelegate {
|
||||
/**
|
||||
* During preprocessing indentation can be stopped if there are more than
|
||||
* two new lines after last element of text in Markdown file.
|
||||
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.intellij.plugins.markdown.editor.tables.handlers
|
||||
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter
|
||||
import com.intellij.openapi.actionSystem.DataContext
|
||||
import com.intellij.openapi.command.executeCommand
|
||||
import com.intellij.openapi.editor.Editor
|
||||
@@ -15,7 +14,7 @@ import com.intellij.psi.PsiFile
|
||||
import org.intellij.plugins.markdown.editor.tables.TableUtils
|
||||
import org.intellij.plugins.markdown.settings.MarkdownCodeInsightSettings
|
||||
|
||||
internal class MarkdownTableEnterHandler: EnterHandlerDelegateAdapter() {
|
||||
internal class MarkdownTableEnterHandler: EnterHandlerDelegate {
|
||||
private var firstEnterPosition: Int? = null
|
||||
|
||||
override fun preprocessEnter(
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.lang.properties;
|
||||
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate;
|
||||
import com.intellij.lang.properties.parsing.PropertiesTokenTypes;
|
||||
import com.intellij.lang.properties.psi.PropertiesFile;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
@@ -16,7 +16,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
final class EnterInPropertiesFileHandler extends EnterHandlerDelegateAdapter {
|
||||
final class EnterInPropertiesFileHandler implements EnterHandlerDelegate {
|
||||
@Override
|
||||
public Result preprocessEnter(final @NotNull PsiFile file, final @NotNull Editor editor, final @NotNull Ref<Integer> caretOffsetRef, final @NotNull Ref<Integer> caretAdvance,
|
||||
final @NotNull DataContext dataContext, final EditorActionHandler originalHandler) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//package org.jetbrains.plugins.textmate.editor
|
||||
//
|
||||
//import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate
|
||||
//import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter
|
||||
//import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate
|
||||
//import com.intellij.openapi.actionSystem.DataContext
|
||||
//import com.intellij.openapi.editor.Editor
|
||||
//import com.intellij.openapi.editor.ex.EditorEx
|
||||
@@ -13,7 +13,7 @@
|
||||
//import org.jetbrains.plugins.textmate.psi.TextMateFile
|
||||
//
|
||||
//// todo: consider using this for onEnterRules, instead of TextMateLineIndentProvider
|
||||
//class TextMateEnterHandler : EnterHandlerDelegateAdapter() {
|
||||
//class TextMateEnterHandler : EnterHandlerDelegate {
|
||||
// override fun postProcessEnter(file: PsiFile, editor: Editor, dataContext: DataContext): EnterHandlerDelegate.Result {
|
||||
// if (file !is TextMateFile) return super.postProcessEnter(file, editor, dataContext)
|
||||
//
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
package org.jetbrains.yaml.smart
|
||||
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter
|
||||
import com.intellij.formatting.FormattingMode
|
||||
import com.intellij.lang.injection.InjectedLanguageManager
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||
@@ -26,7 +25,7 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import java.util.*
|
||||
|
||||
class YAMLInjectedElementEnterHandler : EnterHandlerDelegateAdapter() {
|
||||
class YAMLInjectedElementEnterHandler : EnterHandlerDelegate {
|
||||
|
||||
override fun postProcessEnter(file: PsiFile, editor: Editor, dataContext: DataContext): EnterHandlerDelegate.Result {
|
||||
val hostEditor = CommonDataKeys.HOST_EDITOR.getData(dataContext) as? EditorEx ?: return EnterHandlerDelegate.Result.Continue
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright 2000-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 file.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.yaml.smart;
|
||||
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
import com.intellij.codeInsight.editorActions.BackspaceHandler;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
@@ -31,7 +31,7 @@ import java.util.Objects;
|
||||
import static org.jetbrains.yaml.settingsSync.YamlBackendExtensionSuppressorKt.shouldDoNothingInBackendMode;
|
||||
import static org.jetbrains.yaml.smart.YamlIndentPreservationUtilsKt.preserveIndentStateBeforeProcessing;
|
||||
|
||||
public class YAMLEnterAtIndentHandler extends EnterHandlerDelegateAdapter {
|
||||
public class YAMLEnterAtIndentHandler implements EnterHandlerDelegate {
|
||||
@Override
|
||||
public Result preprocessEnter(@NotNull PsiFile file,
|
||||
@NotNull Editor editor,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
package com.jetbrains.python.editor;
|
||||
|
||||
import com.intellij.codeInsight.editorActions.BackspaceHandler;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate;
|
||||
import com.intellij.injected.editor.EditorWindow;
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
@@ -15,7 +15,7 @@ import com.jetbrains.python.ast.PyAstFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
public final class PyEnterAtIndentHandler extends EnterHandlerDelegateAdapter {
|
||||
public final class PyEnterAtIndentHandler implements EnterHandlerDelegate {
|
||||
@Override
|
||||
public Result preprocessEnter(@NotNull PsiFile file,
|
||||
@NotNull Editor editor,
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.jetbrains.python.editor;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightSettings;
|
||||
import com.intellij.codeInsight.editorActions.AutoHardWrapHandler;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.injected.editor.EditorWindow;
|
||||
import com.intellij.lang.ASTNode;
|
||||
@@ -38,7 +38,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
|
||||
public final class PythonEnterHandler extends EnterHandlerDelegateAdapter {
|
||||
public final class PythonEnterHandler implements EnterHandlerDelegate {
|
||||
private int myPostprocessShift = 0;
|
||||
|
||||
@Override
|
||||
@@ -252,7 +252,7 @@ public final class PythonEnterHandler extends EnterHandlerDelegateAdapter {
|
||||
return Result.Continue;
|
||||
}
|
||||
addGoogleDocStringSectionIndent(file, editor, editor.getCaretModel().getOffset());
|
||||
return super.postProcessEnter(file, editor, dataContext);
|
||||
return EnterHandlerDelegate.super.postProcessEnter(file, editor, dataContext);
|
||||
}
|
||||
|
||||
private static void addGoogleDocStringSectionIndent(@NotNull PsiFile file, @NotNull Editor editor, int offset) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.editorActions;
|
||||
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter;
|
||||
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -21,7 +21,7 @@ import com.intellij.psi.xml.XmlTokenType;
|
||||
import com.intellij.xml.util.HtmlUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class EnterBetweenXmlTagsHandler extends EnterHandlerDelegateAdapter {
|
||||
public class EnterBetweenXmlTagsHandler implements EnterHandlerDelegate {
|
||||
@Override
|
||||
public Result preprocessEnter(final @NotNull PsiFile file, final @NotNull Editor editor, final @NotNull Ref<Integer> caretOffset, final @NotNull Ref<Integer> caretAdvance,
|
||||
final @NotNull DataContext dataContext, final EditorActionHandler originalHandler) {
|
||||
|
||||
Reference in New Issue
Block a user