updating SQL plugin with latest Quantum code
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.sql / src / net / sourceforge / phpdt / sql / actions / ConnectAction.java
index e58acec..f104552 100644 (file)
@@ -1,5 +1,7 @@
 package net.sourceforge.phpdt.sql.actions;
 
+import java.sql.Connection;
+
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.viewers.ISelection;
@@ -7,13 +9,11 @@ import org.eclipse.ui.IViewActionDelegate;
 import org.eclipse.ui.IViewPart;
 import org.eclipse.ui.IWorkbenchPart;
 
-import net.sourceforge.phpdt.sql.sql.MultiSQLServer;
-import net.sourceforge.phpdt.sql.sql.SQLHelper;
+import net.sourceforge.phpdt.sql.Messages;
 import net.sourceforge.phpdt.sql.view.BookmarkView;
 import net.sourceforge.phpdt.sql.view.bookmark.BookmarkNode;
 
 public class ConnectAction extends Action implements IViewActionDelegate {
-       private SQLHelper helper = new SQLHelper();
        private BookmarkView view;
        /**
         * Constructor for Action1.
@@ -52,15 +52,14 @@ public class ConnectAction extends Action implements IViewActionDelegate {
         * @see org.eclipse.jface.action.IAction#run()
         */
        public void run() {
-               view.disconnect();
                BookmarkNode current = view.getCurrentBookmark();
-               view.setStatus("Connecting to " + current.getName() + "..."); //$NON-NLS-1$ //$NON-NLS-2$
-               boolean status = MultiSQLServer.getInstance().connect(current);
-               if (status) {
+               view.setStatus(Messages.getString("ConnectAction.ConnectingTo") + current.getName() + "...");  //$NON-NLS-2$ //$NON-NLS-1$
+               Connection con = current.getConnection();
+               if (con != null) {
                        view.refreshBookmarkData();
                        view.expandCurrent(current);
                } else {
-                       view.setStatus("Error while connecting to " + current.getName()); //$NON-NLS-1$
+                       view.setStatus(Messages.getString("ConnectAction.ErrorConnecting") + current.getName());  //$NON-NLS-1$
                }
        }
 }
\ No newline at end of file