use of com.ibm.icu.util.StringTokenizer in project webtools.sourceediting by eclipse.
the class AbstractCompletionProposalCategoriesConfiguration method loadDefaultPagePreference.
/**
* <p>Loads the user preferences for which categories to
* display on the default content assist page</p>
*
* @param useDefaults if <code>true</code> then use the {@link IPreferenceStore} defaults,
* otherwise use the user specified preferences
*/
private void loadDefaultPagePreference(boolean useDefaults) {
// clear the current display on default page configuration
this.fShouldNotDisplayOnDefaultPage.clear();
// parse either the default or user configuration preference
String displayOnDefaultPage;
if (useDefaults) {
displayOnDefaultPage = getPreferenceStore().getDefaultString(getShouldNotDisplayOnDefaultPagePrefKey());
} else {
displayOnDefaultPage = getPreferenceStore().getString(getShouldNotDisplayOnDefaultPagePrefKey());
}
StringTokenizer defaultPageTokenizer = new StringTokenizer(displayOnDefaultPage, PREFERENCE_CATEGORY_SEPERATOR);
while (defaultPageTokenizer.hasMoreTokens()) {
fShouldNotDisplayOnDefaultPage.add(defaultPageTokenizer.nextToken());
}
}
use of com.ibm.icu.util.StringTokenizer in project webtools.sourceediting by eclipse.
the class AbstractCompletionProposalCategoriesConfiguration method loadDefaultPageSortOrder.
/**
* <p>Loads the user preferences for the sort order of the content assist pages</p>
*
* @param useDefaults if <code>true</code> then use the {@link IPreferenceStore} defaults,
* otherwise use the user specified preferences
*/
private void loadDefaultPageSortOrder(boolean useDefaults) {
// clear the current sort order
this.fDefaultPageSortOrder.clear();
// parse either the default or user configuration preference
String sortOrder;
if (useDefaults) {
sortOrder = getPreferenceStore().getDefaultString(getDefaultPageSortOrderPrefKey());
} else {
sortOrder = getPreferenceStore().getString(getDefaultPageSortOrderPrefKey());
}
StringTokenizer tokenizer = new StringTokenizer(sortOrder, PREFERENCE_CATEGORY_SEPERATOR);
while (tokenizer.hasMoreTokens()) {
String categoryID = tokenizer.nextToken();
this.fDefaultPageSortOrder.add(categoryID);
}
}
use of com.ibm.icu.util.StringTokenizer in project webtools.sourceediting by eclipse.
the class StringUtils method unpack.
/**
* Unpacks a comma delimited String into an array of Strings
*
* @param s
* @return
* @todo Generated comment
*/
public static String[] unpack(String s) {
if (s == null)
return new String[0];
// $NON-NLS-1$
StringTokenizer toker = new StringTokenizer(s, ",");
List<String> list = new ArrayList<>();
while (toker.hasMoreTokens()) {
// since we're separating the values with ',', escape ',' in the
// values
// $NON-NLS-1$ //$NON-NLS-2$
list.add(StringUtils.replace(toker.nextToken(), ",", ",").trim());
}
return list.toArray(new String[0]);
}
use of com.ibm.icu.util.StringTokenizer in project webtools.sourceediting by eclipse.
the class StringUtils method asArray.
/**
* Breaks out delim-separated words into an array of words. For example:
* <code>"no comment"</code> into an array <code>a[0]="no"</code> and
* <code>a[1]= "comment"</code>.
*
* @param value
* the string to be converted
* @return the list of words
*/
public static String[] asArray(String value, String delim, boolean returnTokens) {
List<String> list = new ArrayList<>();
StringTokenizer stok = new StringTokenizer(value, delim, returnTokens);
while (stok.hasMoreTokens()) {
list.add(stok.nextToken());
}
String[] result = new String[list.size()];
list.toArray(result);
return result;
}
use of com.ibm.icu.util.StringTokenizer in project webtools.sourceediting by eclipse.
the class StringUtils method asArray.
/**
* Breaks out space-separated words into an array of words. For example:
* <code>"no comment"</code> into an array <code>a[0]="no"</code> and
* <code>a[1]= "comment"</code>.
*
* @param value
* the string to be converted
* @return the list of words
*/
public static String[] asArray(String value) {
List<String> list = new ArrayList<>();
StringTokenizer stok = new StringTokenizer(value);
while (stok.hasMoreTokens()) {
list.add(stok.nextToken());
}
String[] result = new String[list.size()];
list.toArray(result);
return result;
}
Aggregations