|
|
@ -3,6 +3,7 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package com.fr.design.data.datapane.connect; |
|
|
|
package com.fr.design.data.datapane.connect; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.data.driver.util.JarFileParseUtil; |
|
|
|
import com.fr.data.impl.Connection; |
|
|
|
import com.fr.data.impl.Connection; |
|
|
|
import com.fr.data.impl.JDBCDatabaseConnection; |
|
|
|
import com.fr.data.impl.JDBCDatabaseConnection; |
|
|
|
import com.fr.data.impl.JNDIDatabaseConnection; |
|
|
|
import com.fr.data.impl.JNDIDatabaseConnection; |
|
|
@ -32,10 +33,12 @@ import com.fr.workspace.WorkContext; |
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.BoxLayout; |
|
|
|
import javax.swing.BoxLayout; |
|
|
|
import javax.swing.JDialog; |
|
|
|
import javax.swing.JDialog; |
|
|
|
|
|
|
|
import javax.swing.JLabel; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.JScrollPane; |
|
|
|
import javax.swing.JScrollPane; |
|
|
|
import javax.swing.JTextArea; |
|
|
|
import javax.swing.JTextArea; |
|
|
|
import javax.swing.ScrollPaneConstants; |
|
|
|
import javax.swing.ScrollPaneConstants; |
|
|
|
|
|
|
|
import javax.swing.SwingConstants; |
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
import javax.swing.SwingWorker; |
|
|
|
import javax.swing.SwingWorker; |
|
|
|
import javax.swing.UIManager; |
|
|
|
import javax.swing.UIManager; |
|
|
@ -55,6 +58,7 @@ import java.awt.event.MouseAdapter; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
import java.awt.event.WindowAdapter; |
|
|
|
import java.awt.event.WindowAdapter; |
|
|
|
import java.awt.event.WindowEvent; |
|
|
|
import java.awt.event.WindowEvent; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.net.URI; |
|
|
|
import java.net.URI; |
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
|
|
|
|
|
|
|
|
@ -190,6 +194,55 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti |
|
|
|
JScrollPane jsp = new JScrollPane(jta); |
|
|
|
JScrollPane jsp = new JScrollPane(jta); |
|
|
|
jsp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); |
|
|
|
jsp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); |
|
|
|
jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
|
|
|
jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
|
|
|
|
|
|
|
Connection con = DatabaseConnectionPane.this.updateBean(); |
|
|
|
|
|
|
|
if(con instanceof JDBCDatabaseConnection) { |
|
|
|
|
|
|
|
JPanel xBorderPanel = new JPanel(); |
|
|
|
|
|
|
|
xBorderPanel.setLayout(new BorderLayout()); |
|
|
|
|
|
|
|
UILabel driverTestTip = new UILabel(); |
|
|
|
|
|
|
|
JLabel testResult = new JLabel(); |
|
|
|
|
|
|
|
driverTestTip.setForeground(Color.BLUE); |
|
|
|
|
|
|
|
driverTestTip.setVisible(true); |
|
|
|
|
|
|
|
testResult.setVisible(false); |
|
|
|
|
|
|
|
testResult.setHorizontalAlignment(SwingConstants.CENTER); |
|
|
|
|
|
|
|
driverTestTip.setText(Toolkit.i18nText("Fine_Designer_Driver_Path_Test")); |
|
|
|
|
|
|
|
xBorderPanel.add(driverTestTip, BorderLayout.WEST); |
|
|
|
|
|
|
|
xBorderPanel.add(testResult, BorderLayout.CENTER); |
|
|
|
|
|
|
|
String driverPath = JarFileParseUtil.getDriverClassPath((JDBCDatabaseConnection) con); |
|
|
|
|
|
|
|
jta.append(Toolkit.i18nText("Fine_Designer_Current_Driver_Path") + ":" + driverPath + "\n"); |
|
|
|
|
|
|
|
driverTestTip.addMouseListener(new MouseAdapter() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseEntered(MouseEvent e) { |
|
|
|
|
|
|
|
driverTestTip.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseExited(MouseEvent e) { |
|
|
|
|
|
|
|
driverTestTip.setCursor(Cursor.getDefaultCursor()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
String path; |
|
|
|
|
|
|
|
if(driverPath.endsWith(JarFileParseUtil.JAR_MARKER)) { |
|
|
|
|
|
|
|
path = new File(driverPath).getParent(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
path = driverPath; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(JarFileParseUtil.hasDuplicateDriver(con.getDriver(), path)) { |
|
|
|
|
|
|
|
testResult.setForeground(Color.RED); |
|
|
|
|
|
|
|
testResult.setText(Toolkit.i18nText("Fine_Designer_Driver_Conflict")); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
testResult.setForeground(Color.BLACK); |
|
|
|
|
|
|
|
testResult.setText(Toolkit.i18nText("Fine_Designer_Driver_No_Conflict")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
testResult.setVisible(true); |
|
|
|
|
|
|
|
} catch (Exception clickException) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().warn(clickException, "can not test driver conflict"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
borderPanel.add(xBorderPanel, BorderLayout.NORTH); |
|
|
|
|
|
|
|
} |
|
|
|
jta.append(select.getResultException().getDetailMessage() + "\n"); |
|
|
|
jta.append(select.getResultException().getDetailMessage() + "\n"); |
|
|
|
jta.append(select.getResultException().getSolution()); |
|
|
|
jta.append(select.getResultException().getSolution()); |
|
|
|
jta.setCaretPosition(0); |
|
|
|
jta.setCaretPosition(0); |
|
|
|