Time for action – creating an E4 application

Eclipse applications use an application ID to launch and start execution. For E4 applications, org.eclipse.e4.ui.workbench.swt.E4Application is used. A new E4 application will be created to demonstrate a standalone E4 application.

  1. Go to the File | New | Project… menu and choose Plug-in Project.
  2. Use the name com.packtpub.e4.application, and step through the wizard. Choose the default values for each field, ensuring that the activator checkbox is selected, the This plug-in will make contributions to the UI is selected, and Would you like to create a rich client application? is Yes:
    Time for action – creating an E4 application
  3. Click on Next and then choose the Eclipse 4 RCP application template. Click on Next again and ensure that Create sample content is selected:
    Time for action – creating an E4 application
  4. Click on Finish and the project will be created.
  5. Right-click on the com.packtpub.e4.application project and choose Run As | Eclipse Application. This launches a new version of the IDE, which is not intended.

    Note

    To launch the project instead, double-click on the product file (called com.packtpub.e4.application.product) and click on the run icon in the top right:

    Time for action – creating an E4 application
  6. If a web-browser is launched when invoking the product, it may be that RAP is installed. If this happens, the product can be launched by going to the Run | Run As… and selecting the Eclipse Application type, followed by Run a product: com.packtpub.e4.application.product. Alternatively, the Overview tab has a Testing section, which includes a link to Launch an Eclipse Application. When the application is run, the default window should be shown:
    Time for action – creating an E4 application

What just happened?

The new E4 wizard created a simple E4 rich client application, including creating some sample content (menus, commands, and so on). After fixing issues with missing dependencies, the application can be launched as a product. If the application fails to launch with a message No application id has been found, it may be a missing dependency such as javax.xml:

!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: No application id has been found.

Note

When running any kind of Eclipse application, it is good practice to prevent launching when there are missing dependencies. The launch configuration, visible from the Run | Run Configurations… menu, has an option on the plug-ins tab Validate plug-ins automatically prior to launching, which performs a check prior to launching:

What just happened?

Now, when launching the product without adding the necessary plug-ins, a warning will be shown. The Validate Plug-ins button can be clicked to run this validation at any time.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.11.98