From 46522509f0f1a0ab5850c933448fbf61e8a79e11 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Sun, 4 Dec 2022 11:49:08 +0100 Subject: [PATCH] [Java] ModifierFix: fix preview when the modifier is not from the current file GitOrigin-RevId: 25f5da768acb943fe10c984baa0b15904a78a9ad --- .../codeInsight/daemon/impl/quickfix/ModifierFix.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ModifierFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ModifierFix.java index 6a252823dd97..54c630b9db5a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ModifierFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ModifierFix.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 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-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.daemon.impl.quickfix; import com.intellij.codeInsight.FileModificationService; @@ -171,6 +171,11 @@ public class ModifierFix extends LocalQuickFixAndIntentionActionOnPsiElement imp return IntentionPreviewInfo.DIFF; } + @Override + public @Nullable PsiElement getElementToMakeWritable(@NotNull PsiFile currentFile) { + return getStartElement().getContainingFile(); + } + @Override public void invoke(@NotNull Project project, @NotNull PsiFile file,