PsiClass (@NotNull RunConfiguration runConfiguration) { if (runConfiguration instanceof SingleClassConfiguration) { return ((SingleClassConfiguration)runConfiguration).getMainClass(); } if (!(runConfiguration instanceof CommonJavaRunConfigurationParameters) || !(runConfiguration instanceof ModuleBasedConfiguration)) { return null; } RunConfigurationModule configurationModule = ((ModuleBasedConfiguration<?, ?>)runConfiguration).getConfigurationModule(); if (!(configurationModule instanceof JavaRunConfigurationModule)) return null; String runClassName = ((CommonJavaRunConfigurationParameters)runConfiguration).getRunClass(); if (runClassName == null) return null; return ((JavaRunConfigurationModule)configurationModule).findClass(runClassName); }