Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 354426

Summary: Support creation of generic EGL projects using concept of a project template
Product: z_Archived Reporter: Will Smythe <smythew>
Component: EDTAssignee: Huang Ji Yong <hjiyong>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P1 CC: carrollk, chenzhh, jqian, lasher, mheitz, smythew, tdramsey, tww, wxwu
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Complete the basic functions for new project wizard
lasher: iplog+
updated patch
lasher: iplog+
2 Updates: Remove basepackage.server for WebClient projectTemplate; Add hint for base package field as Theresa suggested.
lasher: iplog+
2 Updates: Remember Base Package name; Move Base package field before project location (comment 11) lasher: iplog+

Description Will Smythe CLA 2011-08-10 14:34:27 EDT
Background:
In CE, we only had 1 type of project (a "CE" project that had Java and JavaScript capabilities). In EDT, we will have multiple types of projects, including at least 2 out of the gate: 1) "CE"-like project, and 2) basic/general project (e.g. Java only). Theresa and I had a conversation about this today and came to the conclusion it makes a lot of sense to expose these different "project types" as templates, like the template support in the New EGL Record wizard. The list of templates will certainly grow as new generators are added, since various combinations of generators could result in various, specialized project types. Project templates would be chosen by the developer like part templates, but would augment (enhance) the base EGL project that is created by the wizard. Project templates could optionally provide a UI for configuring elements about it. For example, the "CE" (we will find a new name) project template would allow the user to select which widget libraries to import (just like we offer today). The settings for a basic project may be as simple as allowing the user to select the generator(s) to use and the projects to include in the new project's build path. At a minimum,  we need to support the developer creating a CE-like project (like we have today in EDT) and a basic ("Java only", for example) project.

Proposed wizard flow:

page 1 - EGL Project
- Project name
- location (defaulted)
- base package name (optional)

page 2 - Templates
- Templates
	o Basic <-- contributed by EDT core
	o Web client <-- contributed by "CE2" plugin, supports JavaScript/RUI only
	o Web client with services <-- contributed by "CE2" plugin, supports JavaScript/RUI and Java

page 3 (optional): configuration settings for the selected template

page 4 - EGL Settings (Build Path)

Additional details ....

1) The New EGL Project wizard should be part of EDT Core and the "Basic" project template should be contributed by EDT core as well. So, if the developer only has the EDT Core "IDE" installed (not "CE2" extensions), he/she would only see 1 project template (the "Basic" project template), assuming no other templates had been contributed.

1a) The first page of the New EGL Project wizard will ask for project name, location, and base package (see Bug 352765 - Allow user to input a "base package" in new project wizard). This base package will be used by templates to create a set of packages when the project is created and configure each package with the appropriate generator (if supported by the selected template). 

2) The Basic project template will have at least 1 configurable setting: default generator for the project. I believe  Alice had coded this panel at one point already. Need to determine if we should also allow the developer to select a compiler.

3) The "Web client with services" (Java+JavaScript) project template should be contributed by EDT "CE2" (not shipped in EDT core). It will create a  project that is configured for both Java and JavaScript and will create the WebContent folders and populate (like we do today). It will ask the user to select a widget library (EGL RUI and/or Dojo). 

4) Templates should be contributed (via extension points) similarly to how templates are implemented in the New EGL Record wizard. I am not sure whether the same extension point and interface can be used, since the current part template infrastructure assumes it's enhancing the contents of a new EGL part. The current template extension point also allows the developer to specify just a generic code template ID, which will then leverage the code templates configured under Preferences > EGL > Editor > Templates -- this concept is not applicable for a new project.

5) Templates should be able to contribute UI panels to the New EGL Project wizard (like the New EGL Record wizard). For example, the "Web client with services" project template will contribute a panel that allows the user to select a widget library.
Comment 1 Will Smythe CLA 2011-08-10 14:43:49 EDT
Think of project templates as "decorators" that add capability to a project. Some templates, like the proposed "Basic", will configure the project with a generator (and add appropriate natures based on the selected generator). Other templates, like the proposed "Web client with services" will create packages under the EGLSource folder, configure the generator for each of those packages, create a WebContent folder and add files to it.

I will open a separate enhancement that will describe how EGL project templates should be able to be applied to any existing workspace project. For example, if the developer already has a Java project, he/she should be able to select Configure > Convert to EGL Project and apply an EGL template (any EGL project template). So, our implementation for the project template should assume that it can decorate an existing project (created by the developer) or the base EGL project being created in the New EGL project wizard.

Because this is an extensible mechanism, others can contribute additional project templates. For example, we may want to create a "Hello world" project template that extends the "Web client with services" template and seeds the project with a basic RUI handler and services that can be immediately run by the user. For us, it should be as simple as creating a template class that extends the "web client with services" template (e.g. class HelloWorldTemplate extends WebClientWithServicesTemplate) and that adds some additional smarts to put some sample EGL source files into the appropriate packages of the new project.
Comment 2 Theresa Ramsey CLA 2011-08-10 15:58:01 EDT
Page 3 of the new project wizard for web clients would include selecting Dojo web and mobile support, plus other libraries. We can list these in a list box with checkboxes next to each selection.  

Page 3 for basic would be generator selection.
Comment 3 Tony Chen CLA 2011-08-10 22:06:03 EDT
assigned to jiyong.
Comment 4 Will Smythe CLA 2011-08-11 08:18:16 EDT
This is blocked by Bug 352765
Comment 5 Huang Ji Yong CLA 2011-08-17 05:15:59 EDT
Created attachment 201630 [details]
Complete the basic functions for new project wizard

This patch also include code change for bug 352765
Comment 6 Tony Chen CLA 2011-08-17 08:01:10 EDT
Created attachment 201635 [details]
updated patch

updated patch
Comment 7 Tony Chen CLA 2011-08-17 08:20:03 EDT
code committed
Comment 8 Jing Qian CLA 2011-08-17 13:31:18 EDT
The code committed broke the EGL project creation API.

We need a way to create EGL Project programmatically, currently, I'm using EGLWizardUtilities.createProject to create EGL project.  
Now the code inside has been commented out, it broke the EGL test framework test driver generation
Comment 9 Will Smythe CLA 2011-08-17 14:08:59 EDT
In response to Jing's comment: not sure this is exactly the right time to make this statement, but project templates should also be able to be applied programmatically to a project.

As mentioned earlier, at some point (not necessarily 0.7), a developer should be able to right-click on any project and select Configure > Convert to EGL Project ... and be able to choose a template to apply to the selected project.
Comment 10 Huang Ji Yong CLA 2011-08-18 05:41:52 EDT
Created attachment 201702 [details]
2 Updates: Remove basepackage.server for WebClient projectTemplate; Add hint for base package field as Theresa suggested.
Comment 11 Theresa Ramsey CLA 2011-08-18 09:16:19 EDT
Can you move the base package field above the default location group box?  It looks a bit lonely at the bottom of the panel all by itself.  Thanks!
Comment 12 Huang Ji Yong CLA 2011-08-18 22:26:36 EDT
(In reply to comment #11)
> Can you move the base package field above the default location group box?  It
> looks a bit lonely at the bottom of the panel all by itself.  Thanks!

Sure.
Comment 13 Huang Ji Yong CLA 2011-08-19 06:15:43 EDT
Created attachment 201774 [details]
2 Updates: Remember Base Package name; Move Base package field before project location  (comment 11)
Comment 14 Tony Chen CLA 2011-08-22 03:38:34 EDT
code committed
Comment 15 Huang Ji Yong CLA 2011-08-22 06:11:27 EDT
Finish the coding of this work item.
Will has mentioned "EGL project templates should be able to be applied to any existing workspace project." which is not planned in 0.7.0 and will be tracked in another bug.
Comment 16 Will Smythe CLA 2011-11-02 00:09:53 EDT
Looks good.