提交 2e3ccb10 编写于 作者: S Serge Rider

UI confirmations fix (invalid thread access)

上级 8d11c456
......@@ -431,12 +431,18 @@ public class UIUtils {
DBeaverUI.syncExec(runnable);
}
public static boolean confirmAction(final String title, final String question)
{
return confirmAction(null, title, question);
}
public static boolean confirmAction(final Shell shell, final String title, final String question)
{
return new UIConfirmation() {
@Override
public Boolean runTask() {
MessageBox messageBox = new MessageBox(shell, SWT.ICON_WARNING | SWT.YES | SWT.NO);
Shell activeShell = shell != null ? shell : DBeaverUI.getActiveWorkbenchShell();
MessageBox messageBox = new MessageBox(activeShell, SWT.ICON_WARNING | SWT.YES | SWT.NO);
messageBox.setMessage(question);
messageBox.setText(title);
int response = messageBox.open();
......
......@@ -480,7 +480,7 @@ public class DB2DataSource extends JDBCDataSource implements DBSObjectSelector,
// No valid explain tables found, propose to create them in current authId
String msg = String.format(DB2Messages.dialog_explain_ask_to_create, sessionUserSchema);
if (!UIUtils.confirmAction(DBeaverUI.getActiveWorkbenchShell(), DB2Messages.dialog_explain_no_tables, msg)) {
if (!UIUtils.confirmAction(DB2Messages.dialog_explain_no_tables, msg)) {
return null;
}
......
......@@ -40,6 +40,7 @@ import org.jkiss.dbeaver.model.sql.SQLConstants;
import org.jkiss.dbeaver.model.sql.SQLDialect;
import org.jkiss.dbeaver.model.sql.SQLState;
import org.jkiss.dbeaver.model.struct.*;
import org.jkiss.dbeaver.ui.UIConfirmation;
import org.jkiss.dbeaver.ui.UIUtils;
import org.jkiss.utils.CommonUtils;
......@@ -517,7 +518,6 @@ public class OracleDataSource extends JDBCDataSource
final String newPlanTableName = candidateNames[0];
// Plan table not found - try to create new one
if (!UIUtils.confirmAction(
DBeaverUI.getActiveWorkbenchShell(),
"Oracle PLAN_TABLE missing",
"PLAN_TABLE not found in current user's session. " +
"Do you want DBeaver to create new PLAN_TABLE (" + newPlanTableName + ")?")) {
......
......@@ -45,6 +45,8 @@ public class URLAttributeTransformer implements DBDAttributeTransformer {
private static final Log log = Log.getLog(URLAttributeTransformer.class);
private static final String PROP_PATTERN = "pattern";
private static final String PROP_VIEW_INLINE = "view.inline";
private static final String PROP_VIEW_PANEL = "view.panel";
public static final String URL_TYPE_NAME = "URL.Preview";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册