diff --git a/scala/scala-impl/resources/META-INF/scala-plugin-common.xml b/scala/scala-impl/resources/META-INF/scala-plugin-common.xml index bfba434f39c..2e4a0201344 100644 --- a/scala/scala-impl/resources/META-INF/scala-plugin-common.xml +++ b/scala/scala-impl/resources/META-INF/scala-plugin-common.xml @@ -93,7 +93,6 @@ - - @@ -1484,6 +1482,9 @@ + + diff --git a/scala/scala-impl/src/org/jetbrains/plugins/scala/actions/EnableHydraSettingsAction.scala b/scala/scala-impl/src/org/jetbrains/plugins/scala/actions/EnableHydraSettingsAction.scala new file mode 100644 index 00000000000..c2aa1e0969e --- /dev/null +++ b/scala/scala-impl/src/org/jetbrains/plugins/scala/actions/EnableHydraSettingsAction.scala @@ -0,0 +1,20 @@ +package org.jetbrains.plugins.scala.actions + +import com.intellij.openapi.actionSystem.{AnAction, AnActionEvent, CommonDataKeys} +import com.intellij.openapi.project.Project +import org.jetbrains.plugins.scala.compiler.HydraCompilerSettings + +/** + * @author Maris Alexandru + */ +class EnableHydraSettingsAction extends AnAction{ + def actionPerformed(e: AnActionEvent) { + CommonDataKeys.PROJECT.getData(e.getDataContext) match { + case project: Project => { + val settings = HydraCompilerSettings.getInstance(project) + settings.isHydraSettingsEnabled = !settings.isHydraSettingsEnabled + } + case _ => + } + } +} diff --git a/scala/scala-impl/src/org/jetbrains/plugins/scala/compiler/HydraCompilerConfigurable.scala b/scala/scala-impl/src/org/jetbrains/plugins/scala/compiler/HydraCompilerConfigurable.scala index a8fd52692e7..6e72f84d38d 100644 --- a/scala/scala-impl/src/org/jetbrains/plugins/scala/compiler/HydraCompilerConfigurable.scala +++ b/scala/scala-impl/src/org/jetbrains/plugins/scala/compiler/HydraCompilerConfigurable.scala @@ -10,7 +10,9 @@ import org.jetbrains.plugins.scala.settings.HydraApplicationSettings /** * @author Maris Alexandru */ -class HydraCompilerConfigurable (project: Project, settings: HydraCompilerSettings, hydraGlobalSettings: HydraApplicationSettings) extends AbstractConfigurable("Hydra Compiler"){ +class HydraCompilerConfigurable (project: Project) extends AbstractConfigurable("Hydra Compiler"){ + private val settings = HydraCompilerSettings.getInstance(project) + private val hydraGlobalSettings = HydraApplicationSettings.getInstance() private val form = new ScalaHydraCompilerConfigurationPanel(project, settings, hydraGlobalSettings) override def createComponent(): JPanel = form.getContentPanel diff --git a/scala/scala-impl/src/org/jetbrains/plugins/scala/compiler/HydraCompilerSettings.scala b/scala/scala-impl/src/org/jetbrains/plugins/scala/compiler/HydraCompilerSettings.scala index 64447732195..f2916b46282 100644 --- a/scala/scala-impl/src/org/jetbrains/plugins/scala/compiler/HydraCompilerSettings.scala +++ b/scala/scala-impl/src/org/jetbrains/plugins/scala/compiler/HydraCompilerSettings.scala @@ -21,6 +21,8 @@ class HydraCompilerSettings(project: Project) extends PersistentStateComponent[H var isHydraEnabled: Boolean = false + var isHydraSettingsEnabled: Boolean = false + var hydraVersion: String = "0.9.5" var noOfCores: String = Math.ceil(Runtime.getRuntime.availableProcessors()/2D).toInt.toString @@ -37,6 +39,7 @@ class HydraCompilerSettings(project: Project) extends PersistentStateComponent[H state.hydraStorePath = hydraStorePath state.sourcePartitioner = sourcePartitioner state.projectRoot = ProjectRoot + state.isHydraSettingsEnabled = isHydraSettingsEnabled state } @@ -46,6 +49,7 @@ class HydraCompilerSettings(project: Project) extends PersistentStateComponent[H noOfCores = state.noOfCores hydraStorePath = state.hydraStorePath sourcePartitioner = state.sourcePartitioner + isHydraSettingsEnabled = state.isHydraSettingsEnabled } def getDefaultHydraStorePath: String = ProjectRoot + File.separator + ".hydra" @@ -75,6 +79,9 @@ class HydraCompilerSettingsState { @BeanProperty var projectRoot: String = "" + + @BeanProperty + var isHydraSettingsEnabled: Boolean = false } object SourcePartitioner { diff --git a/scala/scala-impl/src/org/jetbrains/plugins/scala/project/settings/ScalaCompilerConfigurable.scala b/scala/scala-impl/src/org/jetbrains/plugins/scala/project/settings/ScalaCompilerConfigurable.scala index 9ad4356baf2..5a72bdfbd0b 100644 --- a/scala/scala-impl/src/org/jetbrains/plugins/scala/project/settings/ScalaCompilerConfigurable.scala +++ b/scala/scala-impl/src/org/jetbrains/plugins/scala/project/settings/ScalaCompilerConfigurable.scala @@ -6,13 +6,13 @@ import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer import com.intellij.compiler.server.BuildManager import com.intellij.openapi.project.Project import org.jetbrains.plugins.scala.project.AbstractConfigurable + import scala.collection.JavaConverters._ import scala.util.Random - import com.intellij.openapi.options.Configurable import com.intellij.openapi.options.Configurable.Composite import com.intellij.openapi.util.registry.Registry -import org.jetbrains.plugins.scala.compiler.{ScalaCompileServerForm, ScalaCompileServerSettings} +import org.jetbrains.plugins.scala.compiler.{HydraCompilerConfigurable, HydraCompilerSettings, ScalaCompileServerForm, ScalaCompileServerSettings} /** * @author Pavel Fatin @@ -42,5 +42,10 @@ class ScalaCompilerConfigurable(project: Project, configuration: ScalaCompilerCo BuildManager.getInstance().clearState(project) } - override def getConfigurables(): Array[Configurable] = Array() -} + override def getConfigurables(): Array[Configurable] = { + if (HydraCompilerSettings.getInstance(project).isHydraSettingsEnabled) + Array(new HydraCompilerConfigurable(project)) + else + Array() + } +} \ No newline at end of file