use of com.cubrid.common.ui.query.dialog.SetFileEncodingDialog in project cubrid-manager by CUBRID.
the class FavoriteQueryNavigatorView method addFile.
/**
* Add a favorite by external sql file(s).
*/
private void addFile() {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
String charset = StringUtil.getDefaultCharset();
SetFileEncodingDialog dialog = new SetFileEncodingDialog(shell, charset, true);
if (dialog.open() != IDialogConstants.OK_ID) {
return;
}
String memo = null;
try {
CubridDatabase cubridDatabase = getCurrentDatabase();
memo = cubridDatabase.getDatabaseInfo().getDbName() + "@" + cubridDatabase.getServer().getServerInfo().getHostAddress();
} catch (Exception e) {
memo = "";
}
String filenameToSave = dialog.getFilePath();
File file = new File(filenameToSave);
String pathname = file.getPath();
String filename = file.getName();
int sp = pathname.indexOf(filename);
if (sp != -1) {
pathname = pathname.substring(0, sp);
}
lastDirectory = pathname;
charset = dialog.getEncoding();
addFavoriteByFileLink(lastDirectory, filename, memo, charset);
}
Aggregations