Search in sources :

Example 1 with QueryRecordProject

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);
    }
}
Also used : QueryRecordProject(com.cubrid.common.ui.query.tuner.QueryRecordProject)

Example 2 with QueryRecordProject

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);
    }
}
Also used : QueryRecordProject(com.cubrid.common.ui.query.tuner.QueryRecordProject)

Example 3 with QueryRecordProject

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);
}
Also used : QueryRecordProject(com.cubrid.common.ui.query.tuner.QueryRecordProject)

Example 4 with QueryRecordProject

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);
}
Also used : QueryRecordProject(com.cubrid.common.ui.query.tuner.QueryRecordProject)

Example 5 with QueryRecordProject

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);
    }
}
Also used : QueryRecordProject(com.cubrid.common.ui.query.tuner.QueryRecordProject)

Aggregations

QueryRecordProject (com.cubrid.common.ui.query.tuner.QueryRecordProject)14 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3 QueryRecord (com.cubrid.common.ui.query.tuner.QueryRecord)2 IXMLMemento (com.cubrid.cubridmanager.core.common.xml.IXMLMemento)2 DateFormat (java.text.DateFormat)2 List (java.util.List)2 StructQueryPlan (com.cubrid.common.core.queryplan.StructQueryPlan)1 QueryPlanComposite (com.cubrid.common.ui.query.control.queryplan.QueryPlanComposite)1 RestorableQueryEditorInfo (com.cubrid.common.ui.spi.model.RestorableQueryEditorInfo)1 ParseException (java.text.ParseException)1 CTabFolder (org.eclipse.swt.custom.CTabFolder)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 FillLayout (org.eclipse.swt.layout.FillLayout)1 FormAttachment (org.eclipse.swt.layout.FormAttachment)1 FormData (org.eclipse.swt.layout.FormData)1 FormLayout (org.eclipse.swt.layout.FormLayout)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Combo (org.eclipse.swt.widgets.Combo)1