PsiType[] () { int offset1 = getEditor().getSelectionModel().getSelectionStart(); int offset2 = getEditor().getSelectionModel().getSelectionEnd(); PsiExpression expr = CodeInsightUtil.findExpressionInRange(getFile(), offset1, offset2); assertNotNull(expr); return GuessManager.getInstance(getProject()).guessTypeToCast(expr); }