Search in sources :

Example 1 with QueryTunerDialog

use of com.cubrid.common.ui.query.tuner.dialog.QueryTunerDialog in project cubrid-manager by CUBRID.

the class QueryTunerAction method run.

public void run() {
    Object[] obj = this.getSelectedObj();
    if (!isSupported(obj)) {
        setEnabled(false);
        return;
    }
    ISelectionProvider provider = getSelectionProvider();
    if (!(provider instanceof TreeViewer)) {
        return;
    }
    ISchemaNode node = (ISchemaNode) obj[0];
    String query = getQuery();
    if (StringUtil.isNotEmpty(query)) {
        new QueryTunerDialog(getShell(), node.getDatabase(), query).open();
    } else {
        CommonUITool.openInformationBox(Messages.errSelectQueryForTuning);
        new QueryTunerDialog(getShell(), node.getDatabase()).open();
    }
}
Also used : ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) QueryTunerDialog(com.cubrid.common.ui.query.tuner.dialog.QueryTunerDialog) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) TreeViewer(org.eclipse.jface.viewers.TreeViewer)

Example 2 with QueryTunerDialog

use of com.cubrid.common.ui.query.tuner.dialog.QueryTunerDialog in project cubrid-manager by CUBRID.

the class QueryTunerRunAction method run.

public void run() {
    Control control = getFocusProvider();
    String query = "";
    if (control instanceof StyledText) {
        StyledText stext = (StyledText) control;
        String data = stext.getSelectionText();
        if (data != null && !data.equals("")) {
            query = data;
        }
    }
    CubridDatabase database = getDatabaseWithSelection();
    if (database != null) {
        new QueryTunerDialog(getShell(), getDatabaseWithSelection(), query).open();
    }
}
Also used : Control(org.eclipse.swt.widgets.Control) StyledText(org.eclipse.swt.custom.StyledText) QueryTunerDialog(com.cubrid.common.ui.query.tuner.dialog.QueryTunerDialog) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Aggregations

QueryTunerDialog (com.cubrid.common.ui.query.tuner.dialog.QueryTunerDialog)2 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)1 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)1 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 StyledText (org.eclipse.swt.custom.StyledText)1 Control (org.eclipse.swt.widgets.Control)1