Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EDT:New Project Wizard"

Line 1: Line 1:
 
= Introduction  =
 
= Introduction  =
  
In order to start EGL programming, the first thing is to create a new EGL project. The EGL new project wizard looks very much the same as other eclipse new project wizards. If you're familiar with eclipse, it will be very easy to handle and create a new project in EDT. In this page, we will introduce EGL project type, how to create each kind of project and finally how to extend EGL project wizard to create your own project type.  
+
In order to start EGL programming, the first thing is to create a new EGL project. The EGL new project wizard looks very much the same as other eclipse new project wizards. If you're familiar with eclipse, it will be very easy to handle and create a new project in EDT. In this page, we will introduce,
 +
 
 +
#EGL project types.
 +
#How to create each kind of project.
 +
#How to extend EGL project wizard to create your own project type.
 +
 
 +
Notice: If you're only interested in using the EDT (do not want to extend the EDT), then you can focus on the 1st & 2nd topics. 
  
 
= EGL Project Type  =
 
= EGL Project Type  =

Revision as of 01:10, 4 January 2012

Introduction

In order to start EGL programming, the first thing is to create a new EGL project. The EGL new project wizard looks very much the same as other eclipse new project wizards. If you're familiar with eclipse, it will be very easy to handle and create a new project in EDT. In this page, we will introduce,

  1. EGL project types.
  2. How to create each kind of project.
  3. How to extend EGL project wizard to create your own project type.

Notice: If you're only interested in using the EDT (do not want to extend the EDT), then you can focus on the 1st & 2nd topics. 

EGL Project Type

There are 4 types of project templates in the EDT released.

  1. Basic project: It is used for developing EGL programs, services, and libraries. The project can be configured to generate to multiple target languages.
    Typical usages:Batch (command line) programs, Common libraries and records, Web services, Data access services and libraries.
  2. Web 2.0 client application project:It is used for developing rich web applications that utilize existing web services. EGL Rich UI code is generated to JavaScript and HTML. Applications are deployed to web application servers, such as Apache Tomcat.
    Typical usages: Web client for existing services, Mashup applications,
    Target languages: JavaScript
  3. Web 2.0 client with services application project: Creates a project for developing rich web applications and related services accessible from standard web browsers. Service code is generated to Java and EGL Rich UI code is generated to JavaScript™ and HTML. Applications are deployed to web application servers, such as Apache Tomcat.
    Typical usages: End-to-end client/server application
    Target languages: Java, JavaScript
  4. Hello world project: This is a simple example application that demonstrates an EGL Rich UI web application calling an EGL service.

Notice that, besides the 4 built-in project types, developers can extend the project wizard to add their own project types. In a new project type, developers can add a bunch of setting parameter, add new default packages and handlers and include default copyright statements etc. The hello world project is also an example to demonstrate the extensibility.

Create a New EGL Project

Open New Project Wizard

  1. From the menu bar in the EGL perspective, click File > New > EGL Project. The EGL Project window opens.
  2. The EGL Project window is as shown in the following snapshot.  
    • Project name: This field is required. Developers must specify a name for the new project.
    • If you want the project to be created in your Eclipse workspace, leave the Use the default location for the project check box selected.
    • Select the template you want to use. An introduction will be shown in the right pane when a template is selected. The selected template will be remembered. When you create a new project, the template being used last time will be selected by default.
      New Project Window
  3. Select the template you want and click next to go to the next setting page.

Create a Basic Project

  1. Open new project wizard as described in the last section, select "Basic" and click Next
  2. The EGL Setting Page will display as following snapshot. You can specify the compiler and generator setting for the new project (You can refer to this article for the detailed introduction of compiler & generator settings). Notice that, you can change these setting after project created.
    • Compiler Selection: You can specify the compiler used in the new project. The default and compiler is EDT compiler. Developers can extend or implement their own compilers to be shown here.
    • The default new project generator setting complies to the workspace setting. You can set the project specific generator setting by check the "override the generation settings from workspace preference". It is good practice to save the most frequently generator setting by configuring the workspace generator preference.
    • If the checkbox is checked, you can specify a set of generators by select or deselect the appropriate generator name. Notice that, developer can also extend their own generators to be shown here.
    • If you want to change the name of the default generation folder for the selected generator, type the desired folder name in the Default generation folder field on the tab of the selected generator.
    • Click Next, the EGL Build Path page is displayed.
      Basic Project Setting page
  3. On the EGL Build Path Page, you can specify the dependent EGL projects for the new project. Notice that, you can change these setting after project created.
    • On the Projects tab, select any other projects in your workspace to be added to the build path of the new project.
      EGL Build Path
    • On the Order and Export tab, optionally reorder the names of the projects that will be available to projects that reference the current project.
      Order and Export
  4. Click Finish, a new project is created in the workspace. The project in the project Explorer looks like the picture. EGLSource folder and a egldd file is created in the project.
    Basic Project

Create a Web 2.0 Client Project

  1. Open new project wizard as described in the last section, select "Web 2.0 client application" and click Next
  2. Web 2.0 setting page is displayed as the following image.
    • Base Package is an optional field. The Web 2.0 project includes a default package "client". If the base package field is specified, the default package name will be #basePackageName#.client. For example, base package name is sample, the created project will have a default package sample.client.
    • Widget Library Selection: EDT Web 2.0 project can use web 2.0 widget in the project. There are already 2 built-in widget projects which includes dozens of widgets. Developer can also extend new widget project or new version of widget project. All the widget projects will be listed in this page. Users can select the widget they want to use in the project.
      Web .0 client application project
      • The standard widgets and utilities is selected by default and can not be deselected.
      • When clicking at the widget project line, the description is shown in the bottom
      • User can switch version by click in the version field. For example, Dojo widgets have local version and remote version.
        Switch widget project version
    • Click Next to the EGL Build Path Page
  3. EGL Build Path Page is the same as Basic project.
  4. Click Finish, several new projects are created in the workspace. The projects include the newly created egl project and the selected widget projects(EGL widget project and Dojo widget project in the snapshot). The Web 2.0 client project should have EGLSource folder and WebContent folder; A default package samples.client is also created in the EGLSource folder.
    Web 2.0 client project

Create a Web 2.0 Client with Services Project

Web 2.0 Client with Services Project has the same wizard page as Web 2.0 Client project. The difference is in the created project generator setting and package layer.

  1. Open new project wizard as described in the last section, select "Web 2.0 client with services application" and click Next
  2. Web 2.0 setting page is the same as the last section. We can select remote Dojo widget project here to check the different widget project.
    Widget project setting
  3. EGL Build Path Page is the same as Basic project.
  4. Click Finish, several new projects are created in the workspace. The projects include the newly created egl project and the selected widget projects(EGL widget project and Remote Dojo widget project in the snapshot). The Web 2.0 client with services project should have EGLSource folder and WebContent folder.
    Web 2.0 client with services project
    The differences with Web 2.0 client application project includes:
    • There are 3 default packages: client, common, server.
    • client package is used to contain the UI handlers. This package only generates javascript.
    • common package can be used to contain common libraries, records etc. This package generates both java and javascript.
    • server package can be used to contain the service parts.This package generates both java and javascript.

Add New Project Type

EDT is extensible both in the language and the IDE. Developers can implement their own language feature by extend compiler/generaters, they can also extend the IDE to support the new language features. Project type and wizard is the same. We will introduce how to extend a new project type in this section by create a very simple sample project type.

First of all, you must set up the development environment for EDT. Please refer to EDT:Developer's_Guide_to_Getting_Started_on_EDT for more information

Create Extension Point

Project templates are implemented as an extension point in org.eclipse.edt.ide.ui
<extension-point id="projectTemplates" name="EGL Project Templates" schema="schema/projectTemplates.exsd"/>
In order to create a new project type, we must extend this extension point.
  1. Open org.eclipse.edt.ide.rui plugin project. Open plugin.xml with XML Editor
  2. Add a new projectTemplates extension point by adding the following line before</plugin>
    • category: must be "org.eclipse.edt.ide.ui.projects" for project template
    • default: indicates if the project template is the default project type
    • description: the description text of the project type. This will be shown in the wizard page.
    • icon: the icon of the project template, which will be shown in the new project wizard
    • id: must be unique for a project type.
    • name: the name of the project type, which will be shown in the new project wizard
    • templateClass: a java class of the template which includes the operations when the project is created.
    • wizardClass: optional field, a java class which includes the wizard/setting pages of the project template. If not specify, the wizard will be the default wizard with the template selection page.
<extension
         point="org.eclipse.edt.ide.ui.projectTemplates">
      <template
            category="org.eclipse.edt.ide.ui.projects"
            default="false"
            description="My Sample Project Template"
            icon="icons/templates/WebClientTemplate.gif"
            id="org.eclipse.edt.ide.ui.projects.sample"
            name="Sample Project"
            templateClass="org.eclipse.edt.ide.rui.internal.project.SampleProjectTemplate">
      </template>
</extension>

Create Operations

  1. Create the new template class. Notice that the package name and class name must comply with the templateClass field of the extension point definition. Set the super class to an existing template to ease the work org.eclipse.edt.ide.rui.internal.project.WebClientWithServicesProjectTemplateNew template class
  2. Implement the class. The completed class file is listed below. Note that, we only add a default base package name for the project type.
package org.eclipse.edt.ide.rui.internal.project;
 
import java.util.List;
 
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.edt.ide.ui.wizards.ProjectConfiguration;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
 
public class SampleProjectTemplate extends WebClientWithServicesProjectTemplate {
 
	public SampleProjectTemplate() {
		super();
	}
 
	@Override
	public List<WorkspaceModifyOperation> getOperations(
			ProjectConfiguration eglProjConfiguration, int eglFeatureMask,
			ISchedulingRule rule) {
 
		eglProjConfiguration.setBasePackageName("samples");
 
		return super.getOperations(eglProjConfiguration, eglFeatureMask, rule);
	}
 
}

Use New Project Type

  1. Run the EDT in development mode as described in the developer guide
  2. Open the new EGL project wizard, the new project type is listed in the template list.
    New project wizard
  3. Click Finish. The new sample project is created. Notice that the base package is samples.
    Sample project

Back to the top