Quantum version 2.4.2
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / view / ViewHelper.java
index e460e44..7733294 100644 (file)
@@ -12,8 +12,10 @@ import java.sql.SQLException;
 
 import com.quantum.Messages;
 import com.quantum.QuantumPlugin;
+import com.quantum.model.Bookmark;
 import com.quantum.sql.MultiSQLServer;
 import com.quantum.sql.SQLResults;
+import com.quantum.ui.dialog.SQLExceptionDialog;
 
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.SWT;
@@ -27,23 +29,22 @@ import org.eclipse.ui.IViewPart;
  */
 public class ViewHelper {
 
-       public static SQLResults tryGetResults(IViewPart view, Connection con, String query) {
-               return tryGetResults(view.getSite().getShell(), con, query);
+       /** @deprecated */
+       public static SQLResults tryGetResults(IViewPart view, Bookmark bookmark, Connection con, String query) {
+               return tryGetResults(view.getSite().getShell(), bookmark, con, query);
        }
 
-       public static SQLResults tryGetResults(Shell shell, Connection con, String query) {
-               SQLResults results = null;      
-               MultiSQLServer server = MultiSQLServer.getInstance();
+       /** @deprecated */
+       public static SQLResults tryGetResults(Shell shell, Bookmark bookmark, Connection con, String query) {
                try {
-                       results = server.execute(con, query);
+                       MultiSQLServer server = MultiSQLServer.getInstance();
+                       return server.execute(bookmark, con, query);
                } catch (SQLException e) {
                        LogProxy log = LogProxy.getInstance();
                        log.addText(LogProxy.ERROR, e.getLocalizedMessage(), e); //$NON-NLS-1$ //$NON-NLS-2$
-                       results = new SQLResults();
-                       results.setIsError(true);
-                       MessageDialog.openConfirm(shell, "Database returned error", e.getLocalizedMessage());  //$NON-NLS-1$                                                    
+            SQLExceptionDialog.openException(shell, bookmark, e);
+                       return null;
                }
-               return results;
        }
        
        public static FileOutputStream askSaveFile(String key, Shell shell) {