Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse PDE Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.pde.ui.templates
Interface ITemplateSection

All Known Implementing Classes:
  AbstractTemplateSection

public interface ITemplateSection

This interface represents a section of the template wizard that generates a new extension or plug-in. Typically, it maps to one wizard page, but more complex sections may span several pages. Also note that in the very simple cases it may not contribute any wizard pages.

If a section generates extensions, it should be written in such a way to be used both in the 'New Extension' wizard and as a part of a new plug-in project wizard. When used as part of the new plug-in project wizard, it may appear alongside other templates and therefore should not do anything that prevents it.

Since:
  2.0

Method Summary
`void` | `addPages(Wizard wizard)` Adds template-related pages to the wizard.
`void` | `execute(IProject project, IPluginModelBase model, IProgressMonitor monitor)` Executes the template.
`IPluginReference[]` | `getDependencies(String schemaVersion)` Provides the list of template dependencies.
`String` | `getDescription()` Returns a description of the section.
`String` | `getLabel()` Returns a presentable label the section.
`String[]` | `getNewFiles()` Returns an array of tokens representing new files and folders created by this template section.
`int` | `getNumberOfWorkUnits()` Returns the number of work units that this template will consume during the execution.
`WizardPage` | `getPage(int pageIndex)` Returns a wizard page at the provided index.
`int` | `getPageCount()` Returns number of pages that are contributed by this template.
`boolean` | `getPagesAdded()` Tests whether this template have had a chance to create its pages.
`String` | `getReplacementString(String fileName, String key)` Returns a replacement string for the provided key.
`URL` | `getTemplateLocation()` Returns the URL of the zip file containing template files and directories that will be created in the plug-in project.
`String` | `getUsedExtensionPoint()` Returns identifier of the extension point used in this section.

Method Detail

### getTemplateLocation

    public URL getTemplateLocation()

  Returns the URL of the zip file containing template files and directories that will be created in the plug-in project. If URL protocol is 'file', and the URL ends with a trailing file separator, an attempt will be made to treat the URL as a root directory and iterate using standard Java I/O classes. If template files are stored in a ZIP or JAR archive, the name of the archive must be part of the URL.

  Returns:
    a template location URL

### getLabel

    public String getLabel()

  Returns a presentable label the section.

  Returns:
    a template label

### getDescription

    public String getDescription()

  Returns a description of the section. The description should explain what extension will be used, what classes will be generated and how to test that the generated code works properly.

  Returns:
    a template description

### getReplacementString

    public String getReplacementString(String fileName,
                                       String key)

  Returns a replacement string for the provided key. When a token is found in the template file with a form '$key$', the actual key is passed to this method to obtain the replacement. If replacement is provided, it is substituted for the token (including the '$' characters). Otherwise, it is transfered as-is.

  Parameters:
    `fileName` - the name of the file in which the key was found. You can use it to return different values for different files.
    `key` - the replacement key found in the template file
  Returns:
    replacement string for the provided key, or the key itself if not found.

### addPages

    public void addPages(Wizard wizard)

  Adds template-related pages to the wizard. A typical section implementation contributes one page, but complex sections may span several pages.

  Parameters:
    `wizard` - the host wizard to add pages into

### getPage

    public WizardPage getPage(int pageIndex)

  Returns a wizard page at the provided index.

  Returns:
    wizard page index.

### getPageCount

    public int getPageCount()

  Returns number of pages that are contributed by this template.

### getPagesAdded

    public boolean getPagesAdded()

  Tests whether this template have had a chance to create its pages. This method returns true after 'addPages' has been called.

  Returns:
    `true` if wizard pages have been created by this template.

### getNumberOfWorkUnits

    public int getNumberOfWorkUnits()

  Returns the number of work units that this template will consume during the execution. This number is used to calculate the total number of work units when initializing the progress indicator.

  Returns:

### getDependencies

    public IPluginReference[] getDependencies(String schemaVersion)

  Provides the list of template dependencies. A template may generate a number of Java classes that reference classes and interfaces from other plug-ins. By providing this list, a template enables the template wizard to create the correct Java build path so that these classes and interfaces are correctly resolved.

  Parameters:
    `schemaVersion` - version of the target manifest, or `null` if older manifest (prior to 3.0) will be created. Depending on the manifest version, the list of dependencies may vary.
  Returns:

### getUsedExtensionPoint

    public String getUsedExtensionPoint()

  Returns identifier of the extension point used in this section.

  Returns:
    extension point id if this section contributes into an extension point or `null` if not applicable.

### execute

    public void execute(IProject project,
                        IPluginModelBase model,
                        IProgressMonitor monitor)
                 throws CoreException

  Executes the template. As part of the execution, template may generate resources under the provided project, and/or modify the plug-in model.

  Parameters:
    `project` - the workspace project that contains the plug-in
    `model` - structured representation of the plug-in manifest
    `monitor` - progress monitor to indicate execution progress
  Throws:
    `CoreException`

### getNewFiles

    public String[] getNewFiles()

  Returns an array of tokens representing new files and folders created by this template section. The information is collected for the benefit of `build.properties` file so that the generated files and folders are included in the binary build. The tokens will be added as-is to the variable . For this reason, wild cards and other syntax rules applicable to this variable can be used in this method. For example:

       return new String[]{"/icons/*.gif"};

  Returns:
    an array of strings that fully describe the files and folders created by this template section as required by `bin.includes` variable in `build.properties` file.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse PDE Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) IBM Corp. and others 2000, 2004. All Rights Reserved.