提交 4bc5daa3 编写于 作者: S Serge Rider

Inline editors value extraction


Former-commit-id: 8d30c502
上级 bb251048
......@@ -23,6 +23,9 @@ import org.eclipse.swt.widgets.Control;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.data.DBDDisplayFormat;
import org.jkiss.dbeaver.model.exec.DBCExecutionPurpose;
import org.jkiss.dbeaver.model.exec.DBCSession;
import org.jkiss.dbeaver.model.runtime.VoidProgressMonitor;
import org.jkiss.dbeaver.ui.controls.CustomTimeEditor;
import org.jkiss.dbeaver.ui.data.IValueController;
......@@ -51,8 +54,10 @@ public class DateTimeInlineEditor extends BaseValueEditor<Control> {
@Override
public Object extractEditorValue() throws DBException {
final String strValue = timeEditor.getValue();
return valueController.getValueHandler().getValueFromObject(null, valueController.getValueType(), strValue, false);
try (DBCSession session = valueController.getExecutionContext().openSession(VoidProgressMonitor.INSTANCE, DBCExecutionPurpose.UTIL, "Make datetime value from editor")) {
final String strValue = timeEditor.getValue();
return valueController.getValueHandler().getValueFromObject(session, valueController.getValueType(), strValue, false);
}
}
@Override
......
......@@ -24,6 +24,10 @@ import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.data.DBDDisplayFormat;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.exec.DBCExecutionPurpose;
import org.jkiss.dbeaver.model.exec.DBCSession;
import org.jkiss.dbeaver.model.runtime.VoidProgressMonitor;
import org.jkiss.dbeaver.ui.UIUtils;
import org.jkiss.dbeaver.ui.data.IValueController;
import org.jkiss.utils.CommonUtils;
......@@ -61,10 +65,12 @@ public class StringInlineEditor extends BaseValueEditor<Text> {
@Override
public Object extractEditorValue() throws DBCException {
return valueController.getValueHandler().getValueFromObject(
null,
valueController.getValueType(),
control.getText(),
false);
try (DBCSession session = valueController.getExecutionContext().openSession(VoidProgressMonitor.INSTANCE, DBCExecutionPurpose.UTIL, "Make string value from editor")) {
return valueController.getValueHandler().getValueFromObject(
session,
valueController.getValueType(),
control.getText(),
false);
}
}
}
......@@ -259,8 +259,7 @@ public class TextViewDialog extends ValueViewDialog {
}
}
DBCExecutionContext context = getValueController().getExecutionContext();
try (DBCSession session = context.openSession(VoidProgressMonitor.INSTANCE, DBCExecutionPurpose.UTIL, "Make content value from editor")) {
try (DBCSession session = getValueController().getExecutionContext().openSession(VoidProgressMonitor.INSTANCE, DBCExecutionPurpose.UTIL, "Make text value from editor")) {
return getValueController().getValueHandler().getValueFromObject(
session,
getValueController().getValueType(),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册