Example usage for com.intellij.openapi.actionSystem IdeActions ACTION_GOTO_SUPER

List of usage examples for com.intellij.openapi.actionSystem IdeActions ACTION_GOTO_SUPER

Introduction

In this page you can find the example usage for com.intellij.openapi.actionSystem IdeActions ACTION_GOTO_SUPER.

Prototype

String ACTION_GOTO_SUPER

To view the source code for com.intellij.openapi.actionSystem IdeActions ACTION_GOTO_SUPER.

Click Source Link

Usage

From source file:org.mustbe.consulo.csharp.ide.lineMarkerProvider.LambdaLineMarkerCollector.java

License:Apache License

@RequiredReadAction
@Override//  www. j  a  v  a2  s.co m
public void collect(PsiElement psiElement, @NotNull Consumer<LineMarkerInfo> lineMarkerInfos) {
    IElementType elementType = PsiUtilCore.getElementType(psiElement);
    if (elementType == CSharpTokens.DARROW) {
        PsiElement parent = psiElement.getParent();
        if (!(parent instanceof CSharpLambdaExpressionImpl)) {
            return;
        }

        MarkerInfo markerInfo = new MarkerInfo(parent, psiElement.getTextRange(),
                AllIcons.Gutter.ImplementingFunctional, Pass.UPDATE_ALL,
                new ConstantFunction<PsiElement, String>("Navigate to lambda delegate"),
                new GutterIconNavigationHandler<PsiElement>()

                {
                    @Override
                    @RequiredDispatchThread
                    public void navigate(MouseEvent e, PsiElement elt) {
                        if (!(elt instanceof CSharpLambdaExpressionImpl)) {
                            return;
                        }
                        CSharpLambdaResolveResult lambdaResolveResult = CSharpLambdaExpressionImplUtil
                                .resolveLeftLambdaTypeRef(elt);
                        if (lambdaResolveResult == null) {
                            return;
                        }

                        PsiElement element = lambdaResolveResult.getElement();
                        if (element instanceof Navigatable) {
                            ((Navigatable) element).navigate(true);
                        }
                    }
                }, GutterIconRenderer.Alignment.RIGHT);
        NavigateAction.setNavigateAction(markerInfo, "Navigate to lambda delegate",
                IdeActions.ACTION_GOTO_SUPER);
        lineMarkerInfos.consume(markerInfo);
    }
}