本文整理汇总了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);
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}