use of com.maddyhome.idea.copyright.psi.UpdateJavaFileCopyright in project intellij-community by JetBrains.
the class UpdateGroovyCopyrightsProvider method createInstance.
@Override
public UpdateCopyright createInstance(Project project, Module module, VirtualFile file, FileType base, CopyrightProfile options) {
return new UpdateJavaFileCopyright(project, module, file, options) {
@Override
protected boolean accept() {
return getFile() instanceof GroovyFile;
}
@Override
protected PsiElement[] getImportsList() {
return ((GroovyFile) getFile()).getImportStatements();
}
@Override
protected PsiElement getPackageStatement() {
return ((GroovyFile) getFile()).getPackageDefinition();
}
@Override
protected void checkCommentsForTopClass(PsiClass topclass, int location, List<PsiComment> comments) {
if (!(topclass instanceof GroovyScriptClass)) {
super.checkCommentsForTopClass(topclass, location, comments);
return;
}
final GroovyFile containingFile = (GroovyFile) topclass.getContainingFile();
PsiElement last = containingFile.getFirstChild();
while (last != null && !(last instanceof GrStatement)) {
last = last.getNextSibling();
}
checkComments(last, location == JavaOptions.LOCATION_BEFORE_CLASS, comments);
}
};
}
Aggregations