new Preferences tree
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / wizards / BaseSQLPage.java
index 3c75b99..435f0cc 100644 (file)
@@ -1,6 +1,7 @@
 package com.quantum.wizards;
 
 import java.sql.SQLException;
+import java.util.Arrays;
 
 import com.quantum.adapters.DatabaseAdapter;
 import com.quantum.model.Bookmark;
@@ -10,10 +11,12 @@ import com.quantum.model.NotConnectedException;
 import com.quantum.sql.MultiSQLServer;
 import com.quantum.sql.SQLResultSetResults;
 import com.quantum.sql.SQLResults;
-import com.quantum.ui.dialog.ExceptionDisplayDialog;
+import com.quantum.ui.dialog.SQLExceptionDialog;
 import com.quantum.util.connection.ConnectionUtil;
 
 import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
 
 /**
  * @author BC Holmes
@@ -29,14 +32,14 @@ public abstract class BaseSQLPage extends WizardPage implements SQLPage {
         super(pageName);
     }
     public boolean performFinish() {
+               Bookmark bookmark = this.results.getBookmark();
                try {
-                       Bookmark bookmark = this.results.getBookmark();
                        bookmark.addQuery(getQueryText());
                        SQLResults sqlResults = MultiSQLServer.getInstance().execute(bookmark, 
                                        this.connectionUtil.getConnection(bookmark, getShell()), getQueryText());
                        return sqlResults == null ? false : true;
                } catch (SQLException e) {
-                       ExceptionDisplayDialog.openError(getShell(), null, null, e);
+                       SQLExceptionDialog.openException(getShell(), bookmark, e);
                        return false;
                }
        }
@@ -71,4 +74,25 @@ public abstract class BaseSQLPage extends WizardPage implements SQLPage {
        this.results = results;
                this.row = row;
     }
+       
+       /**
+        * @param table
+        * @param colName
+        * @param style
+        * @param pos
+        * @param width
+        */
+       protected void createTableColumn(Table table, String colName, int style, int pos, int width) {
+        TableColumn column = new TableColumn(table, style, pos);
+               column.setText(colName);                
+               column.setWidth(width);
+    }
+       
+       /**
+        * @param columnNames
+        * @return
+        */
+       protected java.util.List getColumnNamesAsList(String[] columnNames) {
+               return Arrays.asList(columnNames);      
+       }
 }