mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
implement window menu
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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))
|
||||
|
||||
42
extra/jheidi/removeFromWindowMenu.ajl
Normal file
42
extra/jheidi/removeFromWindowMenu.ajl
Normal file
@@ -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")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
|
||||
21
extra/jheidi/windowMenuEvents.ajl
Normal file
21
extra/jheidi/windowMenuEvents.ajl
Normal file
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user