From 855a095fe32fc33c8b014a5db944d2c7163e5f5b Mon Sep 17 00:00:00 2001 From: sevdokimov Date: Wed, 17 Dec 2014 16:03:11 +0300 Subject: [PATCH] Fix compilation for scala. --- META-INF/plugin.xml | 11 ++++++++++- ggIdeaPluginUpdate.xml | 4 ++-- .../abbrev/GridScalaAbbreviationInspection.scala | 10 +++++----- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 059e48c..01eba8a 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -3,7 +3,7 @@ coding guidelines.]]> - 2.6.2 + 2.6.3 GridGain Inc. @@ -33,6 +33,15 @@ enabledByDefault="true" /> + + + url="https://github.com/sevdokimov-gg/gg-abbrev-plugin/releases/download/2.6.3/gg-abbrev-plugin.jar" + version="2.6.3" /> \ No newline at end of file diff --git a/src/org/gridgain/inspection/abbrev/GridScalaAbbreviationInspection.scala b/src/org/gridgain/inspection/abbrev/GridScalaAbbreviationInspection.scala index ea787dc..86ff7da 100644 --- a/src/org/gridgain/inspection/abbrev/GridScalaAbbreviationInspection.scala +++ b/src/org/gridgain/inspection/abbrev/GridScalaAbbreviationInspection.scala @@ -10,6 +10,7 @@ package org.gridgain.inspection.abbrev import com.intellij.codeInspection._ +import com.intellij.openapi.components.ServiceManager import com.intellij.psi.{PsiIdentifier, PsiNamedElement, PsiElement, PsiElementVisitor} import org.jetbrains.plugins.scala.lang.psi.api.ScalaElementVisitor import org.jetbrains.plugins.scala.lang.psi.api.statements.{ScValue, ScValueDeclaration, ScVariableDefinition} @@ -27,9 +28,6 @@ import com.intellij.refactoring.{RenameRefactoring, JavaRefactoringFactory} * @version @java.version */ class GridScalaAbbreviationInspection extends LocalInspectionTool { - /** Abbreviation rules. */ - val abbrRules = GridAbbreviationRules.getInstance - /** Abbreviation exceptions. */ val abbrExceptions = Set("value") @@ -73,9 +71,11 @@ class GridScalaAbbreviationInspection extends LocalInspectionTool { */ private def check0(parts: java.util.List[String], elem: PsiElement): Unit = { for (part <- parts) { - if (!abbrExceptions.contains(part) && abbrRules.getAbbreviation(part) != null) { + val config: GridAbbreviationConfig = ServiceManager.getService(elem.getProject, classOf[GridAbbreviationConfig]) + + if (!abbrExceptions.contains(part) && config.getAbbreviation(part) != null) { holder.registerProblem(elem, "Abbreviation should be used", - new RenameToFix(abbrRules.replaceWithAbbreviations(parts))) + new RenameToFix(config.replaceWithAbbreviations(parts))) return }