cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgen...@apache.org
Subject svn commit: r604717 - in /cayenne/main/trunk: framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ modeler/cayenne-modeler-mac-ext/src/main/java/org/apache/cayenn...
Date Sun, 16 Dec 2007 21:46:44 GMT
Author: mgentry
Date: Sun Dec 16 13:46:43 2007
New Revision: 604717

URL: http://svn.apache.org/viewvc?rev=604717&view=rev
Log:
Fix for CAY-932 -- make OS X quit menu option (and Command-Q) operate correctly.

Modified:
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Application.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectAction.java
    cayenne/main/trunk/modeler/cayenne-modeler-mac-ext/src/main/java/org/apache/cayenne/modeler/MacOSXSetup.java

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Application.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Application.java?rev=604717&r1=604716&r2=604717&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Application.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Application.java
Sun Dec 16 13:46:43 2007
@@ -85,6 +85,9 @@
     protected BindingFactory bindingFactory;
     protected AdapterMapping adapterMapping;
 
+    // This is for OS X support
+    private boolean isQuittingApplication = false;
+
     public static Application getInstance() {
         return instance;
     }
@@ -354,5 +357,15 @@
         protected Window getDefaultParentWindow() {
             return frame;
         }
+    }
+
+    
+    public boolean isQuittingApplication() {
+        return isQuittingApplication;
+    }
+
+    
+    public void setQuittingApplication(boolean isQuittingApplication) {
+        this.isQuittingApplication = isQuittingApplication;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectAction.java?rev=604717&r1=604716&r2=604717&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectAction.java
Sun Dec 16 13:46:43 2007
@@ -95,6 +95,7 @@
      * Returns false if cancel closing the window, true otherwise.
      */
     public boolean checkSaveOnClose() {
+        System.out.println("mrg mrg mrg 1");
         ProjectController projectController = getProjectController();
         if (projectController != null && projectController.isDirty()) {
             UnsavedChangesDialog dialog = new UnsavedChangesDialog(Application.getFrame());
@@ -102,6 +103,8 @@
 
             if (dialog.shouldCancel()) {
                 // discard changes and DO NOT close
+                System.out.println("mrg mrg mrg 2");
+                Application.getInstance().setQuittingApplication(false);
                 return false;
             }
             else if (dialog.shouldSave()) {

Modified: cayenne/main/trunk/modeler/cayenne-modeler-mac-ext/src/main/java/org/apache/cayenne/modeler/MacOSXSetup.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/modeler/cayenne-modeler-mac-ext/src/main/java/org/apache/cayenne/modeler/MacOSXSetup.java?rev=604717&r1=604716&r2=604717&view=diff
==============================================================================
--- cayenne/main/trunk/modeler/cayenne-modeler-mac-ext/src/main/java/org/apache/cayenne/modeler/MacOSXSetup.java
(original)
+++ cayenne/main/trunk/modeler/cayenne-modeler-mac-ext/src/main/java/org/apache/cayenne/modeler/MacOSXSetup.java
Sun Dec 16 13:46:43 2007
@@ -53,8 +53,12 @@
 
         public void handleQuit(ApplicationEvent e) {
             if (!e.isHandled()) {
+                Application.getInstance().setQuittingApplication(true);
                 ((ExitAction) getAction(ExitAction.getActionName())).exit();
-                e.setHandled(true);
+                if (Application.getInstance().isQuittingApplication())
+                    e.setHandled(true);
+                else
+                    Application.getInstance().setQuittingApplication(false);
             }
         }
 



Mime
View raw message