# com.bea.ide.workspace.project
IProjectTemplate Interface

public interface IProjectTemplate

A project template represents a set of static or dynamic content to be inserted into a new or existing project. An IProjectTemplate corresponds to a element found in the template.xml file of a template zip file located in the workshop templates directory.

A project template may define a set of content for populating a single new or existing project of a specific project type. Content members may also include application-level Library and Module files.

Workshop provides a default template processor which can handle processing a list of file or archive content elements. Alternatively, a project template may specify use of a custom template processor class located in an extension jar. A custom processor implementation can then make full use of the extension API, examine and update configuration files, query the user for input, and control how content is added to the application when the template is invoked.

Project template definitions may be displayed in the New Project Dialog, Import Project Dialog, or in the application tree project context menu under Install. They may extend or be extended by other project templates as well as be referenced by application templates.

## Nested Class Summary

`public static interface` | `IProjectTemplate.ITemplateContent` Represents a piece of content data to be used when creating a project template.
`public static interface` | `IProjectTemplate.ITemplateDisplay` Information to use when displaying a project template.

## Field Summary

`public static final `String`` | `CONTEXT_MENU_ID` Id for display in the project context menu
`public static final `String`` | `IMPORT_DIALOG_ID` Id for display in the Import Project Dialog
`public static final `String`` | `NEW_DIALOG_ID` Id for display in the New Project Dialog

## Method Summary

`public `IProjectTemplateProcessor`` | `createProcessor`(`IProject` project) Creates a template processor which may be used to apply this template to a given IProject.
`public `IProjectTemplate.ITemplateContent`[]` | `getContents`() Array of content elements to use when populating a project with this template.
`public `String`` | `getDefaultProjectName`() An optional default project name to be used when creating a project with this template.
`public `IProjectTemplate.ITemplateDisplay`` | `getDisplay`(`String` id) Gets the display information for the given display id.
`public `String`` | `getId`() Id string for the template.
`public `IProjectInfo`` | `getProjectInfo`() Returns the project type information object for the project type this template may be used to populate.
`public `IFile`` | `getZipFile`() Returns the template zip file containing this template definition.

## Field Detail

### CONTEXT_MENU_ID

    public static final String CONTEXT_MENU_ID

  Id for display in the project context menu

### IMPORT_DIALOG_ID

    public static final String IMPORT_DIALOG_ID

  Id for display in the Import Project Dialog

### NEW_DIALOG_ID

    public static final String NEW_DIALOG_ID

  Id for display in the New Project Dialog

## Method Detail

### createProcessor(IProject) Method

    public IProjectTemplateProcessor createProcessor(IProject project)

Creates a template processor which may be used to apply this template to a given IProject.

If an IProjectTemplateProcessor class has been declared in the template xml, an instance of that class will be created. Otherwise a default processor implementation will be used. See IProjectTemplateProcessor for default processor behavior.

#### Parameters

project
  IProject which will form the context for the template processor.

#### Returns

IProjectTemplateProcessor.

### getContents() Method

    public IProjectTemplate.ITemplateContent[] getContents()

Array of content elements to use when populating a project with this template.

#### Returns

array of ITemplateContent.

### getDefaultProjectName() Method

    public String getDefaultProjectName()

An optional default project name to be used when creating a project with this template.

#### Returns

default name, may be null if a default name was not specified in the template declaration.

### getDisplay(String) Method

    public IProjectTemplate.ITemplateDisplay getDisplay(String id)

Gets the display information for the given display id. Places where a project template may be displayed include the New Project Dialog, the Import Project Dialog, and the project context menu in the application tree.

#### Parameters

id
  String identifier for a display location, e.g. NEW_DIALOG_ID, IMPORT_DIALOG_ID, CONTEXT_MENU_ID.

#### Returns

ITemplateDisplay will be null if this template is not intended to be displayed in the given location.

### getId() Method

    public String getId()

Id string for the template. Will be unique among all project templates for this template's project type.

#### Returns

string representing the template id.

### getProjectInfo() Method

    public IProjectInfo getProjectInfo()

Returns the project type information object for the project type this template may be used to populate.

#### Returns

IProjectInfo

### getZipFile() Method

    public IFile getZipFile()

Returns the template zip file containing this template definition.

#### Returns

IFile for the zip.