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;
*/
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) {