From 06346c31cd43bbde5d575c71242e53f74fed0494 Mon Sep 17 00:00:00 2001 From: rinoux Date: Thu, 12 May 2022 11:09:28 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-69285=20=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E5=AE=89=E5=85=A8=E5=85=B3=E9=94=AE=E5=AD=97=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E6=8B=A6=E6=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/os/impl/DatabaseDialogAction.java | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java index 057b561fa0..669ef6ef4a 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java @@ -3,19 +3,26 @@ package com.fr.design.os.impl; import com.fr.design.data.datapane.connect.ConnectionManagerPane; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.editlock.EditLockUtils; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.file.ConnectionConfig; +import com.fr.report.LockItem; import com.fr.stable.os.support.OSBasedAction; import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; -import com.fr.report.LockItem; + +import javax.swing.JOptionPane; +import java.util.concurrent.atomic.AtomicBoolean; + import static com.fr.design.actions.server.ConnectionListAction.doWithDatasourceManager; /** * 数据连接窗口 + * * @author pengda * @date 2019/10/9 */ @@ -52,10 +59,17 @@ public class DatabaseDialogAction implements OSBasedAction { databaseListDialog.setDoOKSucceed(false); return; } + + AtomicBoolean saved = new AtomicBoolean(true); Configurations.modify(new WorkerFacade(ConnectionConfig.class) { @Override public void run() { - databaseManagerPane.update(datasourceManager); + try { + databaseManagerPane.update(datasourceManager); + } catch (Exception e) { + saved.set(false); + FineJOptionPane.showMessageDialog(databaseManagerPane, e.getMessage(), Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE); + } } }.addCallBack(new CallBackAdaptor() { @Override @@ -66,9 +80,13 @@ public class DatabaseDialogAction implements OSBasedAction { @Override public void afterCommit() { - DesignerContext.getDesignerBean("databasename").refreshBeanElement(); - // 定义数据连接弹窗关闭后,解锁 - EditLockUtils.unlock(LockItem.CONNECTION); + if (saved.get()) { + DesignerContext.getDesignerBean("databasename").refreshBeanElement(); + // 定义数据连接弹窗关闭后,解锁 + EditLockUtils.unlock(LockItem.CONNECTION); + } else { + databaseListDialog.setDoOKSucceed(false); + } } })); }