Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.pde.ui.templates
Class OptionTemplateSection  view OptionTemplateSection download OptionTemplateSection.java

java.lang.Object
  extended byorg.eclipse.pde.ui.templates.AbstractTemplateSection
      extended byorg.eclipse.pde.ui.templates.BaseOptionTemplateSection
          extended byorg.eclipse.pde.ui.templates.OptionTemplateSection
All Implemented Interfaces:
ITemplateSection, IVariableProvider

public abstract class OptionTemplateSection
extends BaseOptionTemplateSection

This class adds some conventions to the class it is based on. For example, it expects to find the template content in the following location:

 
     [install location]/[templateDirectory]/[sectionId]
  
 
where templateDirectory is expected to be 'templates_3.0' (to distinguish from template designed for earlier Eclipse versions), and sectionId is the unique identifier as reported by the template section.

It also assumes that all wizard pages associated with this template will be based on OptionWizardTemplatePage.

Since:
2.0

Nested Class Summary
private static class OptionTemplateSection.TemplatePage
           
 
Field Summary
private static java.lang.String KEY_MUST_BE_SET
           
private  java.util.ArrayList pages
           
 
Fields inherited from class org.eclipse.pde.ui.templates.BaseOptionTemplateSection
 
Fields inherited from class org.eclipse.pde.ui.templates.AbstractTemplateSection
KEY_PACKAGE_NAME, KEY_PLUGIN_CLASS, KEY_PLUGIN_ID, KEY_PLUGIN_NAME, model, project
 
Constructor Summary
OptionTemplateSection()
          The default constructor.
 
Method Summary
 org.eclipse.jface.wizard.WizardPage createPage(int pageIndex)
          Creates the wizard page for the specified page index.
 org.eclipse.jface.wizard.WizardPage createPage(int pageIndex, java.lang.String helpContextId)
          Creates the wizard page for the specified page index.
protected  void flagMissingRequiredOption(TemplateOption option)
          Locates the page that this option is presented in and flags that the option is required and is currently not set.
 java.lang.String getDescription()
          Returns the description of this template to be used in the UI.
protected abstract  java.net.URL getInstallURL()
          Returns the install URL of the plug-in that contributes this template.
 java.lang.String getLabel()
          Returns the label of this template to be used in the UI.
 TemplateOption[] getOptions(int pageIndex)
          Returns options that belong to the page with the given index.
 TemplateOption[] getOptions(org.eclipse.jface.wizard.WizardPage page)
          Returns options that are added to the provided wizard page.
 org.eclipse.jface.wizard.WizardPage getPage(int pageIndex)
          Returns the wizard page at the specified index.
 int getPageCount()
          Returns a number of pages that this template contributes to the wizard.
 int getPageIndex(TemplateOption option)
          Returns the zero-based index of a page that hosts the the given option.
abstract  java.lang.String getSectionId()
          Returns the unique name of this section.
protected  java.lang.String getTemplateDirectory()
          Returns the directory where all the templates are located in the contributing plug-in.
 java.net.URL getTemplateLocation()
          Implements the abstract method by looking for templates using the following path:
protected  void registerOption(TemplateOption option, java.lang.Object value, int pageIndex)
          Registers the provided option and sets the initial value.
protected  void resetPageState()
          Resets the current page state by clearing the error message and making the page complete, thereby allowing users to flip to the next page.
 void setPageCount(int count)
          Sets the number of pages this template will manage.
 
Methods inherited from class org.eclipse.pde.ui.templates.BaseOptionTemplateSection
addOption, addOption, addOption, execute, getBooleanOption, getReplacementString, getStringOption, getValue, initializeFields, initializeFields, initializeOption, isDependentOnParentWizard, setOptionEnabled, validateOptions
 
Methods inherited from class org.eclipse.pde.ui.templates.AbstractTemplateSection
addPages, createExtension, generateFiles, getDependencies, getNumberOfWorkUnits, getPagesAdded, getPluginResourceBundle, getPluginResourceString, getSourceFolder, isOkToCreateFile, isOkToCreateFolder, markPagesAdded, updateModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.pde.ui.templates.ITemplateSection
getNewFiles, getUsedExtensionPoint
 

Field Detail

KEY_MUST_BE_SET

private static final java.lang.String KEY_MUST_BE_SET
See Also:
Constant Field Values

pages

private java.util.ArrayList pages
Constructor Detail

OptionTemplateSection

public OptionTemplateSection()
The default constructor.

Method Detail

getSectionId

public abstract java.lang.String getSectionId()
Returns the unique name of this section. This name will be used to construct name and description lookup keys, as well as the template file location in the contributing plug-in.


getTemplateDirectory

protected java.lang.String getTemplateDirectory()
Returns the directory where all the templates are located in the contributing plug-in.


getInstallURL

protected abstract java.net.URL getInstallURL()
Returns the install URL of the plug-in that contributes this template.


getTemplateLocation

public java.net.URL getTemplateLocation()
Implements the abstract method by looking for templates using the following path:

[install location]/[templateDirectory]/[sectionId]

Specified by:
getTemplateLocation in interface ITemplateSection
Overrides:
getTemplateLocation in class AbstractTemplateSection

getPage

public org.eclipse.jface.wizard.WizardPage getPage(int pageIndex)
Returns the wizard page at the specified index. Pages must be created prior to calling this method.


createPage

public org.eclipse.jface.wizard.WizardPage createPage(int pageIndex)
Creates the wizard page for the specified page index. This method cannot be called before setPageCount(int). The page will be created with all the options registered for that page index. Therefore, make all the calls to addOption() before calling this method.


createPage

public org.eclipse.jface.wizard.WizardPage createPage(int pageIndex,
                                                      java.lang.String helpContextId)
Creates the wizard page for the specified page index. This method cannot be called before setPageCount(int). The page will be created with all the options registered for that page index. Therefore, make all the calls to addOption() before calling this method.


getPageCount

public int getPageCount()
Returns a number of pages that this template contributes to the wizard.


setPageCount

public void setPageCount(int count)
Sets the number of pages this template will manage. This method must be called prior to adding pages and options in order to initialize the template. Once the method has been called, you can call methods that accept page index in the range [0..count-1].


getOptions

public TemplateOption[] getOptions(int pageIndex)
Returns options that belong to the page with the given index.


getOptions

public TemplateOption[] getOptions(org.eclipse.jface.wizard.WizardPage page)
Returns options that are added to the provided wizard page.


getPageIndex

public int getPageIndex(TemplateOption option)
Returns the zero-based index of a page that hosts the the given option.


getLabel

public java.lang.String getLabel()
Returns the label of this template to be used in the UI. The label is obtained by creating a lookup key using the following rule: "template.[section-id].name". This key is used to locate the label in the plugin.properties file of the plug-in that contributed this template.


getDescription

public java.lang.String getDescription()
Returns the description of this template to be used in the UI. The description is obtained by creating a lookup key using the following rule: "template.[section-id].desc". This key is used to locate the label in the plugin.properties file of the plug-in that contributed this template.

Specified by:
getDescription in interface ITemplateSection
Overrides:
getDescription in class AbstractTemplateSection

flagMissingRequiredOption

protected void flagMissingRequiredOption(TemplateOption option)
Locates the page that this option is presented in and flags that the option is required and is currently not set. The flagging is done by setting the page incomplete and setting the error message that uses option's message label.


resetPageState

protected void resetPageState()
Resets the current page state by clearing the error message and making the page complete, thereby allowing users to flip to the next page.


registerOption

protected void registerOption(TemplateOption option,
                              java.lang.Object value,
                              int pageIndex)
Description copied from class: BaseOptionTemplateSection
Registers the provided option and sets the initial value.

Overrides:
registerOption in class BaseOptionTemplateSection