You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/05/08 16:17:57 UTC
svn commit: r773000 -
/incubator/pivot/trunk/wtk/src/pivot/wtk/DesktopApplicationContext.java
Author: gbrown
Date: Fri May 8 14:17:56 2009
New Revision: 773000
URL: http://svn.apache.org/viewvc?rev=773000&view=rev
Log:
Comment out OSX-specific code.
Modified:
incubator/pivot/trunk/wtk/src/pivot/wtk/DesktopApplicationContext.java
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/DesktopApplicationContext.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/DesktopApplicationContext.java?rev=773000&r1=772999&r2=773000&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/DesktopApplicationContext.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/DesktopApplicationContext.java Fri May 8 14:17:56 2009
@@ -56,40 +56,24 @@
// Hook into OSX application menu
if (System.getProperty("mrj.version") != null) {
+ /*
new com.apple.eawt.Application() {
{ addApplicationListener(new com.apple.eawt.ApplicationAdapter() {
@Override
public void handleAbout(com.apple.eawt.ApplicationEvent event) {
- // TODO i18n
- Display display = applicationContext.getDisplay();
-
- ArrayList<String> options = new ArrayList<String>();
- options.add("OK");
-
- Component body;
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- try {
- body = (Component)wtkxSerializer.readObject(getClass().getResource("about.wtkx"));
- } catch(Exception exception) {
- throw new RuntimeException(exception);
- }
-
- Alert alert = new Alert(MessageType.INFO, "About Apache Pivot", options, body);
- alert.setTitle("About");
- alert.setSelectedOption(0);
-
- alert.open(display);
-
+ showAboutDialog();
event.setHandled(true);
}
@Override
public void handleQuit(com.apple.eawt.ApplicationEvent event) {
exit();
+ event.setHandled(true);
}
});
}
};
+ */
}
}
@@ -174,6 +158,8 @@
private static HostFrame windowedHostFrame = null;
private static HostFrame fullScreenHostFrame = null;
+ private static Alert aboutDialog = null;
+
private static int x = 0;
private static int y = 0;
private static int width = 800;
@@ -408,4 +394,39 @@
args[0] = applicationClass.getName();
main(args);
}
+
+ /**
+ * Shows the platform "About" dialog.
+ */
+ public static void showAboutDialog() {
+ if (aboutDialog == null) {
+ Display display = applicationContext.getDisplay();
+
+ ArrayList<String> options = new ArrayList<String>();
+ options.add("OK");
+
+ Component body;
+ WTKXSerializer wtkxSerializer = new WTKXSerializer();
+ try {
+ // TODO i18n
+ body = (Component)wtkxSerializer.readObject(DesktopApplicationContext.class.getResource("about.wtkx"));
+ } catch(Exception exception) {
+ throw new RuntimeException(exception);
+ }
+
+ // TODO i18n
+ aboutDialog = new Alert(MessageType.INFO, "About Apache Pivot", options, body);
+ aboutDialog.setTitle("About");
+ aboutDialog.setSelectedOption(0);
+
+ aboutDialog.getWindowStateListeners().add(new WindowStateListener.Adapter() {
+ @Override
+ public void windowClosed(Window window, Display previousDisplay) {
+ aboutDialog = null;
+ }
+ });
+
+ aboutDialog.open(display);
+ }
+ }
}