mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
suppression intentions: make files writable outside write action
This commit is contained in:
-2
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon.impl;
|
||||
|
||||
import com.intellij.codeInsight.FileModificationService;
|
||||
import com.intellij.codeInsight.daemon.QuickFixBundle;
|
||||
import com.intellij.codeInspection.JavaSuppressionUtil;
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
@@ -73,7 +72,6 @@ public class RemoveSuppressWarningAction implements LocalQuickFix {
|
||||
PsiElement element = descriptor.getPsiElement();
|
||||
try {
|
||||
if (element != null) {
|
||||
if (!FileModificationService.getInstance().prepareFileForWrite(element.getContainingFile())) return;
|
||||
final PsiDocCommentOwner commentOwner = PsiTreeUtil.getParentOfType(element, PsiDocCommentOwner.class);
|
||||
if (commentOwner != null) {
|
||||
final PsiElement psiElement = JavaSuppressionUtil.getElementMemberSuppressedIn(commentOwner, myID);
|
||||
|
||||
-2
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon.impl.actions;
|
||||
|
||||
import com.intellij.codeInsight.FileModificationService;
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.codeInspection.JavaSuppressionUtil;
|
||||
import com.intellij.codeInspection.SuppressionUtil;
|
||||
@@ -74,7 +73,6 @@ public class SuppressAllForClassFix extends SuppressFix {
|
||||
public void invoke(@NotNull final Project project, @NotNull final PsiElement element) throws IncorrectOperationException {
|
||||
final PsiDocCommentOwner container = getContainer(element);
|
||||
LOG.assertTrue(container != null);
|
||||
if (!FileModificationService.getInstance().preparePsiElementForWrite(container)) return;
|
||||
if (use15Suppressions(container)) {
|
||||
final PsiModifierList modifierList = container.getModifierList();
|
||||
if (modifierList != null) {
|
||||
|
||||
-2
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon.impl.actions;
|
||||
|
||||
import com.intellij.codeInsight.FileModificationService;
|
||||
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.codeInspection.JavaSuppressionUtil;
|
||||
@@ -108,7 +107,6 @@ public class SuppressFix extends AbstractBatchSuppressByNoInspectionCommentFix {
|
||||
|
||||
private boolean doSuppress(@NotNull Project project, PsiDocCommentOwner container) {
|
||||
assert container != null;
|
||||
if (!FileModificationService.getInstance().preparePsiElementForWrite(container)) return true;
|
||||
if (use15Suppressions(container)) {
|
||||
final PsiModifierList modifierList = container.getModifierList();
|
||||
if (modifierList != null) {
|
||||
|
||||
-7
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.intellij.codeInsight.daemon.impl.actions;
|
||||
|
||||
import com.intellij.codeInsight.FileModificationService;
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.lang.Language;
|
||||
@@ -91,10 +90,6 @@ public abstract class AbstractBatchSuppressByNoInspectionCommentFix implements C
|
||||
myText = text;
|
||||
}
|
||||
|
||||
public boolean startInWriteAction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getText();
|
||||
@@ -142,8 +137,6 @@ public abstract class AbstractBatchSuppressByNoInspectionCommentFix implements C
|
||||
PsiElement container = getContainer(element);
|
||||
if (container == null) return;
|
||||
|
||||
if (!FileModificationService.getInstance().preparePsiElementForWrite(container)) return;
|
||||
|
||||
if (replaceSuppressionComments(container)) return;
|
||||
|
||||
createSuppression(project, element, container);
|
||||
|
||||
-3
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.intellij.codeInsight.daemon.impl.actions;
|
||||
|
||||
import com.intellij.codeInsight.FileModificationService;
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.codeInspection.SuppressIntentionAction;
|
||||
import com.intellij.codeInspection.SuppressionUtil;
|
||||
@@ -88,8 +87,6 @@ public abstract class AbstractSuppressByNoInspectionCommentFix extends SuppressI
|
||||
PsiElement container = getContainer(element);
|
||||
if (container == null) return;
|
||||
|
||||
if (!FileModificationService.getInstance().preparePsiElementForWrite(container)) return;
|
||||
|
||||
final List<? extends PsiElement> comments = getCommentsFor(container);
|
||||
if (comments != null) {
|
||||
for (PsiElement comment : comments) {
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.codeInspection.i18n;
|
||||
|
||||
import com.intellij.codeInsight.FileModificationService;
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.codeInspection.SuppressIntentionAction;
|
||||
@@ -42,7 +41,6 @@ class SuppressByCommentOutAction extends SuppressIntentionAction {
|
||||
|
||||
@Override
|
||||
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException {
|
||||
if (!FileModificationService.getInstance().preparePsiElementForWrite(element)) return;
|
||||
element = findJavaCodeUpThere(element);
|
||||
PsiFile file = element.getContainingFile();
|
||||
editor = InjectedLanguageUtil.openEditorFor(file, project);
|
||||
|
||||
-10
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.codeInsight.FileModificationService;
|
||||
import com.intellij.lang.properties.PropertiesBundle;
|
||||
import com.intellij.lang.properties.psi.PropertiesFile;
|
||||
import com.intellij.lang.properties.psi.PropertiesList;
|
||||
@@ -25,7 +24,6 @@ import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -98,7 +96,6 @@ public class PropertiesInspectionSuppressor implements InspectionSuppressor {
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
final PsiElement element = descriptor.getStartElement();
|
||||
final PsiFile file = element.getContainingFile();
|
||||
if (!FileModificationService.getInstance().prepareFileForWrite(file)) return;
|
||||
|
||||
final Property property = PsiTreeUtil.getParentOfType(element, Property.class);
|
||||
LOG.assertTrue(property != null);
|
||||
@@ -125,8 +122,6 @@ public class PropertiesInspectionSuppressor implements InspectionSuppressor {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static class SuppressForFile implements SuppressQuickFix {
|
||||
private final String shortName;
|
||||
|
||||
@@ -144,7 +139,6 @@ public class PropertiesInspectionSuppressor implements InspectionSuppressor {
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
final PsiElement element = descriptor.getStartElement();
|
||||
final PsiFile file = element.getContainingFile();
|
||||
if (!FileModificationService.getInstance().prepareFileForWrite(file)) return;
|
||||
|
||||
@NonNls final Document doc = PsiDocumentManager.getInstance(project).getDocument(file);
|
||||
LOG.assertTrue(doc != null, file);
|
||||
@@ -164,9 +158,5 @@ public class PropertiesInspectionSuppressor implements InspectionSuppressor {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startInWriteAction() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user