Package org.eclipse.pde.ui.templates
Class TemplateOption
java.lang.Object
org.eclipse.pde.ui.templates.TemplateField
org.eclipse.pde.ui.templates.TemplateOption
- Direct Known Subclasses:
AbstractChoiceOption
,BlankField
,BooleanOption
,ChoiceOption
,StringOption
The base class of all the template options. Options have unique name and a
value that can be changed. The value of the option is automatically available
to the template files - can be accessed by substitution (e.g. $value_name$)
or as part of conditional code generation (e.g. if value_name).
- Since:
- 2.0
-
Constructor Summary
ConstructorDescriptionTemplateOption
(BaseOptionTemplateSection section, String name, String label) Creates a new option for the provided template section. -
Method Summary
Modifier and TypeMethodDescriptionReturns the label of this option that can be presented in the messages to the user.getName()
Returns the unique name of this optiongetValue()
Returns the value of this option.boolean
isEmpty()
Returns whether this option is currently empty.boolean
Returns whether this option is enabled.boolean
Returns whether this option is required (cannot be empty)void
setEnabled
(boolean enabled) Sets the enabled state of this option.void
Changes the unique name of this optionvoid
setRequired
(boolean required) Marks this option as required.void
Sets the new value of this option.Methods inherited from class org.eclipse.pde.ui.templates.TemplateField
createControl, createLabel, getLabel, getSection, setLabel
-
Constructor Details
-
TemplateOption
Creates a new option for the provided template section.- Parameters:
section
- the parent template sectionname
- the unique name of this optionlabel
- presentable label of this option
-
-
Method Details
-
getName
Returns the unique name of this option- Returns:
- option name
-
setName
Changes the unique name of this option- Parameters:
name
- the new option name
-
getValue
Returns the value of this option.- Returns:
- the current value
-
isEmpty
public boolean isEmpty()Returns whether this option is currently empty. The actual semantics of the result depends on the implementing option.- Returns:
- true if option is empty, false otherwise.
-
setRequired
public void setRequired(boolean required) Marks this option as required. Required options must be set by the user. An option that is empty and is marked required will be flagged as an error in the wizard.- Parameters:
required
- the new value of the property- See Also:
-
isRequired
public boolean isRequired()Returns whether this option is required (cannot be empty)- Returns:
- true if this option is required, false otherwise.
-
setValue
Sets the new value of this option.- Parameters:
value
- the new value
-
isEnabled
public boolean isEnabled()Returns whether this option is enabled. The actual presentation of enabled state depends on the implementing option.- Returns:
- true if option is enabled and can be modified.
-
setEnabled
public void setEnabled(boolean enabled) Sets the enabled state of this option. The action presentation of the enabled state depends on the implementing option.- Parameters:
enabled
- the new enabled state
-
getMessageLabel
Returns the label of this option that can be presented in the messages to the user. The default implementation trims the 'label' property from mnemonics and from the trailing column.- Returns:
- the label to show to the user
-