Author: jm
Date: 2012-08-24 11:03:16 -0700 (Fri, 24 Aug 2012)
New Revision: 30267

Added:
   
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/view/MacFullScreenEnabler.java
Modified:
   
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/CyActivator.java
   
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/view/CytoscapeDesktop.java
Log:
Fixes #1398: Added workaround that tiptoes around the class loader so we don't 
trigger the loading of system classes that aren't present on platforms other 
than Mac OS X 10.7+

Modified: 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/CyActivator.java
===================================================================
--- 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/CyActivator.java
       2012-08-24 17:08:44 UTC (rev 30266)
+++ 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/CyActivator.java
       2012-08-24 18:03:16 UTC (rev 30267)
@@ -91,6 +91,7 @@
 import org.cytoscape.internal.view.CytoscapeMenuPopulator;
 import org.cytoscape.internal.view.CytoscapeMenus;
 import org.cytoscape.internal.view.CytoscapeToolBar;
+import org.cytoscape.internal.view.MacFullScreenEnabler;
 import org.cytoscape.internal.view.NetworkPanel;
 import org.cytoscape.internal.view.NetworkViewManager;
 import org.cytoscape.internal.view.ToolBarEnableUpdater;
@@ -463,7 +464,11 @@
                // Full screen actions.  This is platform dependent
                FullScreenAction fullScreenAction = null;
                if(isMac()) {
-                       fullScreenAction = new 
FullScreenMacAction(cytoscapeDesktop);
+                       if 
(MacFullScreenEnabler.supportsNativeFullScreenMode()) {
+                               fullScreenAction = new 
FullScreenMacAction(cytoscapeDesktop);
+                       } else {
+                               fullScreenAction = new 
FullScreenAction(cytoscapeDesktop);
+                       }
                } else {
                        fullScreenAction = new 
FullScreenAction(cytoscapeDesktop);
                }

Modified: 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/view/CytoscapeDesktop.java
===================================================================
--- 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/view/CytoscapeDesktop.java
     2012-08-24 17:08:44 UTC (rev 30266)
+++ 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/view/CytoscapeDesktop.java
     2012-08-24 18:03:16 UTC (rev 30267)
@@ -159,9 +159,8 @@
 
                setJMenuBar(cyMenus.getJMenuBar());
 
-               if(System.getProperty("os.name").startsWith("Mac OS X")) {
-                       // Enable full screen mode for 10.7+
-                       FullScreenUtilities.setWindowCanFullScreen(this, true);
+               if(MacFullScreenEnabler.supportsNativeFullScreenMode()) {
+                       MacFullScreenEnabler.setEnabled(this, true);
                }
 
                //don't automatically close window. Let shutdown.exit(returnVal)

Added: 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/view/MacFullScreenEnabler.java
===================================================================
--- 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/view/MacFullScreenEnabler.java
                         (rev 0)
+++ 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/view/MacFullScreenEnabler.java
 2012-08-24 18:03:16 UTC (rev 30267)
@@ -0,0 +1,27 @@
+package org.cytoscape.internal.view;
+
+import java.awt.Window;
+
+import com.apple.eawt.FullScreenUtilities;
+
+public class MacFullScreenEnabler {
+       public static void setEnabled(Window window, boolean b) {
+               FullScreenUtilities.setWindowCanFullScreen(window, true);
+       }
+
+       public static boolean supportsNativeFullScreenMode() {
+               if (!System.getProperty("os.name").startsWith("Mac OS X")) {
+                       return false;
+               }
+               
+               String[] parts = System.getProperty("os.version").split("[.]");
+               int majorNumber = Integer.parseInt(parts[0]);
+               
+               int minorNumber = 0;
+               if (parts.length > 1) {
+                       minorNumber = Integer.parseInt(parts[1]);
+               }
+               
+               return majorNumber == 10 && minorNumber >= 7;
+       }
+}

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to