Skip to content

Commit

Permalink
Fix compilation for scala.
Browse files Browse the repository at this point in the history
  • Loading branch information
sevdokimov-gg committed Dec 17, 2014
1 parent 8c90a41 commit 855a095
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
11 changes: 10 additions & 1 deletion META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<description><![CDATA[Simplifies development with GridGain
<a href="http://atlassian.gridgain.com/wiki/display/GG/Coding+Guidelines">coding guidelines</a>.]]>
</description>
<version>2.6.2</version>
<version>2.6.3</version>
<vendor>GridGain Inc.</vendor>

<idea-version since-build="135.1"/>
Expand Down Expand Up @@ -33,6 +33,15 @@
enabledByDefault="true"
/>

<localInspection
implementationClass="org.gridgain.inspection.abbrev.GridScalaAbbreviationInspection"
displayName="Incorrect Scala abbreviation usage"
groupName="Scala: Code style"
shortName="ScalaAbbreviationUsage"
level="WARNING"
enabledByDefault="true"
language="Scala"/>

<localInspection implementationClass="org.gridgain.inspection.comment.GridCommentInspection"
shortName="CommentAbsent"
displayName="Comment is absent"
Expand Down
4 changes: 2 additions & 2 deletions ggIdeaPluginUpdate.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<plugins>
<plugin
id="GridGain plugin"
url="https://github.com/sevdokimov-gg/gg-abbrev-plugin/releases/download/2.6.2/gg-abbrev-plugin.jar"
version="2.6.2" />
url="https://github.com/sevdokimov-gg/gg-abbrev-plugin/releases/download/2.6.3/gg-abbrev-plugin.jar"
version="2.6.3" />
</plugins>
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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")

Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 855a095

Please sign in to comment.