mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
icon classes generation: update warning message
This commit is contained in:
+1
-1
@@ -125,7 +125,7 @@ class IconsClassGenerator(val projectHome: File, val util: JpsModule) {
|
||||
// please do corresponding changes in IconsGeneratedSourcesFilter as well
|
||||
append(answer, "/**", 0)
|
||||
append(answer, " * NOTE THIS FILE IS AUTO-GENERATED", 0)
|
||||
append(answer, " * DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead", 0)
|
||||
append(answer, " * DO NOT EDIT IT BY HAND, run \"Generate icon classes\" configuration instead", 0)
|
||||
append(answer, " */", 0)
|
||||
|
||||
append(answer, "public class $className {", 0)
|
||||
|
||||
@@ -33,7 +33,10 @@ public class IconsGeneratedSourcesFilter extends GeneratedSourcesFilter {
|
||||
for (PsiClass aClass : ((PsiJavaFile)psiFile).getClasses()) {
|
||||
if (aClass.isValid() && aClass.hasModifierProperty(PsiModifier.PUBLIC)) {
|
||||
PsiDocComment comment = aClass.getDocComment();
|
||||
return comment != null && comment.getText().contains("run build/scripts/icons.gant instead");
|
||||
if (comment == null) return false;
|
||||
String docText = comment.getText();
|
||||
return docText.contains("NOTE THIS FILE IS AUTO-GENERATED") &&
|
||||
docText.contains("DO NOT EDIT IT BY HAND");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,16 @@ public class IconsGeneratedSourcesTest extends LightCodeInsightFixtureTestCase {
|
||||
assertTrue(new IconsGeneratedSourcesFilter().isGeneratedSource(file.getVirtualFile(), myFixture.getProject()));
|
||||
}
|
||||
|
||||
public void testNewGeneratedFile() {
|
||||
PsiFile file = myFixture.configureByText("MyIcons.java", "package icons;\n" +
|
||||
"/**\n" +
|
||||
" * NOTE THIS FILE IS AUTO-GENERATED\n" +
|
||||
" * DO NOT EDIT IT BY HAND, run \"Generate icon classes\" configuration instead\n" +
|
||||
" */\n" +
|
||||
"public class RubyIcons {}");
|
||||
assertTrue(new IconsGeneratedSourcesFilter().isGeneratedSource(file.getVirtualFile(), myFixture.getProject()));
|
||||
}
|
||||
|
||||
public void testFilterByName() {
|
||||
PsiFile file = myFixture.configureByText("MyIconsTest.java", "package icons;\n" +
|
||||
"/**\n" +
|
||||
|
||||
Reference in New Issue
Block a user