pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Noel Grandin <noelgran...@gmail.com>
Subject Re: [patch] making it easier to run stuff from an IDE
Date Fri, 01 May 2009 20:05:34 GMT
My pleasure.

The annotation stuff mentioned there looks a lot like the EJB
@Resource injection annotation.
  http://java.sun.com/developer/technicalArticles/J2EE/injection/

I agree, I think annotations like that would be a great help.

On Fri, May 1, 2009 at 17:01, Greg Brown <gkbrown@mac.com> wrote:
> This is great. I just submitted a minor change to the variable names and Javadoc, but
otherwise I love this. Combined with the annotation change proposed here:
>
> http://java.dzone.com/news/building-simple-rss-client
>
> it will be much easier to write and launch apps in Pivot 1.2. Thanks!
>
>
> 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