mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-64506 (correct handling of empty file header template)
This commit is contained in:
+9
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -102,15 +102,20 @@ public class FileHeaderChecker {
|
||||
|
||||
String newText;
|
||||
try {
|
||||
newText = template.getText(computeProperties(matcher, offsetToProperty, project));
|
||||
newText = template.getText(computeProperties(matcher, offsetToProperty, project)).trim();
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.error(e);
|
||||
return;
|
||||
}
|
||||
|
||||
PsiDocComment newComment = JavaPsiFacade.getElementFactory(project).createDocCommentFromText(newText);
|
||||
element.replace(newComment);
|
||||
if (!newText.isEmpty()) {
|
||||
PsiDocComment newComment = JavaPsiFacade.getElementFactory(project).createDocCommentFromText(newText);
|
||||
element.replace(newComment);
|
||||
}
|
||||
else {
|
||||
element.delete();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+6
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -30,8 +30,12 @@ public class DefaultFileTemplateUsageInspectionTest extends LightCodeInsightFixt
|
||||
public void testX3() { doTest(); }
|
||||
public void testRange() { doTest(); }
|
||||
|
||||
public void doTest() {
|
||||
private void doTest() {
|
||||
myFixture.enableInspections(new DefaultFileTemplateUsageInspection());
|
||||
myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
|
||||
}
|
||||
|
||||
public void testWtf() throws Exception {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user