Refactoringaction: net.sourceforge.phpdt.ltk.ui.actions.RenameLocalVariable
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / actions / BaseExecuteAction.java
index c5ab79e..830e5ee 100644 (file)
@@ -15,6 +15,7 @@ import com.quantum.sql.SQLResultSetResults;
 import com.quantum.sql.SQLResults;
 import com.quantum.sql.SQLUpdateResults;
 import com.quantum.ui.dialog.ExceptionDisplayDialog;
+import com.quantum.ui.dialog.SQLExceptionDialog;
 import com.quantum.ui.dialog.SimpleSelectionDialog;
 import com.quantum.util.connection.ConnectionUtil;
 import com.quantum.view.LogProxy;
@@ -22,17 +23,16 @@ import com.quantum.view.tableview.TableView;
 
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IStatusLineManager;
 import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.actions.SelectionListenerAction;
 
 /**
  * @author BC
  */
-public abstract class BaseExecuteAction extends Action {
+public abstract class BaseExecuteAction extends SelectionListenerAction {
        
        class Metrics {
                int resultCount = 0;
@@ -81,6 +81,14 @@ public abstract class BaseExecuteAction extends Action {
        String execute1 = Messages.getString(BaseExecuteAction.class, "execute1");
        String execute2 = Messages.getString(BaseExecuteAction.class, "execute2");
 
+       protected BaseExecuteAction(String text) {
+               super(text);
+       }
+       
+       protected BaseExecuteAction() {
+               super(null);
+       }
+       
        public void run() {
                Bookmark bookmark = getBookmark();
                if (bookmark != null) {
@@ -102,7 +110,7 @@ public abstract class BaseExecuteAction extends Action {
                } catch (IOException e) {
                    ExceptionDisplayDialog.openError(getShell(), null, null, e);
                } catch (SQLException e) {
-                   ExceptionDisplayDialog.openError(getShell(), null, null, e);
+                   SQLExceptionDialog.openException(getShell(), bookmark, e);
                } catch (CoreException e) {
                    ErrorDialog.openError(getShell(), null, null, e.getStatus());
                }
@@ -197,9 +205,7 @@ public abstract class BaseExecuteAction extends Action {
                        LogProxy log = LogProxy.getInstance();
                        log.addText(LogProxy.ERROR,
                                "Error Executing: " + query + ":" + e.toString(), e); //$NON-NLS-1$ //$NON-NLS-2$
-                       MessageDialog.openConfirm(getShell(), 
-                                       "Database returned error", 
-                                       e.getLocalizedMessage());  //$NON-NLS-1$ 
+                       SQLExceptionDialog.openException(getShell(), bookmark, e);
                }
                return results;
        }