Package org.eclipse.pde.ui.templates
Class OptionTemplateSection
- java.lang.Object
- 
- org.eclipse.pde.ui.templates.AbstractTemplateSection
- 
- org.eclipse.pde.ui.templates.BaseOptionTemplateSection
- 
- org.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]wheretemplateDirectoryis expected to be 'templates_3.0' (to distinguish from template designed for earlier Eclipse versions), andsectionIdis the unique identifier as reported by the template section.It also assumes that all wizard pages associated with this template will be based on OptionTemplateWizardPage.- Since:
- 2.0
 
- 
- 
Field Summary- 
Fields inherited from class org.eclipse.pde.ui.templates.AbstractTemplateSectionKEY_ACTIVATOR_SIMPLE, KEY_PACKAGE_NAME, KEY_PLUGIN_CLASS, KEY_PLUGIN_ID, KEY_PLUGIN_NAME, model, project
 
- 
 - 
Constructor SummaryConstructors Constructor Description OptionTemplateSection()The default constructor.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description WizardPagecreatePage(int pageIndex)Creates the wizard page for the specified page index.WizardPagecreatePage(int pageIndex, String helpContextId)Creates the wizard page for the specified page index.protected voidflagMissingRequiredOption(TemplateOption option)Locates the page that this option is presented in and flags that the option is required and is currently not set.StringgetDescription()Returns the description of this template to be used in the UI.protected abstract URLgetInstallURL()Returns the install URL of the plug-in that contributes this template.StringgetLabel()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(WizardPage page)Returns options that are added to the provided wizard page.WizardPagegetPage(int pageIndex)Returns the wizard page at the specified index.intgetPageCount()Returns a number of pages that this template contributes to the wizard.intgetPageIndex(TemplateOption option)Returns the zero-based index of a page that hosts the the given option.abstract StringgetSectionId()Returns the unique name of this section.protected StringgetTemplateDirectory()Returns the directory where all the templates are located in the contributing plug-in.URLgetTemplateLocation()Implements the abstract method by looking for templates using the following path:protected voidregisterOption(TemplateOption option, Object value, int pageIndex)Registers the provided option and sets the initial value.protected voidresetPageState()Resets the current page state by clearing the error message and making the page complete, thereby allowing users to flip to the next page.voidsetPageCount(int count)Sets the number of pages this template will manage.voidvalidateOptions(TemplateOption source)Validate options given a template option- 
Methods inherited from class org.eclipse.pde.ui.templates.BaseOptionTemplateSectionaddBlankField, addBlankField, addComboChoiceOption, addOption, addOption, addOption, execute, getBooleanOption, getReplacementString, getStringOption, getValue, initializeFields, initializeFields, initializeOption, isDependentOnParentWizard, setOptionEnabled
 - 
Methods inherited from class org.eclipse.pde.ui.templates.AbstractTemplateSectionaddPages, createExtension, generateFiles, generateFiles, getDependencies, getManifestHeader, getNumberOfWorkUnits, getPagesAdded, getPluginResourceBundle, getPluginResourceString, getSourceFolder, getTargetVersion, hasBundleManifest, isOkToCreateFile, isOkToCreateFolder, markPagesAdded, setManifestHeader, updateModel
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.eclipse.pde.ui.templates.ITemplateSectiongetNewFiles, getUsedExtensionPoint
 
- 
 
- 
- 
- 
Method Detail- 
getSectionIdpublic abstract 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.- Returns:
- the unique section Id
- See Also:
- getLabel(),- getDescription(),- getTemplateLocation()
 
 - 
getTemplateDirectoryprotected String getTemplateDirectory() Returns the directory where all the templates are located in the contributing plug-in.- Returns:
- "templates_[schemaVersion]" for code since Eclipse 3.0, or "templates" for pre-3.0 code.
 
 - 
getInstallURLprotected abstract URL getInstallURL() Returns the install URL of the plug-in that contributes this template.- Returns:
- the install URL of the contributing plug-in
 
 - 
getTemplateLocationpublic URL getTemplateLocation() Implements the abstract method by looking for templates using the following path:[install location]/[templateDirectory]/[sectionId] - Specified by:
- getTemplateLocationin interface- ITemplateSection
- Overrides:
- getTemplateLocationin class- AbstractTemplateSection
- Returns:
- the URL of the location where files to be emitted by this template are located.
 
 - 
getPagepublic WizardPage getPage(int pageIndex) Returns the wizard page at the specified index. Pages must be created prior to calling this method.- Parameters:
- pageIndex- the index to get the page for
- Returns:
- the wizard page at the specified index or null if invalid index.
- See Also:
- createPage(int)
 
 - 
createPagepublic 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.- Parameters:
- pageIndex- a zero-based index of the page relative to this template. For example, if a template needs to have two pages, you have to call this method twice (once with index 0 and again with index 1).
- Returns:
- the created wizard page
- See Also:
- setPageCount(int),- BaseOptionTemplateSection.addOption(java.lang.String, java.lang.String, boolean, int)
 
 - 
createPagepublic WizardPage createPage(int pageIndex, 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.- Parameters:
- pageIndex- a zero-based index of the page relative to this template. For example, if a template need to have two pages, you have to call this method twice (once with index 0 and again with index 1).
- helpContextId- the Id of the help context defined in the contributing plug-in that will be used to locate content of the info-pop displayed when F1 is pressed.
- Returns:
- the created wizard page
- See Also:
- setPageCount(int),- BaseOptionTemplateSection.addOption(java.lang.String, java.lang.String, boolean, int)
 
 - 
getPageCountpublic int getPageCount() Returns a number of pages that this template contributes to the wizard.- Returns:
- the number of pages
- See Also:
- setPageCount(int)
 
 - 
setPageCountpublic 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].- Parameters:
- count- number of pages that this template will contribute to the template wizard
 
 - 
getOptionspublic TemplateOption[] getOptions(int pageIndex) Returns options that belong to the page with the given index.- Parameters:
- pageIndex- 0-based index of the template page
- Returns:
- Options for the page with given index.
- See Also:
- setPageCount(int)
 
 - 
getOptionspublic TemplateOption[] getOptions(WizardPage page) Returns options that are added to the provided wizard page.- Parameters:
- page- wizard page that hosts required options
- Returns:
- array of options added to the provided wizard page
 
 - 
getPageIndexpublic int getPageIndex(TemplateOption option) Returns the zero-based index of a page that hosts the the given option.- Parameters:
- option- template option for which a page index is being requested
- Returns:
- zero-based index of a page that hosts the option or -1 if none of the pages contain the option.
 
 - 
getLabelpublic 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.- Returns:
- the translated label of this template
 
 - 
getDescriptionpublic 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:
- getDescriptionin interface- ITemplateSection
- Overrides:
- getDescriptionin class- AbstractTemplateSection
- Returns:
- the translated description of this template
 
 - 
flagMissingRequiredOptionprotected 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.- Parameters:
- option- the option that is required and currently not set
 
 - 
resetPageStateprotected 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.
 - 
registerOptionprotected void registerOption(TemplateOption option, Object value, int pageIndex) Description copied from class:BaseOptionTemplateSectionRegisters the provided option and sets the initial value.- Overrides:
- registerOptionin class- BaseOptionTemplateSection
- Parameters:
- option- the option to register
- value- the initial value
- pageIndex- the page index to which this option belongs
 
 - 
validateOptionspublic void validateOptions(TemplateOption source) Validate options given a template option- Specified by:
- validateOptionsin class- BaseOptionTemplateSection
- Parameters:
- source- the template option to validate
 
 
- 
 
-