use of com.cubrid.common.ui.query.tuner.QueryRecordProject in project cubrid-manager by CUBRID.
the class QueryRecordListComparator method removeQueryRecord.
/**
* Remove selected query record
*
*/
private void removeQueryRecord() {
QueryRecordProject queryRecordProject = ApplicationPersistUtil.getInstance().findQueryRecordProject(database.getDatabaseInfo(), historyCombo.getText());
if (queryRecordProject == null) {
CommonUITool.openErrorBox(Messages.errUnselectHistory);
}
String recordName = queryRecordRightCombo.getText();
queryRecordProject.removeQueryRecord(recordName);
ApplicationPersistUtil.getInstance().removeQueryRecordProject(database.getDatabaseInfo(), queryRecordProject.getName());
ApplicationPersistUtil.getInstance().addQueryRecordProject(database.getDatabaseInfo(), queryRecordProject);
ApplicationPersistUtil.getInstance().save();
initQueryRecord(queryRecordProject);
if (queryRecordLeftCombo.getItemCount() == 0) {
CommonUITool.openErrorBox(Messages.msgQueryTunerNotSavedProject);
tabFolder.setSelection(0);
}
}
use of com.cubrid.common.ui.query.tuner.QueryRecordProject in project cubrid-manager by CUBRID.
the class QueryRecordListComparator method switchQueryRecordProject.
/**
* Change query record list
*/
private void switchQueryRecordProject(String name) {
List<QueryRecordProject> projectList = loadProjectList();
int index = -1;
if (projectList != null && projectList.size() > 0) {
for (int i = 0; i < projectList.size(); i++) {
QueryRecordProject temp = projectList.get(i);
if (StringUtil.isEqual(name, temp.getName())) {
index = i;
break;
}
}
}
if (index >= 0) {
initQueryProject(projectList, index);
} else {
initQueryProject(projectList, 0);
}
}
use of com.cubrid.common.ui.query.tuner.QueryRecordProject in project cubrid-manager by CUBRID.
the class QueryRecordListComparator method getSelectedLeftQueryRecord.
/**
* Get left selected history query record
*
* @return
*/
private QueryRecord getSelectedLeftQueryRecord() {
QueryRecordProject queryRecordProject = ApplicationPersistUtil.getInstance().findQueryRecordProject(database.getDatabaseInfo(), historyCombo.getText());
if (queryRecordProject == null) {
CommonUITool.openErrorBox(Messages.errUnselectHistory);
}
String historyName = queryRecordLeftCombo.getText();
return queryRecordProject.findQueryRecord(historyName);
}
use of com.cubrid.common.ui.query.tuner.QueryRecordProject in project cubrid-manager by CUBRID.
the class QueryRecordListComparator method initQueryProject.
/**
* Load history list
*
* @param index
*/
private void initQueryProject(List<QueryRecordProject> queryRecordProjectList, int index) {
historyCombo.removeAll();
QueryRecordProject selectProject = null;
if (queryRecordProjectList != null && queryRecordProjectList.size() > 0) {
String[] items = new String[queryRecordProjectList.size()];
for (int i = 0; i < queryRecordProjectList.size(); i++) {
QueryRecordProject queryRecordProject = queryRecordProjectList.get(i);
items[i] = queryRecordProject.getName();
if (i == index) {
selectProject = queryRecordProject;
}
}
historyCombo.setItems(items);
if (items.length > index) {
historyCombo.select(index);
// infoText.setText(formater.format(queryRecordProjectList.get(
// index).getCreateDate()));
}
}
/*If change project, clear the buffer data*/
if (selectProject != null && queryRecordProject != null && !StringUtil.isEqual(selectProject.getName(), queryRecordProject.getName())) {
clearBufferRecord();
}
queryRecordProject = selectProject;
initQueryRecord(selectProject);
}
use of com.cubrid.common.ui.query.tuner.QueryRecordProject in project cubrid-manager by CUBRID.
the class ApplicationPersistUtil method removeQueryRecordProject.
public void removeQueryRecordProject(DatabaseInfo databaseInfo, String projectName) {
int index = -1;
List<QueryRecordProject> list = queryRecordMap.get(getDBMapKey(databaseInfo));
for (int i = 0; i < list.size(); i++) {
QueryRecordProject queryRecordProject = list.get(i);
if (StringUtil.isEqual(projectName, queryRecordProject.getName())) {
index = i;
break;
}
}
if (index >= 0) {
list.remove(index);
}
}
Aggregations