本文整理汇总了Java中com.intellij.codeInsight.hint.TooltipController类的典型用法代码示例。如果您正苦于以下问题:Java TooltipController类的具体用法?Java TooltipController怎么用?Java TooltipController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TooltipController类属于com.intellij.codeInsight.hint包,在下文中一共展示了TooltipController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showTooltip
import com.intellij.codeInsight.hint.TooltipController; //导入依赖的package包/类
static void showTooltip(@NotNull Editor editor, final int start, int end, @NotNull String text) {
final Rectangle visibleArea = editor.getScrollingModel().getVisibleArea();
final Point left = editor.logicalPositionToXY(editor.offsetToLogicalPosition(start));
final int documentLength = editor.getDocument().getTextLength();
if (end >= documentLength) end = documentLength;
final Point right = editor.logicalPositionToXY(editor.offsetToLogicalPosition(end));
final Point bestPoint = new Point(left.x + (right.x - left.x) / 2, right.y + editor.getLineHeight() / 2);
if (visibleArea.x > bestPoint.x) {
bestPoint.x = visibleArea.x;
}
else if (visibleArea.x + visibleArea.width < bestPoint.x) {
bestPoint.x = visibleArea.x + visibleArea.width - 5;
}
final Point p = SwingUtilities.convertPoint(editor.getContentComponent(), bestPoint,
editor.getComponent().getRootPane().getLayeredPane());
final HintHint hint = new HintHint(editor, bestPoint).setAwtTooltip(true).setHighlighterType(true).setShowImmediately(true)
.setCalloutShift(editor.getLineHeight() / 2 - 1);
TooltipController.getInstance().showTooltip(editor, p, text, visibleArea.width, false, SS_INFO_TOOLTIP_GROUP, hint);
}
示例2: showInfoTooltip
import com.intellij.codeInsight.hint.TooltipController; //导入依赖的package包/类
public static void showInfoTooltip(@NotNull final HighlightInfo info, @NotNull Editor editor, final int defaultOffset, final int currentWidth) {
if (info.getToolTip() == null) return;
Rectangle visibleArea = editor.getScrollingModel().getVisibleArea();
Point bestPoint = editor.logicalPositionToXY(editor.offsetToLogicalPosition(defaultOffset));
bestPoint.y += editor.getLineHeight() / 2;
if (!visibleArea.contains(bestPoint)) {
bestPoint = editor.logicalPositionToXY(editor.offsetToLogicalPosition(defaultOffset));
}
Point p = SwingUtilities.convertPoint(
editor.getContentComponent(),
bestPoint,
editor.getComponent().getRootPane().getLayeredPane()
);
TooltipController.getInstance().showTooltip(editor, p, info.getToolTip(), currentWidth, false, DAEMON_INFO_GROUP, new HintHint(editor, bestPoint).setAwtTooltip(true).setHighlighterType(true).setCalloutShift(
editor.getLineHeight() / 2 - 1));
}
示例3: showInfoTooltip
import com.intellij.codeInsight.hint.TooltipController; //导入依赖的package包/类
public static void showInfoTooltip(@Nonnull final HighlightInfo info, @Nonnull Editor editor, final int defaultOffset, final int currentWidth) {
if (info.getToolTip() == null) return;
Rectangle visibleArea = editor.getScrollingModel().getVisibleArea();
Point bestPoint = editor.logicalPositionToXY(editor.offsetToLogicalPosition(defaultOffset));
bestPoint.y += editor.getLineHeight() / 2;
if (!visibleArea.contains(bestPoint)) {
bestPoint = editor.logicalPositionToXY(editor.offsetToLogicalPosition(defaultOffset));
}
Point p = SwingUtilities.convertPoint(
editor.getContentComponent(),
bestPoint,
editor.getComponent().getRootPane().getLayeredPane()
);
TooltipController.getInstance().showTooltip(editor, p, info.getToolTip(), currentWidth, false, DAEMON_INFO_GROUP, new HintHint(editor, bestPoint).setAwtTooltip(true).setHighlighterType(true).setCalloutShift(
editor.getLineHeight() / 2 - 1));
}
示例4: mouseExited
import com.intellij.codeInsight.hint.TooltipController; //导入依赖的package包/类
@Override
public void mouseExited(@NotNull MouseEvent e) {
runMouseExitedCommand(e);
EditorMouseEvent event = new EditorMouseEvent(EditorImpl.this, e, getMouseEventArea(e));
if (event.getArea() == EditorMouseEventArea.LINE_MARKERS_AREA) {
myGutterComponent.mouseExited(e);
}
TooltipController.getInstance().cancelTooltip(FOLDING_TOOLTIP_GROUP, e, true);
}
示例5: handleInputFocusMovement
import com.intellij.codeInsight.hint.TooltipController; //导入依赖的package包/类
private void handleInputFocusMovement(LogicalPosition position) {
checkModelValidity();
String text = "";
final int offset = editor.logicalPositionToOffset(position);
final int length = editor.getDocument().getTextLength();
final CharSequence elements = editor.getDocument().getCharsSequence();
int start = offset-1;
int end = -1;
while(start >=0 && Character.isJavaIdentifierPart(elements.charAt(start)) && elements.charAt(start)!='$') start--;
if (start >=0 && elements.charAt(start)=='$') {
end = offset;
while(end < length && Character.isJavaIdentifierPart(elements.charAt(end)) && elements.charAt(end)!='$') end++;
if (end < length && elements.charAt(end)=='$') {
String varname = elements.subSequence(start + 1, end).toString();
Variable foundVar = null;
for (final Variable var : variables) {
if (var.getName().equals(varname)) {
foundVar = var;
break;
}
}
if (foundVar!=null) {
text = UIUtil.getShortParamString(editor.getUserData(CURRENT_CONFIGURATION_KEY),varname);
}
}
}
if (text.length() > 0) {
UIUtil.showTooltip(editor, start, end + 1, text);
}
else {
TooltipController.getInstance().cancelTooltips();
}
}
示例6: mouseMoved
import com.intellij.codeInsight.hint.TooltipController; //导入依赖的package包/类
@Override
public void mouseMoved(MouseEvent e) {
int line = EditorUtil.yPositionToLogicalLine(editor, e.getPoint());
if (line == lastGutterToolTipLine) {
return;
}
TooltipController controller = TooltipController.getInstance();
if (lastGutterToolTipLine != -1) {
controller.cancelTooltip(TOOLTIP_GROUP, e, true);
}
String toolTip = gutterContentProvider.getToolTip(line, editor);
setCursor(toolTip == null ? Cursor.getDefaultCursor() : Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
if (toolTip == null) {
lastGutterToolTipLine = -1;
controller.cancelTooltip(TOOLTIP_GROUP, e, false);
}
else {
lastGutterToolTipLine = line;
RelativePoint showPoint = new RelativePoint(this, e.getPoint());
controller.showTooltipByMouseMove(editor,
showPoint,
((EditorMarkupModel)editor.getMarkupModel()).getErrorStripTooltipRendererProvider().calcTooltipRenderer(toolTip),
false,
TOOLTIP_GROUP,
new HintHint(this, e.getPoint()).setAwtTooltip(true));
}
}
示例7: mouseExited
import com.intellij.codeInsight.hint.TooltipController; //导入依赖的package包/类
@Override
public void mouseExited(@Nonnull MouseEvent e) {
runMouseExitedCommand(e);
EditorMouseEvent event = new EditorMouseEvent(EditorImpl.this, e, getMouseEventArea(e));
if (event.getArea() == EditorMouseEventArea.LINE_MARKERS_AREA) {
myGutterComponent.mouseExited(e);
}
TooltipController.getInstance().cancelTooltip(FOLDING_TOOLTIP_GROUP, e, true);
}
示例8: mouseMoved
import com.intellij.codeInsight.hint.TooltipController; //导入依赖的package包/类
@Override
public void mouseMoved(@NotNull MouseEvent e) {
if (getMouseSelectionState() != MOUSE_SELECTION_STATE_NONE) {
if (myMousePressedEvent != null && myMousePressedEvent.getComponent() == e.getComponent()) {
Point lastPoint = myMousePressedEvent.getPoint();
Point point = e.getPoint();
int deadZone = Registry.intValue("editor.mouseSelectionStateResetDeadZone");
if (Math.abs(lastPoint.x - point.x) >= deadZone || Math.abs(lastPoint.y - point.y) >= deadZone) {
resetMouseSelectionState(e);
}
}
else {
validateMousePointer(e);
}
}
else {
validateMousePointer(e);
}
myMouseMovedEvent = e;
EditorMouseEvent event = new EditorMouseEvent(EditorImpl.this, e, getMouseEventArea(e));
if (e.getSource() == myGutterComponent) {
myGutterComponent.mouseMoved(e);
}
if (event.getArea() == EditorMouseEventArea.EDITING_AREA) {
FoldRegion fold = myFoldingModel.getFoldingPlaceholderAt(e.getPoint());
TooltipController controller = TooltipController.getInstance();
if (fold != null && !fold.shouldNeverExpand()) {
DocumentFragment range = createDocumentFragment(fold);
final Point p =
SwingUtilities.convertPoint((Component)e.getSource(), e.getPoint(), getComponent().getRootPane().getLayeredPane());
controller.showTooltip(EditorImpl.this, p, new DocumentFragmentTooltipRenderer(range), false, FOLDING_TOOLTIP_GROUP);
}
else {
controller.cancelTooltip(FOLDING_TOOLTIP_GROUP, e, true);
}
}
for (EditorMouseMotionListener listener : myMouseMotionListeners) {
listener.mouseMoved(event);
}
}
示例9: mouseDragged
import com.intellij.codeInsight.hint.TooltipController; //导入依赖的package包/类
@Override
public void mouseDragged(MouseEvent e) {
TooltipController.getInstance().cancelTooltips();
}
示例10: mouseExited
import com.intellij.codeInsight.hint.TooltipController; //导入依赖的package包/类
@Override
public void mouseExited(MouseEvent e) {
TooltipController.getInstance().cancelTooltip(GUTTER_TOOLTIP_GROUP, e, false);
}
示例11: hide
import com.intellij.codeInsight.hint.TooltipController; //导入依赖的package包/类
public void hide(boolean ok) {
if (isVisible()) {
if (myIsRealPopup) {
if (ok) {
myPopup.closeOk(null);
}
else {
myPopup.cancel();
}
myPopup = null;
}
else {
if (myCurrentIdeTooltip != null) {
IdeTooltip tooltip = myCurrentIdeTooltip;
myCurrentIdeTooltip = null;
tooltip.hide();
}
else {
final JRootPane rootPane = myComponent.getRootPane();
if (rootPane != null) {
final Rectangle bounds = myComponent.getBounds();
final JLayeredPane layeredPane = rootPane.getLayeredPane();
try {
if (myFocusBackComponent != null) {
LayoutFocusTraversalPolicyExt.setOverridenDefaultComponent(myFocusBackComponent);
}
layeredPane.remove(myComponent);
}
finally {
LayoutFocusTraversalPolicyExt.setOverridenDefaultComponent(null);
}
layeredPane.paintImmediately(bounds.x, bounds.y, bounds.width, bounds.height);
}
}
}
}
if (myEscListener != null) {
myComponent.unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
}
TooltipController.getInstance().hide(this);
fireHintHidden();
}
示例12: cancelTooltips
import com.intellij.codeInsight.hint.TooltipController; //导入依赖的package包/类
public static void cancelTooltips() {
TooltipController.getInstance().cancelTooltip(DAEMON_INFO_GROUP, null, true);
}
示例13: MyEditorMouseListener
import com.intellij.codeInsight.hint.TooltipController; //导入依赖的package包/类
public MyEditorMouseListener(@NotNull TooltipController tooltipController) {
myTooltipController = tooltipController;
}
示例14: cancelMyToolTips
import com.intellij.codeInsight.hint.TooltipController; //导入依赖的package包/类
private void cancelMyToolTips(final MouseEvent e, boolean checkIfShouldSurvive) {
final TooltipController tooltipController = TooltipController.getInstance();
if (!checkIfShouldSurvive || !tooltipController.shouldSurvive(e)) {
tooltipController.cancelTooltip(ERROR_STRIPE_TOOLTIP_GROUP, e, true);
}
}
示例15: showTooltip
import com.intellij.codeInsight.hint.TooltipController; //导入依赖的package包/类
private void showTooltip(MouseEvent e, final TooltipRenderer tooltipObject, @NotNull HintHint hintHint) {
TooltipController tooltipController = TooltipController.getInstance();
tooltipController.showTooltipByMouseMove(myEditor, new RelativePoint(e), tooltipObject,
myEditor.getVerticalScrollbarOrientation() == EditorEx.VERTICAL_SCROLLBAR_RIGHT,
ERROR_STRIPE_TOOLTIP_GROUP, hintHint);
}