Initialize preferences defaults per language correctly

This commit is contained in:
Peter Dell 2022-09-10 23:09:24 +02:00
parent 29538d2880
commit a02da769cc

View File

@ -102,8 +102,7 @@ public final class LanguagePreferencesInitializer extends AbstractPreferenceInit
LanguageContentAssistProcessorDefaultCase.LOWER_CASE); LanguageContentAssistProcessorDefaultCase.LOWER_CASE);
// Compiling. // Compiling.
setDefault(language, setDefault(language, LanguagePreferencesConstants.EDITOR_COMPILE_COMMAND_POSITIONING_MODE,
LanguagePreferencesConstants.EDITOR_COMPILE_COMMAND_POSITIONING_MODE,
LanguageEditorCompileCommandPositioningMode.FIRST_ERROR_OR_WARNING); LanguageEditorCompileCommandPositioningMode.FIRST_ERROR_OR_WARNING);
} }
@ -115,25 +114,24 @@ public final class LanguagePreferencesInitializer extends AbstractPreferenceInit
CompilerRegistry compilerRegistry = languagePlugin.getCompilerRegistry(); CompilerRegistry compilerRegistry = languagePlugin.getCompilerRegistry();
List<CompilerDefinition> compilerDefinitions = compilerRegistry.getCompilerDefinitions(language); List<CompilerDefinition> compilerDefinitions = compilerRegistry.getCompilerDefinitions(language);
for (CompilerDefinition compilerDefinition : compilerDefinitions) { for (CompilerDefinition compilerDefinition : compilerDefinitions) {
String compilerId; String compilerId = compilerDefinition.getId();
String name; String name;
compilerId = compilerDefinition.getId();
for (Hardware hardware : Hardware.values()) { for (Hardware hardware : Hardware.values()) {
if (hardware.equals(Hardware.GENERIC)) { if (hardware.equals(Hardware.GENERIC)) {
continue; continue;
} }
store.setDefault(LanguagePreferencesConstants.getCompilerTargetName(compilerId, hardware), setDefault(language, LanguagePreferencesConstants.getCompilerTargetName(compilerId, hardware),
compilerDefinition.getSupportedTargets().get(0).toString()); compilerDefinition.getSupportedTargets().get(0).toString());
name = LanguagePreferencesConstants.getCompilerParametersName(compilerId, hardware); name = LanguagePreferencesConstants.getCompilerParametersName(compilerId, hardware);
store.setDefault(name, compilerDefinition.getDefaultParameters()); setDefault(language, name, compilerDefinition.getDefaultParameters());
name = LanguagePreferencesConstants.getCompilerOutputFolderModeName(compilerId, hardware); name = LanguagePreferencesConstants.getCompilerOutputFolderModeName(compilerId, hardware);
store.setDefault(name, CompilerOutputFolderMode.TEMP_FOLDER); setDefault(language, name, CompilerOutputFolderMode.TEMP_FOLDER);
name = LanguagePreferencesConstants.getCompilerOutputFileExtensionName(compilerId, hardware); name = LanguagePreferencesConstants.getCompilerOutputFileExtensionName(compilerId, hardware);
store.setDefault(name, HardwareUtility.getDefaultFileExtension(hardware)); setDefault(language, name, HardwareUtility.getDefaultFileExtension(hardware));
name = LanguagePreferencesConstants.getCompilerRunnerIdName(compilerId, hardware); name = LanguagePreferencesConstants.getCompilerRunnerIdName(compilerId, hardware);
store.setDefault(name, RunnerId.DEFAULT_APPLICATION); setDefault(language, name, RunnerId.DEFAULT_APPLICATION);
} }
} }