@@ -21,14 +21,18 @@ trait EclipseSettings {
21
case setting : Settings # StringSetting =>
21
case setting : Settings # StringSetting =>
22
setting.name match {
22
setting.name match {
23
case " -Ypresentation-log" | " -Ypresentation-replay" =>
23
case " -Ypresentation-log" | " -Ypresentation-replay" =>
24
- println(" setting a file setting" )
24
+ println(" file setting for " + setting.name )
25
new FileSetting (setting)
25
new FileSetting (setting)
26
case _ =>
26
case _ =>
27
println(" plain old string setting " + setting.name)
27
println(" plain old string setting " + setting.name)
28
new StringSetting (setting)
28
new StringSetting (setting)
29
}
29
}
30
// case setting : Settings#PhasesSetting => new StringSetting(setting) // !!!
30
// case setting : Settings#PhasesSetting => new StringSetting(setting) // !!!
31
- case setting : Settings # MultiStringSetting => new MultiStringSetting (setting)
31
+ case setting : Settings # MultiStringSetting =>
32
+ setting.name match {
33
+ case " -Xplugin" => new MultiFileSetting (setting)
34
+ case _ => new MultiStringSetting (setting)
35
+ }
32
case setting : Settings # ChoiceSetting => new ComboSetting (setting)
36
case setting : Settings # ChoiceSetting => new ComboSetting (setting)
33
}
37
}
34
38
@@ -215,23 +219,50 @@ trait EclipseSettings {
215
layout.widthHint = 200
219
layout.widthHint = 200
216
}
220
}
217
control.setLayoutData(layout)
221
control.setLayoutData(layout)
222
+ control.setMessage(" Path is relative to the workspace" )
218
control.addModifyListener(ModifyListenerSing )
223
control.addModifyListener(ModifyListenerSing )
219
}
224
}
220
225
221
- def fileName () = {
226
+ def isChanged = setting.value != fileName(control.getText)
222
- import scala .tools .eclipse .ScalaPlugin
223
- import java .io .File
224
-
225
- val text = control.getText
226
- if (text.nonEmpty && ! text.startsWith(File .separator)) {
227
- val workspacePath = ScalaPlugin .plugin.workspaceRoot.getLocation
228
- workspacePath + java.io.File .separator + text
229
- } else text
230
- }
231
-
232
- def isChanged = setting.value != fileName()
233
def reset () { control.setText(setting.default) }
227
def reset () { control.setText(setting.default) }
234
- def apply () { setting.value = fileName() }
228
+ def apply () { setting.value = fileName(control.getText) }
229
+ }
230
+
231
+
232
+
233
+ class MultiFileSetting (setting : Settings # MultiStringSetting ) extends EclipseSetting (setting) {
234
+ var control : Text = _
235
+ def createControl (page : Composite ) {
236
+ control = new Text (page, SWT .SINGLE | SWT .BORDER )
237
+ control.setText(setting.value.mkString(" , " ))
238
+ var layout = data
239
+ if (setting.value.isEmpty) {
240
+ layout = new GridData ()
241
+ layout.widthHint = 200
242
+ }
243
+ control.setLayoutData(layout)
244
+ control.setMessage(" Path is relative to the workspace" )
245
+ control.addModifyListener(ModifyListenerSing )
246
+ }
247
+
248
+ def fileNames () = {
249
+ control.getText().split(',' ).map(f => fileName(f.trim)).toList
250
+ }
251
+
252
+ override def isChanged = setting.value != fileNames()
253
+ override def reset () { control.setText(" " ) }
254
+ override def apply () { setting.value = fileNames() }
255
+ }
256
+
257
+ def fileName (text : String ) = {
258
+ import scala .tools .eclipse .ScalaPlugin
259
+ import java .io .File
260
+
261
+ if (text.nonEmpty && ! text.startsWith(File .separator)) {
262
+ val workspacePath = ScalaPlugin .plugin.workspaceRoot.getLocation
263
+ workspacePath + java.io.File .separator + text
264
+ } else text
235
}
265
}
236
266
267
+
237
}
268
}
0 commit comments