Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Better handling of presentation compiler settings. Honors most settin…

…gs now, including compiler plugins. Fixed #1000367.
  • Loading branch information...
commit e936bf421dcf144ef9b4c9bfec2ee5ee4716af6c 1 parent c742b82
@dragos dragos authored
View
21 org.scala-ide.sdt.core/src/scala/tools/eclipse/ScalaProject.scala
@@ -45,7 +45,7 @@ class ScalaProject(val underlying: IProject) {
try {
val settings = new Settings
settings.printtypes.tryToSet(Nil)
- initialize(settings, _.name.startsWith("-Ypresentation"))
+ initialize(settings, isPCSetting(settings))
Some(new ScalaPresentationCompiler(ScalaProject.this, settings))
} catch {
case ex @ MissingRequirementError(required) =>
@@ -66,6 +66,25 @@ class ScalaProject(val underlying: IProject) {
}
}
+ /** Compiler settings that are honored by the presentation compiler. */
+ private def isPCSetting(settings: Settings): Set[Settings#Setting] = {
+ import settings.{ plugin => pluginSetting, _ }
+ Set(deprecation,
+ unchecked,
+ pluginOptions,
+ verbose,
+ Xexperimental,
+ future,
+ Xmigration28,
+ pluginSetting,
+ pluginsDir,
+ YpresentationDebug,
+ YpresentationVerbose,
+ YpresentationLog,
+ YpresentationReplay,
+ YpresentationDelay)
+ }
+
private var messageShowed = false
private def failedCompilerInitialization(msg: String) {
View
61 org.scala-ide.sdt.core/src/scala/tools/eclipse/properties/EclipseSettings.scala
@@ -21,14 +21,18 @@ trait EclipseSettings {
case setting : Settings#StringSetting =>
setting.name match {
case "-Ypresentation-log" | "-Ypresentation-replay" =>
- println("setting a file setting")
+ println("file setting for " + setting.name)
new FileSetting(setting)
case _ =>
println("plain old string setting " + setting.name)
new StringSetting(setting)
}
// case setting : Settings#PhasesSetting => new StringSetting(setting) // !!!
- case setting : Settings#MultiStringSetting => new MultiStringSetting(setting)
+ case setting : Settings#MultiStringSetting =>
+ setting.name match {
+ case "-Xplugin" => new MultiFileSetting(setting)
+ case _ => new MultiStringSetting(setting)
+ }
case setting : Settings#ChoiceSetting => new ComboSetting(setting)
}
@@ -215,23 +219,50 @@ trait EclipseSettings {
layout.widthHint = 200
}
control.setLayoutData(layout)
+ control.setMessage("Path is relative to the workspace")
control.addModifyListener(ModifyListenerSing)
}
- def fileName() = {
- import scala.tools.eclipse.ScalaPlugin
- import java.io.File
-
- val text = control.getText
- if (text.nonEmpty && !text.startsWith(File.separator)) {
- val workspacePath = ScalaPlugin.plugin.workspaceRoot.getLocation
- workspacePath + java.io.File.separator + text
- } else text
- }
-
- def isChanged = setting.value != fileName()
+ def isChanged = setting.value != fileName(control.getText)
def reset() { control.setText(setting.default) }
- def apply() { setting.value = fileName() }
+ def apply() { setting.value = fileName(control.getText) }
+ }
+
+
+
+ class MultiFileSetting(setting: Settings#MultiStringSetting) extends EclipseSetting(setting) {
+ var control : Text = _
+ def createControl(page : Composite) {
+ control = new Text(page, SWT.SINGLE | SWT.BORDER)
+ control.setText(setting.value.mkString(", "))
+ var layout = data
+ if (setting.value.isEmpty) {
+ layout = new GridData()
+ layout.widthHint = 200
+ }
+ control.setLayoutData(layout)
+ control.setMessage("Path is relative to the workspace")
+ control.addModifyListener(ModifyListenerSing)
+ }
+
+ def fileNames() = {
+ control.getText().split(',').map(f => fileName(f.trim)).toList
+ }
+
+ override def isChanged = setting.value != fileNames()
+ override def reset() { control.setText("") }
+ override def apply() { setting.value = fileNames() }
+ }
+
+ def fileName(text: String) = {
+ import scala.tools.eclipse.ScalaPlugin
+ import java.io.File
+
+ if (text.nonEmpty && !text.startsWith(File.separator)) {
+ val workspacePath = ScalaPlugin.plugin.workspaceRoot.getLocation
+ workspacePath + java.io.File.separator + text
+ } else text
}
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.