src/Tools/jEdit/src/plugin.scala
changeset 44606 b625650aa2db
parent 44580 3bc9a215a56d
child 44609 6ec4a5eb2fc0
     1.1 --- a/src/Tools/jEdit/src/plugin.scala	Tue Aug 30 18:12:48 2011 +0200
     1.2 +++ b/src/Tools/jEdit/src/plugin.scala	Wed Aug 31 14:39:41 2011 +0200
     1.3 @@ -14,7 +14,7 @@
     1.4  import javax.swing.JOptionPane
     1.5  
     1.6  import scala.collection.mutable
     1.7 -import scala.swing.ComboBox
     1.8 +import scala.swing.{ComboBox, ListView, ScrollPane}
     1.9  import scala.util.Sorting
    1.10  
    1.11  import org.gjt.sp.jedit.{jEdit, GUIUtilities, EBMessage, EBPlugin,
    1.12 @@ -367,20 +367,23 @@
    1.13            yield (model.master_dir, model.thy_name)
    1.14        val files = thy_info.dependencies(thys).map(_._1).filterNot(loaded_buffer _)
    1.15  
    1.16 -      val do_load = !files.isEmpty &&
    1.17 -        {
    1.18 -          val files_sorted = { val a = files.toArray; Sorting.quickSort(a); a.toList }
    1.19 -          val files_text = new scala.swing.TextArea(files_sorted.mkString("\n"))
    1.20 -          files_text.editable = false
    1.21 +      if (!files.isEmpty) {
    1.22 +        val files_sorted = { val a = files.toArray; Sorting.quickSort(a); a.toList }
    1.23 +        val files_list = new ListView(files_sorted)
    1.24 +        for (i <- 0 until files_sorted.length)
    1.25 +          files_list.selection.indices += i
    1.26 +
    1.27 +        val answer =
    1.28            Library.confirm_dialog(jEdit.getActiveView(),
    1.29              "Auto loading of required files",
    1.30              JOptionPane.YES_NO_OPTION,
    1.31 -            "The following files are required to resolve theory imports.  Reload now?",
    1.32 -            files_text) == 0
    1.33 -        }
    1.34 -      if (do_load)
    1.35 -        for (file <- files if !loaded_buffer(file))
    1.36 -          jEdit.openFile(null: View, file)
    1.37 +            "The following files are required to resolve theory imports.",
    1.38 +            "Reload selected files now?",
    1.39 +            new ScrollPane(files_list))
    1.40 +        if (answer == 0)
    1.41 +          files_list.selection.items foreach (file =>
    1.42 +            if (!loaded_buffer(file)) jEdit.openFile(null: View, file))
    1.43 +      }
    1.44      }
    1.45  
    1.46