当前位置: 首页>>代码示例>>Java>>正文


Java HintUtil.prepareHintText方法代码示例

本文整理汇总了Java中com.intellij.codeInsight.hint.HintUtil.prepareHintText方法的典型用法代码示例。如果您正苦于以下问题:Java HintUtil.prepareHintText方法的具体用法?Java HintUtil.prepareHintText怎么用?Java HintUtil.prepareHintText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.codeInsight.hint.HintUtil的用法示例。


在下文中一共展示了HintUtil.prepareHintText方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculateWidthIncrease

import com.intellij.codeInsight.hint.HintUtil; //导入方法依赖的package包/类
/**
 * It's possible that we need to expand quick doc control's width in order to provide better visual representation
 * (see https://youtrack.jetbrains.com/issue/IDEA-101425). This method calculates that width expand.
 *
 * @param buttonWidth  icon button's width
 * @param updatedText  text which will be should at the quick doc control
 * @return             width increase to apply to the target quick doc control (zero if no additional width increase is required)
 */
private static int calculateWidthIncrease(int buttonWidth, String updatedText) {
  int maxLineWidth = 0;
  TIntArrayList lineWidths = new TIntArrayList();
  for (String lineText : StringUtil.split(updatedText, "<br/>")) {
    String html = HintUtil.prepareHintText(lineText, HintUtil.getInformationHint());
    int width = new JLabel(html).getPreferredSize().width;
    maxLineWidth = Math.max(maxLineWidth, width);
    lineWidths.add(width);
  }

  if (!lineWidths.isEmpty()) {
    int firstLineAvailableTrailingWidth = maxLineWidth - lineWidths.get(0);
    if (firstLineAvailableTrailingWidth >= buttonWidth) {
      return 0;
    }
    else {
      return buttonWidth - firstLineAvailableTrailingWidth;
    }
  }
  return 0;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:CtrlMouseHandler.java

示例2: calculateWidthIncrease

import com.intellij.codeInsight.hint.HintUtil; //导入方法依赖的package包/类
/**
 * It's possible that we need to expand quick doc control's width in order to provide better visual representation
 * (see http://youtrack.jetbrains.com/issue/IDEA-101425). This method calculates that width expand.
 *
 * @param buttonWidth  icon button's width
 * @param updatedText  text which will be should at the quick doc control
 * @return             width increase to apply to the target quick doc control (zero if no additional width increase is required)
 */
private static int calculateWidthIncrease(int buttonWidth, String updatedText) {
  int maxLineWidth = 0;
  TIntArrayList lineWidths = new TIntArrayList();
  for (String lineText : StringUtil.split(updatedText, "<br/>")) {
    String html = HintUtil.prepareHintText(lineText, HintUtil.getInformationHint());
    int width = new JLabel(html).getPreferredSize().width;
    maxLineWidth = Math.max(maxLineWidth, width);
    lineWidths.add(width);
  }

  if (!lineWidths.isEmpty()) {
    int firstLineAvailableTrailingWidth = maxLineWidth - lineWidths.get(0);
    if (firstLineAvailableTrailingWidth >= buttonWidth) {
      return 0;
    }
    else {
      return buttonWidth - firstLineAvailableTrailingWidth;
    }
  }
  return 0;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:30,代码来源:CtrlMouseHandler.java

示例3: calculateWidthIncrease

import com.intellij.codeInsight.hint.HintUtil; //导入方法依赖的package包/类
/**
 * It's possible that we need to expand quick doc control's width in order to provide better visual representation
 * (see https://youtrack.jetbrains.com/issue/IDEA-101425). This method calculates that width expand.
 *
 * @param buttonWidth icon button's width
 * @param updatedText text which will be should at the quick doc control
 * @return width increase to apply to the target quick doc control (zero if no additional width increase is required)
 */
private static int calculateWidthIncrease(int buttonWidth, String updatedText) {
  int maxLineWidth = 0;
  TIntArrayList lineWidths = new TIntArrayList();
  for (String lineText : StringUtil.split(updatedText, "<br/>")) {
    String html = HintUtil.prepareHintText(lineText, HintUtil.getInformationHint());
    int width = new JLabel(html).getPreferredSize().width;
    maxLineWidth = Math.max(maxLineWidth, width);
    lineWidths.add(width);
  }

  if (!lineWidths.isEmpty()) {
    int firstLineAvailableTrailingWidth = maxLineWidth - lineWidths.get(0);
    if (firstLineAvailableTrailingWidth >= buttonWidth) {
      return 0;
    }
    else {
      return buttonWidth - firstLineAvailableTrailingWidth;
    }
  }
  return 0;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:30,代码来源:CtrlMouseHandler.java

示例4: toHTML

import com.intellij.codeInsight.hint.HintUtil; //导入方法依赖的package包/类
private String toHTML(String text) {
  final HintHint hintHint = new HintHint(myDescriptionBrowser, new Point(0, 0));
  hintHint.setFont(UIUtil.getLabelFont());
  return HintUtil.prepareHintText(text, hintHint);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:IntentionDescriptionPanel.java

示例5: toHTML

import com.intellij.codeInsight.hint.HintUtil; //导入方法依赖的package包/类
private String toHTML(String text) {
  final HintHint hintHint = new HintHint(myBrowser, new Point(0, 0));
  hintHint.setFont(UIUtil.getLabelFont());
  return HintUtil.prepareHintText(text, hintHint);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:SingleInspectionProfilePanel.java


注:本文中的com.intellij.codeInsight.hint.HintUtil.prepareHintText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。