cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amania...@apache.org
Subject svn commit: r604648 - in /cayenne/main/trunk/framework/cayenne-modeler/src/main: java/org/apache/cayenne/modeler/ java/org/apache/cayenne/modeler/action/ java/org/apache/cayenne/modeler/dialog/ java/org/apache/cayenne/modeler/util/ resources/org/apache...
Date Sun, 16 Dec 2007 16:42:40 GMT
Author: amaniatis
Date: Sun Dec 16 08:42:39 2007
New Revision: 604648

URL: http://svn.apache.org/viewvc?rev=604648&view=rev
Log:
CAY-923
Centre splash screen, remove link from http reference (any click in the window closes the
window) and add Documentation menu item.

Added:
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DocumentationAction.java
Modified:
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ActionManager.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerFrame.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/AboutDialog.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/BrowserControl.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/resources/org/apache/cayenne/modeler/cayennemodeler-strings.properties

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ActionManager.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ActionManager.java?rev=604648&r1=604647&r2=604648&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ActionManager.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ActionManager.java
Sun Dec 16 08:42:39 2007
@@ -46,6 +46,7 @@
 import org.apache.cayenne.modeler.action.CreateQueryAction;
 import org.apache.cayenne.modeler.action.CreateRelationshipAction;
 import org.apache.cayenne.modeler.action.DbEntitySyncAction;
+import org.apache.cayenne.modeler.action.DocumentationAction;
 import org.apache.cayenne.modeler.action.ExitAction;
 import org.apache.cayenne.modeler.action.FindAction;
 import org.apache.cayenne.modeler.action.GenerateCodeAction;
@@ -187,6 +188,7 @@
         registerAction(new GenerateDBAction(application));
         registerAction(new MigrateAction(application));
         registerAction(new AboutAction(application)).setAlwaysOn(true);
+        registerAction(new DocumentationAction(application)).setAlwaysOn(true);
         registerAction(new ConfigurePreferencesAction(application)).setAlwaysOn(true);
         registerAction(new ExitAction(application)).setAlwaysOn(true);
         registerAction(new NavigateBackwardAction(application)).setAlwaysOn(true);

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerFrame.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerFrame.java?rev=604648&r1=604647&r2=604648&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerFrame.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerFrame.java
Sun Dec 16 08:42:39 2007
@@ -47,6 +47,7 @@
 import org.apache.cayenne.modeler.action.CreateObjEntityAction;
 import org.apache.cayenne.modeler.action.CreateProcedureAction;
 import org.apache.cayenne.modeler.action.CreateQueryAction;
+import org.apache.cayenne.modeler.action.DocumentationAction;
 import org.apache.cayenne.modeler.action.ExitAction;
 import org.apache.cayenne.modeler.action.FindAction;
 import org.apache.cayenne.modeler.action.GenerateCodeAction;
@@ -172,7 +173,8 @@
         toolMenu.add(getAction(ConfigurePreferencesAction.getActionName()).buildMenu());
 
         helpMenu.add(getAction(AboutAction.getActionName()).buildMenu());
-
+        helpMenu.add(getAction(DocumentationAction.getActionName()).buildMenu());
+        
         JMenuBar menuBar = new JMenuBar();
 
         menuBar.add(fileMenu);

Added: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DocumentationAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DocumentationAction.java?rev=604648&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DocumentationAction.java
(added)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DocumentationAction.java
Sun Dec 16 08:42:39 2007
@@ -0,0 +1,46 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.modeler.action;
+
+import java.awt.event.ActionEvent;
+
+import org.apache.cayenne.modeler.Application;
+import org.apache.cayenne.modeler.util.BrowserControl;
+import org.apache.cayenne.modeler.util.CayenneAction;
+
+/**
+ * @author Aristedes Maniatis
+ */
+public class DocumentationAction extends CayenneAction {
+
+    private static final long serialVersionUID = 1L;
+
+    public final static String getActionName() {
+        return "Documentation";
+    }
+
+    public DocumentationAction(Application application) {
+        super(getActionName(), application);
+    }
+
+    public void performAction(ActionEvent e) {
+        BrowserControl.displayURL("http://cayenne.apache.org");
+    }
+}

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/AboutDialog.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/AboutDialog.java?rev=604648&r1=604647&r2=604648&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/AboutDialog.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/AboutDialog.java
Sun Dec 16 08:42:39 2007
@@ -134,6 +134,7 @@
         info.setText(getInfoString());
         
         this.pack();
+        this.setLocationRelativeTo(null);
         this.setVisible(true);
     }
     

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/BrowserControl.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/BrowserControl.java?rev=604648&r1=604647&r2=604648&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/BrowserControl.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/BrowserControl.java
Sun Dec 16 08:42:39 2007
@@ -19,7 +19,9 @@
 
 package org.apache.cayenne.modeler.util;
 
-import java.io.IOException;
+import java.lang.reflect.Method;
+
+import org.apache.commons.lang.SystemUtils;
 
 /**
  * Opens a URL in the system default browser.
@@ -28,8 +30,6 @@
  */
 public class BrowserControl {
 
-    // Used to identify the windows platform.
-    private static final String WIN_ID = "Windows";
     // The default system browser under windows.
     private static final String WIN_PATH = "rundll32";
     // The flag to display a url.
@@ -46,36 +46,35 @@
      * 
      * @param url the file's url (the url must start with either "http://" or "file://").
      */
+    // see public domain code at
+    // http://www.centerkey.com/java/browser/myapp/BareBonesBrowserLaunch.java
     public static void displayURL(String url) {
-        boolean windows = isWindowsPlatform();
-        String cmd = null;
         try {
-            if (windows) {
+            if (SystemUtils.IS_OS_WINDOWS) {
                 // cmd = 'rundll32 url.dll,FileProtocolHandler http://...'
-                cmd = WIN_PATH + " " + WIN_FLAG + " " + url;
+                String cmd = WIN_PATH + " " + WIN_FLAG + " " + url;
                 Runtime.getRuntime().exec(cmd);
             }
-            else {
-                // unsupported...
+            else if (SystemUtils.IS_OS_MAC_OSX) {
+                Class<?> fileManager = Class.forName("com.apple.eio.FileManager");
+                Method openURL = fileManager.getDeclaredMethod("openURL", new Class[] {String.class});
+                openURL.invoke(null, new Object[] {url});
+            }
+            else { // assume Unix or Linux
+                String[] browsers = {
+                        "firefox", "opera", "konqueror", "epiphany", "mozilla",
+                        "netscape"
+                };
+                for (String browser : browsers) {
+                    if (Runtime.getRuntime().exec(new String[] {"which", browser}).waitFor()
== 0) {
+                        Runtime.getRuntime().exec(new String[] {browser, url});
+                        break;
+                    }
+                }
             }
         }
-        catch (IOException ex) {
-            ex.printStackTrace();
+        catch (Exception ex) {
+            // could not open browser. Fail silently.
         }
-    }
-
-    /**
-     * Try to determine whether this application is running under Windows or some other
-     * platform by examing the "os.name" property.
-     * 
-     * @return true if this application is running under a Windows OS
-     */
-    public static boolean isWindowsPlatform() {
-        String os = System.getProperty("os.name");
-        if (os != null && os.startsWith(WIN_ID))
-            return true;
-        else
-            return false;
-
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/resources/org/apache/cayenne/modeler/cayennemodeler-strings.properties
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/resources/org/apache/cayenne/modeler/cayennemodeler-strings.properties?rev=604648&r1=604647&r2=604648&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/resources/org/apache/cayenne/modeler/cayennemodeler-strings.properties
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/resources/org/apache/cayenne/modeler/cayennemodeler-strings.properties
Sun Dec 16 08:42:39 2007
@@ -17,8 +17,7 @@
 
 cayenne.bugreport.url = http://issues.apache.org/cayenne/
 
-cayenne.modeler.about.info = (c) 2001-2007 Apache Software Foundation and individual authors.<br><br>\
-			<a href='http://cayenne.apache.org/'>http://cayenne.apache.org/</a></font><br>
+cayenne.modeler.about.info = (c) 2001-2007 Apache Software Foundation and individual authors.<br><br>http://cayenne.apache.org<br>
 
 
 // "New Project" dialog.



Mime
View raw message