KT-3250 Copyright plugin does not work on Kotlin sources
This commit is contained in:
Generated
+11
@@ -0,0 +1,11 @@
|
||||
<component name="libraryTable">
|
||||
<library name="copyright-plugin">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/plugins/copyright/lib/copyright.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/copyright/src" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
@@ -26,6 +26,7 @@
|
||||
<orderEntry type="module" module-name="jet.as.java.psi" />
|
||||
<orderEntry type="library" name="idea-full" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="junit-plugin" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="copyright-plugin" level="project" />
|
||||
<orderEntry type="module" module-name="j2k" />
|
||||
<orderEntry type="module" module-name="js.translator" />
|
||||
<orderEntry type="module" module-name="cli" scope="TEST" />
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<idea-plugin>
|
||||
<extensions defaultExtensionNs="com.intellij.copyright">
|
||||
<updater filetype="Kotlin" implementationClass="org.jetbrains.jet.plugin.copyright.UpdateKotlinCopyrightsProvider"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -9,6 +9,7 @@
|
||||
<idea-version since-build="123.4" until-build="124.9999" />
|
||||
|
||||
<depends optional="true">JUnit</depends>
|
||||
<depends optional="true" config-file="kotlin-copyright.xml">com.intellij.copyright</depends>
|
||||
|
||||
<project-components>
|
||||
<component>
|
||||
@@ -254,4 +255,8 @@
|
||||
<project.converterProvider implementation="org.jetbrains.jet.plugin.converters.JetRunConfigurationSettingsFormatConverterProvider"/>
|
||||
|
||||
</extensions>
|
||||
|
||||
<extensionPoints>
|
||||
<extensionPoint name="updater" beanClass="com.intellij.openapi.fileTypes.FileTypeExtensionPoint"/>
|
||||
</extensionPoints>
|
||||
</idea-plugin>
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.copyright;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiComment;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiWhiteSpace;
|
||||
import com.maddyhome.idea.copyright.CopyrightProfile;
|
||||
import com.maddyhome.idea.copyright.psi.UpdatePsiFileCopyright;
|
||||
|
||||
class UpdateKotlinCopyright extends UpdatePsiFileCopyright {
|
||||
|
||||
UpdateKotlinCopyright(Project project, Module module, VirtualFile root, CopyrightProfile copyrightProfile) {
|
||||
super(project, module, root, copyrightProfile);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void scanFile() {
|
||||
PsiElement first = getFile().getFirstChild();
|
||||
PsiElement last = first;
|
||||
PsiElement next = first;
|
||||
while (next != null) {
|
||||
if (next instanceof PsiComment || next instanceof PsiWhiteSpace) {
|
||||
next = getNextSibling(next);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
last = next;
|
||||
}
|
||||
|
||||
if (first != null) {
|
||||
checkComments(first, last, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.copyright;
|
||||
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.maddyhome.idea.copyright.CopyrightProfile;
|
||||
import com.maddyhome.idea.copyright.psi.UpdateCopyright;
|
||||
import com.maddyhome.idea.copyright.psi.UpdateCopyrightsProvider;
|
||||
|
||||
public class UpdateKotlinCopyrightsProvider extends UpdateCopyrightsProvider {
|
||||
@Override
|
||||
public UpdateCopyright createInstance(Project project, Module module, VirtualFile file, FileType base, CopyrightProfile options) {
|
||||
return new UpdateKotlinCopyright(project, module, file, options);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user