org.eclipse.cdt.internal.ui.preferences
Class ProposalFilterPreferencesUtil

java.lang.Object
  extended by org.eclipse.cdt.internal.ui.preferences.ProposalFilterPreferencesUtil

public class ProposalFilterPreferencesUtil
extends java.lang.Object

A class which encapsulates several utility functions related to code completion preference settings.


Nested Class Summary
static class ProposalFilterPreferencesUtil.ComboState
          Convenience class wraps the data to initialize a Combo
 
Method Summary
static java.lang.String comboStateAsString(org.eclipse.swt.widgets.Combo combo)
          The state of a Combo consists of the list of entries and the index of the selected entry.
static ProposalFilterPreferencesUtil.ComboState getComboState(java.lang.String comboPreference)
          Convenience method to extract the state of a Combo from the state string stored e.g. in a preference store
static org.eclipse.core.runtime.IConfigurationElement getElementForName(java.lang.String filterName)
          Return the configuration element which corresponds to the human-readable filter name
static org.eclipse.core.runtime.IConfigurationElement getPreferredFilterElement()
          Look up the setting for the preferred proposal filter and return it's configuration element.
static java.lang.String[] getProposalFilterNames()
          Get an array of proposal filter names (i.e. the human-readable text for display to fill into the Combo)
static java.lang.String getProposalFilternamesAsString()
          Look up all contributed completion proposal filters and return their names as a semicolon-separated list plus a leading entry for the selected index 0, plus a leading entry.
static void restoreComboFromString(org.eclipse.swt.widgets.Combo combo, java.lang.String text)
          The state of a Combo consists of the list of entries and the index of the selected entry.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getProposalFilterNames

public static java.lang.String[] getProposalFilterNames()
Get an array of proposal filter names (i.e. the human-readable text for display to fill into the Combo)


getProposalFilternamesAsString

public static java.lang.String getProposalFilternamesAsString()
Look up all contributed completion proposal filters and return their names as a semicolon-separated list plus a leading entry for the selected index 0, plus a leading entry.
A Combo may be initialized from this string.

Returns:
The list of filter names

getElementForName

public static org.eclipse.core.runtime.IConfigurationElement getElementForName(java.lang.String filterName)
Return the configuration element which corresponds to the human-readable filter name

Parameters:
filterName - The human-readable filter name
Returns:
The configuration element, or null if there is none

comboStateAsString

public static java.lang.String comboStateAsString(org.eclipse.swt.widgets.Combo combo)
The state of a Combo consists of the list of entries and the index of the selected entry. This method converts the state of the given Combo to a string representation for storage in a preference store.
The string contains a semicolon-separated list of entries. The first entry is the index of the selected entry. The following entries are the texts of the individual fields.
Since the semicolon is the separator, the entries cannot contain semicolons. This method will replace semicolons with commas if any are found.

Parameters:
combo - The Combo whose state shall be converted
Returns:
A string representation of the Combo state

restoreComboFromString

public static void restoreComboFromString(org.eclipse.swt.widgets.Combo combo,
                                          java.lang.String text)
The state of a Combo consists of the list of entries and the index of the selected entry. This method takes a string representation of the state (e.g. from a preference store) and restores it into the Combo.
For a description of the text format see method comboStateAsString().

Parameters:
combo - The combo to be restored.
text - The text representation of the state.

getComboState

public static ProposalFilterPreferencesUtil.ComboState getComboState(java.lang.String comboPreference)
Convenience method to extract the state of a Combo from the state string stored e.g. in a preference store

Parameters:
comboPreference - The state string
Returns:
A ComboState instance.

getPreferredFilterElement

public static org.eclipse.core.runtime.IConfigurationElement getPreferredFilterElement()
Look up the setting for the preferred proposal filter and return it's configuration element.

Returns:
The configuration element, or null if none is found.