--- a/src/Tools/jEdit/src/plugin.scala Sat Jun 18 17:32:13 2011 +0200
+++ b/src/Tools/jEdit/src/plugin.scala Sat Jun 18 17:33:27 2011 +0200
@@ -19,9 +19,11 @@
Buffer, EditPane, ServiceManager, View}
import org.gjt.sp.jedit.buffer.JEditBuffer
import org.gjt.sp.jedit.textarea.{JEditTextArea, TextArea}
+import org.gjt.sp.jedit.syntax.{Token => JEditToken}
import org.gjt.sp.jedit.msg.{EditorStarted, BufferUpdate, EditPaneUpdate, PropertiesChanged}
import org.gjt.sp.jedit.gui.DockableWindowManager
+import org.gjt.sp.util.SyntaxUtilities
import org.gjt.sp.util.Log
import scala.actors.Actor
@@ -32,10 +34,16 @@
{
/* plugin instance */
+ var plugin: Plugin = null
var system: Isabelle_System = null
var session: Session = null
+ /* extended syntax styles */
+
+ def extended_styles: Boolean = plugin != null && plugin._extended_styles
+
+
/* properties */
val OPTION_PREFIX = "options.isabelle."
@@ -256,6 +264,19 @@
class Plugin extends EBPlugin
{
+ /* extended syntax styles */
+
+ @volatile var _extended_styles: Boolean = false
+
+ private def check_extended_styles()
+ {
+ val family = jEdit.getProperty("view.font")
+ val size = jEdit.getIntegerProperty("view.fontsize", 12)
+ val styles = SyntaxUtilities.loadStyles(family, size)
+ _extended_styles = (styles.length == JEditToken.ID_COUNT * 3 + 1)
+ }
+
+
/* session management */
private def init_model(buffer: Buffer)
@@ -346,6 +367,7 @@
message match {
case msg: EditorStarted =>
Isabelle.check_jvm()
+ check_extended_styles()
if (Isabelle.Boolean_Property("auto-start")) Isabelle.start_session()
case msg: BufferUpdate
@@ -382,6 +404,7 @@
override def start()
{
+ Isabelle.plugin = this
Isabelle.setup_tooltips()
Isabelle.system = new Isabelle_System
Isabelle.system.install_fonts()