UpdateCopyright (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); } }; }