src/Tools/jEdit/src/plugin.scala
changeset 44963 4662dddc2fd8
parent 44955 9adaf5cd4f1c
child 45055 55274f7e306b
     1.1 --- a/src/Tools/jEdit/src/plugin.scala	Sun Sep 18 13:39:33 2011 +0200
     1.2 +++ b/src/Tools/jEdit/src/plugin.scala	Sun Sep 18 13:47:12 2011 +0200
     1.3 @@ -366,6 +366,8 @@
     1.4    private lazy val delay_load =
     1.5      Swing_Thread.delay_last(Isabelle.session.load_delay)
     1.6      {
     1.7 +      val view = jEdit.getActiveView()
     1.8 +
     1.9        val buffers = Isabelle.jedit_buffers().toList
    1.10        def loaded_buffer(name: String): Boolean =
    1.11          buffers.exists(buffer => Isabelle.buffer_name(buffer) == name)
    1.12 @@ -373,7 +375,8 @@
    1.13        val thys =
    1.14          for (buffer <- buffers; model <- Isabelle.document_model(buffer))
    1.15            yield model.name
    1.16 -      val files = Isabelle.thy_info.dependencies(thys).map(_._1.node).filterNot(loaded_buffer _)
    1.17 +      val files = Isabelle.thy_info.dependencies(thys).map(_._1.node).
    1.18 +        filter(file => !loaded_buffer(file) && Isabelle.thy_load.check_file(view, file))
    1.19  
    1.20        if (!files.isEmpty) {
    1.21          val files_list = new ListView(Library.sort_strings(files))
    1.22 @@ -381,7 +384,7 @@
    1.23            files_list.selection.indices += i
    1.24  
    1.25          val answer =
    1.26 -          Library.confirm_dialog(jEdit.getActiveView(),
    1.27 +          Library.confirm_dialog(view,
    1.28              "Auto loading of required files",
    1.29              JOptionPane.YES_NO_OPTION,
    1.30              "The following files are required to resolve theory imports.",
    1.31 @@ -390,7 +393,7 @@
    1.32          if (answer == 0)
    1.33            for {
    1.34              file <- files
    1.35 -            if !loaded_buffer(file) && files_list.selection.items.contains(file)
    1.36 +            if files_list.selection.items.contains(file)
    1.37            } jEdit.openFile(null: View, file)
    1.38        }
    1.39      }