Isabelle.load_icon with some sanity checks;
authorwenzelm
Thu, 09 Sep 2010 21:30:33 +0200
changeset 39241 e9a442606db3
parent 39240 a0c0698e56c0
child 39242 28d3809ff91f
Isabelle.load_icon with some sanity checks;
src/Tools/jEdit/src/jedit/isabelle_markup.scala
src/Tools/jEdit/src/jedit/plugin.scala
--- a/src/Tools/jEdit/src/jedit/isabelle_markup.scala	Thu Sep 09 20:09:13 2010 +0200
+++ b/src/Tools/jEdit/src/jedit/isabelle_markup.scala	Thu Sep 09 21:30:33 2010 +0200
@@ -11,7 +11,6 @@
 
 import java.awt.Color
 
-import org.gjt.sp.jedit.GUIUtilities
 import org.gjt.sp.jedit.syntax.Token
 
 
@@ -31,8 +30,8 @@
   {
     def >= (that: Icon): Boolean = this.priority >= that.priority
   }
-  val warning_icon = new Icon(1, GUIUtilities.loadIcon("16x16/status/dialog-warning.png"))
-  val error_icon = new Icon(2, GUIUtilities.loadIcon("16x16/status/dialog-error.png"))
+  val warning_icon = new Icon(1, Isabelle.load_icon("16x16/status/dialog-warning.png"))
+  val error_icon = new Icon(2, Isabelle.load_icon("16x16/status/dialog-error.png"))
 
 
   /* command status */
--- a/src/Tools/jEdit/src/jedit/plugin.scala	Thu Sep 09 20:09:13 2010 +0200
+++ b/src/Tools/jEdit/src/jedit/plugin.scala	Thu Sep 09 21:30:33 2010 +0200
@@ -15,12 +15,15 @@
 
 import scala.collection.mutable
 
-import org.gjt.sp.jedit.{jEdit, EBMessage, EBPlugin, Buffer, EditPane, ServiceManager, View}
+import org.gjt.sp.jedit.{jEdit, GUIUtilities, EBMessage, EBPlugin,
+  Buffer, EditPane, ServiceManager, View}
 import org.gjt.sp.jedit.buffer.JEditBuffer
 import org.gjt.sp.jedit.textarea.{JEditTextArea, TextArea}
 import org.gjt.sp.jedit.msg.{BufferUpdate, EditPaneUpdate, PropertiesChanged}
 import org.gjt.sp.jedit.gui.DockableWindowManager
 
+import org.gjt.sp.util.Log
+
 
 object Isabelle
 {
@@ -106,6 +109,17 @@
   }
 
 
+  /* icons */
+
+  def load_icon(name: String): javax.swing.Icon =
+  {
+    val icon = GUIUtilities.loadIcon(name)
+    if (icon.getIconWidth < 0 || icon.getIconHeight < 0)
+      Log.log(Log.ERROR, icon, "Bad icon: " + name);
+    icon
+  }
+
+
   /* settings */
 
   def default_logic(): String =