Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
e3897eba
Commit
e3897eba
authored
6 years ago
by
Dmitry Avdeev
Browse files
Options
Download
Email Patches
Plain Diff
web references highlighting: store message in session
parent
ce3ad6a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
platform/lang-impl/src/com/intellij/codeInsight/highlighting/HyperlinkAnnotator.java
+10
-3
...intellij/codeInsight/highlighting/HyperlinkAnnotator.java
with
10 additions
and
3 deletions
+10
-3
platform/lang-impl/src/com/intellij/codeInsight/highlighting/HyperlinkAnnotator.java
+
10
-
3
View file @
e3897eba
...
...
@@ -11,6 +11,8 @@ import com.intellij.openapi.editor.colors.CodeInsightColors;
import
com.intellij.openapi.keymap.KeymapManager
;
import
com.intellij.openapi.keymap.KeymapUtil
;
import
com.intellij.openapi.paths.WebReference
;
import
com.intellij.openapi.util.Key
;
import
com.intellij.openapi.util.TextRange
;
import
com.intellij.psi.PsiElement
;
import
com.intellij.psi.PsiReference
;
import
com.intellij.util.containers.ContainerUtil
;
...
...
@@ -18,14 +20,19 @@ import org.jetbrains.annotations.NotNull;
public
class
HyperlinkAnnotator
implements
Annotator
{
private
static
final
String
ourM
essage
=
getM
essage
(
);
private
static
final
Key
<
String
>
m
essage
Key
=
Key
.
create
(
"hyperlink.m
essage
"
);
@Override
public
void
annotate
(
@NotNull
PsiElement
element
,
@NotNull
AnnotationHolder
holder
)
{
for
(
PsiReference
reference
:
element
.
getReferences
())
{
if
(
reference
instanceof
WebReference
)
{
Annotation
annotation
=
holder
.
createInfoAnnotation
(
reference
.
getRangeInElement
().
shiftRight
(
element
.
getTextRange
().
getStartOffset
()),
ourMessage
);
String
message
=
holder
.
getCurrentAnnotationSession
().
getUserData
(
messageKey
);
if
(
message
==
null
)
{
message
=
getMessage
();
holder
.
getCurrentAnnotationSession
().
putUserData
(
messageKey
,
message
);
}
TextRange
range
=
reference
.
getRangeInElement
().
shiftRight
(
element
.
getTextRange
().
getStartOffset
());
Annotation
annotation
=
holder
.
createInfoAnnotation
(
range
,
message
);
annotation
.
setTextAttributes
(
CodeInsightColors
.
INACTIVE_HYPERLINK_ATTRIBUTES
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment