void (final DefaultActionGroup actionGroup, final String eventName, final PsiExpression listenerArg) { final PsiType type = listenerArg.getType(); if (type instanceof PsiClassType) { PsiClass listenerClass = ((PsiClassType) type).resolve(); if (listenerClass != null) { if (!isAbstractOrInterface(listenerClass)) { actionGroup.add(new MyNavigateAction(eventName + ": " + ClassPresentationUtil.getNameForClass(listenerClass, false), listenerClass)); return; } else if (listenerArg instanceof PsiReferenceExpression) { final PsiElement psiElement = ((PsiReferenceExpression)listenerArg).resolve(); if (psiElement instanceof PsiVariable) { PsiCodeBlock codeBlock = PsiTreeUtil.getParentOfType(listenerArg, PsiCodeBlock.class); final PsiElement[] defs = DefUseUtil.getDefs(codeBlock, (PsiVariable)psiElement, listenerArg); if (defs.length == 1) { final PsiElement def = defs[0]; if (def instanceof PsiVariable var) { if (var.getInitializer() != listenerArg) { addListenerRef(actionGroup, eventName, var.getInitializer()); return; } } else if (def.getParent() instanceof PsiAssignmentExpression assignmentExpr) { if (def.equals(assignmentExpr.getLExpression())) { addListenerRef(actionGroup, eventName, assignmentExpr.getRExpression()); return; } } } } } } } actionGroup.add(new MyNavigateAction(eventName + ": " + listenerArg.getText(), listenerArg)); }