Java Code Examples for com.intellij.util.text.StringTokenizer#hasMoreElements()

The following examples show how to use com.intellij.util.text.StringTokenizer#hasMoreElements() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PathMacroListEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
private Collection<String> parseIgnoredVariables() {
  final String s = myIgnoredVariables.getText();
  final List<String> ignored = new ArrayList<String>();
  final StringTokenizer st = new StringTokenizer(s, ";");
  while (st.hasMoreElements()) {
    ignored.add(st.nextElement().trim());
  }

  return ignored;
}
 
Example 2
Source File: AbstractFileType.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void loadKeywords(Element element, Set<? super String> keywords) {
  String value = element.getAttributeValue(ELEMENT_KEYWORDS);
  if (value != null) {
    StringTokenizer tokenizer = new StringTokenizer(value, SEMICOLON);
    while (tokenizer.hasMoreElements()) {
      String keyword = tokenizer.nextToken().trim();
      if (!keyword.isEmpty()) keywords.add(keyword);
    }
  }
  for (final Object o1 : element.getChildren(ELEMENT_KEYWORD)) {
    keywords.add(((Element)o1).getAttributeValue(ATTRIBUTE_NAME));
  }
}
 
Example 3
Source File: EncodingAwareProperties.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void load(File file, String encoding) throws IOException{
  String propText = FileUtil.loadFile(file, encoding);
  propText = StringUtil.convertLineSeparators(propText);
  StringTokenizer stringTokenizer = new StringTokenizer(propText, "\n");
  while (stringTokenizer.hasMoreElements()){
    String line = stringTokenizer.nextElement();
    int i = line.indexOf('=');
    String propName = i == -1 ? line : line.substring(0,i);
    String propValue = i == -1 ? "" : line.substring(i+1);
    setProperty(propName, propValue);
  }
}