mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
split help for mysql and oracle
This commit is contained in:
@@ -54,7 +54,7 @@
|
||||
|
||||
|
||||
args().put("windowContext", context);
|
||||
script("initHelpTree", args());
|
||||
script("initHelpTreeMySQL", args());
|
||||
|
||||
dlg.visible();
|
||||
|
||||
|
||||
79
extra/jheidi/initHelpTreeMySQL.ajl
Normal file
79
extra/jheidi/initHelpTreeMySQL.ajl
Normal file
@@ -0,0 +1,79 @@
|
||||
import java.util.List;
|
||||
|
||||
WindowContext context = argObj("windowContext");
|
||||
HashObject profile = context.get("profile");
|
||||
Tree tree = context.get("/helpTree");
|
||||
final NodeInfo root = (NodeInfo)tree.getModel().getRoot();
|
||||
|
||||
tree.setCellRenderer(new IconicCellRenderer("images/helptopic.gif", "images/helpitem.gif"));
|
||||
|
||||
final DB db = context.get("db");
|
||||
|
||||
DB.AutoCleanupTX tx = new DB.AutoCleanupTX() {
|
||||
public void execute() throws Exception {
|
||||
List<HashObject> curItems = db.execute("help contents");
|
||||
NodeInfo curNode = root;
|
||||
|
||||
Stack<HashObject> stack = new Stack<HashObject>();
|
||||
HashObject pointer = new HashObject();
|
||||
pointer.put("node", curNode);
|
||||
pointer.put("items", curItems);
|
||||
stack.push(pointer);
|
||||
|
||||
while (!stack.empty())
|
||||
{
|
||||
pointer = stack.pop();
|
||||
curItems = pointer.getObject("items");
|
||||
curNode = pointer.getObject("node");
|
||||
|
||||
for ( HashObject item: curItems)
|
||||
{
|
||||
if ( "Y".equals(item.get("is_it_category")))
|
||||
{
|
||||
NodeInfo branch = new NodeInfo(item.get("name"));
|
||||
//this if statement is needed because of bugs in some mysql help tables
|
||||
//causing infinite recursion. lazier loading in jheidi would also work.
|
||||
if ( !branch.getText().equals(curNode.getText()))
|
||||
{
|
||||
branch.setType("helptopic");
|
||||
branch.setIcon("helptopic");
|
||||
HashObject newPointer = new HashObject();
|
||||
newPointer.put("items", db.execute("help '" + item.get("name") + "'"));
|
||||
newPointer.put("node", branch);
|
||||
curNode.add(branch);
|
||||
stack.push(newPointer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NodeInfo leaf = new NodeInfo(item.get("name"));
|
||||
leaf.setType("helpitem");
|
||||
leaf.setIcon("helpitem");
|
||||
curNode.add(leaf);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
db.execute(tx);
|
||||
|
||||
tree.updateUI();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
79
extra/jheidi/initHelpTreeOracle.ajl
Normal file
79
extra/jheidi/initHelpTreeOracle.ajl
Normal file
@@ -0,0 +1,79 @@
|
||||
import java.util.List;
|
||||
|
||||
WindowContext context = argObj("windowContext");
|
||||
HashObject profile = context.get("profile");
|
||||
Tree tree = context.get("/helpTree");
|
||||
final NodeInfo root = (NodeInfo)tree.getModel().getRoot();
|
||||
|
||||
tree.setCellRenderer(new IconicCellRenderer("images/helptopic.gif", "images/helpitem.gif"));
|
||||
|
||||
final DB db = context.get("db");
|
||||
|
||||
DB.AutoCleanupTX tx = new DB.AutoCleanupTX() {
|
||||
public void execute() throws Exception {
|
||||
List<HashObject> curItems = db.execute("select info as name, 'N' as is_it_category from system.help where topic='TOPICS' and info<>'MENU' and info<>'INDEX' and info <> 'TOPICS' and info is not null and info not like ' Help%' order by seq");
|
||||
NodeInfo curNode = root;
|
||||
|
||||
Stack<HashObject> stack = new Stack<HashObject>();
|
||||
HashObject pointer = new HashObject();
|
||||
pointer.put("node", curNode);
|
||||
pointer.put("items", curItems);
|
||||
stack.push(pointer);
|
||||
|
||||
while (!stack.empty())
|
||||
{
|
||||
pointer = stack.pop();
|
||||
curItems = pointer.getObject("items");
|
||||
curNode = pointer.getObject("node");
|
||||
|
||||
for ( HashObject item: curItems)
|
||||
{
|
||||
if ( "Y".equals(item.get("is_it_category")))
|
||||
{
|
||||
NodeInfo branch = new NodeInfo(item.get("name"));
|
||||
//this if statement is needed because of bugs in some mysql help tables
|
||||
//causing infinite recursion. lazier loading in jheidi would also work.
|
||||
if ( !branch.getText().equals(curNode.getText()))
|
||||
{
|
||||
branch.setType("helptopic");
|
||||
branch.setIcon("helptopic");
|
||||
HashObject newPointer = new HashObject();
|
||||
newPointer.put("items", db.execute("help '" + item.get("name") + "'"));
|
||||
newPointer.put("node", branch);
|
||||
curNode.add(branch);
|
||||
stack.push(newPointer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NodeInfo leaf = new NodeInfo(item.get("name"));
|
||||
leaf.setType("helpitem");
|
||||
leaf.setIcon("helpitem");
|
||||
curNode.add(leaf);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
db.execute(tx);
|
||||
|
||||
tree.updateUI();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user