| java.lang.Object org.eclipse.pde.ui.templates.AbstractTemplateSection org.eclipse.pde.ui.templates.BaseOptionTemplateSection
All known Subclasses: org.eclipse.pde.ui.templates.OptionTemplateSection,
BaseOptionTemplateSection | abstract public class BaseOptionTemplateSection extends AbstractTemplateSection (Code) | | This class adds a notion of options to the default template section
implementation. Options have values and visual presence that allows users to
change them. When a section is configured with a number of options, they
become available to the code generator and can take part in conditional code
emitting.
This class is typically used in conjunction with
OptionTemplateWizardPage . The later is capable of creating UI
based on the list of options it was given, thus simplifying new template
section creation.
since: 2.0 |
Method Summary | |
protected TemplateOption | addBlankField(int pageIndex) Adds a blank field with a default height to provide spacing. | protected TemplateOption | addBlankField(int height, int pageIndex) Adds a blank field with a specific height to provide spacing. | protected ComboChoiceOption | addComboChoiceOption(String name, String label, String[][] choices, String value, int pageIndex) Force a combo choice representation. | protected TemplateOption | addOption(String name, String label, boolean value, int pageIndex) Adds a boolean option with a provided name, label and initial value. | protected TemplateOption | addOption(String name, String label, String value, int pageIndex) Adds a string option with a provided name, label and initial value. | protected TemplateOption | addOption(String name, String label, String[][] choices, String value, int pageIndex) Adds a choice option with a provided name, label, list of choices and the
initial value (choice).
Parameters: name - the unique name of the option (can be used as a variable inconditional code emitting and variable substitution) Parameters: label - presentable name of the option Parameters: choices - an array of choices that the user will have when setting thevalue of the option. | public void | execute(IProject project, IPluginModelBase model, IProgressMonitor monitor) Modifies the superclass implementation by adding the initialization step
before commencing execution. | public boolean | getBooleanOption(String key) Returns a boolean value of the option with a given name. | public String | getReplacementString(String fileName, String key) Expands variable substitution to include all string options defined in
this template. | public String | getStringOption(String name) Returns a string value of the option with a given name. | public Object | getValue(String name) Returns the value of the option with a given name. | protected void | initializeFields(IFieldData data) Initializes options in the wizard page using the data provided by the
method parameters. | public void | initializeFields(IPluginModelBase model) Initializes options in the wizard page using the data provided by the
method parameters. | protected void | initializeOption(String name, Object value) Initializes the option with a given unique name with the provided value. | public boolean | isDependentOnParentWizard() Returns true if this template depends on values set in the parent wizard.
Values in the parent wizard include plug-in id, plug-in name, plug-in
class name, plug-in provider etc. | protected void | registerOption(TemplateOption option, Object value, int pageIndex) Registers the provided option and sets the initial value. | public void | setOptionEnabled(String name, boolean enabled) Enables the option with a given name. | abstract public void | validateOptions(TemplateOption changed) Subclasses must implement this method in order to validate options whose
value have been changed by the user. |
addBlankField | protected TemplateOption addBlankField(int pageIndex)(Code) | | Adds a blank field with a default height to provide spacing.
Parameters: pageIndex - a zero-based index of a page where this option should appear the newly created option |
addBlankField | protected TemplateOption addBlankField(int height, int pageIndex)(Code) | | Adds a blank field with a specific height to provide spacing.
Parameters: height - specifies the height of the blank field in pixels Parameters: pageIndex - a zero-based index of a page where this option should appear the newly created option |
addComboChoiceOption | protected ComboChoiceOption addComboChoiceOption(String name, String label, String[][] choices, String value, int pageIndex)(Code) | | Force a combo choice representation.
Radio buttons look bad - even if only two options specified.
Parameters: name - Parameters: label - Parameters: choices - Parameters: value - Parameters: pageIndex - the newly created option |
addOption | protected TemplateOption addOption(String name, String label, boolean value, int pageIndex)(Code) | | Adds a boolean option with a provided name, label and initial value.
Parameters: name - the unique name of the option (can be used as a variable inconditional code emitting and variable substitution) Parameters: label - presentable name of the option Parameters: value - initial value of the option Parameters: pageIndex - a zero-based index of a page where this option should appear the newly created option |
addOption | protected TemplateOption addOption(String name, String label, String value, int pageIndex)(Code) | | Adds a string option with a provided name, label and initial value.
Parameters: name - the unique name of the option (can be used as a variable inconditional code emitting and variable substitution) Parameters: label - presentable name of the option Parameters: value - initial value of the option Parameters: pageIndex - a zero-based index of a page where this option should appear the newly created option |
addOption | protected TemplateOption addOption(String name, String label, String[][] choices, String value, int pageIndex)(Code) | | Adds a choice option with a provided name, label, list of choices and the
initial value (choice).
Parameters: name - the unique name of the option (can be used as a variable inconditional code emitting and variable substitution) Parameters: label - presentable name of the option Parameters: choices - an array of choices that the user will have when setting thevalue of the option. Each array position should accept anarray of String objects of size 2, the first being the uniquename and the second the presentable label of the choice. Parameters: value - initial value (choice) of the option Parameters: pageIndex - a zero-based index of a page where this option should appear the newly created option |
execute | public void execute(IProject project, IPluginModelBase model, IProgressMonitor monitor) throws CoreException(Code) | | Modifies the superclass implementation by adding the initialization step
before commencing execution. This is important because some options may
not be initialized and users may choose to press 'Finish' before the
wizard page where the options are were shown for the first time.
|
getBooleanOption | public boolean getBooleanOption(String key)(Code) | | Returns a boolean value of the option with a given name. The option with
that name must exist and must be registered as a boolean option to begin
with.
Parameters: key - the unique name of the option the boolean value of the option with a given name or null if not found. |
getStringOption | public String getStringOption(String name)(Code) | | Returns a string value of the option with a given name. The option with
that name must exist and must be registered as a string option to begin
with.
Parameters: name - the unique name of the option the string value of the option with a given name or null if not found. |
getValue | public Object getValue(String name)(Code) | | Returns the value of the option with a given name. The actual type of the
returned object depends on the option type.
Parameters: name - the name of the option the current value of the option with a specified name ornull if not found or not applicable. |
initializeFields | protected void initializeFields(IFieldData data)(Code) | | Initializes options in the wizard page using the data provided by the
method parameters. Some options may depend on the user selection in the
common wizard pages before template page has been shown (for example,
plug-in ID, plug-in name etc.). This method allows options to initialize
in respect to these values.
The method is called before the actual plug-in has been built.
Parameters: data - plug-in data as defined in the common plug-in project wizardpages |
initializeFields | public void initializeFields(IPluginModelBase model)(Code) | | Initializes options in the wizard page using the data provided by the
method parameters. Some options may depend on the user selection in the
common wizard pages before template page has been shown (for example,
plug-in ID, plug-in name etc.). This method allows options to initialize
in respect to these values.
This method is called after the plug-in has already been created or as
part of new extension creation (inside the manifest editor). Either way,
the plug-in properties in the model have been fully set and the model can
be used to initialize options that cannot be initialized independently.
Parameters: model - the model of the plug-in manifest file. |
initializeOption | protected void initializeOption(String name, Object value)(Code) | | Initializes the option with a given unique name with the provided value.
The value will be set only if the option has not yet been initialized.
Parameters: name - option unique name Parameters: value - the initial value of the option |
isDependentOnParentWizard | public boolean isDependentOnParentWizard()(Code) | | Returns true if this template depends on values set in the parent wizard.
Values in the parent wizard include plug-in id, plug-in name, plug-in
class name, plug-in provider etc. If the template does depend on these
values, initializeFields will be called when the page is
made visible in the forward direction (going from the first page to the
pages owned by this template). If the page is never shown (Finish is
pressed before the page is made visible at least once),
initializeFields will be called with the model object
instead during template execution. The same method will also be called
when the template is created within the context of the plug-in manifest
editor, because plug-in model already exists at that time.
true if this template depends on the data set inthe parent wizard, false otherwise. |
registerOption | protected void registerOption(TemplateOption option, Object value, int pageIndex)(Code) | | Registers the provided option and sets the initial value.
Parameters: option - the option to register Parameters: value - the initial value Parameters: pageIndex - the page index to which this option belongs |
setOptionEnabled | public void setOptionEnabled(String name, boolean enabled)(Code) | | Enables the option with a given name. The exact effect of the method
depends on the option type, but the end-result should always be the same -
users should not be able to modify values of disabled options. This
method has no effect if the option with a given name is not found.
Parameters: name - the unique name of the option Parameters: enabled - the enable state that the option should have |
validateOptions | abstract public void validateOptions(TemplateOption changed)(Code) | | Subclasses must implement this method in order to validate options whose
value have been changed by the user. The subclass can elect to validate
the option on its own, or to also check validity of other options in
relation to the new value of this one.
Parameters: changed - the option whose value has been changed by the user |
|
|