LPEX
4.4.0

com.ibm.lpex.alef.preferences
Class ParsersPreferencePage

java.lang.Object
  extended by PreferencePage
      extended by com.ibm.lpex.alef.preferences.ParsersPreferencePage

public final class ParsersPreferencePage
extends PreferencePage

Preference page for document parser settings. It lets the user add and remove registered parsers.


Constructor Summary
ParsersPreferencePage()
           
 
Method Summary
protected  void contributeButtons(Composite buttonBar)
          Contributes a "Reset" button.
protected  Control createContents(Composite parent)
          Creates and returns the SWT control for the customized body of this preference page.
 void dispose()
          Extended in order to clear the last document parser selected for this LPEX instance.
protected  void doSetPressed(String name, String className)
          Handles the "Set" button having been pressed.
protected  Vector<com.ibm.lpex.alef.preferences.LpexTableItem> getItems()
          Returns the current vector of LpexTableItems in the table.
protected  String getValue2()
          Returns the text in the value2 edit field.
protected  String[] getValue2Options()
          Returns an array of options for the value2 combo list, when a combo box is used as the value2 edit field.
protected  String[] getValueNames()
          Returns the names for the text-field labels.
protected  String[] getValueTableNames()
          Returns the names for the table columns.
protected  int[] getValueWeights()
          Returns the column weights for the two columns in the table.
 void init(IWorkbench workbench)
          Initializes this preference page for the given workbench.
protected  Vector<com.ibm.lpex.alef.preferences.LpexTableItem> initialize()
          Returns a new vector of LpexTableItems with the initial settings (the preference page is being initialized).
protected  Vector<com.ibm.lpex.alef.preferences.LpexTableItem> initializeDefaults()
          Returns a new vector of LpexTableItems with the install settings ("Restore Defaults" button was pressed).
protected  void performDefaults()
          "Restore Defaults" button pressed.
 boolean performOk()
          "OK" / "Apply" button pressed.
protected  void performReset()
          "Reset" button pressed.
protected  void selectItem(String value1)
          Selects an item in the table, and ensures it shows.
static void setLastParserSelected(String parser)
          Records the last document parser selected in this LPEX instance.
 void setValid(boolean b)
          Sets whether this page is valid.
protected  void setValue2Options()
          Called to (re)set the options list in the value2 combo, when a combo box is used as the value2 edit field.
 void setVisible(boolean visible)
          Extended in order to update the document parser each time this page is made visible.
protected  void tableSelectionModified(String newValue1, String newValue2)
          Notification from superclass TablePreferencePage that the table selection was modified.
protected  Text value1Info()
          Returns the Text widget used to display additional information for the value1 edit field.
protected  void value1Modified()
          Value1 is being edited in the text field.
protected  Text value1TextField()
          Returns the Text widget used as the value1 edit field.
protected  void value2ListSelectionModified()
          A new Value2 has been selected in the combo field list.
protected  void value2Modified()
          Value2 is being edited in the text field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParsersPreferencePage

public ParsersPreferencePage()
Method Detail

createContents

protected Control createContents(Composite parent)
Creates and returns the SWT control for the customized body of this preference page. Extended in order to set the context help.

See Also:
PreferencePage

setLastParserSelected

public static void setLastParserSelected(String parser)
Records the last document parser selected in this LPEX instance.

Parameters:
parser - a document parser name, e.g., "cpp" (see the parser editor parameter)

setVisible

public void setVisible(boolean visible)
Extended in order to update the document parser each time this page is made visible.


dispose

public void dispose()
Extended in order to clear the last document parser selected for this LPEX instance.


getValueTableNames

protected String[] getValueTableNames()
Returns the names for the table columns.


getValueNames

protected String[] getValueNames()
Returns the names for the text-field labels.


getValueWeights

protected int[] getValueWeights()
Returns the column weights for the two columns in the table.


initialize

protected Vector<com.ibm.lpex.alef.preferences.LpexTableItem> initialize()
Returns a new vector of LpexTableItems with the initial settings (the preference page is being initialized).


initializeDefaults

protected Vector<com.ibm.lpex.alef.preferences.LpexTableItem> initializeDefaults()
Returns a new vector of LpexTableItems with the install settings ("Restore Defaults" button was pressed).


tableSelectionModified

protected void tableSelectionModified(String newValue1,
                                      String newValue2)
Notification from superclass TablePreferencePage that the table selection was modified.


performOk

public boolean performOk()
"OK" / "Apply" button pressed. Commits any new updated values.


doSetPressed

protected void doSetPressed(String name,
                            String className)
Handles the "Set" button having been pressed. Extended here in order to accept "install" in the "Class name" entry field, which will restore the parser definition to its LPEX-shipped value.

Parameters:
name - trimmed value read from the value1 entry field
className - trimmed value read from the value2 entry field

value1Modified

protected void value1Modified()
Value1 is being edited in the text field. Extended to check it is a valid LPEX parser name.


value2Modified

protected void value2Modified()
Value2 is being edited in the text field. Extended to check it is a valid Java class name.


init

public void init(IWorkbench workbench)
Initializes this preference page for the given workbench. This method, defined by IWorkbenchPreferencePage, is called automatically when the preference page defined in plugin.xml is being created and initialized.

The TablePreferencePage implementation of this method does nothing.


value1TextField

protected Text value1TextField()
Returns the Text widget used as the value1 edit field.


getValue2

protected String getValue2()
Returns the text in the value2 edit field.


value1Info

protected Text value1Info()
Returns the Text widget used to display additional information for the value1 edit field.


setValid

public void setValid(boolean b)
Sets whether this page is valid. The enable state of the container buttons and the "Apply" button is updated when a page's valid state changes. Extended here to enable/disable the "Set" button as well.


contributeButtons

protected void contributeButtons(Composite buttonBar)
Contributes a "Reset" button. Method performReset() is called when this button is selected.

Parameters:
buttonBar - the preference-page button bar
See Also:
PreferencePage, performReset()

performDefaults

protected void performDefaults()
"Restore Defaults" button pressed. Sets the table to the install settings.


performReset

protected void performReset()
"Reset" button pressed. Restores the initial preference page settings.


getValue2Options

protected String[] getValue2Options()
Returns an array of options for the value2 combo list, when a combo box is used as the value2 edit field. You may override to return the desired list options.

See Also:
setValue2Options()

setValue2Options

protected void setValue2Options()
Called to (re)set the options list in the value2 combo, when a combo box is used as the value2 edit field.

See Also:
getValue2Options()

getItems

protected Vector<com.ibm.lpex.alef.preferences.LpexTableItem> getItems()
Returns the current vector of LpexTableItems in the table.


value2ListSelectionModified

protected void value2ListSelectionModified()
A new Value2 has been selected in the combo field list. The implementation of this method in TablePreferencePage does nothing. You may override.


selectItem

protected void selectItem(String value1)
Selects an item in the table, and ensures it shows. If not in the table, clears any existing selection.


LPEX
4.4.0

Copyright � 2016 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.