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


Java HintUtil.createInformationLabel方法代码示例

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


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

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

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

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

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

示例5: showHint

import com.intellij.codeInsight.hint.HintUtil; //导入方法依赖的package包/类
protected static void showHint(final Editor editor) {
  String message = FindBundle.message("select.next.occurence.not.found.message");
  final LightweightHint hint = new LightweightHint(HintUtil.createInformationLabel(message));
  HintManagerImpl.getInstanceImpl().showEditorHint(hint,
                                                   editor,
                                                   HintManager.UNDER,
                                                   HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING,
                                                   0,
                                                   false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:SelectOccurrencesActionHandler.java

示例6: showEditorHint

import com.intellij.codeInsight.hint.HintUtil; //导入方法依赖的package包/类
private static void showEditorHint(String message, final Editor editor) {
  JComponent component = HintUtil.createInformationLabel(message);
  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,代码来源:FindUsagesManager.java

示例7: showQueryContextHint

import com.intellij.codeInsight.hint.HintUtil; //导入方法依赖的package包/类
/**
 * Shows a query context hint under the current caret position.
 * The hint hides after a few seconds or when the user interacts with the editor
 */
private static void showQueryContextHint(Editor editor, String hintText) {
    final HintManagerImpl hintManager = HintManagerImpl.getInstanceImpl();
    final JComponent label = HintUtil.createInformationLabel(hintText);
    final LightweightHint lightweightHint = new LightweightHint(label);
    final Point hintPosition = hintManager.getHintPosition(lightweightHint, editor, HintManager.UNDER);
    hintManager.showEditorHint(lightweightHint, editor, hintPosition, 0, 2000, false, HintManager.UNDER);
}
 
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:12,代码来源:JSGraphQLQueryContextHighlightVisitor.java

示例8: createExpandableHintComponent

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

示例9: prepareEditorForWrite

import com.intellij.codeInsight.hint.HintUtil; //导入方法依赖的package包/类
public static boolean prepareEditorForWrite(@NotNull Editor editor) {
  if (!editor.isViewer()) return true;
  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);
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:CodeInsightUtilBase.java

示例10: createHintComponent

import com.intellij.codeInsight.hint.HintUtil; //导入方法依赖的package包/类
@NotNull
private JComponent createHintComponent(@NotNull String text,
                                       @NotNull final FindUsagesHandler handler,
                                       @NotNull final RelativePoint popupPosition,
                                       final Editor editor,
                                       @NotNull final Runnable cancelAction,
                                       final int maxUsages,
                                       @NotNull final FindUsagesOptions options) {
  JComponent label = HintUtil.createInformationLabel(suggestSecondInvocation(options, handler, text + " "));
  InplaceButton button = createSettingsButton(handler, popupPosition, editor, maxUsages, cancelAction);

  JPanel panel = new JPanel(new BorderLayout()) {
    @Override
    public void addNotify() {
      mySearchEverywhereRunnable = new Runnable() {
        @Override
        public void run() {
          searchEverywhere(options, handler, editor, popupPosition, maxUsages);
        }
      };
      super.addNotify();
    }

    @Override
    public void removeNotify() {
      mySearchEverywhereRunnable = null;
      super.removeNotify();
    }
  };
  button.setBackground(label.getBackground());
  panel.setBackground(label.getBackground());
  label.setOpaque(false);
  label.setBorder(null);
  panel.setBorder(HintUtil.createHintBorder());
  panel.add(label, BorderLayout.CENTER);
  panel.add(button, BorderLayout.EAST);
  return panel;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:39,代码来源:ShowUsagesAction.java

示例11: showDecisionEventToolTip

import com.intellij.codeInsight.hint.HintUtil; //导入方法依赖的package包/类
public static void showDecisionEventToolTip(Editor editor, int offset, HintManagerImpl hintMgr, String msg) {
	int flags =
		HintManager.HIDE_BY_ANY_KEY|
			HintManager.HIDE_BY_TEXT_CHANGE|
			HintManager.HIDE_BY_SCROLLING;
	int timeout = 0; // default?
	JComponent infoLabel = HintUtil.createInformationLabel(msg);
	LightweightHint hint = new LightweightHint(infoLabel);
	final LogicalPosition pos = editor.offsetToLogicalPosition(offset);
	final Point p = HintManagerImpl.getHintPosition(hint, editor, pos, HintManager.ABOVE);
	hintMgr.showEditorHint(hint, editor, p, flags, timeout, false);
}
 
开发者ID:antlr,项目名称:intellij-plugin-v4,代码行数:13,代码来源:InputPanel.java

示例12: createHintComponent

import com.intellij.codeInsight.hint.HintUtil; //导入方法依赖的package包/类
@NotNull
private JComponent createHintComponent(@NotNull String text,
    @NotNull final FindUsagesHandler handler, @NotNull final RelativePoint popupPosition,
    final Editor editor, @NotNull final Runnable cancelAction, final int maxUsages,
    @NotNull final FindUsagesOptions options) {
  JComponent label =
      HintUtil.createInformationLabel(suggestSecondInvocation(options, handler, text + " "));
  InplaceButton button =
      createSettingsButton(handler, popupPosition, editor, maxUsages, cancelAction);

  JPanel panel = new JPanel(new BorderLayout()) {
    @Override
    public void addNotify() {
      mySearchEverywhereRunnable = new Runnable() {
        @Override
        public void run() {
          searchEverywhere(options, handler, editor, popupPosition, maxUsages);
        }
      };
      super.addNotify();
    }

    @Override
    public void removeNotify() {
      mySearchEverywhereRunnable = null;
      super.removeNotify();
    }
  };
  button.setBackground(label.getBackground());
  panel.setBackground(label.getBackground());
  label.setOpaque(false);
  label.setBorder(null);
  panel.setBorder(HintUtil.createHintBorder());
  panel.add(label, BorderLayout.CENTER);
  panel.add(button, BorderLayout.EAST);
  return panel;
}
 
开发者ID:square,项目名称:dagger-intellij-plugin,代码行数:38,代码来源:ShowUsagesAction.java

示例13: 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(@Nonnull MouseEvent event, int clickCount) {
      if (myCurrentHint != null) {
        myCurrentHint.hide();
      }
      expand.run();
      return true;
    }
  });
  return component;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:AbstractValueHint.java

示例14: showHint

import com.intellij.codeInsight.hint.HintUtil; //导入方法依赖的package包/类
public static void showHint(@Nonnull Editor editor, @Nonnull 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:consulo,项目名称:consulo,代码行数:10,代码来源:FileInEditorProcessor.java

示例15: 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:consulo,项目名称:consulo,代码行数:9,代码来源:CodeInsightUtilBase.java


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