pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Volkert <tvolk...@gmail.com>
Subject Re: [patch] making it easier to run stuff from an IDE
Date Fri, 01 May 2009 14:34:32 GMT
Yep - agreed.  I just applied it :)

-T

On Fri, May 1, 2009 at 10:31 AM, Greg Brown <gkbrown@mac.com> wrote:
> Excellent idea. It makes double-clickable Pivot JARs possible, too. Cool.
>
> On Friday, May 01, 2009, at 10:01AM, "Noel Grandin" <noelgrandin@gmail.com> wrote:
>>Hi
>>
>>I've been using the following patch to DeskopApplicationContext for my
>>code quite a bit.
>>
>>It makes it easier to make my pivot code runnable from inside an IDE -
>>now I can just point Eclipse to one of my classes and got "Run As Java
>>Application"
>>
>>Regards, Noel.
>>
>>Index: wtk/src/pivot/wtk/DesktopApplicationContext.java
>>===================================================================
>>--- wtk/src/pivot/wtk/DesktopApplicationContext.java   (revision 770656)
>>+++ wtk/src/pivot/wtk/DesktopApplicationContext.java   (working copy)
>>@@ -26,6 +26,7 @@
>>
>> import pivot.collections.HashMap;
>> import pivot.collections.immutable.ImmutableMap;
>>+import pivot.tutorials.layout.Forms;
>> import pivot.wtk.media.Image;
>> import pivot.wtk.media.Picture;
>>
>>@@ -172,6 +173,25 @@
>>         System.exit(0);
>>     }
>>
>>+    /**
>>+     * Utility method to make it easier to define main() entry-points in applications.
>>+     *
>>+     * Then your main class looks like:
>>+     * <code>
>>+     * public class MyApp implements Application {
>>+     *   public static void main(String[] args) throws Exception {
>>+     *     DesktopApplicationContext.main(MyApp.class, args);
>>+     *   }
>>+     * }
>>+     * </code>
>>+     */
>>+    public static void main(Class<? extends Application> clazz, String[]
args) {
>>+      String [] newArgs = new String[args.length+1];
>>+      System.arraycopy(args, 0, newArgs, 1, args.length);
>>+      newArgs[0] = clazz.getName();
>>+      main(newArgs);
>>+    }
>>+
>>     public static void main(String[] args) {
>>         if (application != null) {
>>             throw new IllegalStateException();
>>
>>
>

Mime
View raw message