Search in sources :

Example 36 with StringTokenizer

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());
    }
}
Also used : StringTokenizer(com.ibm.icu.util.StringTokenizer)

Example 37 with StringTokenizer

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);
    }
}
Also used : StringTokenizer(com.ibm.icu.util.StringTokenizer)

Example 38 with StringTokenizer

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(), "&comma;", ",").trim());
    }
    return list.toArray(new String[0]);
}
Also used : StringTokenizer(com.ibm.icu.util.StringTokenizer) ArrayList(java.util.ArrayList)

Example 39 with StringTokenizer

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;
}
Also used : StringTokenizer(com.ibm.icu.util.StringTokenizer) ArrayList(java.util.ArrayList)

Example 40 with StringTokenizer

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;
}
Also used : StringTokenizer(com.ibm.icu.util.StringTokenizer) ArrayList(java.util.ArrayList)

Aggregations

StringTokenizer (com.ibm.icu.util.StringTokenizer)53 ArrayList (java.util.ArrayList)9 List (java.util.List)6 HashSet (java.util.HashSet)4 IDOMAttr (org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr)4 Attr (org.w3c.dom.Attr)4 Set (java.util.Set)3 Point (org.eclipse.swt.graphics.Point)3 XSDSimpleTypeDefinition (org.eclipse.xsd.XSDSimpleTypeDefinition)3 InputStream (java.io.InputStream)2 Iterator (java.util.Iterator)2 Pattern (java.util.regex.Pattern)2 IFile (org.eclipse.core.resources.IFile)2 IProject (org.eclipse.core.resources.IProject)2 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)2 IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)2 IStatus (org.eclipse.core.runtime.IStatus)2 Status (org.eclipse.core.runtime.Status)2 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)2 IDocument (org.eclipse.jface.text.IDocument)2