]> gitweb.factorcode.org Git - factor.git/commitdiff
updates for console plugin
authorSlava Pestov <slava@factorcode.org>
Tue, 16 Nov 2004 03:47:19 +0000 (03:47 +0000)
committerSlava Pestov <slava@factorcode.org>
Tue, 16 Nov 2004 03:47:19 +0000 (03:47 +0000)
factor/jedit/FactorShell.java
library/tools/debugger.factor

index 1968ba18f06d030aa95d5e8071186381a14c9e28..4a22ed9a204508ff04a2331de4b69fcb76b2a138 100644 (file)
@@ -34,7 +34,7 @@ import factor.*;
 import javax.swing.text.AttributeSet;
 import java.io.IOException;
 import java.util.Iterator;
-import java.util.WeakHashMap;
+import java.util.HashMap;
 import org.gjt.sp.jedit.jEdit;
 import org.gjt.sp.jedit.ServiceManager;
 import org.gjt.sp.util.Log;
@@ -45,7 +45,19 @@ public class FactorShell extends Shell
        public FactorShell()
        {
                super("Factor");
-               consoles = new WeakHashMap();
+               consoles = new HashMap();
+       } //}}}
+
+       //{{{ closeConsole() method
+       /**
+        * Called when a Console dockable is closed.
+        * @since Console 4.0.2
+        */
+       public void closeConsole(Console console)
+       {
+               ConsoleState state = (ConsoleState)consoles.get(console);
+               if(state != null)
+                       state.closeStream();
        } //}}}
 
        //{{{ printInfoMessage() method
@@ -129,7 +141,7 @@ public class FactorShell extends Shell
        } //}}}
 
        //{{{ Private members
-       private WeakHashMap consoles;
+       private HashMap consoles;
        
        //{{{ getConsoleState() method
        private ConsoleState getConsoleState(Console console)
@@ -178,7 +190,6 @@ public class FactorShell extends Shell
                                        console.print(console.getInfoColor(),
                                                jEdit.getProperty("factor.shell.closing"));
                                        stream.close();
-                                       stream = null;
                                }
                        }
                        catch(IOException e)
@@ -186,6 +197,8 @@ public class FactorShell extends Shell
                                /* We don't care */
                                Log.log(Log.ERROR,this,e);
                        }
+
+                       stream = null;
                }
                
                void packetLoop(Output output) throws Exception
index 3b5eda2a92df2741a890d60420b63c0e11803813..46ad510af757e2b39775dce154b19e2b131cedbc 100644 (file)
@@ -59,19 +59,20 @@ USE: unparser
     #! The game overrides this.
     ;
 
+: :s ( -- ) "error-datastack"  get {.} ;
+: :r ( -- ) "error-callstack"  get {.} ;
+: :n ( -- ) "error-namestack"  get {.} ;
+: :c ( -- ) "error-catchstack" get {.} ;
+
 : default-error-handler ( error -- )
     #! Print the error and return to the top level.
     [
         in-parser? [ parse-dump ] [ standard-dump ] ifte
 
-        ":s :r :n :c show stacks at time of error." print
+        [ :s :r :n :c ] [ prettyprint-word " " write ] each
+        "show stacks at time of error." print
 
         java? [ ":j shows Java stack trace." print ] when
         error-handler-hook
 
     ] when* ;
-
-: :s ( -- ) "error-datastack"  get {.} ;
-: :r ( -- ) "error-callstack"  get {.} ;
-: :n ( -- ) "error-namestack"  get {.} ;
-: :c ( -- ) "error-catchstack" get {.} ;