Search in sources :

Example 1 with StringInlineEditor

use of org.jkiss.dbeaver.ui.data.editors.StringInlineEditor in project dbeaver by serge-rider.

the class FilterValueEditDialog method createSingleValueEditor.

private void createSingleValueEditor(Composite composite) {
    Composite editorPlaceholder = UIUtils.createPlaceholder(composite, 1);
    editorPlaceholder.setLayoutData(new GridData(GridData.FILL_BOTH));
    editorPlaceholder.setLayout(new FillLayout());
    ResultSetRow singleRow = handler.getRows()[0];
    final ResultSetValueController valueController = new ResultSetValueController(handler.getViewer(), handler.getAttribute(), singleRow, IValueController.EditType.INLINE, editorPlaceholder) {

        @Override
        public boolean isReadOnly() {
            // Filter value is never read-only
            return false;
        }
    };
    IValueEditor editor = null;
    try {
        editor = valueController.getValueManager().createEditor(valueController);
    } catch (Exception e) {
        log.error("Can't create inline value editor", e);
    }
    if (editor == null) {
        editor = new StringInlineEditor(valueController);
    }
    handler.setEditor(editor);
    editor.createControl();
    try {
        editor.primeEditorValue(valueController.getValue());
    } catch (DBException e) {
        log.error("Error populating filter value", e);
    }
}
Also used : DBException(org.jkiss.dbeaver.DBException) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) ResultSetValueController(org.jkiss.dbeaver.ui.controls.resultset.ResultSetValueController) StringInlineEditor(org.jkiss.dbeaver.ui.data.editors.StringInlineEditor) ResultSetRow(org.jkiss.dbeaver.ui.controls.resultset.ResultSetRow) FillLayout(org.eclipse.swt.layout.FillLayout) IValueEditor(org.jkiss.dbeaver.ui.data.IValueEditor) DBException(org.jkiss.dbeaver.DBException)

Example 2 with StringInlineEditor

use of org.jkiss.dbeaver.ui.data.editors.StringInlineEditor in project dbeaver by dbeaver.

the class FilterValueEditDialog method createSingleValueEditor.

private void createSingleValueEditor(Composite composite) {
    Composite editorPlaceholder = UIUtils.createPlaceholder(composite, 1);
    editorPlaceholder.setLayoutData(new GridData(GridData.FILL_BOTH));
    editorPlaceholder.setLayout(new FillLayout());
    ResultSetRow singleRow = handler.getRows()[0];
    final ResultSetValueController valueController = new ResultSetValueController(handler.getViewer(), handler.getAttribute(), singleRow, IValueController.EditType.INLINE, editorPlaceholder) {

        @Override
        public boolean isReadOnly() {
            // Filter value is never read-only
            return false;
        }
    };
    IValueEditor editor = null;
    try {
        editor = valueController.getValueManager().createEditor(valueController);
    } catch (Exception e) {
        log.error("Can't create inline value editor", e);
    }
    if (editor == null) {
        editor = new StringInlineEditor(valueController);
    }
    handler.setEditor(editor);
    editor.createControl();
    try {
        editor.primeEditorValue(valueController.getValue());
    } catch (DBException e) {
        log.error("Error populating filter value", e);
    }
}
Also used : DBException(org.jkiss.dbeaver.DBException) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) ResultSetValueController(org.jkiss.dbeaver.ui.controls.resultset.ResultSetValueController) StringInlineEditor(org.jkiss.dbeaver.ui.data.editors.StringInlineEditor) ResultSetRow(org.jkiss.dbeaver.ui.controls.resultset.ResultSetRow) FillLayout(org.eclipse.swt.layout.FillLayout) IValueEditor(org.jkiss.dbeaver.ui.data.IValueEditor) DBException(org.jkiss.dbeaver.DBException)

Aggregations

FillLayout (org.eclipse.swt.layout.FillLayout)2 GridData (org.eclipse.swt.layout.GridData)2 Composite (org.eclipse.swt.widgets.Composite)2 DBException (org.jkiss.dbeaver.DBException)2 ResultSetRow (org.jkiss.dbeaver.ui.controls.resultset.ResultSetRow)2 ResultSetValueController (org.jkiss.dbeaver.ui.controls.resultset.ResultSetValueController)2 IValueEditor (org.jkiss.dbeaver.ui.data.IValueEditor)2 StringInlineEditor (org.jkiss.dbeaver.ui.data.editors.StringInlineEditor)2