• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HintUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createTooltip

import com.intellij.codeInsight.hint.HintUtil; //导入依赖的package包/类
public static HyperlinkLabel createTooltip(final String message) {
  final HyperlinkLabel link = new HyperlinkLabel("");
  link.setIcon(AllIcons.General.Help_small);
  link.setUseIconAsLink(true);
  link.setIconTextGap(0);
  link.addHyperlinkListener(new HyperlinkAdapter() {
    @Override
    protected void hyperlinkActivated(HyperlinkEvent e) {
      final JLabel label = new JLabel(message);
      label.setBorder(HintUtil.createHintBorder());
      label.setBackground(HintUtil.INFORMATION_COLOR);
      label.setOpaque(true);
      HintManager.getInstance()
        .showHint(label, RelativePoint.getSouthEastOf(link), HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE, -1);
    }
  });
  return link;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:TooltipUtil.java


示例2: updateBalloonText

import com.intellij.codeInsight.hint.HintUtil; //导入依赖的package包/类
private void updateBalloonText() {
  final Point point = myVertical ? new Point(0, myPointerValue) : new Point(myPointerValue, 0);
  myLabel.setText(myTitle + ": " + Unit.formatValue(myValue, myUnit));
  if (myTooltipHint == null) {
    myTooltipHint = new LightweightHint(myLabel);
    myTooltipHint.setCancelOnClickOutside(false);
    myTooltipHint.setCancelOnOtherWindowOpen(false);

    final HintHint hint = new HintHint(this, point)
      .setPreferredPosition(myVertical ? Balloon.Position.atLeft : Balloon.Position.above)
      .setBorderColor(Color.BLACK)
      .setAwtTooltip(true)
      .setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD))
      .setTextBg(HintUtil.INFORMATION_COLOR)
      .setShowImmediately(true);

    final Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
    myTooltipHint.show(this, point.x, point.y, owner instanceof JComponent ? (JComponent)owner : null, hint);
  }
  else {
    myTooltipHint.setLocation(new RelativePoint(this, point));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:SlideComponent.java


示例3: setAdText

import com.intellij.codeInsight.hint.HintUtil; //导入依赖的package包/类
@Override
public void setAdText(@NotNull final String s, int alignment) {
  if (myAdComponent == null) {
    myAdComponent = HintUtil.createAdComponent(s, JBUI.Borders.empty(1, 5), alignment);
    JPanel wrapper = new JPanel(new BorderLayout()) {
      @Override
      protected void paintComponent(Graphics g) {
        g.setColor(Gray._135);
        g.drawLine(0, 0, getWidth(), 0);
        super.paintComponent(g);
      }
    };
    wrapper.setOpaque(false);
    wrapper.setBorder(JBUI.Borders.emptyTop(1));
    wrapper.add(myAdComponent, BorderLayout.CENTER);
    myContent.add(wrapper, BorderLayout.SOUTH);
    pack(false, true);
  } else {
    myAdComponent.setText(s);
    myAdComponent.setHorizontalAlignment(alignment);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AbstractPopup.java


示例4: VcsCommitInfoBalloon

import com.intellij.codeInsight.hint.HintUtil; //导入依赖的package包/类
public VcsCommitInfoBalloon(@NotNull JTree tree) {
  myTree = tree;
  myEditorPane = new JEditorPane(UIUtil.HTML_MIME, "");
  myEditorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
  myEditorPane.setEditable(false);
  myEditorPane.setBackground(HintUtil.INFORMATION_COLOR);
  myEditorPane.setFont(UIUtil.getToolTipFont());
  myEditorPane.setBorder(HintUtil.createHintBorder());
  Border margin = IdeBorderFactory.createEmptyBorder(3, 3, 3, 3);
  myEditorPane.setBorder(new CompoundBorder(myEditorPane.getBorder(), margin));
  myEditorPane.addHyperlinkListener(new HyperlinkAdapter() {
    @Override
    protected void hyperlinkActivated(HyperlinkEvent e) {
      BrowserUtil.browse(e.getURL());
    }
  });
  myWrapper = new Wrapper(myEditorPane);
  myPopupBuilder = JBPopupFactory.getInstance().createComponentPopupBuilder(myWrapper, null);
  myPopupBuilder.setCancelOnClickOutside(true).setResizable(true).setMovable(true).setRequestFocus(false)
    .setMinSize(new Dimension(80, 30));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:VcsCommitInfoBalloon.java


示例5: 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


示例6: setAdText

import com.intellij.codeInsight.hint.HintUtil; //导入依赖的package包/类
@Override
public void setAdText(@NotNull final String s, int alignment) {
  if (myAdComponent == null) {
    myAdComponent = HintUtil.createAdComponent(s, BorderFactory.createEmptyBorder(1, 5, 1, 5), alignment);
    JPanel wrapper = new JPanel(new BorderLayout()) {
      @Override
      protected void paintComponent(Graphics g) {
        g.setColor(Gray._135);
        g.drawLine(0, 0, getWidth(), 0);
        super.paintComponent(g);
      }
    };
    wrapper.setOpaque(false);
    wrapper.setBorder(new EmptyBorder(1, 0, 0, 0));
    wrapper.add(myAdComponent, BorderLayout.CENTER);
    myContent.add(wrapper, BorderLayout.SOUTH);
    pack(false, true);
  } else {
    myAdComponent.setText(s);
    myAdComponent.setHorizontalAlignment(alignment);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:AbstractPopup.java


示例7: 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


示例8: SQLPopupView

import com.intellij.codeInsight.hint.HintUtil; //导入依赖的package包/类
/**
 * construct parameter table and SQL panel
 *
 * @param parameterClass parameter class
 * @param parameters     parameter list
 * @param rawSqlCode     SQL code
 */
public SQLPopupView(PsiClass parameterClass, Set<String> parameters, String rawSqlCode) {
    this.rawSqlCode = rawSqlCode;
    this.parameterClass = parameterClass;
    try {
        ParametersTableModel tableModel = new ParametersTableModel();
        for (String parameter : parameters) {
            tableModel.add(parameter, "string", "");
            updateParameterValue(parameter, "");
        }
        paramsTable.setModel(tableModel);
        textPane.setText(rawSqlCode);
        textPane.setBackground(HintUtil.INFORMATION_COLOR);
    }
    catch (Exception e) {
        textPane.setText(e.getMessage());
    }
}
 
开发者ID:code4craft,项目名称:ibatis-plugin,代码行数:25,代码来源:SQLPopupView.java


示例9: setAdText

import com.intellij.codeInsight.hint.HintUtil; //导入依赖的package包/类
@Override
public void setAdText(@Nonnull final String s, int alignment) {
  if (myAdComponent == null) {
    myAdComponent = HintUtil.createAdComponent(s, JBUI.Borders.empty(1, 5), alignment);
    JPanel wrapper = new JPanel(new BorderLayout()) {
      @Override
      protected void paintComponent(Graphics g) {
        g.setColor(Gray._135);
        UIUtil.drawLine(g, 0, 0, getWidth(), 0);
        super.paintComponent(g);
      }
    };
    wrapper.setOpaque(false);
    wrapper.setBorder(JBUI.Borders.emptyTop(1));
    wrapper.add(myAdComponent, BorderLayout.CENTER);
    myContent.add(wrapper, BorderLayout.SOUTH);
    pack(false, true);
  }
  else {
    myAdComponent.setText(s);
    myAdComponent.setHorizontalAlignment(alignment);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:AbstractPopup.java


示例10: VcsCommitInfoBalloon

import com.intellij.codeInsight.hint.HintUtil; //导入依赖的package包/类
public VcsCommitInfoBalloon(@Nonnull JTree tree) {
  myTree = tree;
  myEditorPane = new JEditorPane(UIUtil.HTML_MIME, "");
  myEditorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
  myEditorPane.setEditable(false);
  myEditorPane.setBackground(HintUtil.INFORMATION_COLOR);
  myEditorPane.setFont(UIUtil.getToolTipFont());
  myEditorPane.setBorder(HintUtil.createHintBorder());
  Border margin = IdeBorderFactory.createEmptyBorder(3, 3, 3, 3);
  myEditorPane.setBorder(new CompoundBorder(myEditorPane.getBorder(), margin));
  myEditorPane.addHyperlinkListener(new HyperlinkAdapter() {
    @Override
    protected void hyperlinkActivated(HyperlinkEvent e) {
      BrowserUtil.browse(e.getURL());
    }
  });
  myWrapper = new Wrapper(myEditorPane);
  myPopupBuilder = JBPopupFactory.getInstance().createComponentPopupBuilder(myWrapper, null);
  myPopupBuilder.setCancelOnClickOutside(true).setResizable(true).setMovable(true).setRequestFocus(false)
          .setMinSize(new Dimension(80, 30));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:VcsCommitInfoBalloon.java


示例11: 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


示例12: showMessageIfNeeded

import com.intellij.codeInsight.hint.HintUtil; //导入依赖的package包/类
private void showMessageIfNeeded() {
  if (myWarning != null) {
    myEditor.getScrollingModel().disableAnimation();
    myEditor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
    myEditor.getScrollingModel().enableAnimation();

    LogicalPosition hintPosition = myCaret.getLogicalPosition();
    if (myWarningLocation != null) {
      LogicalPosition targetPosition = myEditor.offsetToLogicalPosition(myWarningLocation.getStartOffset());
      Point targetPoint = myEditor.logicalPositionToXY(targetPosition);
      if (myEditor.getScrollingModel().getVisibleArea().contains(targetPoint)) {
        hintPosition = targetPosition;
      }
    }
    LightweightHint hint = new LightweightHint(HintUtil.createInformationLabel(myWarning));
    Point p = HintManagerImpl.getHintPosition(hint, myEditor, hintPosition, HintManager.ABOVE);
    HintManagerImpl.getInstanceImpl().showEditorHint(hint, myEditor, p, 0, 0, false);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:CommentByBlockCommentHandler.java


示例13: showHint

import com.intellij.codeInsight.hint.HintUtil; //导入依赖的package包/类
private void showHint(final SimpleColoredText text, final WatchItemDescriptor descriptor) {
  DebuggerInvocationUtil.invokeLater(getProject(), new Runnable() {
    @Override
    public void run() {
      if(!isHintHidden()) {
        JComponent component;
        if (!isActiveTooltipApplicable(descriptor.getValue())) {
          component = HintUtil.createInformationLabel(text);
        }
        else {
          component = createExpandableHintComponent(text, new Runnable() {
            @Override
            public void run() {
              final DebuggerContextImpl debuggerContext = DebuggerManagerEx.getInstanceEx(getProject()).getContext();
              final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
              debugProcess.getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext) {
                            @Override
                            public void threadAction() {
                              descriptor.setRenderer(debugProcess.getAutoRenderer(descriptor));
                              final String expressionText = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
                                @Override
                                public String compute() {
                                  return myCurrentExpression.getText();
                                }
                              });

                              createAndShowTree(expressionText, descriptor);
                            }
                          });
            }
          });
        }
        if (!showHint(component)) return;
        if(getType() == ValueHintType.MOUSE_CLICK_HINT) {
          HintUtil.createInformationLabel(text).requestFocusInWindow();
        }
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:ValueHint.java


示例14: createNotifyHint

import com.intellij.codeInsight.hint.HintUtil; //导入依赖的package包/类
@NotNull
private static HintHint createNotifyHint(@NotNull JComponent component, @NotNull Point point, boolean above) {
  return new HintHint(component, point)
    .setPreferredPosition(above ? Balloon.Position.above : Balloon.Position.below)
    .setAwtTooltip(true)
    .setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD))
    .setTextBg(HintUtil.INFORMATION_COLOR)
    .setShowImmediately(true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:DiffRequestProcessor.java


示例15: showNoSuggestions

import com.intellij.codeInsight.hint.HintUtil; //导入依赖的package包/类
private void showNoSuggestions(boolean isExplicit) {
  hideCurrentPopup();

  if (!isExplicit) return;

  final JComponent message = HintUtil.createErrorLabel(IdeBundle.message("file.chooser.completion.no.suggestions"));
  final ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(message, message);
  builder.setRequestFocus(false).setResizable(false).setAlpha(0.1f).setFocusOwners(new Component[] {myPathTextField});
  myNoSuggestionsPopup = builder.createPopup();
  myNoSuggestionsPopup.showInScreenCoordinates(getField(), getLocationForCaret(myPathTextField));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:FileTextFieldImpl.java


示例16: setWarning

import com.intellij.codeInsight.hint.HintUtil; //导入依赖的package包/类
public void setWarning(@NotNull String text) {
  JBLabel label = new JBLabel(text, UIUtil.getBalloonWarningIcon(), SwingConstants.CENTER);
  label.setOpaque(true);
  Color color = HintUtil.INFORMATION_COLOR;
  label.setBackground(color);
  label.setBorder(BorderFactory.createLineBorder(color, 3));
  myHeaderPanel.add(label, BorderLayout.SOUTH);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AbstractPopup.java


示例17: createExpandableHintComponent

import com.intellij.codeInsight.hint.HintUtil; //导入依赖的package包/类
protected JComponent createExpandableHintComponent(final SimpleColoredText text, final Runnable expand) {
  final JComponent component = HintUtil.createInformationLabel(text, IconUtil.getAddIcon());
  addClickListenerToHierarchy(component, new ClickListener() {
    @Override
    public boolean onClick(@NotNull MouseEvent event, int clickCount) {
      if (myCurrentHint != null) {
        myCurrentHint.hide();
      }
      expand.run();
      return true;
    }
  });
  return component;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:AbstractValueHint.java


示例18: showValuePopup

import com.intellij.codeInsight.hint.HintUtil; //导入依赖的package包/类
public static void showValuePopup(@NotNull XFullValueEvaluator evaluator, @NotNull MouseEvent event, @NotNull Project project, @Nullable Editor editor) {
  EditorTextField textArea = new TextViewer("Evaluating...", project);
  textArea.setBackground(HintUtil.INFORMATION_COLOR);

  final FullValueEvaluationCallbackImpl callback = new FullValueEvaluationCallbackImpl(textArea);
  evaluator.startEvaluation(callback);

  Dimension size = DimensionService.getInstance().getSize(FULL_VALUE_POPUP_DIMENSION_KEY, project);
  if (size == null) {
    Dimension frameSize = WindowManager.getInstance().getFrame(project).getSize();
    size = new Dimension(frameSize.width / 2, frameSize.height / 2);
  }

  textArea.setPreferredSize(size);

  JBPopup popup = createValuePopup(project, textArea, callback);
  if (editor == null) {
    Rectangle bounds = new Rectangle(event.getLocationOnScreen(), size);
    ScreenUtil.fitToScreenVertical(bounds, 5, 5, true);
    if (size.width != bounds.width || size.height != bounds.height) {
      size = bounds.getSize();
      textArea.setPreferredSize(size);
    }
    popup.showInScreenCoordinates(event.getComponent(), bounds.getLocation());
  }
  else {
    popup.showInBestPositionFor(editor);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:DebuggerUIUtil.java


示例19: showHint

import com.intellij.codeInsight.hint.HintUtil; //导入依赖的package包/类
public static void showHint(@NotNull Editor editor, @NotNull String info, @Nullable HyperlinkListener hyperlinkListener) {
  JComponent component = HintUtil.createInformationLabel(info, hyperlinkListener, null, null);
  LightweightHint hint = new LightweightHint(component);
  HintManagerImpl.getInstanceImpl().showEditorHint(hint, editor, HintManager.UNDER,
                                                   HintManager.HIDE_BY_ANY_KEY |
                                                   HintManager.HIDE_BY_TEXT_CHANGE |
                                                   HintManager.HIDE_BY_SCROLLING,
                                                   0, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:FileInEditorProcessor.java


示例20: showReadOnlyViewWarning

import com.intellij.codeInsight.hint.HintUtil; //导入依赖的package包/类
public static void showReadOnlyViewWarning(Editor editor) {
  if (ApplicationManager.getApplication().isHeadlessEnvironment()) return;
  
  JComponent component = HintUtil.createInformationLabel("This view is read-only");
  final LightweightHint hint = new LightweightHint(component);
  HintManagerImpl.getInstanceImpl().showEditorHint(hint, editor, HintManager.UNDER,
                             HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING, 0, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:CodeInsightUtilBase.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JFormatter类代码示例发布时间:2022-05-22
下一篇:
Java WebWindow类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap