PsiExpression (PsiLiteralExpression context) { PsiMethodCallExpression methodCallExpression = PsiTreeUtil.getParentOfType(context, PsiMethodCallExpression.class); final Object value = context.getValue(); if (value instanceof String && ((String)value).endsWith(".bss")) { final PsiExpressionList addArgumentsList = PsiTreeUtil.getParentOfType(methodCallExpression, PsiExpressionList.class); methodCallExpression = PsiTreeUtil.getParentOfType(addArgumentsList, PsiMethodCallExpression.class); } if (methodCallExpression != null) { PsiMethod psiMethod = methodCallExpression.resolveMethod(); if (psiMethod != null) { if ("getResource".equals(psiMethod.getName())) { final PsiExpressionList addArgumentsList = PsiTreeUtil.getParentOfType(methodCallExpression, PsiExpressionList.class); methodCallExpression = PsiTreeUtil.getParentOfType(addArgumentsList, PsiMethodCallExpression.class); psiMethod = methodCallExpression != null ? methodCallExpression.resolveMethod() : null; if (psiMethod == null) return null; } if ("add".equals(psiMethod.getName())) { final PsiClass containingClass = psiMethod.getContainingClass(); if (containingClass != null ) { final PsiExpression qualifierExpression = methodCallExpression.getMethodExpression().getQualifierExpression(); if (qualifierExpression instanceof PsiMethodCallExpression) { final PsiReferenceExpression getStylesheetsMethodExpression = ((PsiMethodCallExpression)qualifierExpression).getMethodExpression(); if ("getStylesheets".equals(getStylesheetsMethodExpression.getReferenceName())) { return getStylesheetsMethodExpression.getQualifierExpression(); } } } } } } return null; }