Eclipse PDE
Release 3.1

org.eclipse.pde.ui.templates
Class ChoiceOption

java.lang.Object
  extended byorg.eclipse.pde.ui.templates.TemplateField
      extended byorg.eclipse.pde.ui.templates.TemplateOption
          extended byorg.eclipse.pde.ui.templates.ChoiceOption

public class ChoiceOption
extends TemplateOption

Implementation of the TemplateOption that allows users to choose a value from the fixed set of options.

Since:
2.0

Constructor Summary
ChoiceOption(BaseOptionTemplateSection section, String name, String label, String[][] choices)
          Constructor for ChoiceOption.
 
Method Summary
 void createControl(Composite parent, int span)
          Subclasses must implement this method to create the control of the template field.
 String getChoice()
          Returns the string value of the current choice.
 void setEnabled(boolean enabled)
          Implements the superclass method by updating the enable state of the option's widget.
 void setValue(Object value)
          Implements the superclass method by passing the new value to the option's widget.
 
Methods inherited from class org.eclipse.pde.ui.templates.TemplateOption
getMessageLabel, getName, getValue, isEmpty, isEnabled, isRequired, setName, setRequired
 
Methods inherited from class org.eclipse.pde.ui.templates.TemplateField
createLabel, getLabel, getSection, setLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChoiceOption

public ChoiceOption(BaseOptionTemplateSection section,
                    String name,
                    String label,
                    String[][] choices)
Constructor for ChoiceOption.

Parameters:
section - the parent section.
name - the unique name
label - the presentable label
choices - the list of choices from which the value can be chosen. Each array entry should be an array of size 2, where position 0 will be interpeted as the choice unique name, and position 1 as the choice presentable label.
Method Detail

createControl

public void createControl(Composite parent,
                          int span)
Description copied from class: TemplateField
Subclasses must implement this method to create the control of the template field.

Specified by:
createControl in class TemplateField
Parameters:
parent - the parent composite the control should be created in
span - number of columns that the control should span

getChoice

public String getChoice()
Returns the string value of the current choice.

Returns:
the current choice or null if not initialized.

setValue

public void setValue(Object value)
Implements the superclass method by passing the new value to the option's widget.

Overrides:
setValue in class TemplateOption
Parameters:
value - the new value.

setEnabled

public void setEnabled(boolean enabled)
Implements the superclass method by updating the enable state of the option's widget.

Overrides:
setEnabled in class TemplateOption
Parameters:
enabled - the new enabled state

Eclipse PDE
Release 3.1

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