Revision: 3989
Author: [email protected]
Date: Wed Nov 24 08:09:51 2010
Log: A few changes to the UI to keep the user from pressing buttons when
they shouldn't be able to.
http://code.google.com/p/power-architect/source/detail?r=3989
Modified:
/trunk/src/main/java/ca/sqlpower/architect/swingui/CompareDMPanel.java
/trunk/src/main/java/ca/sqlpower/architect/swingui/SQLScriptDialog.java
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/CompareDMPanel.java
Tue Nov 9 14:03:08 2010
+++ /trunk/src/main/java/ca/sqlpower/architect/swingui/CompareDMPanel.java
Wed Nov 24 08:09:51 2010
@@ -1293,11 +1293,10 @@
Messages.getString("CompareDMPanel.couldNotBeginDiffProcess"), ex);
//$NON-NLS-1$
return;
} catch (IOException ex) {
+ reenableGUIComponents();
ASUtils.showExceptionDialogNoReport(CompareDMPanel.this,
Messages.getString("CompareDMPanel.couldNotReadFile"), ex); //$NON-NLS-1$
logger.error("Could not read file", ex);
//$NON-NLS-1$
return;
- } finally {
- reenableGUIComponents();
}
compareWorker = new SPSwingWorker(session) {
@@ -1343,18 +1342,19 @@
message = "Finished";
logger.debug("Finished Compare");
} catch (CancellationException e) {
+ reenableGUIComponents();
setFinished(true);
}
}
public void cleanup() {
try {
- reenableGUIComponents();
if (getDoStuffException() != null) {
Throwable exc = getDoStuffException();
logger.error("Error in doStuff()", exc);
//$NON-NLS-1$
ASUtils.showExceptionDialog(session,
Messages.getString("CompareDMPanel.databaseComparisonFailed"), exc);
//$NON-NLS-1$
+ reenableGUIComponents();
return;
}
logger.debug("cleanup starts"); //$NON-NLS-1$
@@ -1373,6 +1373,7 @@
}
logger.debug("cleanup finished"); //$NON-NLS-1$
} catch (CancellationException e) {
+ reenableGUIComponents();
setFinished(true);
}
}
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/SQLScriptDialog.java
Mon Jun 14 11:54:52 2010
+++ /trunk/src/main/java/ca/sqlpower/architect/swingui/SQLScriptDialog.java
Wed Nov 24 08:09:51 2010
@@ -101,6 +101,8 @@
private SPSwingWorker executeTask;
+ private JButton executeButton;
+
/**
* Creates and packs a new SQL script dialog, but does not display it.
Call
* setVisible(true) to show the dialog, which will appear over or near
the
@@ -220,7 +222,7 @@
barBuilder.addRelatedGap();
barBuilder.addGlue();
- JButton executeButton = new JButton(execute);
+ executeButton = new JButton(execute);
executeButton.setText(Messages.getString("SQLScriptDialog.executeOption"));
//$NON-NLS-1$
barBuilder.addGridded(executeButton);
barBuilder.addRelatedGap();
@@ -382,6 +384,8 @@
logger.info("Starting DDL Generation at " + new
java.util.Date(System.currentTimeMillis())); //$NON-NLS-1$
logger.info("Database Target: " + target.getDataSource());
//$NON-NLS-1$
logger.info("Playpen Dump: " +
target.getDataSource()); //$NON-NLS-1$
+
+
SQLScriptDialog.this.executeButton.setEnabled(false);
Iterator<DDLStatement> it =
statements.iterator();
while (it.hasNext() && !isFinished() &&
!isCancelled()) {
DDLStatement ddlStmt = it.next();
@@ -450,6 +454,7 @@
} catch (SQLException ex) {
logger.error("Couldn't close
connection", ex); //$NON-NLS-1$
}
+
SQLScriptDialog.this.executeButton.setEnabled(true);
}
}