diff --git a/extra/jheidi/mainToolbarEvents.ajl b/extra/jheidi/mainToolbarEvents.ajl index ec306970..51997047 100644 --- a/extra/jheidi/mainToolbarEvents.ajl +++ b/extra/jheidi/mainToolbarEvents.ajl @@ -1,10 +1,10 @@ import javax.swing.tree.*; - -String who = arg("source"); + +String who = arg("source"); WindowContext context = argObj("windowContext"); -log.debug("Event received: " + who); +log.debug("Event received: " + who); if ("Connect".equals(who) ) { @@ -106,6 +106,7 @@ else if ("Help".equals(who)) else if ("Close".equals(who) ) { Frame window = context.get("/"); + script("removeFromWindowMenu", args()); window.dispose(); } else { diff --git a/extra/jheidi/mainWindowEvents.ajl b/extra/jheidi/mainWindowEvents.ajl index 7f055cd4..b3ccdd8d 100644 --- a/extra/jheidi/mainWindowEvents.ajl +++ b/extra/jheidi/mainWindowEvents.ajl @@ -8,6 +8,7 @@ log.debug("Event received: " + who); if ("Close".equals(who) ) { Frame window = context.get("/"); + script("removeFromWindowMenu", args()); window.dispose(); } else if ("Connection".equals(who)) diff --git a/extra/jheidi/removeFromWindowMenu.ajl b/extra/jheidi/removeFromWindowMenu.ajl new file mode 100644 index 00000000..b1eb8213 --- /dev/null +++ b/extra/jheidi/removeFromWindowMenu.ajl @@ -0,0 +1,42 @@ +import java.util.*; + +WindowContext context = argObj("windowContext"); +HashObject profile = context.get("profile"); +String profileName = profile.get("name"); +Frame thisFrame = context.get("/"); + +// dont confuse Context (global context) with the variable context (the window context) +HashObject windowList = Context.get("windowList"); + +windowList.remove(thisFrame); + +//now rebuild all the window menus on all open frames +for (Object o : windowList) +{ + Frame f = (Frame)o; + Menu windowMenu = f.get("Window"); + windowMenu.removeAll(); + + for (Object o2 : windowList) + { + windowMenu.item(((String)((Frame)o2).getProperty("windowId"))); + } +} + + + + + + + + + + + + + + + + + + diff --git a/extra/jheidi/showMainWindow.ajl b/extra/jheidi/showMainWindow.ajl index afd6d955..03d65ae7 100644 --- a/extra/jheidi/showMainWindow.ajl +++ b/extra/jheidi/showMainWindow.ajl @@ -19,7 +19,7 @@ m.item("separator", "User-Manager", "Maintenance", "separator", "Preferences"); app.menu("&Import").item("Import CSV File", "Load SQL File", "Insert Files into Blob Fields"); app.menu("E&xport").item("Export Tables as SQL","separator", "Copy as CSV Data", "Copy as HTML Data", "Copy as XML Data","Export Data..."); - app.menu("&Window").item("Connection 1"); + app.menu("&Window").events("windowMenuEvents"); Menu help = app.menu("&Help"); help.events("helpMenuEvents").item("SQL Help", "separator", "Heidi SQL Website", "Downloads", "Support Forums", "Bug Tracker", "Feature Tracker", "separator", "About"); @@ -121,6 +121,7 @@ args().put("windowContext", context); script("initDB", args()); script("initTree", args()); + script("addToWindowMenu", args()); thread("loadHostInfo", args(), true); diff --git a/extra/jheidi/windowMenuEvents.ajl b/extra/jheidi/windowMenuEvents.ajl new file mode 100644 index 00000000..07d09076 --- /dev/null +++ b/extra/jheidi/windowMenuEvents.ajl @@ -0,0 +1,21 @@ + +String who = arg("source"); + +log.debug("Event received: " + who); + +WindowContext context = argObj("windowContext"); + +HashObject windowList = Context.get("windowList"); + +Frame f = windowList.getObject(who); + +if (f != (Frame)context.get("/")) +{ + f.toFront(); +} + + + + + +