mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (no PSI leak in quick fix; deprecated calls dropped)
This commit is contained in:
+5
-7
@@ -61,16 +61,14 @@ public class MissingFinalNewlineInspection extends LocalInspectionTool {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class AddNewlineQuickFix implements LocalQuickFix {
|
||||
private final Section mySection;
|
||||
|
||||
private static class AddNewlineQuickFix extends LocalQuickFixOnPsiElement {
|
||||
private AddNewlineQuickFix(Section section) {
|
||||
mySection = section;
|
||||
super(section);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getText() {
|
||||
return ManifestBundle.message("inspection.newline.fix");
|
||||
}
|
||||
|
||||
@@ -81,8 +79,8 @@ public class MissingFinalNewlineInspection extends LocalInspectionTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
PsiElement lastChild = mySection.getLastChild();
|
||||
public void invoke(@NotNull Project project, @NotNull PsiFile file, @NotNull PsiElement startElement, @NotNull PsiElement endElement) {
|
||||
PsiElement lastChild = startElement.getLastChild();
|
||||
if (lastChild instanceof Header) {
|
||||
lastChild.getNode().addLeaf(ManifestTokenType.NEWLINE, "\n", null);
|
||||
}
|
||||
|
||||
+3
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,6 @@ package org.jetbrains.lang.manifest;
|
||||
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import junit.framework.Assert;
|
||||
import org.jetbrains.lang.manifest.highlighting.MissingFinalNewlineInspection;
|
||||
|
||||
public class MissingFinalNewlineInspectionTest extends LightCodeInsightFixtureTestCase {
|
||||
@@ -29,12 +28,12 @@ public class MissingFinalNewlineInspectionTest extends LightCodeInsightFixtureTe
|
||||
|
||||
public void testEmptyFile() {
|
||||
myFixture.configureByText(ManifestFileTypeFactory.MANIFEST, "");
|
||||
Assert.assertEquals(0, myFixture.getAvailableIntentions().size());
|
||||
assertEquals(0, myFixture.getAvailableIntentions().size());
|
||||
}
|
||||
|
||||
public void testNoProblem() {
|
||||
myFixture.configureByText(ManifestFileTypeFactory.MANIFEST, "Manifest-Version: 1.0\n");
|
||||
Assert.assertEquals(0, myFixture.getAvailableIntentions().size());
|
||||
assertEquals(0, myFixture.getAvailableIntentions().size());
|
||||
}
|
||||
|
||||
public void testFix() {
|
||||
|
||||
Reference in New Issue
Block a user