Closed pmlopes closed 13 years ago
The quit menu does not work, i looked at the code and made a simple patch, please review and merge if you like it:
diff --git a/resource/xml/JMongoBrowser.xml b/resource/xml/JMongoBrowser.xml index ee7abba..ae1a08c 100644 --- a/resource/xml/JMongoBrowser.xml +++ b/resource/xml/JMongoBrowser.xml @@ -621,7 +621,7 @@ </org.mongo.jmongob.ConnectDialog> </MenuItem> <MenuSeparator/> - <MenuItem id="exit" label="Quit" alt="q" key="q" keyMod="cmd"/> + <MenuItem id="exit" label="Quit" alt="q" key="q" keyMod="cmd" call="exit" /> </Menu> <Menu id="tools" alt="o"> <MenuItem id="importFile" alt="i" call="importFile"/> diff --git a/src/org/mongo/jmongob/MainMenu.java b/src/org/mongo/jmongob/MainMenu.java index 70f8e03..22912d0 100644 --- a/src/org/mongo/jmongob/MainMenu.java +++ b/src/org/mongo/jmongob/MainMenu.java @@ -4,6 +4,7 @@ */ package org.mongo.jmongob; +import com.edgytech.swingfast.ConfirmDialog; import com.edgytech.swingfast.EnumListener; import com.edgytech.swingfast.InfoDialog; import com.edgytech.swingfast.MenuBar; @@ -27,7 +28,7 @@ import org.mongo.jmongob.MainMenu.Item; public class MainMenu extends MenuBar implements EnumListener<Item> { public enum Item { - + exit, connect, preferences, prefDialog, @@ -120,4 +121,16 @@ public class MainMenu extends MenuBar implements EnumListener<Item> { JMongoBrowser.instance.showError(id, ex); } } + + public void exit() { + if(!JMongoBrowser.instance.getTree().hasChildren()) { + System.exit(0); + } else { + String text = "You have open connections, are you sure you want to exit?"; + ConfirmDialog confirm = new ConfirmDialog(null, "Confirm Exit", null, text); + if (confirm.show()) { + System.exit(0); + } + } + } }
thanks for the report, will work in next version. It checks there is no job running
The quit menu does not work, i looked at the code and made a simple patch, please review and merge if you like it: