equal
deleted
inserted
replaced
31 loaded_theories: Set[String], |
31 loaded_theories: Set[String], |
32 known_theories: Map[String, Document.Node.Name], |
32 known_theories: Map[String, Document.Node.Name], |
33 base_syntax: Outer_Syntax) |
33 base_syntax: Outer_Syntax) |
34 extends Resources(loaded_theories, known_theories, base_syntax) |
34 extends Resources(loaded_theories, known_theories, base_syntax) |
35 { |
35 { |
36 /* document node names */ |
36 /* document node name */ |
37 |
37 |
38 def node_name(buffer: Buffer): Document.Node.Name = |
38 def node_name(buffer: Buffer): Document.Node.Name = |
39 { |
39 { |
40 val node = JEdit_Lib.buffer_name(buffer) |
40 val node = JEdit_Lib.buffer_name(buffer) |
41 val theory = Thy_Header.thy_name_bootstrap(node).getOrElse("") |
41 val theory = Thy_Header.thy_name_bootstrap(node).getOrElse("") |
47 { |
47 { |
48 val name = node_name(buffer) |
48 val name = node_name(buffer) |
49 if (name.is_theory) Some(name) else None |
49 if (name.is_theory) Some(name) else None |
50 } |
50 } |
51 |
51 |
52 |
|
53 /* file-system operations */ |
|
54 |
|
55 override def append(dir: String, source_path: Path): String = |
52 override def append(dir: String, source_path: Path): String = |
56 { |
53 { |
57 val path = source_path.expand |
54 val path = source_path.expand |
58 if (dir == "" || path.is_absolute) |
55 if (dir == "" || path.is_absolute) |
59 MiscUtilities.resolveSymlinks(File.platform_path(path)) |
56 MiscUtilities.resolveSymlinks(File.platform_path(path)) |
64 MiscUtilities.resolveSymlinks( |
61 MiscUtilities.resolveSymlinks( |
65 vfs.constructPath(dir, File.platform_path(path))) |
62 vfs.constructPath(dir, File.platform_path(path))) |
66 else vfs.constructPath(dir, File.standard_path(path)) |
63 else vfs.constructPath(dir, File.standard_path(path)) |
67 } |
64 } |
68 } |
65 } |
|
66 |
|
67 |
|
68 /* file content */ |
69 |
69 |
70 override def with_thy_reader[A](name: Document.Node.Name, f: Reader[Char] => A): A = |
70 override def with_thy_reader[A](name: Document.Node.Name, f: Reader[Char] => A): A = |
71 { |
71 { |
72 GUI_Thread.now { |
72 GUI_Thread.now { |
73 JEdit_Lib.jedit_buffer(name) match { |
73 JEdit_Lib.jedit_buffer(name) match { |
83 else error("No such file: " + quote(file.toString)) |
83 else error("No such file: " + quote(file.toString)) |
84 } |
84 } |
85 } |
85 } |
86 } |
86 } |
87 |
87 |
88 |
|
89 /* file content */ |
|
90 |
88 |
91 private class File_Content_Output(buffer: Buffer) extends |
89 private class File_Content_Output(buffer: Buffer) extends |
92 ByteArrayOutputStream(buffer.getLength + 1) |
90 ByteArrayOutputStream(buffer.getLength + 1) |
93 { |
91 { |
94 def content(): Bytes = Bytes(this.buf, 0, this.count) |
92 def content(): Bytes = Bytes(this.buf, 0, this.count) |