diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaEnterInInjectedTextBlockHandler.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaEnterInInjectedTextBlockHandler.java index 0862209fbf65..866d41ab114e 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaEnterInInjectedTextBlockHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaEnterInInjectedTextBlockHandler.java @@ -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; diff --git a/java/java-impl/src/com/intellij/javadoc/EnterInJavadocParamDescriptionHandler.java b/java/java-impl/src/com/intellij/javadoc/EnterInJavadocParamDescriptionHandler.java index b0b7e3bdde7c..43670035ee79 100644 --- a/java/java-impl/src/com/intellij/javadoc/EnterInJavadocParamDescriptionHandler.java +++ b/java/java-impl/src/com/intellij/javadoc/EnterInJavadocParamDescriptionHandler.java @@ -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(); diff --git a/java/java-impl/src/com/intellij/javadoc/JavaDocMarkdownEnterHandler.java b/java/java-impl/src/com/intellij/javadoc/JavaDocMarkdownEnterHandler.java index 77e93b1bd06c..847fb0d218d7 100644 --- a/java/java-impl/src/com/intellij/javadoc/JavaDocMarkdownEnterHandler.java +++ b/java/java-impl/src/com/intellij/javadoc/JavaDocMarkdownEnterHandler.java @@ -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 diff --git a/java/java-impl/src/com/intellij/javadoc/JavadocSnippetEnterHandler.java b/java/java-impl/src/com/intellij/javadoc/JavadocSnippetEnterHandler.java index 65b5ee885e93..df27569d91d1 100644 --- a/java/java-impl/src/com/intellij/javadoc/JavadocSnippetEnterHandler.java +++ b/java/java-impl/src/com/intellij/javadoc/JavadocSnippetEnterHandler.java @@ -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, diff --git a/json/split/src/com/intellij/json/editor/JsonEnterHandler.java b/json/split/src/com/intellij/json/editor/JsonEnterHandler.java index a8706dfecd87..6588835ba3e8 100644 --- a/json/split/src/com/intellij/json/editor/JsonEnterHandler.java +++ b/json/split/src/com/intellij/json/editor/JsonEnterHandler.java @@ -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, diff --git a/platform/lang-impl/api-dump-unreviewed.txt b/platform/lang-impl/api-dump-unreviewed.txt index c3e187d5bb7e..388acd0a9198 100644 --- a/platform/lang-impl/api-dump-unreviewed.txt +++ b/platform/lang-impl/api-dump-unreviewed.txt @@ -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 - (com.intellij.lang.Language,com.intellij.psi.tree.TokenSet,com.intellij.psi.tree.IElementType,java.lang.String,com.intellij.psi.tree.TokenSet):V - (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 - ():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 - ():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 - ():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 diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/BaseIndentEnterHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/BaseIndentEnterHandler.java index 61b13d8baa5b..2a3af95111dd 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/BaseIndentEnterHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/BaseIndentEnterHandler.java @@ -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; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterAfterJavadocTagHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterAfterJavadocTagHandler.java index 7d217961b73f..28573fc27819 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterAfterJavadocTagHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterAfterJavadocTagHandler.java @@ -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(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterAfterUnmatchedBraceHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterAfterUnmatchedBraceHandler.java index cde9b8f971e1..d50cd0329d2a 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterAfterUnmatchedBraceHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterAfterUnmatchedBraceHandler.java @@ -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 diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterBetweenBracesFinalHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterBetweenBracesFinalHandler.java index f47ca90f69fa..c2d5cb5de9b4 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterBetweenBracesFinalHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterBetweenBracesFinalHandler.java @@ -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, diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterHandlerDelegate.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterHandlerDelegate.java index a932bad875da..5a4bd39469b4 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterHandlerDelegate.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterHandlerDelegate.java @@ -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 * */ - Result preprocessEnter(final @NotNull PsiFile file, final @NotNull Editor editor, final @NotNull Ref caretOffset, - final @NotNull Ref caretAdvance, final @NotNull DataContext dataContext, - final @Nullable EditorActionHandler originalHandler); + default Result preprocessEnter( + final @NotNull PsiFile file, + final @NotNull Editor editor, + final @NotNull Ref caretOffset, + final @NotNull Ref 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; + } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterHandlerDelegateAdapter.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterHandlerDelegateAdapter.java index 05bf18dbde08..238fddc01a29 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterHandlerDelegateAdapter.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterHandlerDelegateAdapter.java @@ -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 diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterInBlockCommentHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterInBlockCommentHandler.java index 56c85ad73b19..045f9a0a87a1 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterInBlockCommentHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterInBlockCommentHandler.java @@ -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 diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterInLineCommentHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterInLineCommentHandler.java index 24d97a02d443..cab6211c3b4e 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterInLineCommentHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterInLineCommentHandler.java @@ -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 diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterInStringLiteralHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterInStringLiteralHandler.java index e2b01790fea1..60cc80614a77 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterInStringLiteralHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterInStringLiteralHandler.java @@ -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 caretOffsetRef, final @NotNull Ref caretAdvanceRef, final @NotNull DataContext dataContext, diff --git a/plugins/editorconfig/src/org/editorconfig/language/codeinsight/actions/EnterInEditorConfigFileHandler.kt b/plugins/editorconfig/src/org/editorconfig/language/codeinsight/actions/EnterInEditorConfigFileHandler.kt index 369a4aa7676c..48d5a17386a3 100644 --- a/plugins/editorconfig/src/org/editorconfig/language/codeinsight/actions/EnterInEditorConfigFileHandler.kt +++ b/plugins/editorconfig/src/org/editorconfig/language/codeinsight/actions/EnterInEditorConfigFileHandler.kt @@ -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, diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/actions/GroovyEnterHandler.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/actions/GroovyEnterHandler.java index 49b55a61c25a..e832522a22f7 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/actions/GroovyEnterHandler.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/actions/GroovyEnterHandler.java @@ -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); diff --git a/plugins/kotlin/base/code-insight/minimal/src/org/jetbrains/kotlin/idea/editor/KotlinEnterHandler.kt b/plugins/kotlin/base/code-insight/minimal/src/org/jetbrains/kotlin/idea/editor/KotlinEnterHandler.kt index 94f962826f33..b0385051fd82 100644 --- a/plugins/kotlin/base/code-insight/minimal/src/org/jetbrains/kotlin/idea/editor/KotlinEnterHandler.kt +++ b/plugins/kotlin/base/code-insight/minimal/src/org/jetbrains/kotlin/idea/editor/KotlinEnterHandler.kt @@ -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) diff --git a/plugins/kotlin/base/code-insight/minimal/src/org/jetbrains/kotlin/idea/editor/KotlinMultilineStringEnterHandler.kt b/plugins/kotlin/base/code-insight/minimal/src/org/jetbrains/kotlin/idea/editor/KotlinMultilineStringEnterHandler.kt index 553b2e2e1bbd..449eceb9c2e4 100644 --- a/plugins/kotlin/base/code-insight/minimal/src/org/jetbrains/kotlin/idea/editor/KotlinMultilineStringEnterHandler.kt +++ b/plugins/kotlin/base/code-insight/minimal/src/org/jetbrains/kotlin/idea/editor/KotlinMultilineStringEnterHandler.kt @@ -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 diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/editor/MarkdownEnterHandler.kt b/plugins/markdown/core/src/org/intellij/plugins/markdown/editor/MarkdownEnterHandler.kt index c4826788d91c..0f77342b6cec 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/editor/MarkdownEnterHandler.kt +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/editor/MarkdownEnterHandler.kt @@ -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. diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/editor/tables/handlers/MarkdownTableEnterHandler.kt b/plugins/markdown/core/src/org/intellij/plugins/markdown/editor/tables/handlers/MarkdownTableEnterHandler.kt index 52f15dbf85e3..a43aa0fda2ea 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/editor/tables/handlers/MarkdownTableEnterHandler.kt +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/editor/tables/handlers/MarkdownTableEnterHandler.kt @@ -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( diff --git a/plugins/properties/properties-common/src/com/intellij/lang/properties/EnterInPropertiesFileHandler.java b/plugins/properties/properties-common/src/com/intellij/lang/properties/EnterInPropertiesFileHandler.java index 333f18bff489..fd49474d938c 100644 --- a/plugins/properties/properties-common/src/com/intellij/lang/properties/EnterInPropertiesFileHandler.java +++ b/plugins/properties/properties-common/src/com/intellij/lang/properties/EnterInPropertiesFileHandler.java @@ -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 caretOffsetRef, final @NotNull Ref caretAdvance, final @NotNull DataContext dataContext, final EditorActionHandler originalHandler) { diff --git a/plugins/textmate/src/org/jetbrains/plugins/textmate/editor/TextMateEnterHandler.kt b/plugins/textmate/src/org/jetbrains/plugins/textmate/editor/TextMateEnterHandler.kt index 2ebb48e558c9..e1d0bc703faf 100644 --- a/plugins/textmate/src/org/jetbrains/plugins/textmate/editor/TextMateEnterHandler.kt +++ b/plugins/textmate/src/org/jetbrains/plugins/textmate/editor/TextMateEnterHandler.kt @@ -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) // diff --git a/plugins/yaml/backend/src/smart/YAMLInjectedElementEnterHandler.kt b/plugins/yaml/backend/src/smart/YAMLInjectedElementEnterHandler.kt index c988a758190c..8cb85f9d67bd 100644 --- a/plugins/yaml/backend/src/smart/YAMLInjectedElementEnterHandler.kt +++ b/plugins/yaml/backend/src/smart/YAMLInjectedElementEnterHandler.kt @@ -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 diff --git a/plugins/yaml/src/smart/YAMLEnterAtIndentHandler.java b/plugins/yaml/src/smart/YAMLEnterAtIndentHandler.java index 9e6e0e4acc5a..bcf14db7f2f3 100644 --- a/plugins/yaml/src/smart/YAMLEnterAtIndentHandler.java +++ b/plugins/yaml/src/smart/YAMLEnterAtIndentHandler.java @@ -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, diff --git a/python/python-syntax/src/com/jetbrains/python/editor/PyEnterAtIndentHandler.java b/python/python-syntax/src/com/jetbrains/python/editor/PyEnterAtIndentHandler.java index c57d5076213f..d1ccb46b5e20 100644 --- a/python/python-syntax/src/com/jetbrains/python/editor/PyEnterAtIndentHandler.java +++ b/python/python-syntax/src/com/jetbrains/python/editor/PyEnterAtIndentHandler.java @@ -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, diff --git a/python/python-syntax/src/com/jetbrains/python/editor/PythonEnterHandler.java b/python/python-syntax/src/com/jetbrains/python/editor/PythonEnterHandler.java index 7e5fd6ca6322..89b4c24d1c87 100644 --- a/python/python-syntax/src/com/jetbrains/python/editor/PythonEnterHandler.java +++ b/python/python-syntax/src/com/jetbrains/python/editor/PythonEnterHandler.java @@ -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) { diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/EnterBetweenXmlTagsHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/EnterBetweenXmlTagsHandler.java index 110220f2a23e..7961ad5c1413 100644 --- a/xml/impl/src/com/intellij/codeInsight/editorActions/EnterBetweenXmlTagsHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/editorActions/EnterBetweenXmlTagsHandler.java @@ -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 caretOffset, final @NotNull Ref caretAdvance, final @NotNull DataContext dataContext, final EditorActionHandler originalHandler) {