|
|
|
@ -1,9 +1,14 @@
|
|
|
|
|
package com.fr.design.data.datapane.connect; |
|
|
|
|
|
|
|
|
|
import com.fr.data.impl.Connection; |
|
|
|
|
import com.fr.design.gui.frpane.LoadingBasicPane; |
|
|
|
|
import com.fr.design.gui.ilist.ListModelElement; |
|
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
import com.fr.file.ConnectionConfig; |
|
|
|
|
|
|
|
|
|
import com.fr.general.NameObject; |
|
|
|
|
import com.fr.license.database.DatabaseTypeValidateUtil; |
|
|
|
|
import com.fr.license.exception.DataBaseNotSupportedException; |
|
|
|
|
import com.fr.stable.Nameable; |
|
|
|
|
|
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
@ -61,4 +66,23 @@ public class ConnectionManagerPane extends LoadingBasicPane implements Connectio
|
|
|
|
|
return connectionListPane.isNamePermitted(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 校验是否支持当前选中连接的数据库类型 |
|
|
|
|
*/ |
|
|
|
|
public void validateDatabaseType(ConnectionConfig connectionConfig) { |
|
|
|
|
ListModelElement selectedValue = this.connectionListPane.getSelectedValue(); |
|
|
|
|
if (selectedValue != null) { |
|
|
|
|
Nameable wrapper = selectedValue.wrapper; |
|
|
|
|
try { |
|
|
|
|
Connection connection = (Connection) ((NameObject) wrapper).getObject(); |
|
|
|
|
DatabaseTypeValidateUtil.validateDatabaseType(connection.getDriver(), connection.feature()); |
|
|
|
|
} catch (DataBaseNotSupportedException e) { |
|
|
|
|
// 仅抛出数据库类型不支持异常
|
|
|
|
|
throw e; |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
// ignore
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |