updates for console plugin

cvs
Slava Pestov 2004-11-16 03:47:19 +00:00
parent 666d945966
commit d9f39dbe2e
2 changed files with 24 additions and 10 deletions

View File

@ -34,7 +34,7 @@ import factor.*;
import javax.swing.text.AttributeSet; import javax.swing.text.AttributeSet;
import java.io.IOException; import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import java.util.WeakHashMap; import java.util.HashMap;
import org.gjt.sp.jedit.jEdit; import org.gjt.sp.jedit.jEdit;
import org.gjt.sp.jedit.ServiceManager; import org.gjt.sp.jedit.ServiceManager;
import org.gjt.sp.util.Log; import org.gjt.sp.util.Log;
@ -45,7 +45,19 @@ public class FactorShell extends Shell
public FactorShell() public FactorShell()
{ {
super("Factor"); 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 //{{{ printInfoMessage() method
@ -129,7 +141,7 @@ public class FactorShell extends Shell
} //}}} } //}}}
//{{{ Private members //{{{ Private members
private WeakHashMap consoles; private HashMap consoles;
//{{{ getConsoleState() method //{{{ getConsoleState() method
private ConsoleState getConsoleState(Console console) private ConsoleState getConsoleState(Console console)
@ -178,7 +190,6 @@ public class FactorShell extends Shell
console.print(console.getInfoColor(), console.print(console.getInfoColor(),
jEdit.getProperty("factor.shell.closing")); jEdit.getProperty("factor.shell.closing"));
stream.close(); stream.close();
stream = null;
} }
} }
catch(IOException e) catch(IOException e)
@ -186,6 +197,8 @@ public class FactorShell extends Shell
/* We don't care */ /* We don't care */
Log.log(Log.ERROR,this,e); Log.log(Log.ERROR,this,e);
} }
stream = null;
} }
void packetLoop(Output output) throws Exception void packetLoop(Output output) throws Exception

View File

@ -59,19 +59,20 @@ USE: unparser
#! The game overrides this. #! The game overrides this.
; ;
: :s ( -- ) "error-datastack" get {.} ;
: :r ( -- ) "error-callstack" get {.} ;
: :n ( -- ) "error-namestack" get {.} ;
: :c ( -- ) "error-catchstack" get {.} ;
: default-error-handler ( error -- ) : default-error-handler ( error -- )
#! Print the error and return to the top level. #! Print the error and return to the top level.
[ [
in-parser? [ parse-dump ] [ standard-dump ] ifte 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 java? [ ":j shows Java stack trace." print ] when
error-handler-hook error-handler-hook
] when* ; ] when* ;
: :s ( -- ) "error-datastack" get {.} ;
: :r ( -- ) "error-callstack" get {.} ;
: :n ( -- ) "error-namestack" get {.} ;
: :c ( -- ) "error-catchstack" get {.} ;