Skip to content

Commit

Permalink
small fix in enable hydra action
Browse files Browse the repository at this point in the history
  • Loading branch information
maris123 committed Oct 23, 2017
1 parent ebd31d9 commit f6da3bd
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
package org.jetbrains.plugins.scala.actions

import com.intellij.openapi.actionSystem.{AnAction, AnActionEvent, CommonDataKeys}
import com.intellij.openapi.actionSystem.{AnAction, AnActionEvent, CommonDataKeys, ToggleAction}
import com.intellij.openapi.project.Project
import org.jetbrains.plugins.scala.compiler.HydraCompilerSettings

/**
* @author Maris Alexandru
*/
class EnableHydraSettingsAction extends AnAction{
def actionPerformed(e: AnActionEvent) {
class EnableHydraSettingsAction extends ToggleAction{

override def setSelected(e: AnActionEvent, toSet: Boolean): Unit = {
CommonDataKeys.PROJECT.getData(e.getDataContext) match {
case project: Project => {
val settings = HydraCompilerSettings.getInstance(project)
settings.isHydraSettingsEnabled = !settings.isHydraSettingsEnabled
settings.isHydraSettingsEnabled = toSet
}
case _ =>
}
}

override def isSelected(e: AnActionEvent): Boolean = {
CommonDataKeys.PROJECT.getData(e.getDataContext) match {
case project: Project => {
val settings = HydraCompilerSettings.getInstance(project)
settings.isHydraSettingsEnabled
}
case _ => false
}
}
}

0 comments on commit f6da3bd

Please sign in to comment.