Merging code from trunk that fixes #774, this work was done by incastrix
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / actions / DisconnectAction.java
index 7966a08..aa0ca9c 100644 (file)
@@ -1,13 +1,14 @@
 package com.quantum.actions;
 
+import java.sql.SQLException;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Vector;
 
+import com.quantum.ImageStore;
 import com.quantum.Messages;
-import com.quantum.QuantumPlugin;
 import com.quantum.model.Bookmark;
-import com.quantum.model.ConnectionException;
+import com.quantum.ui.dialog.SQLExceptionDialog;
 import com.quantum.view.bookmark.BookmarkNode;
 
 import org.eclipse.jface.viewers.IStructuredSelection;
@@ -30,17 +31,18 @@ public class DisconnectAction extends SelectionListenerAction {
         super(Messages.getString(DisconnectAction.class.getName() + ".text"));
         this.view = view;
         setImageDescriptor(
-            QuantumPlugin.getImageDescriptor("disconnect.gif")); //$NON-NLS-1$
+                       ImageStore.getImageDescriptor(ImageStore.DISCONNECT));
     }
 
 
     public void run() {
-        for (Iterator i = this.selections.iterator(); i.hasNext();) {
+        for (Iterator i = this.selections.iterator(); i.hasNext(); ) {
             Bookmark bookmark = (Bookmark) i.next();
             try {
                 bookmark.disconnect();
-            } catch (ConnectionException e) {
-                e.printStackTrace();
+            } catch (SQLException e) {
+                SQLExceptionDialog.openException(
+                               this.view.getViewSite().getShell(), bookmark, e);
             }
         }
         updateStatusLine(getMessage("message"));