Language (@NotNull ColorSettingsPage page) { for (Language language : Language.getRegisteredLanguages()) { if (page instanceof RainbowColorSettingsPage && language.is(((RainbowColorSettingsPage)page).getLanguage()) || page.getDisplayName().equals(language.getDisplayName())) { return language; } } return null; }