src/Tools/jEdit/src/jedit_options.scala
changeset 49247 ffd9ad9dc35b
parent 49246 248e66e8321f
child 49248 bff772033a97
equal deleted inserted replaced
49246:248e66e8321f 49247:ffd9ad9dc35b
    15 
    15 
    16 
    16 
    17 trait Option_Component extends Component
    17 trait Option_Component extends Component
    18 {
    18 {
    19   val title: String
    19   val title: String
       
    20   def load(): Unit
    20   def save(): Unit
    21   def save(): Unit
    21 }
    22 }
    22 
    23 
    23 class JEdit_Options extends Options_Variable
    24 class JEdit_Options extends Options_Variable
    24 {
    25 {
    33 
    34 
    34     val component =
    35     val component =
    35       if (opt.typ == Options.Bool)
    36       if (opt.typ == Options.Bool)
    36         new CheckBox with Option_Component {
    37         new CheckBox with Option_Component {
    37           val title = opt_title
    38           val title = opt_title
       
    39           def load = selected = bool(opt_name)
    38           def save = bool(opt_name) = selected
    40           def save = bool(opt_name) = selected
    39           selected = bool(opt_name)
       
    40         }
    41         }
    41       else {
    42       else {
    42         val text_area =
    43         val text_area =
    43           new TextArea with Option_Component {
    44           new TextArea with Option_Component {
    44             val title = opt_title
    45             val title = opt_title
       
    46             def load = text = value.check_name(opt_name).value
    45             def save = update(value + (opt_name, text))
    47             def save = update(value + (opt_name, text))
    46             text = opt.value
       
    47           }
    48           }
    48         text_area.peer.setInputVerifier(new InputVerifier {
    49         text_area.peer.setInputVerifier(new InputVerifier {
    49           def verify(jcomponent: JComponent): Boolean =
    50           def verify(jcomponent: JComponent): Boolean =
    50             jcomponent match {
    51             jcomponent match {
    51               case text: JTextComponent =>
    52               case text: JTextComponent =>
    54               case _ => true
    55               case _ => true
    55             }
    56             }
    56           })
    57           })
    57         text_area
    58         text_area
    58       }
    59       }
    59     component.tooltip = opt.description
    60     component.load()
       
    61     component.tooltip = opt.print
    60     component
    62     component
    61   }
    63   }
    62 }
    64 }
    63 
    65