cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject cayenne git commit: Modeler: Fix disabled button after schema load canceled
Date Thu, 17 May 2018 14:27:42 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 5505164e9 -> b659b69d5


Modeler: Fix disabled button after schema load canceled


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/b659b69d
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/b659b69d
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/b659b69d

Branch: refs/heads/master
Commit: b659b69d518ee5d1469f5716137b23f94b52877f
Parents: 5505164
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Thu May 17 17:27:37 2018 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Thu May 17 17:27:37 2018 +0300

----------------------------------------------------------------------
 .../modeler/action/LoadDbSchemaAction.java      | 36 +++++++++-----------
 1 file changed, 17 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/b659b69d/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/LoadDbSchemaAction.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/LoadDbSchemaAction.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/LoadDbSchemaAction.java
index 671b7c7..45604fd 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/LoadDbSchemaAction.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/LoadDbSchemaAction.java
@@ -64,29 +64,28 @@ public class LoadDbSchemaAction extends CayenneAction {
         rootParent.getLoadDbSchemaButton().setEnabled(false);
         Thread thread = new Thread(() -> {
             LoadDbSchemaAction.this.setEnabled(false);
+            rootParent.lockToolbarButtons();
             draggableTreePanel.getMoveButton().setEnabled(false);
             draggableTreePanel.getMoveInvertButton().setEnabled(false);
-            rootParent.lockToolbarButtons();
-            DBConnectionInfo connectionInfo;
-            if (!datamapPreferencesExist()) {
-                final DataSourceWizard connectWizard = new DataSourceWizard(getProjectController(),
"Load Db Schema");
-                connectWizard.setProjectController(getProjectController());
-                if (!connectWizard.startupAction()) {
-                    return;
-                }
-                connectionInfo = connectWizard.getConnectionInfo();
-                saveConnectionInfo(connectWizard);
-            } else {
-                connectionInfo = getConnectionInfoFromPreferences();
-            }
             try {
+                DBConnectionInfo connectionInfo;
+                if (!datamapPreferencesExist()) {
+                    final DataSourceWizard connectWizard = new DataSourceWizard(getProjectController(),
"Load Db Schema");
+                    connectWizard.setProjectController(getProjectController());
+                    if (!connectWizard.startupAction()) {
+                        return;
+                    }
+                    connectionInfo = connectWizard.getConnectionInfo();
+                    saveConnectionInfo(connectWizard);
+                } else {
+                    connectionInfo = getConnectionInfoFromPreferences();
+                }
+
                 ReverseEngineering databaseReverseEngineering = new DatabaseSchemaLoader()
                         .load(connectionInfo, getApplication().getClassLoadingService());
-                draggableTreePanel
-                        .getSourceTree()
+                draggableTreePanel.getSourceTree()
                         .setEnabled(true);
-                draggableTreePanel
-                        .getSourceTree()
+                draggableTreePanel.getSourceTree()
                         .translateReverseEngineeringToTree(databaseReverseEngineering, true);
                 draggableTreePanel
                         .bindReverseEngineeringToDatamap(getProjectController().getCurrentDataMap(),
databaseReverseEngineering);
@@ -97,8 +96,7 @@ public class LoadDbSchemaAction extends CayenneAction {
                         exception.getMessage(),
                         "Error db schema loading",
                         JOptionPane.ERROR_MESSAGE);
-            }
-            finally {
+            } finally {
                 rootParent.getLoadDbSchemaButton().setEnabled(true);
                 rootParent.getLoadDbSchemaProgress().setVisible(false);
                 rootParent.unlockToolbarButtons();


Mime
View raw message