void (HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { boolean apply = "apply".equals(e.getDescription()); ExtractedSettingsDialog myDialog = null; if (!apply) { final List<Value> values = calculatedValues.getValues(); Language language = file.getLanguage(); CodeStyleSettingsNameProvider nameProvider = new CodeStyleSettingsNameProvider(); for (final LanguageCodeStyleSettingsProvider provider : LanguageCodeStyleSettingsProvider.getAllProviders()) { Language target = provider.getLanguage(); if (target.equals(language)) { //this is our language nameProvider.addSettings(provider); myDialog = new ExtractedSettingsDialog(project, nameProvider, values); apply = myDialog.showAndGet(); break; } } } if (apply /*&& myDialog != null*/) { //create new settings named after the file //final ExtractedSettingsDialog finalMyDialog = myDialog; //calculatedValues.applyConditioned(value -> finalMyDialog.valueIsSelectedInTree(value), backup); calculatedValues.applySelected(); CodeStyleScheme derivedScheme = CodeStyleSchemes .getInstance() .createNewScheme("Derived from " + file.getName(), null); derivedScheme.getCodeStyleSettings().copyFrom(cloneSettings); CodeStyleSchemes.getInstance().addScheme(derivedScheme); CodeStyleSchemesImpl.getSchemeManager().setCurrent(derivedScheme); CodeStyleSettingsManager.getInstance(project).PREFERRED_PROJECT_CODE_STYLE = derivedScheme.getName(); } } }