public class JavaLineMarkerProvider extends LineMarkerProviderDescriptor
GutterIconDescriptor.Option
Modifier and Type | Field and Description |
---|---|
static GutterIconDescriptor.Option |
LAMBDA_OPTION |
Constructor and Description |
---|
JavaLineMarkerProvider() |
JavaLineMarkerProvider(DaemonCodeAnalyzerSettings daemonSettings,
EditorColorsManager colorsManager)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected java.util.List<LineMarkerInfo<PsiElement>> |
collectInheritingClasses(PsiClass aClass) |
void |
collectSlowLineMarkers(java.util.List<? extends PsiElement> elements,
java.util.Collection<? super LineMarkerInfo<?>> result) |
LineMarkerInfo<?> |
getLineMarkerInfo(PsiElement element)
Get line markers for this PsiElement.
|
java.lang.String |
getName()
Human-readable provider name for UI.
|
GutterIconDescriptor.Option [] |
getOptions() |
getIcon, getId, isEnabledByDefault, toString
public static final GutterIconDescriptor.Option LAMBDA_OPTION
public JavaLineMarkerProvider()
@Deprecated public JavaLineMarkerProvider(DaemonCodeAnalyzerSettings daemonSettings, EditorColorsManager colorsManager)
JavaLineMarkerProvider()
public LineMarkerInfo<?> getLineMarkerInfo(PsiElement element)
LineMarkerProvider
PsiMethod
,
create the marker for the PsiIdentifier
which is a name of this method.
More technical details:Highlighting (specifically, LineMarkersPass) queries all LineMarkerProviders in two passes (for performance reasons):
LineMarkerProvider
which (incorrectly) written like this:
class MyBadLineMarkerProvider implements LineMarkerProvider {
public LineMarkerInfo getLineMarkerInfo(PsiElement element) {
if (element instanceof PsiMethod) { // ACTUALLY DONT!
return new LineMarkerInfo(element, element.getTextRange(), icon, null,null, alignment);
}
else {
return null;
}
}
...
}
Note that it create LineMarkerInfo for the whole method body.
Following will happen when this method is half-visible (e.g. its name is visible but a part of its body isn't):
class MyGoodLineMarkerProvider implements LineMarkerProvider {
public LineMarkerInfo getLineMarkerInfo(PsiElement element) {
if (element instanceof PsiIdentifier &&
(parent = element.getParent()) instanceof PsiMethod &&
((PsiMethod)parent).getMethodIdentifier() == element)) { // aha, we are at method name
return new LineMarkerInfo(element, element.getTextRange(), icon, null,null, alignment);
}
else {
return null;
}
}
...
}
public void collectSlowLineMarkers(java.util.List<? extends PsiElement> elements, java.util.Collection<? super LineMarkerInfo<?>> result)
protected java.util.List<LineMarkerInfo<PsiElement>> collectInheritingClasses(PsiClass aClass)
public java.lang.String getName()
GutterIconDescriptor
getName
in class GutterIconDescriptor
public GutterIconDescriptor.Option [] getOptions()
getOptions
in class GutterIconDescriptor