Author: jfuerth
Date: Tue Oct  7 15:44:38 2008
New Revision: 2756

Modified:
   trunk/src/ca/sqlpower/architect/swingui/SQLScriptDialog.java
   trunk/src/ca/sqlpower/architect/swingui/messages.properties

Log:
The error messages in the SQL Script executor error dialog were not showing up because the "<html>" tag was duplicated: it appeared once in the java code, and again in the properties file.

I fixed that problem and improved the overall layout of the dialog while I was in there making changes.

Modified: trunk/src/ca/sqlpower/architect/swingui/SQLScriptDialog.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/SQLScriptDialog.java        
(original)
+++ trunk/src/ca/sqlpower/architect/swingui/SQLScriptDialog.java Tue Oct 7 15:44:38 2008
@@ -346,22 +346,24 @@
                                                logger.info("executing: " + 
ddlStmt.getSQLText()); //$NON-NLS-1$
                                                
stmt.executeUpdate(ddlStmt.getSQLText());
                                                stmtsCompleted++;
-                                       } catch (SQLException ex) {
-                                               final Exception fex = ex;
-                                               final String fsql = 
ddlStmt.getSQLText();
+                                       } catch (final SQLException ex) {
+ final String fsql = ddlStmt.getSQLText() == null ? null : ddlStmt.getSQLText().trim(); logger.info("sql statement failed: " + ex.getMessage()); //$NON-NLS-1$
                                                try {
                                                        
SwingUtilities.invokeAndWait(new Runnable() {
                                                                public void 
run() {
-                                                                       
JTextArea jta = new JTextArea(fsql,25,40);
+                                                                       
JTextArea jta = new JTextArea(fsql);
+                                                                       
jta.setOpaque(false);
                                                                        
jta.setEditable(false);
-                                                                       
JScrollPane jsp = new JScrollPane(jta);
- JLabel errorLabel = new JLabel("<html>" + Messages.getString("SQLScriptDialog.sqlStatementFailed", fex.getMessage() + "<p>") + "</html>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-                                                                       JPanel 
jp = new JPanel(new BorderLayout());
-                                                                       
jp.add(jsp,BorderLayout.CENTER);
-                                                                       
jp.add(errorLabel,BorderLayout.SOUTH);
-                                                                       int 
decision = JOptionPane.showConfirmDialog
- (SQLScriptDialog.this, jp, Messages.getString("SQLScriptDialog.sqlFailure"), JOptionPane.YES_NO_OPTION); //$NON-NLS-1$
+                                                                       JPanel 
jp = new JPanel(new BorderLayout(0, 10));
+ jp.add(new JLabel(Messages.getString("SQLScriptDialog.sqlStatementFailed", ex.getMessage())), BorderLayout.NORTH);
+                                                                       
jp.add(jta, BorderLayout.CENTER);
+ jp.add(new JLabel(Messages.getString("SQLScriptDialog.continuePrompt")), BorderLayout.SOUTH);
+                                                                       int 
decision = JOptionPane.showConfirmDialog(
+                                                                               
SQLScriptDialog.this,
+                                                                               
jp,
+ Messages.getString("SQLScriptDialog.sqlFailure"), //$NON-NLS-1$
+                                                                               
JOptionPane.YES_NO_OPTION);
                                                                        if 
(decision == JOptionPane.NO_OPTION) {
                                                                                
logger.info("Export cancelled by user."); //$NON-NLS-1$
                                                                                
cancelJob();

Modified: trunk/src/ca/sqlpower/architect/swingui/messages.properties
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/messages.properties (original)
+++ trunk/src/ca/sqlpower/architect/swingui/messages.properties Tue Oct 7 15:44:38 2008
@@ -323,7 +323,8 @@
 SQLScriptDialog.saveOption=Save
SQLScriptDialog.specifyATargetDb=You have to specify a target database connection\nbefore executing this script.
 SQLScriptDialog.sqlFailure=SQL Failure
-SQLScriptDialog.sqlStatementFailed=<html>This SQL statement failed: {0}<p>Do you want to continue?</html> +SQLScriptDialog.sqlStatementFailed=<html>A SQL statement in the script failed to execute.<br><br>Reason: <b>{0}</b>
+SQLScriptDialog.continuePrompt=Do you want to continue?
SQLScriptDialog.successfullyExecuted=Successfully executed {0} out of {1} statements.
 SQLScriptDialog.yourTargetDbIs=Your Target Database is
SwingUIProject.cannotCreateOutputFile=Unable to create output file for save operation, data NOT saved.\n

Reply via email to