PATCH-1559330: PHPDoc comments are garbled in function hover. Applied patch .
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / util / connection / ConnectionUtil.java
index ecfe620..8c775a3 100644 (file)
@@ -1,6 +1,7 @@
 package com.quantum.util.connection;
 
 import java.sql.Connection;
+import java.sql.SQLException;
 
 import com.quantum.Messages;
 import com.quantum.model.Bookmark;
@@ -8,6 +9,7 @@ import com.quantum.model.ConnectionException;
 import com.quantum.model.NotConnectedException;
 import com.quantum.ui.dialog.ExceptionDisplayDialog;
 import com.quantum.ui.dialog.PasswordDialog;
+import com.quantum.ui.dialog.SQLExceptionDialog;
 
 import org.eclipse.swt.widgets.Shell;
 
@@ -16,7 +18,7 @@ import org.eclipse.swt.widgets.Shell;
  * interactions such as providing messages to the user and/or prompting for a 
  * password.
  * 
- * @author BC
+ * @author BC Holmes
  */
 public class ConnectionUtil {
 
@@ -35,10 +37,14 @@ public class ConnectionUtil {
         try {
             connection = bookmark.connect(PasswordDialog.createPasswordFinder(shell));
         } catch (ConnectionException e) {
-            ExceptionDisplayDialog.openError(shell, 
-                Messages.getString(getClass().getName() + ".title"), 
-                Messages.getString(getClass().getName() + ".message") +
-                               " (Bookmark:"+bookmark.getName()+")", e);
+               if (e.getCause() != null && e.getCause() instanceof SQLException) {
+                       SQLExceptionDialog.openException(shell, bookmark, (SQLException) e.getCause());
+               } else {
+                   ExceptionDisplayDialog.openError(shell, 
+                       Messages.getString(getClass().getName() + ".title"), 
+                       Messages.getString(getClass().getName() + ".message") +
+                                       " (Bookmark:"+bookmark.getName()+")", e);
+               }
         }
         return connection;
     }