exitAction is moved to DebugGui

This commit is contained in:
igor%mir2.org 2004-05-27 10:34:44 +00:00
Родитель cd63019db8
Коммит 7fe01ad6bc
2 изменённых файлов: 12 добавлений и 18 удалений

Просмотреть файл

@ -1918,6 +1918,7 @@ class LoadFile implements Runnable
class DebugGui extends JFrame implements GuiCallback
{
Main main;
Runnable exitAction;
JDesktopPane desk;
ContextWindow context;
Menubar menubar;
@ -2081,11 +2082,19 @@ class DebugGui extends JFrame implements GuiCallback
dlg.addChoosableFileFilter(filter);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
main.Exit();
exit();
}
});
}
void exit()
{
if (exitAction != null) {
SwingUtilities.invokeLater(exitAction);
}
main.setReturnValue(Main.EXIT);
}
FileWindow getFileWindow(String url) {
if (url == null || url.equals("<stdin>")) {
return null;
@ -2407,7 +2416,7 @@ class DebugGui extends JFrame implements GuiCallback
} else if (cmd.equals("Break")) {
main.doBreak();
} else if (cmd.equals("Exit")) {
main.Exit();
exit();
} else if (cmd.equals("Open")) {
String fileName = chooseFile("Select a file to compile");
if (fileName != null) {

Просмотреть файл

@ -399,7 +399,6 @@ public class Main {
boolean breakFlag = false;
ScopeProvider scopeProvider;
Runnable exitAction;
int frameIndex = -1;
@ -731,11 +730,6 @@ public class Main {
}
}
static void swingInvokeLater(Runnable f)
{
SwingUtilities.invokeLater(f);
}
void contextSwitch (int frameIndex) {
this.frameIndex = frameIndex;
}
@ -1043,15 +1037,6 @@ public class Main {
return resultString;
}
void Exit() {
// stop handling events
this.returnValue = EXIT;
// call the exit handler if any
if (exitAction != null) {
swingInvokeLater(exitAction);
}
}
private static java.awt.EventQueue awtEventQueue = null;
private static void dispatchNextAwtEvent()
@ -1149,7 +1134,7 @@ public class Main {
* selects "Exit..." or closes the Debugger main window
*/
public void setExitAction(Runnable r) {
exitAction = r;
debugGui.exitAction = r;
}
/**