Search in sources :

Example 1 with FilterValueEditPopup

use of org.jkiss.dbeaver.ui.controls.resultset.valuefilter.FilterValueEditPopup in project dbeaver by serge-rider.

the class ResultSetViewer method showFiltersDistinctMenu.

public void showFiltersDistinctMenu(DBDAttributeBinding curAttribute, boolean atKeyboardCursor) {
    Collection<ResultSetRow> selectedRows = getSelection().getSelectedRows();
    ResultSetRow[] rows = selectedRows.toArray(new ResultSetRow[0]);
    FilterValueEditPopup popup = new FilterValueEditPopup(getSite().getShell(), ResultSetViewer.this, curAttribute, rows);
    Point location;
    if (atKeyboardCursor) {
        location = getKeyboardCursorLocation();
    } else {
        location = getSite().getWorkbenchWindow().getWorkbench().getDisplay().getCursorLocation();
    }
    if (location != null) {
        popup.setLocation(location);
    }
    popup.setModeless(true);
    if (popup.open() == IDialogConstants.OK_ID) {
        Object value = popup.getValue();
        DBDDataFilter filter = new DBDDataFilter(model.getDataFilter());
        DBDAttributeConstraint constraint = filter.getConstraint(curAttribute);
        if (constraint != null) {
            constraint.setOperator(DBCLogicalOperator.IN);
            constraint.setValue(value);
            setDataFilter(filter, true);
        }
    }
}
Also used : Point(org.eclipse.swt.graphics.Point) FilterValueEditPopup(org.jkiss.dbeaver.ui.controls.resultset.valuefilter.FilterValueEditPopup)

Example 2 with FilterValueEditPopup

use of org.jkiss.dbeaver.ui.controls.resultset.valuefilter.FilterValueEditPopup in project dbeaver by dbeaver.

the class ResultSetViewer method showFiltersDistinctMenu.

public void showFiltersDistinctMenu(DBDAttributeBinding curAttribute, boolean atKeyboardCursor) {
    Collection<ResultSetRow> selectedRows = getSelection().getSelectedRows();
    ResultSetRow[] rows = selectedRows.toArray(new ResultSetRow[0]);
    FilterValueEditPopup popup = new FilterValueEditPopup(getSite().getShell(), ResultSetViewer.this, curAttribute, rows);
    Point location;
    if (atKeyboardCursor) {
        location = getKeyboardCursorLocation();
    } else {
        location = getSite().getWorkbenchWindow().getWorkbench().getDisplay().getCursorLocation();
    }
    if (location != null) {
        popup.setLocation(location);
    }
    popup.setModeless(true);
    if (popup.open() == IDialogConstants.OK_ID) {
        Object value = popup.getValue();
        DBDDataFilter filter = new DBDDataFilter(model.getDataFilter());
        DBDAttributeConstraint constraint = filter.getConstraint(curAttribute);
        if (constraint != null) {
            constraint.setOperator(DBCLogicalOperator.IN);
            constraint.setValue(value);
            setDataFilter(filter, true);
        }
    }
}
Also used : Point(org.eclipse.swt.graphics.Point) FilterValueEditPopup(org.jkiss.dbeaver.ui.controls.resultset.valuefilter.FilterValueEditPopup)

Aggregations

Point (org.eclipse.swt.graphics.Point)2 FilterValueEditPopup (org.jkiss.dbeaver.ui.controls.resultset.valuefilter.FilterValueEditPopup)2