本文整理汇总了Java中com.intellij.codeInsight.hint.HintManagerImpl类的典型用法代码示例。如果您正苦于以下问题:Java HintManagerImpl类的具体用法?Java HintManagerImpl怎么用?Java HintManagerImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HintManagerImpl类属于com.intellij.codeInsight.hint包,在下文中一共展示了HintManagerImpl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: show
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的package包/类
@Override
public LightweightHint show(@NotNull Editor editor, @NotNull Point p, boolean alignToRight, @NotNull TooltipGroup group, @NotNull HintHint hintHint) {
myTrafficLightRenderer = (TrafficLightRenderer)((EditorMarkupModelImpl)editor.getMarkupModel()).getErrorStripeRenderer();
myPanel = new TrafficProgressPanel(myTrafficLightRenderer, editor, hintHint);
repaintTooltipWindow();
LineTooltipRenderer.correctLocation(editor, myPanel, p, alignToRight, true, myPanel.getMinWidth());
LightweightHint hint = new LightweightHint(myPanel);
HintManagerImpl hintManager = (HintManagerImpl)HintManager.getInstance();
hintManager.showEditorHint(hint, editor, p,
HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_OTHER_HINT |
HintManager.HIDE_BY_SCROLLING, 0, false, hintHint);
hint.addHintListener(new HintListener() {
@Override
public void hintHidden(EventObject event) {
if (myPanel == null) return; //double hide?
myPanel = null;
onHide.run();
}
});
return hint;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:TrafficTooltipRendererImpl.java
示例2: refreshUi
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的package包/类
void refreshUi(boolean selectionVisible, boolean itemsChanged, boolean reused, boolean onExplicitAction) {
Editor editor = myLookup.getEditor();
if (editor.getComponent().getRootPane() == null || editor instanceof EditorWindow && !((EditorWindow)editor).isValid()) {
return;
}
updateScrollbarVisibility();
if (myLookup.myResizePending || itemsChanged) {
myMaximumHeight = Integer.MAX_VALUE;
}
Rectangle rectangle = calculatePosition();
myMaximumHeight = rectangle.height;
if (myLookup.myResizePending || itemsChanged) {
myLookup.myResizePending = false;
myLookup.pack();
}
HintManagerImpl.updateLocation(myLookup, editor, rectangle.getLocation());
if (reused || selectionVisible || onExplicitAction) {
myLookup.ensureSelectionVisible(false);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:LookupUi.java
示例3: showHint
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的package包/类
public void showHint() {
myParentEditor.putUserData(KEY, this);
Pair<Point, Short> position = guessPosition();
JRootPane pane = myParentEditor.getComponent().getRootPane();
JComponent layeredPane = pane != null ? pane.getLayeredPane() : myParentEditor.getComponent();
HintHint hintHint = new HintHint(layeredPane, position.first)
.setAwtTooltip(true)
.setContentActive(true)
.setExplicitClose(true)
.setShowImmediately(true)
.setPreferredPosition(position.second == HintManager.ABOVE ? Balloon.Position.above : Balloon.Position.below)
.setTextBg(myParentEditor.getColorsScheme().getDefaultBackground())
.setBorderInsets(new Insets(1, 1, 1, 1));
int hintFlags = HintManager.HIDE_BY_OTHER_HINT | HintManager.HIDE_BY_ESCAPE | HintManager.UPDATE_BY_SCROLLING;
HintManagerImpl.getInstanceImpl().showEditorHint(this, myParentEditor, position.first, hintFlags, 0, false, hintHint);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:EmmetPreviewHint.java
示例4: guessPosition
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的package包/类
@NotNull
private Pair<Point, Short> guessPosition() {
JRootPane rootPane = myParentEditor.getContentComponent().getRootPane();
JComponent layeredPane = rootPane != null ? rootPane.getLayeredPane() : myParentEditor.getComponent();
LogicalPosition logicalPosition = myParentEditor.getCaretModel().getLogicalPosition();
LogicalPosition pos = new LogicalPosition(logicalPosition.line, logicalPosition.column);
Point p1 = HintManagerImpl.getHintPosition(this, myParentEditor, pos, HintManager.UNDER);
Point p2 = HintManagerImpl.getHintPosition(this, myParentEditor, pos, HintManager.ABOVE);
boolean p1Ok = p1.y + getComponent().getPreferredSize().height < layeredPane.getHeight();
boolean p2Ok = p2.y >= 0;
if (p1Ok) return new Pair<Point, Short>(p1, HintManager.UNDER);
if (p2Ok) return new Pair<Point, Short>(p2, HintManager.ABOVE);
int underSpace = layeredPane.getHeight() - p1.y;
int aboveSpace = p2.y;
return aboveSpace > underSpace
? new Pair<Point, Short>(new Point(p2.x, 0), HintManager.UNDER)
: new Pair<Point, Short>(p1, HintManager.ABOVE);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:EmmetPreviewHint.java
示例5: showHint
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的package包/类
protected boolean showHint(final JComponent component) {
myCurrentHint = new LightweightHint(component);
myCurrentHint.addHintListener(new HintListener() {
@Override
public void hintHidden(EventObject event) {
if (myHideRunnable != null) {
myHideRunnable.run();
}
}
});
//Editor may be disposed before later invokator process this action
final Editor editor = getEditor();
final JRootPane rootPane = editor.getComponent().getRootPane();
if(rootPane == null) return false;
short constraint = HintManagerImpl.UNDER;
Point p = HintManagerImpl.getHintPosition(myCurrentHint, editor, editor.xyToLogicalPosition(myPoint), constraint);
final HintHint hintHint = HintManagerImpl.createHintHint(editor, p, myCurrentHint, constraint, true);
HintManagerImpl.getInstanceImpl().showEditorHint(myCurrentHint, editor, p,
HintManagerImpl.HIDE_BY_ANY_KEY | HintManagerImpl.HIDE_BY_TEXT_CHANGE | HintManagerImpl.HIDE_BY_SCROLLING, HINT_TIMEOUT, false,
hintHint);
return true;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:AbstractValueHint.java
示例6: show
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的package包/类
@Override
public LightweightHint show(@NotNull Editor editor, @NotNull Point p, boolean alignToRight, @NotNull TooltipGroup group, @NotNull HintHint hintHint) {
myTrafficLightRenderer = (TrafficLightRenderer)((EditorMarkupModelImpl)editor.getMarkupModel()).getErrorStripeRenderer();
myPanel = new TrafficProgressPanel(myTrafficLightRenderer, editor, hintHint);
LineTooltipRenderer.correctLocation(editor, myPanel, p, alignToRight, false, -1);
LightweightHint hint = new LightweightHint(myPanel);
HintManagerImpl hintManager = (HintManagerImpl)HintManager.getInstance();
hintManager.showEditorHint(hint, editor, p,
HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_OTHER_HINT |
HintManager.HIDE_BY_SCROLLING, 0, false, hintHint);
hint.addHintListener(new HintListener() {
@Override
public void hintHidden(EventObject event) {
if (myPanel == null) return; //double hide?
myPanel = null;
onHide.run();
}
});
repaintTooltipWindow();
return hint;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:TrafficTooltipRendererImpl.java
示例7: showIntentionHintImpl
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的package包/类
private void showIntentionHintImpl(final boolean delay, final Point position) {
final int offset = myEditor.getCaretModel().getOffset();
myComponentHint.setShouldDelay(delay);
HintManagerImpl hintManager = HintManagerImpl.getInstanceImpl();
PriorityQuestionAction action = new PriorityQuestionAction() {
@Override
public boolean execute() {
showPopup();
return true;
}
@Override
public int getPriority() {
return -10;
}
};
if (hintManager.canShowQuestionAction(action)) {
hintManager.showQuestionHint(myEditor, position, offset, offset, myComponentHint, action, HintManager.ABOVE);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:IntentionHintComponent.java
示例8: showMessageIfNeeded
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的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
示例9: show
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的package包/类
@Override
public LightweightHint show(@Nonnull Editor editor, @Nonnull Point p, boolean alignToRight, @Nonnull TooltipGroup group, @Nonnull HintHint hintHint) {
myTrafficLightRenderer = (TrafficLightRenderer)((EditorMarkupModelImpl)editor.getMarkupModel()).getErrorStripeRenderer();
myPanel = new TrafficProgressPanel(myTrafficLightRenderer, editor, hintHint);
repaintTooltipWindow();
LineTooltipRenderer.correctLocation(editor, myPanel, p, alignToRight, true, myPanel.getMinWidth());
LightweightHint hint = new LightweightHint(myPanel);
HintManagerImpl hintManager = (HintManagerImpl)HintManager.getInstance();
hintManager.showEditorHint(hint, editor, p,
HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_OTHER_HINT |
HintManager.HIDE_BY_SCROLLING, 0, false, hintHint);
hint.addHintListener(new HintListener() {
@Override
public void hintHidden(EventObject event) {
if (myPanel == null) return; //double hide?
myPanel = null;
onHide.run();
}
});
return hint;
}
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:TrafficTooltipRendererImpl.java
示例10: refreshUi
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的package包/类
void refreshUi(boolean selectionVisible, boolean itemsChanged, boolean reused, boolean onExplicitAction) {
Editor editor = myLookup.getTopLevelEditor();
if (editor.getComponent().getRootPane() == null || editor instanceof EditorWindow && !((EditorWindow)editor).isValid()) {
return;
}
updateScrollbarVisibility();
if (myLookup.myResizePending || itemsChanged) {
myMaximumHeight = Integer.MAX_VALUE;
}
Rectangle rectangle = calculatePosition();
myMaximumHeight = rectangle.height;
if (myLookup.myResizePending || itemsChanged) {
myLookup.myResizePending = false;
myLookup.pack();
}
HintManagerImpl.updateLocation(myLookup, editor, rectangle.getLocation());
if (reused || selectionVisible || onExplicitAction) {
myLookup.ensureSelectionVisible(false);
}
}
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:LookupUi.java
示例11: showEvaluationHint
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的package包/类
public static void showEvaluationHint(final Editor myEditor, final PsiElement myElement, final EvaluateException e) {
if (myEditor.isDisposed() || !myEditor.getComponent().isVisible()) return;
HintManager.getInstance().showErrorHint(myEditor, e.getMessage(), myElement.getTextRange().getStartOffset(),
myElement.getTextRange().getEndOffset(), HintManagerImpl.UNDER,
HintManagerImpl.HIDE_BY_ESCAPE | HintManagerImpl.HIDE_BY_TEXT_CHANGE,
1500);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:EditorEvaluationCommand.java
示例12: showHint
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的package包/类
public void showHint(@NotNull LightweightHint hint) {
final HintManagerImpl hintManager = HintManagerImpl.getInstanceImpl();
Point p = HintManagerImpl.getHintPosition(hint, myEditor, myPosition, HintManager.ABOVE);
hintManager.showEditorHint(hint, myEditor, p,
HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING,
0, false, HintManagerImpl.createHintHint(myEditor, p, hint, HintManager.ABOVE).setContentActive(false));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:CtrlMouseHandler.java
示例13: showHint
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的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
示例14: showReadOnlyViewWarning
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的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
示例15: showLookup
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的package包/类
public boolean showLookup() {
ApplicationManager.getApplication().assertIsDispatchThread();
checkValid();
LOG.assertTrue(!myShown);
myShown = true;
myStampShown = System.currentTimeMillis();
if (ApplicationManager.getApplication().isUnitTestMode()) return true;
if (!myEditor.getContentComponent().isShowing()) {
hideLookup(false);
return false;
}
myAdComponent.showRandomText();
myUi = new LookupUi(this, myAdComponent, myList, myProject);
myUi.setCalculating(myCalculating);
Point p = myUi.calculatePosition().getLocation();
try {
HintManagerImpl.getInstanceImpl().showEditorHint(this, myEditor, p, HintManager.HIDE_BY_ESCAPE | HintManager.UPDATE_BY_SCROLLING, 0, false,
HintManagerImpl.createHintHint(myEditor, p, this, HintManager.UNDER).setAwtTooltip(false));
}
catch (Exception e) {
LOG.error(e);
}
if (!isVisible() || !myList.isShowing()) {
hideLookup(false);
return false;
}
return true;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:LookupImpl.java
示例16: show
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的package包/类
@Override
public void show(@NotNull PsiElement element, @NotNull Editor editor, @NotNull Point point, boolean keyTriggered) {
LightweightHint newHint = getHint(element);
hideCurrentHintIfAny();
if (newHint == null) {
return;
}
hint = newHint;
HintManagerImpl.getInstanceImpl().showEditorHint(newHint, editor,
getHintPosition(newHint, editor, editor.xyToLogicalPosition(point), HintManager.RIGHT_UNDER),
HINT_HIDE_FLAGS, 0, false);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ElementPreviewHintProvider.java
示例17: showHint
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的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
示例18: showEditorHint
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的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
示例19: showEditorHint
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的package包/类
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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:XPathAppComponent.java
示例20: showQueryContextHint
import com.intellij.codeInsight.hint.HintManagerImpl; //导入依赖的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
注:本文中的com.intellij.codeInsight.hint.HintManagerImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论