本文整理汇总了Java中com.intellij.util.text.StringTokenizer.nextElement方法的典型用法代码示例。如果您正苦于以下问题:Java StringTokenizer.nextElement方法的具体用法?Java StringTokenizer.nextElement怎么用?Java StringTokenizer.nextElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.text.StringTokenizer
的用法示例。
在下文中一共展示了StringTokenizer.nextElement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
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);
}
}
示例2: createTipContent
import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
private JComponent createTipContent(String tipText, DebuggerTreeNodeImpl node) {
final JToolTip tooltip = new JToolTip();
if (tipText == null) {
tooltip.setTipText(tipText);
}
else {
Dimension rootSize = getVisibleRect().getSize();
Insets borderInsets = tooltip.getBorder().getBorderInsets(tooltip);
rootSize.width -= (borderInsets.left + borderInsets.right) * 2;
rootSize.height -= (borderInsets.top + borderInsets.bottom) * 2;
@NonNls StringBuilder tipBuilder = new StringBuilder();
final String markupText = node.getMarkupTooltipText();
if (markupText != null) {
tipBuilder.append(markupText);
}
if (!tipText.isEmpty()) {
final StringTokenizer tokenizer = new StringTokenizer(tipText, "\n ", true);
while (tokenizer.hasMoreElements()) {
final String each = tokenizer.nextElement();
if ("\n".equals(each)) {
tipBuilder.append("<br>");
}
else if (" ".equals(each)) {
tipBuilder.append("  ");
}
else {
tipBuilder.append(JDOMUtil.legalizeText(each));
}
}
}
tooltip.setTipText(UIUtil.toHtml(tipBuilder.toString(), 0));
}
tooltip.setBorder(null);
return tooltip;
}