feat: Add case format to ProjectSettingsState and fromSelector method to NamingConvention
This commit adds a new attribute, `caseFormat`, to the `ProjectSettingsState` class. It also introduces a static method `fromSelector` in the `NamingConvention` class to transform a string into a NamingConvention enum. The transformation in `ProjectSettingsComponentState` has been updated to use this new method.
This commit is contained in:
parent
667b748614
commit
b7b3563080
@ -15,4 +15,8 @@ public enum NamingConvention {
|
||||
public String toString() {
|
||||
return super.name().toLowerCase();
|
||||
}
|
||||
static public NamingConvention fromSelector(String name) {
|
||||
String formated = name.replace(" ","_");
|
||||
return valueOf(formated.toUpperCase());
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import de.marhali.easyi18n.io.folder.FolderStrategyType;
|
||||
import de.marhali.easyi18n.settings.presets.Preset;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Mandatory for state management for the project settings component.
|
||||
@ -68,9 +69,10 @@ public class ProjectSettingsComponentState {
|
||||
state.setAssistance(assistance.isSelected());
|
||||
|
||||
state.setAlwaysFold(alwaysFold.isSelected());
|
||||
|
||||
state.setFlavorTemplate(flavorTemplate.getText());
|
||||
|
||||
state.setCaseFormat(NamingConvention.valueOf(KeyCaseFormater.getSelectedItem().toString().replace("Case", "").trim()));
|
||||
state.setCaseFormat(NamingConvention.fromSelector(KeyCaseFormater.getSelectedItem().toString()));
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
@ -95,6 +95,7 @@ public class ProjectSettingsState implements ProjectSettings {
|
||||
|
||||
this.alwaysFold = defaults.isAlwaysFold();
|
||||
this.flavorTemplate = defaults.getFlavorTemplate();
|
||||
this.caseFormat = defaults.getCaseFormat();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user