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;
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.
* @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