| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6b19f7b commit 117bff9
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,6 +26,7 @@ | |||
| 26 | 26 | import java.awt.Color; | |
| 27 | 27 | import java.awt.Cursor; | |
| 28 | 28 | import java.awt.Font; | |
| 29 | + import java.awt.FontMetrics; | ||
| 29 | 30 | import java.awt.Graphics; | |
| 30 | 31 | import java.awt.Graphics2D; | |
| 31 | 32 | import java.awt.Point; | |
@@ -114,39 +115,6 @@ public void mousePressed(MouseEvent event) { | |||
| 114 | 115 | } | |
| 115 | 116 | }); | |
| 116 | 117 | ||
| 117 | - addMouseMotionListener(new MouseMotionAdapter() { | ||
| 118 | - @Override | ||
| 119 | - public void mouseMoved(final MouseEvent evt) { | ||
| 120 | - int line = textArea.yToLine(evt.getY()); | ||
| 121 | - int x = evt.getX(); | ||
| 122 | - | ||
| 123 | - LineMarker marker = getJavaEditor().findError(line); | ||
| 124 | - if (marker != null) { | ||
| 125 | - Problem problem = marker.getProblem(); | ||
| 126 | - | ||
| 127 | - int lineOffset = textArea.getLineStartOffset(problem.getLineNumber()); | ||
| 128 | - | ||
| 129 | - int lineStart = textArea.getLineStartOffset(line); | ||
| 130 | - int lineEnd = textArea.getLineStopOffset(line); | ||
| 131 | - | ||
| 132 | - int errorStart = lineOffset + problem.getPDELineStartOffset(); | ||
| 133 | - int errorEnd = lineOffset + problem.getPDELineStopOffset() + 1; | ||
| 134 | - | ||
| 135 | - int startOffset = Math.max(errorStart, lineStart) - lineStart; | ||
| 136 | - int stopOffset = Math.min(errorEnd, lineEnd) - lineStart; | ||
| 137 | - | ||
| 138 | - if (x >= getJavaTextArea().offsetToX(line, startOffset) && | ||
| 139 | - x <= getJavaTextArea().offsetToX(line, stopOffset)) { | ||
| 140 | - //setToolTipText(problem.getMessage()); | ||
| 141 | - getJavaEditor().statusToolTip(JavaTextAreaPainter.this, | ||
| 142 | - problem.getMessage(), | ||
| 143 | - problem.isError()); | ||
| 144 | - evt.consume(); | ||
| 145 | - } | ||
| 146 | - } | ||
| 147 | - } | ||
| 148 | - }); | ||
| 149 | - | ||
| 150 | 118 | // TweakMode code | |
| 151 | 119 | tweakMode = false; | |
| 152 | 120 | cursorType = Cursor.DEFAULT_CURSOR; | |
@@ -476,6 +444,43 @@ public void setMode(Mode mode) { | |||
| 476 | 444 | } | |
| 477 | 445 | ||
| 478 | 446 | ||
| 447 | + @Override | ||
| 448 | + public String getToolTipText(MouseEvent evt) { | ||
| 449 | + int line = evt.getY() / getFontMetrics().getHeight() + textArea.getFirstLine(); | ||
| 450 | + if (line < 0 || line > textArea.getLineCount() - 1) { | ||
| 451 | + return null; | ||
| 452 | + } | ||
| 453 | + | ||
| 454 | + LineMarker marker = getJavaEditor().findError(line); | ||
| 455 | + if (marker != null) { | ||
| 456 | + Problem problem = marker.getProblem(); | ||
| 457 | + | ||
| 458 | + int lineOffset = textArea.getLineStartOffset(problem.getLineNumber()); | ||
| 459 | + | ||
| 460 | + int lineStart = textArea.getLineStartOffset(line); | ||
| 461 | + int lineEnd = textArea.getLineStopOffset(line); | ||
| 462 | + | ||
| 463 | + int errorStart = lineOffset + problem.getPDELineStartOffset(); | ||
| 464 | + int errorEnd = lineOffset + problem.getPDELineStopOffset() + 1; | ||
| 465 | + | ||
| 466 | + int startOffset = Math.max(errorStart, lineStart) - lineStart; | ||
| 467 | + int stopOffset = Math.min(errorEnd, lineEnd) - lineStart; | ||
| 468 | + | ||
| 469 | + int x = evt.getX(); | ||
| 470 | + | ||
| 471 | + if (x >= getJavaTextArea().offsetToX(line, startOffset) && | ||
| 472 | + x <= getJavaTextArea().offsetToX(line, stopOffset)) { | ||
| 473 | + getJavaEditor().statusToolTip(JavaTextAreaPainter.this, | ||
| 474 | + problem.getMessage(), | ||
| 475 | + problem.isError()); | ||
| 476 | + return super.getToolTipText(); | ||
| 477 | + } | ||
| 478 | + } | ||
| 479 | + return null; | ||
| 480 | + } | ||
| 481 | + | ||
| 482 | + | ||
| 483 | + /* | ||
| 479 | 484 | @Override | |
| 480 | 485 | public String getToolTipText(MouseEvent event) { | |
| 481 | 486 | if (!getJavaEditor().hasJavaTabs()) { | |
@@ -564,6 +569,7 @@ public String getToolTipText(MouseEvent event) { | |||
| 564 | 569 | // setToolTipText(null); | |
| 565 | 570 | return super.getToolTipText(event); | |
| 566 | 571 | } | |
| 572 | + */ | ||
| 567 | 573 | ||
| 568 | 574 | ||
| 569 | 575 | // TweakMode code | |
| Back | FazBrowse Home | New Git URL |
0 commit comments