As expressed in the post Marketing IDE / was: Ctr-1 driven development: these are some proposed Eclipse IDE howto videos:

  • Create an E4 Application with PDE and E4Tools
  • Build an E4 Application with Tycho
  • Test E4 Application with SWTBot
  • Build JEE Application with WTP
  • Build Maven based JEE Application with WTP

Below there is an outline of the scripts. For the scripts I would prefer to get suggestions from the community, therefore any suggestion or comment is helpful

Create an E4 Application with PDE, Window builder and E4Tools

get Eclipse ide, install PDE, check window builder, install e4 tools. Create E4application, test run the application

Open the E4 Model Editor, Add menu, link command to handler

add datamodel; use e4 model editor to declare Part Class.

add user interface. edit UI with Windowbuilder.

show databinding to link datamodel with UI.

Build an E4 Application with Tycho

Get the existing e4 application, create the 4 additional projects: parent, repository, feature, and test .

Setup parent pom with needed repositories, trigger mvn clean verify

It is possible to make a second video on how to create a modular project set, where we have a platform application and more client projects

Remember to move the .product file into the repository

Test E4 Application with SWTBot

Get the existing application with Tycho test, edit the test project by adding a JUnit Test. Create a Test helper class to access the E4Context and provide some basic method to interact with E4 App Model. As example, below there is an example to switch perspective

public class E4Bot extends SWTBot {
 
        private IEclipseContext serviceContext;
 
        @SuppressWarnings("restriction")
        public E4Bot() {
                serviceContext = E4Workbench.getServiceContext();
        }
 
        /** used to switch perspective */
        public void switchPerspective(final String perspectiveId) {
                Display.getDefault().asyncExec(new Runnable() {
 
                        @Override
                        public void run() {
 
                                @SuppressWarnings("restriction")
                                IEclipseContext serviceContext =
                                                E4Workbench.getServiceContext();
 
                                IEclipseContext context = serviceContext.getActiveLeaf();
 
                                // model and app needed
                                EModelService modelService = context.get(EModelService.class);
                                MApplication application = context.get(MApplication.class);
                                // service to switch
                                EPartService partService = context.get(EPartService.class);
 
                                // get the element
                                MPerspective element =
                                                (MPerspective) modelService.find(perspectiveId,
                                                                application);
 
                                // Now switch perspective
                                partService.switchPerspective(element);
                        }
                });
 
        }
 
}

Create a JUnit test class that use the E4SwtBot to access the E4 Context  USe the recorder to record a test. run the test via run > JUnit plug-in tests, run the test via Tycho build

Build JEE Application with WTP

Install AS, Install WTP connectors for AS, launch application server from inside eclipse, verify the AS is running. Create an EJB Project , Write a basic HelloEJB Session bean.

Implementation of the HelloBeam

public @Stateless class HelloBean implements Hello { 
    @Override
    public String sayHello(String name) {
        return "Hello, " + name + "!";
    }
}

Create Dynamic Web Project, create a Servlet, reference the Hello EJB from project properties,

modify the Servlet code to respond using content stored in session bean

@EJB
private Hello hello;
  
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String name = request.getParameter("name");
    String out = hello.sayHello(name);
    response.getOutputStream().println( out );
}

Build Maven-based Java EE applications in Eclipse

use m2e-wtp project to provide tight integration between WTP and Maven.

A good source is the fbrickon video at EclipseCon 2014


2 Comments

Mickael · October 30, 2015 at 10:12

Thanks for those resources
About SWTBot and e4, there is in the recent versions of SWTBot ba plugin dedicated to e4 which I believe is worth being used for the video.
I don’t know it well so I suggest you to get in touchdev@eclipse.org mailing-list for more details. w

Olivier Prouvost · October 30, 2015 at 10:25

Hi Patrick,

Nice to see this initiative !

For the first video you should show how to use the wizard to create a new E4 Application (with or without content). As you probably know, the ‘E4 Application Project’ wizard has been removed (bug 473575). It is now replaced by the create new Plugin + make contribution to UI + ‘Yes’ as Eclipse RCP Application. You will get the wizard (bug 441331)

On the other hand I added another E4 wizard (bug 473570) to get an E4 plugin with a view contributing to any E4 application.

Probably we will find some time to speak about it during ECE in Ludwigsburg ?

See you
Olivier

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *