pResult.removeAll();
pResult.add("Center", gResult);
pResult.doLayout();
} else if (s.equals("Open Script...")) {
FileDialog f = new FileDialog(fMain, "Open Script",
FileDialog.LOAD);
// (ulrivo): set default directory if set from command line
if (defDirectory != null) {
f.setDirectory(defDirectory);
}
f.show();
String file = f.getFile();
if (file != null) {
StringBuffer buf = new StringBuffer();
ifHuge = DatabaseManagerCommon.readFile(f.getDirectory()
+ file);
if (4096 <= ifHuge.length()) {
buf.append(
"This huge file cannot be edited.\n Please execute or clear\n");
txtCommand.setText(buf.toString());
} else {
txtCommand.setText(ifHuge);
}
}
} else if (s.equals("Save Script...")) {
FileDialog f = new FileDialog(fMain, "Save Script",
FileDialog.SAVE);
// (ulrivo): set default directory if set from command line
if (defDirectory != null) {
f.setDirectory(defDirectory);
}
f.show();
String file = f.getFile();
if (file != null) {
DatabaseManagerCommon.writeFile(f.getDirectory() + file,
txtCommand.getText());
}
} else if (s.equals("Save Result csv...")) {
FileDialog f = new FileDialog(fMain, "Save Result CSV",
FileDialog.SAVE);
// (ulrivo): set default directory if set from command line
if (defDirectory != null) {
f.setDirectory(defDirectory);
}
f.show();
String dir = f.getDirectory();
String file = f.getFile();
if (dir != null) {
file = dir + "/" + file;
}
if (file != null) {
showResultInText();
saveAsCsv(file);
}
} else if (s.equals("Save Result...")) {
FileDialog f = new FileDialog(fMain, "Save Result",
FileDialog.SAVE);
// (ulrivo): set default directory if set from command line
if (defDirectory != null) {
f.setDirectory(defDirectory);
}
f.show();
String file = f.getFile();
if (file != null) {
showResultInText();
DatabaseManagerCommon.writeFile(f.getDirectory() + file,
txtResult.getText());
}
} else if (s.equals("Results in Text")) {
iResult = 1;