mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Gradle: PasteMvnDependencyPreProcessor can be reused for kotlin DSL
This commit is contained in:
+6
-1
@@ -22,6 +22,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
@@ -45,12 +46,16 @@ public class PasteMvnDependencyPreProcessor implements CopyPastePreProcessor {
|
||||
@NotNull
|
||||
@Override
|
||||
public String preprocessOnPaste(Project project, PsiFile file, Editor editor, String text, RawText rawText) {
|
||||
if ("build.gradle".equals(file.getName()) && isMvnDependency(text)) {
|
||||
if (isApplicable(file) && isMvnDependency(text)) {
|
||||
return toGradleDependency(text);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
protected boolean isApplicable(PsiFile file) {
|
||||
return file.getName().endsWith('.' + GradleConstants.EXTENSION);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected String formatGradleDependency(@NotNull String groupId,
|
||||
@NotNull String artifactId,
|
||||
|
||||
Reference in New Issue
Block a user