Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1] 2
Print
Author Topic: Eclipse plugin for pureMVC  (Read 32286 times)
gwinnem
Newbie
*
Posts: 9


View Profile WWW Email
« on: November 11, 2009, 03:05:48 »

Does anyone know about a good eclipse plugin for developing pureMVC apps ?
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #1 on: November 11, 2009, 07:07:09 »

Flex Builder (Flash Builder)? :)
Logged
meekgeek
Full Member
***
Posts: 25


View Profile Email
« Reply #2 on: November 11, 2009, 11:07:19 »

I was actually hoping to see some custom project files that would help you start coding with puremvc.  Maybe a quick key for "create new Mediator"  My java is not so good right now, but I'm hoping to one day get to this if no one else does it first.
Logged
Tekool
Sr. Member
****
Posts: 192


View Profile WWW Email
« Reply #3 on: November 11, 2009, 12:43:47 »

Do you both have tried "PureMVC generator" http://www.dehats.com/drupal/?q=node/31 it's Air but can help a lot.
Logged
gwinnem
Newbie
*
Posts: 9


View Profile WWW Email
« Reply #4 on: November 12, 2009, 02:23:59 »

I have tried the FCG air app tool. But i was asking if there was a specific plugin like Log4Flex where you with easy shortcut keys in eclipse can generate new SimpleCommands, Mediators etc...
And yes :) i have offcourse the flexbuilder plugin... ;D Im not exactly a novice developer since i have been developing java apps for the last 10 years in eclipse...

The reason for asking was that i was abit annoyed with the repetitive tasks for all the classes and if there is no plugin i would look into creating my own eclipse plugin..

Geirr
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #5 on: November 12, 2009, 08:30:33 »

There isn't one, to my knowledge. Though it would be helpful.

I kind of cheat a bit and use templates I created in FlashDevelop. I generate them when needed and then pull them into FB. It's a bit clumsy but it works. A plugin for Exclipse would be awesome, but I'm not the right person to write one (not a java guy).


there is also this ruby/ant thing http://blog.smartlogicsolutions.com/2008/12/05/introducing-puremvcgen-an-ant-based-puremvc-flex-generator/
« Last Edit: November 12, 2009, 08:34:04 by Jason MacDonald » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #6 on: November 13, 2009, 01:08:20 »

I haven't done any eclipse plugin work so I don't know how difficult it would be, but being an a die-hard eclipse user for nearly 10 years now, I can certainly say eclipse plugin would be nice!

-=Cliff>
Logged
gwinnem
Newbie
*
Posts: 9


View Profile WWW Email
« Reply #7 on: November 14, 2009, 06:01:37 »

Hi Cliff.

I was planning adding the following to the plugin:
  • Add PureMvc Nature
  • Create New Facade
  • Create New Proxy
  • Create New Mediator
  • Create New Simple Command
  • Create New Macro Command

The PureMvc Nature will only add the puremvcmulticore swc to the project for now.
Will extend it to also handle pipes.

I prefer storing the notification constants in the classes which the notification triggers.
Any pro's con's on this approach ?

Also would like some feedback on what you consider as a minimum of functions to include in the different actors.

Geirr
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #8 on: November 14, 2009, 09:19:39 »

I prefer storing the notification constants in the classes which the notification triggers.
Not a good practice for two reasons:

1) It creates a 'forward-coupling' (knowing who you're sending the note to defeats the purpose of publish/subscribe)

2) When more than one actor responds to the note, this strategy isn't helpful because you only know one of the actors who is interested, and now unrelated actors must reference the actor who defined the constant in order to be interested in it.

If you don't like defining them on the facade, simply put them in an ApplicationConstants file. From there they can always be refactored easily should you want to break your model off into a separate package for use by another app.

-=Cliff>
Logged
gwinnem
Newbie
*
Posts: 9


View Profile WWW Email
« Reply #9 on: November 14, 2009, 11:54:09 »

Tnxs Cliff.
Do you have comments on the other question.

Geirr
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #10 on: November 15, 2009, 05:15:26 »

The first choice you have to make is Standard and MultiCore. This will lead you to two slightly different sets of templates. This will determine the library you put in the libs folder.

Then you'll need to find out what the package is (i.e. com.me.myapp). This will determine the structure under the src folder, and the package name in each class.

I'll have a go at some default templates for Standard and MultiCore actors here.

Standard Version Templates

A Standard Version app would have this packaging (minimally):

com.me.myapp.ApplicationFacade
com.me.myapp.ApplicationConstants
com.me.myapp.controller.StartupCommand
com.me.myapp.model.*
com.me.myapp.model.vo.*
com.me.myapp.view.*
com.me.myapp.view.components.*

Standard ApplicationFacade
:
package com.me.myapp
{
import com.me.myapp.controller.StartupCommand;

import org.puremvc.as3.patterns.facade.Facade;

        public static const STARTUP:String = "/note/startup";

        public function ApplicationFacade(  )
        {
                super();
        }

        public static function getInstance() : ApplicationFacade
        {
            if ( instance == null ) instance = new ApplicationFacade( );
            return instance as ApplicationFacade;
        }


        override protected function initializeController():void
        {
                super.initializeController();
registerCommand( STARTUP, StartupCommand );

// Register your initial commands here...

        }

        public function startup( app:Object ):void
        {
                sendNotification( STARTUP, app );
        }
}

Standard Mediator
:
package com.me.myapp.view
{
import com.me.myapp.ApplicationConstants;
import com.me.myapp.view.components.*;

import org.puremvc.as3.interfaces.INotification;
import org.puremvc.as3.patterns.mediator.Mediator;

public class SomeMediator extends Mediator
{
public static const NAME:String = 'SomeMediator';

  public function SomeMediator( viewComponent:Object )
{
super( NAME, viewComponent );
}

override public function onRegister():void
{
   // Add your initialization activities here not in the constructor
                   // Add event listeners to your component, fetch references to
                   // frequently accessed proxies, etc.
}

override public function listNotificationInterests():Array
{

return [ //ApplicationConstants.SOME_NOTE
         ];
}

override public function handleNotification( note:INotification ):void
{
/*
switch ( note.getName() )
{
case ApplicationConstants.SOME_NOTE:
myComponent.someProp = note.getBody() as SomeClass;
break;
}
*/
}

override public function onRemove():void
{
   // Remove any listeners, null component references, etc.
}

protected function get myComponent():MyComponent
{
return viewComponent as MyComponent;
}
}
}

Standard Proxy
:
package com.me.myapp.model
{
import org.puremvc.as3.patterns.proxy.Proxy;

public class SomeProxy extends Proxy
{
public static const NAME:String = 'SomeProxy';

public function SomeProxy( )
{
super ( NAME );
}

override public function onRegister():void
{
   // Add your initialization activities here not in the constructor
                   // Add services or delegates and their event listeners, etc.
}

override public function onRemove():void
{
   // Remove any listeners, null references, etc.
}
}

Standard SimpleCommand
:
package com.me.myapp.controller
{
import com.me.myapp.ApplicationConstants;

import org.puremvc.as3.interfaces.INotification;
import org.puremvc.as3.patterns.command.SimpleCommand;

public class StartupCommand extends SimpleCommand
{
override public function execute(note:INotification):void
{
// Prepare the Model
//facade.registerProxy( new SomeProxy() );

// Prepare the View
//var app:Shell = note.getBody() as Shell;
//facade.registerMediator( new ShellMediator( app ) );
}
}
}

Standard Command
:
package com.me.myapp.controller
{
    import org.puremvc.as3.interfaces.*;
    import org.puremvc.as3.patterns.command.*;

    public class SomeMacroCommand extends MacroCommand
    {
       
        override protected function initializeMacroCommand() :void
        {
            //Add your subcommands here
            //addSubCommand( SomeSubCommand );
        }
    }
}


MultiCore Templates

A MultiCore app with a Shell and two modules ModuleA and ModuleB would have a package like this (minimally):
com.me.myapp.common.ApplicationConstants
com.me.myapp.common.model.*
com.me.myapp.common.view.*

com.me.myapp.shell.ShellFacade
com.me.myapp.shell.controller.StartupCommand
com.me.myapp.shell.model.*
com.me.myapp.shell.view.*
com.me.myapp.shell.view.components.*

com.me.myapp.modulea.ModuleAFacade
com.me.myapp.modulea.controller.StartupCommand
com.me.myapp.modulea.model.*
com.me.myapp.modulea.view.*

com.me.myapp.moduleb.ModuleBFacade
com.me.myapp.moduleb.controller.StartupCommand
com.me.myapp.moduleb.model.*
com.me.myapp.moduleb.view.*

MultiCore ApplicationFacade
:
package com.me.myapp.shell
{
import com.me.myapp.shell.controller.StartupCommand;

import org.puremvc.as3.multicore.patterns.facade.Facade;

        public static const STARTUP:String = "/note/startup";

        public function ApplicationFacade( key:String )
        {
                super(key);
        }

        public static function getInstance( key:String ) : ApplicationFacade
        {
            if ( instanceMap[ key ] == null ) instanceMap[ key ]  = new ApplicationFacade( key );
            return instanceMap[ key ] as ApplicationFacade;
        }

        override protected function initializeController():void
        {
                super.initializeController();
registerCommand( STARTUP, StartupCommand );

// Register your initial commands here...

        }

        public function startup( app:Object ):void
        {
                sendNotification( STARTUP, app );
        }
}

MultiCore Mediator
:
package com.me.myapp.shell.view
{
import com.me.myapp.common.ApplicationConstants;
import com.me.myapp.view.components.*;

import org.puremvc.as3.multicore.interfaces.INotification;
import org.puremvc.as3.multicore.patterns.mediator.Mediator;

public class SomeMediator extends Mediator
{
public static const NAME:String = 'SomeMediator';

  public function SomeMediator( viewComponent:Object )
{
super( NAME, viewComponent );
}

override public function onRegister():void
{
   // Add your initialization activities here not in the constructor
                   // Add event listeners to your component, fetch references to
                   // frequently accessed proxies, etc.
}

override public function listNotificationInterests():Array
{

return [ //ApplicationConstants.SOME_NOTE
         ];
}

override public function handleNotification( note:INotification ):void
{
/*
switch ( note.getName() )
{
case ApplicationConstants.SOME_NOTE:
myComponent.someProp = note.getBody() as SomeClass;
break;
}
*/
}

override public function onRemove():void
{
   // Remove any listeners, null component references, etc.
}

protected function get myComponent():MyComponent
{
return viewComponent as MyComponent;
}
}
}

MultiCore Proxy
:
package com.me.myapp.shell.model
{
import org.puremvc.as3.multicore.patterns.proxy.Proxy;

public class SomeProxy extends Proxy
{
public static const NAME:String = 'SomeProxy';

public function SomeProxy( )
{
super ( NAME );
}

override public function onRegister():void
{
   // Add your initialization activities here not in the constructor
                   // Add services or delegates and their event listeners, etc.
}

override public function onRemove():void
{
   // Remove any listeners, null references, etc.
}
}

MultiCore SimpleCommand
:
package com.me.myapp.shell.controller
{
import com.me.myapp.common.ApplicationConstants;

import org.puremvc.as3.multicore.interfaces.INotification;
import org.puremvc.as3.multicore.patterns.command.SimpleCommand;

public class StartupCommand extends SimpleCommand
{
override public function execute(note:INotification):void
{
// Prepare the Model
//facade.registerProxy( new SomeProxy() );

// Prepare the View
//var app:Shell = note.getBody() as Shell;
//facade.registerMediator( new ShellMediator( app ) );
}
}
}

MultiCore Command
:
package com.me.myapp.shell.controller
{
    import org.puremvc.as3.multicore.interfaces.*;
    import org.puremvc.as3.multicore.patterns.command.*;

    public class SomeMacroCommand extends MacroCommand
    {
       
        override protected function initializeMacroCommand() :void
        {
            //Add your subcommands here
            //addSubCommand( SomeSubCommand );
        }
    }
}

-=Cliff>
« Last Edit: November 15, 2009, 05:30:14 by puremvc » Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #11 on: November 16, 2009, 07:36:15 »

If I could make one small request, please ensure the template are editable :) Or, if possible, allow for creation of custom templates in addition to the defaults :)
« Last Edit: November 16, 2009, 07:43:25 by Jason MacDonald » Logged
gwinnem
Newbie
*
Posts: 9


View Profile WWW Email
« Reply #12 on: November 16, 2009, 10:14:13 »

I was planning todo the templates in xml so its possible to edit them.
In eclipse it would be easy to edit them.

I posted a small blog post at http://gwinnem.wordpress.com/2009/11/14/building-a-puremvc-multicore-eclipse-plugin-creating-a-preference-page/

Just to give a small impression on what i plan for the plugin.

Feel free to give me some input regarding this.

In the next tutorial i plan to explain howto create the context menu items for this plugin

Rgds
Geirr
Logged
swidnikk
Courseware Beta
Jr. Member
***
Posts: 13


View Profile Email
« Reply #13 on: January 08, 2010, 06:06:19 »

I wish it was easier as this would be immensely useful (especially in team environments). Here's a full blown tutorial from IBM

http://www.ibm.com/developerworks/edu/os-dw-os-eclipse-code-templates.html

http://www.ibm.com/developerworks/opensource/library/os-eclipse-plugin-templates/?S_TACT=105AGY82&S_CMP=GENSITE
Logged
gwinnem
Newbie
*
Posts: 9


View Profile WWW Email
« Reply #14 on: January 11, 2010, 04:35:01 »

I am sorry to inform you that the first final version of this plugin will not be opensource. I just got a contract with http://ahead.com and i will do the first verion for them.

Geirr
Logged
Pages: [1] 2
Print