src/Tools/jEdit/src/jedit_options.scala
changeset 73337 0af9e7e4476f
parent 71601 97ccf48c2f0c
child 73340 0ffcad1f6130
equal deleted inserted replaced
73336:ff7ce802be52 73337:0af9e7e4476f
    63     val button = new ColorWellButton(Color_Value(opt.value))
    63     val button = new ColorWellButton(Color_Value(opt.value))
    64     val component = new Component with Option_Component {
    64     val component = new Component with Option_Component {
    65       override lazy val peer = button
    65       override lazy val peer = button
    66       name = opt_name
    66       name = opt_name
    67       val title = opt_title
    67       val title = opt_title
    68       def load = button.setSelectedColor(Color_Value(string(opt_name)))
    68       def load(): Unit = button.setSelectedColor(Color_Value(string(opt_name)))
    69       def save = string(opt_name) = Color_Value.print(button.getSelectedColor)
    69       def save(): Unit = string(opt_name) = Color_Value.print(button.getSelectedColor)
    70     }
    70     }
    71     component.tooltip = GUI.tooltip_lines(opt.print_default)
    71     component.tooltip = GUI.tooltip_lines(opt.print_default)
    72     component
    72     component
    73   }
    73   }
    74 
    74 
    82     val component =
    82     val component =
    83       if (opt.typ == Options.Bool)
    83       if (opt.typ == Options.Bool)
    84         new CheckBox with Option_Component {
    84         new CheckBox with Option_Component {
    85           name = opt_name
    85           name = opt_name
    86           val title = opt_title
    86           val title = opt_title
    87           def load = selected = bool(opt_name)
    87           def load(): Unit = selected = bool(opt_name)
    88           def save = bool(opt_name) = selected
    88           def save(): Unit = bool(opt_name) = selected
    89         }
    89         }
    90       else {
    90       else {
    91         val default_font = GUI.copy_font(UIManager.getFont("TextField.font"))
    91         val default_font = GUI.copy_font(UIManager.getFont("TextField.font"))
    92         val text_area =
    92         val text_area =
    93           new TextArea with Option_Component {
    93           new TextArea with Option_Component {
    94             if (default_font != null) font = default_font
    94             if (default_font != null) font = default_font
    95             name = opt_name
    95             name = opt_name
    96             val title = opt_title
    96             val title = opt_title
    97             def load = text = value.check_name(opt_name).value
    97             def load(): Unit = text = value.check_name(opt_name).value
    98             def save =
    98             def save(): Unit =
    99               try { JEdit_Options.this += (opt_name, text) }
    99               try { JEdit_Options.this += (opt_name, text) }
   100               catch {
   100               catch {
   101                 case ERROR(msg) =>
   101                 case ERROR(msg) =>
   102                   GUI.error_dialog(this.peer, "Failed to update options",
   102                   GUI.error_dialog(this.peer, "Failed to update options",
   103                     GUI.scrollable_text(msg))
   103                     GUI.scrollable_text(msg))