Search in sources :

Example 1 with StringContent

use of org.jkiss.dbeaver.model.impl.data.StringContent in project dbeaver by dbeaver.

the class ContentPanelEditor method extractEditorValue.

@Override
public Object extractEditorValue() throws DBException {
    final Object content = valueController.getValue();
    if (isStringValue()) {
        StringContent stringContent = new StringContent(valueController.getExecutionContext(), null);
        streamEditor.extractEditorValue(new VoidProgressMonitor(), control, stringContent);
        return stringContent.getRawValue();
    } else {
        if (content == null) {
            log.warn("NULL content value. Must be DBDContent.");
        } else if (streamEditor == null) {
            log.warn("NULL content editor.");
        } else {
            try {
                streamEditor.extractEditorValue(new VoidProgressMonitor(), control, (DBDContent) content);
            } catch (Throwable e) {
                log.debug(e);
                valueController.showMessage(e.getMessage(), DBPMessageType.ERROR);
            }
        }
        return content;
    }
}
Also used : DBDContent(org.jkiss.dbeaver.model.data.DBDContent) StringContent(org.jkiss.dbeaver.model.impl.data.StringContent) DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) DBSTypedObject(org.jkiss.dbeaver.model.struct.DBSTypedObject) VoidProgressMonitor(org.jkiss.dbeaver.model.runtime.VoidProgressMonitor)

Example 2 with StringContent

use of org.jkiss.dbeaver.model.impl.data.StringContent in project dbeaver by serge-rider.

the class ContentPanelEditor method extractEditorValue.

@Override
public Object extractEditorValue() throws DBException {
    final Object content = valueController.getValue();
    if (isStringValue()) {
        StringContent stringContent = new StringContent(valueController.getExecutionContext(), null);
        streamEditor.extractEditorValue(new VoidProgressMonitor(), control, stringContent);
        return stringContent.getRawValue();
    } else {
        if (content == null) {
            log.warn("NULL content value. Must be DBDContent.");
        } else if (streamEditor == null) {
            log.warn("NULL content editor.");
        } else {
            try {
                streamEditor.extractEditorValue(new VoidProgressMonitor(), control, (DBDContent) content);
            } catch (Throwable e) {
                log.debug(e);
                valueController.showMessage(e.getMessage(), DBPMessageType.ERROR);
            }
        }
        return content;
    }
}
Also used : DBDContent(org.jkiss.dbeaver.model.data.DBDContent) StringContent(org.jkiss.dbeaver.model.impl.data.StringContent) DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) DBSTypedObject(org.jkiss.dbeaver.model.struct.DBSTypedObject) VoidProgressMonitor(org.jkiss.dbeaver.model.runtime.VoidProgressMonitor)

Aggregations

DBDContent (org.jkiss.dbeaver.model.data.DBDContent)2 StringContent (org.jkiss.dbeaver.model.impl.data.StringContent)2 VoidProgressMonitor (org.jkiss.dbeaver.model.runtime.VoidProgressMonitor)2 DBSObject (org.jkiss.dbeaver.model.struct.DBSObject)2 DBSTypedObject (org.jkiss.dbeaver.model.struct.DBSTypedObject)2