only perform save all inside reload
This commit is contained in:
parent
55a0a3366b
commit
d85db1fd48
@ -6,6 +6,9 @@
|
||||
### Added
|
||||
- Regex support for translation file patterns
|
||||
|
||||
### Changed
|
||||
- Reload function internally consolidated
|
||||
|
||||
### Fixed
|
||||
- Parsing for <kbd>.properties</kbd> files
|
||||
|
||||
|
@ -49,9 +49,6 @@ public class DataStore {
|
||||
*/
|
||||
public void loadFromPersistenceLayer(@NotNull Consumer<Boolean> successResult) {
|
||||
ProjectSettings settings = ProjectSettingsService.get(project).getState();
|
||||
|
||||
ApplicationManager.getApplication().saveAll(); // Save opened files (required if new locales were added)
|
||||
|
||||
ApplicationManager.getApplication().runReadAction(() -> {
|
||||
try {
|
||||
this.data = new IOHandler(project, settings).read();
|
||||
|
@ -72,6 +72,7 @@ public class InstanceManager {
|
||||
* Fetches data from persistence layer and notifies all endpoints via {@link DataBus}.
|
||||
*/
|
||||
public void reload() {
|
||||
ApplicationManager.getApplication().saveAll(); // Save opened files (required if new locales were added)
|
||||
store.loadFromPersistenceLayer((success) ->
|
||||
bus.propagate().onUpdateData(store.getData()));
|
||||
}
|
||||
|
@ -54,10 +54,7 @@ public class FileChangeListener implements AsyncFileListener {
|
||||
events.forEach((e) -> {
|
||||
if(e.getPath().contains(localesPath)) { // Perform reload
|
||||
logger.debug("Detected file change. Reloading instance...");
|
||||
InstanceManager manager = InstanceManager.get(project);
|
||||
manager.store().loadFromPersistenceLayer((success) -> {
|
||||
manager.bus().propagate().onUpdateData(manager.store().getData());
|
||||
});
|
||||
InstanceManager.get(project).reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public abstract class EndToEndTestCase extends BasePlatformTestCase {
|
||||
|
||||
public void testParseAndSerialize() throws IOException {
|
||||
// Read translation files based on the provided settings
|
||||
InstanceManager.get(getProject()).reload();
|
||||
InstanceManager.get(getProject()).store().loadFromPersistenceLayer(success -> {});
|
||||
|
||||
// Save the cached translation data to a temporary output directory
|
||||
ProjectSettingsState out = new ProjectSettingsState(settings);
|
||||
|
Loading…
x
Reference in New Issue
Block a user