cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [1/2] cayenne git commit: CAY-2310 Modeler shows a warning dialog at each change xml file
Date Fri, 19 May 2017 13:16:56 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 947ddc6c1 -> d0f685dc6


CAY-2310 Modeler shows a warning dialog at each change xml file


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

Branch: refs/heads/master
Commit: 981d5d1b8c48026ece0c708ca5bf60ab73a18623
Parents: 09b0fdb
Author: Anton Dreka <drekoas@gmail.com>
Authored: Thu May 18 16:08:42 2017 +0300
Committer: Anton Dreka <drekoas@gmail.com>
Committed: Thu May 18 16:08:42 2017 +0300

----------------------------------------------------------------------
 .../cayenne/modeler/ProjectFileChangeTracker.java       | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/981d5d1b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectFileChangeTracker.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectFileChangeTracker.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectFileChangeTracker.java
index 66892d6..99866d2 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectFileChangeTracker.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectFileChangeTracker.java
@@ -54,8 +54,9 @@ public class ProjectFileChangeTracker extends Thread {
      */
     protected Map<String, FileInfo> files;
     protected boolean paused;
+    protected boolean isShownChangeDialog;
+    protected boolean isShownRemoveDialog;
     protected ProjectController mediator;
-
     public ProjectFileChangeTracker(ProjectController mediator) {
 
         this.files = new ConcurrentHashMap<>();
@@ -96,6 +97,7 @@ public class ProjectFileChangeTracker extends Thread {
         SwingUtilities.invokeLater(new Runnable() {
 
             public void run() {
+                isShownChangeDialog = true;
                 if (showConfirmation("One or more project files were changed by external
program. "
                         + "Do you want to load the changes?")) {
 
@@ -107,10 +109,10 @@ public class ProjectFileChangeTracker extends Thread {
                         Application.getInstance().getActionManager().getAction(OpenProjectAction.class)
                                 .openProject(fileDirectory);
                     }
-
                 } else {
                     mediator.setDirty(true);
                 }
+                isShownChangeDialog = false;
             }
         });
     }
@@ -121,6 +123,7 @@ public class ProjectFileChangeTracker extends Thread {
             SwingUtilities.invokeLater(new Runnable() {
 
                 public void run() {
+                    isShownRemoveDialog = true;
                     FileDeletedDialog dialog = new FileDeletedDialog(Application.getFrame());
                     dialog.show();
 
@@ -131,6 +134,7 @@ public class ProjectFileChangeTracker extends Thread {
                     } else {
                         mediator.setDirty(true);
                     }
+                    isShownRemoveDialog = false;
                 }
             });
         }
@@ -212,9 +216,9 @@ public class ProjectFileChangeTracker extends Thread {
             }
         }
 
-        if (hasDeletions) {
+        if (hasDeletions && !isShownRemoveDialog) {
             doOnRemove();
-        } else if (hasChanges) {
+        } else if (hasChanges && !isShownChangeDialog) {
             doOnChange();
         }
     }


Mime
View raw message