01: package liquibase;
02:
03: import liquibase.database.Database;
04: import liquibase.exception.JDBCException;
05: import liquibase.util.StreamUtil;
06:
07: import javax.swing.*;
08:
09: public class SwingUIFacade implements UIFacade {
10: /**
11: * Displays swing-based dialog about running against a non-localhost database.
12: * Returns true if the user selected that they are OK with that.
13: */
14: public boolean promptForNonLocalDatabase(Database database)
15: throws JDBCException {
16: return JOptionPane.showConfirmDialog(null,
17: "You are running a database migration against a non-local database."
18: + StreamUtil.getLineSeparator()
19: + "Database URL is: "
20: + database.getConnectionURL()
21: + StreamUtil.getLineSeparator()
22: + "Username is: "
23: + database.getConnectionUsername()
24: + StreamUtil.getLineSeparator()
25: + StreamUtil.getLineSeparator()
26: + "Area you sure you want to do this?",
27: "Confirm", JOptionPane.YES_NO_OPTION,
28: JOptionPane.WARNING_MESSAGE) == JOptionPane.NO_OPTION;
29: }
30:
31: }
|