本文整理汇总了Java中com.intellij.codeInsight.hint.HintManager.HIDE_BY_SCROLLING属性的典型用法代码示例。如果您正苦于以下问题:Java HintManager.HIDE_BY_SCROLLING属性的具体用法?Java HintManager.HIDE_BY_SCROLLING怎么用?Java HintManager.HIDE_BY_SCROLLING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.codeInsight.hint.HintManager
的用法示例。
在下文中一共展示了HintManager.HIDE_BY_SCROLLING属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showEditorHint
public static void showEditorHint(final String info, final Editor editor) {
final JLabel label = new JLabel(info);
label.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.WHITE, Gray._128),
BorderFactory.createEmptyBorder(3, 5, 3, 5)));
label.setForeground(JBColor.foreground());
label.setBackground(HintUtil.INFORMATION_COLOR);
label.setOpaque(true);
label.setFont(label.getFont().deriveFont(Font.BOLD));
final LightweightHint h = new LightweightHint(label);
final Point point = editor.visualPositionToXY(editor.getCaretModel().getVisualPosition());
SwingUtilities.convertPointToScreen(point, editor.getContentComponent());
/* === HintManager API Info ===
public void showEditorHint(final LightweightHint hint,
final Editor editor,
Point p,
int flags,
int timeout,
boolean reviveOnEditorChange)
reviveOnEditorChange means hint should stay even if active editor have been changed. It's should rarely be true.
possible flags are:
public static final int HIDE_BY_ESCAPE = 0x01;
public static final int HIDE_BY_ANY_KEY = 0x02;
public static final int HIDE_BY_LOOKUP_ITEM_CHANGE = 0x04;
public static final int HIDE_BY_TEXT_CHANGE = 0x08;
public static final int HIDE_BY_OTHER_HINT = 0x10;
public static final int HIDE_BY_SCROLLING = 0x20;
public static final int HIDE_IF_OUT_OF_EDITOR = 0x40;
public static final int UPDATE_BY_SCROLLING = 0x80;
*/
final int flags = HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_SCROLLING;
HintManagerImpl.getInstanceImpl().showEditorHint(h, editor, point, flags, 0, false);
}
示例2: showPreviewEditorErrorToolTip
public static void showPreviewEditorErrorToolTip(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?
hintMgr.showErrorHint(editor, msg,
offset, offset+1,
HintManager.ABOVE, flags, timeout);
}
示例3: showDecisionEventToolTip
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);
}
示例4: showActiveHint
public static void showActiveHint(@NotNull Range range,
@NotNull Editor editor,
@Nullable Point mousePosition,
@NotNull LineStatusTracker tracker) {
final Disposable disposable = Disposer.newDisposable();
List<DiffFragment> wordDiff = computeWordDiff(range, tracker);
installEditorHighlighters(range, editor, tracker, wordDiff, disposable);
Pair<JComponent, Integer> editorComponent = createEditorComponent(range, editor, tracker, wordDiff);
ActionToolbar toolbar = buildToolbar(range, editor, tracker, disposable);
toolbar.updateActionsImmediately(); // we need valid ActionToolbar.getPreferredSize() to calc size of popup
PopupPanel popupPanel = new PopupPanel(editor, toolbar, editorComponent.first, editorComponent.second);
LightweightHint hint = new LightweightHint(popupPanel);
HintListener closeListener = new HintListener() {
public void hintHidden(final EventObject event) {
Disposer.dispose(disposable);
}
};
hint.addHintListener(closeListener);
int line = editor.getCaretModel().getLogicalPosition().line;
Point point = HintManagerImpl.getHintPosition(hint, editor, new LogicalPosition(line, 0), HintManager.UNDER);
if (mousePosition != null) { // show right after the nearest line
int lineHeight = editor.getLineHeight();
int delta = (point.y - mousePosition.y) % lineHeight;
if (delta < 0) delta += lineHeight;
point.y = mousePosition.y + delta;
}
point.x -= popupPanel.getEditorTextOffset(); // align main editor with the one in popup
int flags = HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING;
HintManagerImpl.getInstanceImpl().showEditorHint(hint, editor, point, flags, -1, false, new HintHint(editor, point));
if (!hint.isVisible()) {
closeListener.hintHidden(null);
}
}
示例5: showHintAt
public void showHintAt(@Nullable Point mousePosition) {
if (!myTracker.isValid()) return;
final Disposable disposable = Disposer.newDisposable();
FileType fileType = getFileType();
List<DiffFragment> wordDiff = computeWordDiff();
installMasterEditorHighlighters(wordDiff, disposable);
JComponent editorComponent = createEditorComponent(fileType, wordDiff);
ActionToolbar toolbar = buildToolbar(mousePosition, disposable);
toolbar.updateActionsImmediately(); // we need valid ActionToolbar.getPreferredSize() to calc size of popup
toolbar.setReservePlaceAutoPopupIcon(false);
PopupPanel popupPanel = new PopupPanel(myEditor, toolbar, editorComponent);
LightweightHint hint = new LightweightHint(popupPanel);
HintListener closeListener = new HintListener() {
public void hintHidden(final EventObject event) {
Disposer.dispose(disposable);
}
};
hint.addHintListener(closeListener);
int line = myEditor.getCaretModel().getLogicalPosition().line;
Point point = HintManagerImpl.getHintPosition(hint, myEditor, new LogicalPosition(line, 0), HintManager.UNDER);
if (mousePosition != null) { // show right after the nearest line
int lineHeight = myEditor.getLineHeight();
int delta = (point.y - mousePosition.y) % lineHeight;
if (delta < 0) delta += lineHeight;
point.y = mousePosition.y + delta;
}
point.x -= popupPanel.getEditorTextOffset(); // align main editor with the one in popup
int flags = HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING;
HintManagerImpl.getInstanceImpl().showEditorHint(hint, myEditor, point, flags, -1, false, new HintHint(myEditor, point));
if (!hint.isVisible()) {
closeListener.hintHidden(null);
}
}