Author: jm
Date: 2012-01-02 11:41:44 -0800 (Mon, 02 Jan 2012)
New Revision: 27894
Modified:
core3/gui-distribution/trunk/assembly/src/main/resources/etc/custom.properties
core3/impl/trunk/swing-application-impl/pom.xml
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/CytoscapeMenus.java
Log:
Fixes #360: Removed second Quit menu on Mac OS X; Hooked CyShutdown into Quit
menu item
Modified:
core3/gui-distribution/trunk/assembly/src/main/resources/etc/custom.properties
===================================================================
---
core3/gui-distribution/trunk/assembly/src/main/resources/etc/custom.properties
2012-01-02 17:42:19 UTC (rev 27893)
+++
core3/gui-distribution/trunk/assembly/src/main/resources/etc/custom.properties
2012-01-02 19:41:44 UTC (rev 27894)
@@ -1,4 +1,4 @@
karaf.systemBundlesStartLevel=99
karaf.startlevel.bundle=200
org.osgi.framework.startlevel.beginning=200
-org.osgi.framework.system.packages.extra =
org.apache.karaf.branding,org.cytoscape.launcher.internal,com.sun.xml.internal.bind;
+org.osgi.framework.system.packages.extra =
org.apache.karaf.branding,org.cytoscape.launcher.internal,com.sun.xml.internal.bind,com.apple.eawt;
Modified: core3/impl/trunk/swing-application-impl/pom.xml
===================================================================
--- core3/impl/trunk/swing-application-impl/pom.xml 2012-01-02 17:42:19 UTC
(rev 27893)
+++ core3/impl/trunk/swing-application-impl/pom.xml 2012-01-02 19:41:44 UTC
(rev 27894)
@@ -127,5 +127,12 @@
<artifactId>jhall</artifactId>
<version>1.0</version>
</dependency>
+
+ <dependency>
+ <groupId>com.apple.developer</groupId>
+ <artifactId>AppleJavaExtensions</artifactId>
+ <version>1.6</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
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-01-02 17:42:19 UTC (rev 27893)
+++
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/CyActivator.java
2012-01-02 19:41:44 UTC (rev 27894)
@@ -124,6 +124,11 @@
import org.cytoscape.work.swing.undo.SwingUndoSupport;
import org.osgi.framework.BundleContext;
+import com.apple.eawt.Application;
+import com.apple.eawt.QuitHandler;
+import com.apple.eawt.QuitResponse;
+import com.apple.eawt.AppEvent.QuitEvent;
+
/**
*
*/
@@ -278,7 +283,6 @@
registerService(bc, undoAction, CyAction.class, new
Properties());
registerService(bc, redoAction, CyAction.class, new
Properties());
registerService(bc, printAction, CyAction.class, new
Properties());
- registerService(bc, exitAction, CyAction.class, new
Properties());
registerService(bc, preferenceAction, CyAction.class, new
Properties());
registerService(bc, bookmarkAction, CyAction.class, new
Properties());
registerService(bc, settingsAction, CyAction.class, new
Properties());
@@ -287,6 +291,12 @@
registerService(bc, cytoPanelEastAction, CyAction.class, new
Properties());
registerService(bc, cytoPanelSouthWestAction, CyAction.class,
new Properties());
+ if (isMac()) {
+ registerMacExitHandler(cytoscapeShutdownServiceRef);
+ } else {
+ registerService(bc, exitAction, CyAction.class, new
Properties());
+ }
+
Properties helpContentsTaskFactoryProps = new Properties();
helpContentsTaskFactoryProps.setProperty("preferredMenu",
"Help");
helpContentsTaskFactoryProps.setProperty("largeIconURL",
getClass().getResource("/images/ximian/stock_help.png").toString());
@@ -392,4 +402,18 @@
registerServiceListener(bc, layoutMenuPopulator, "addLayout",
"removeLayout",
CyLayoutAlgorithm.class);
}
+
+ private void registerMacExitHandler(final CyShutdown shutdown) {
+ Application application = Application.getApplication();
+ application.setQuitHandler(new QuitHandler() {
+ @Override
+ public void handleQuitRequestWith(QuitEvent event,
QuitResponse response) {
+ shutdown.exit(0);
+ }
+ });
+ }
+
+ private boolean isMac() {
+ return System.getProperty("os.name").startsWith("Mac OS X");
+ }
}
Modified:
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/view/CytoscapeMenus.java
===================================================================
---
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/view/CytoscapeMenus.java
2012-01-02 17:42:19 UTC (rev 27893)
+++
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/view/CytoscapeMenus.java
2012-01-02 19:41:44 UTC (rev 27894)
@@ -63,7 +63,9 @@
menuBar.addSeparator("File", 2.0);
menuBar.addSeparator("File", 4.0);
menuBar.addSeparator("File", 6.0);
- menuBar.addSeparator("File", 8.0);
+ if (!isMac()) {
+ menuBar.addSeparator("File", 8.0);
+ }
menuBar.addSeparator("Edit", 2.0);
menuBar.addSeparator("Edit", 4.0);
@@ -92,7 +94,11 @@
toolBar.addSeparator(8.0f);
}
- public JMenu getJMenu(String s) {
+ private boolean isMac() {
+ return System.getProperty("os.name").startsWith("Mac OS X");
+ }
+
+ public JMenu getJMenu(String s) {
return menuBar.getMenu(s);
}
--
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.