forked from JetBrains/intellij-scala
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The Hydra settings panel opens when you click the Action
- Loading branch information
Showing
4 changed files
with
21 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 6 additions & 16 deletions
22
scala/scala-impl/src/org/jetbrains/plugins/hydra/actions/EnableHydraSettingsAction.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,21 @@ | ||
package org.jetbrains.plugins.hydra.actions | ||
|
||
import com.intellij.openapi.actionSystem.{AnActionEvent, CommonDataKeys, ToggleAction} | ||
import com.intellij.openapi.actionSystem.{AnAction, AnActionEvent, CommonDataKeys} | ||
import com.intellij.openapi.project.Project | ||
import org.jetbrains.plugins.hydra.compiler.HydraCompilerSettings | ||
import org.jetbrains.plugins.hydra.compiler.{HydraCompilerSettings, HydraCompilerSettingsManager} | ||
|
||
/** | ||
* @author Maris Alexandru | ||
*/ | ||
class EnableHydraSettingsAction extends ToggleAction{ | ||
|
||
override def setSelected(e: AnActionEvent, toSet: Boolean): Unit = { | ||
class EnableHydraSettingsAction extends AnAction{ | ||
def actionPerformed(e: AnActionEvent): Unit = { | ||
CommonDataKeys.PROJECT.getData(e.getDataContext) match { | ||
case project: Project => { | ||
val settings = HydraCompilerSettings.getInstance(project) | ||
settings.isHydraSettingsEnabled = toSet | ||
HydraCompilerSettingsManager.showHydraCompileSettingsDialog(project) | ||
settings.isHydraSettingsEnabled = true | ||
} | ||
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 | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/HydraCompilerSettingsManager.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.jetbrains.plugins.hydra.compiler | ||
|
||
import com.intellij.openapi.options.ShowSettingsUtil | ||
import com.intellij.openapi.project.Project | ||
|
||
/** | ||
* @author Maris Alexandru | ||
*/ | ||
object HydraCompilerSettingsManager { | ||
def showHydraCompileSettingsDialog(project: Project): Unit = ShowSettingsUtil.getInstance().showSettingsDialog(project, "Hydra Compiler") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters