|
@@ -28,9 +28,11 @@ import com.dmdirc.interfaces.CommandController;
|
28
|
28
|
import com.dmdirc.interfaces.WindowModel;
|
29
|
29
|
import com.dmdirc.interfaces.config.IdentityController;
|
30
|
30
|
import com.dmdirc.ui.input.AdditionalTabTargets;
|
|
31
|
+import com.dmdirc.util.system.SystemLifecycleComponent;
|
31
|
32
|
|
32
|
33
|
import javax.annotation.Nonnull;
|
33
|
34
|
import javax.inject.Inject;
|
|
35
|
+import java.util.Set;
|
34
|
36
|
|
35
|
37
|
/**
|
36
|
38
|
* Allows the user to save the config file.
|
|
@@ -43,6 +45,8 @@ public final class SaveConfig extends BaseCommand implements IntelligentCommand
|
43
|
45
|
CommandType.TYPE_GLOBAL);
|
44
|
46
|
/** Identity controller cause to save identities. */
|
45
|
47
|
private final IdentityController identityController;
|
|
48
|
+ /** Client lifecycle components */
|
|
49
|
+ private final Set<SystemLifecycleComponent> lifecycleComponents;
|
46
|
50
|
|
47
|
51
|
/**
|
48
|
52
|
* Creates a new instance of the {@link SaveConfig} command.
|
|
@@ -51,16 +55,18 @@ public final class SaveConfig extends BaseCommand implements IntelligentCommand
|
51
|
55
|
* @param identityController The controller to save identities on.
|
52
|
56
|
*/
|
53
|
57
|
@Inject
|
54
|
|
- public SaveConfig(final CommandController controller,
|
|
58
|
+ public SaveConfig(final CommandController controller, final Set<SystemLifecycleComponent> lifecycleComponents,
|
55
|
59
|
final IdentityController identityController) {
|
56
|
60
|
super(controller);
|
57
|
61
|
this.identityController = identityController;
|
|
62
|
+ this.lifecycleComponents = lifecycleComponents;
|
58
|
63
|
}
|
59
|
64
|
|
60
|
65
|
@Override
|
61
|
66
|
public void execute(@Nonnull final WindowModel origin,
|
62
|
67
|
final CommandArguments args, final CommandContext context) {
|
63
|
68
|
identityController.saveAll();
|
|
69
|
+ lifecycleComponents.forEach(SystemLifecycleComponent::save);
|
64
|
70
|
showOutput(origin, args.isSilent(), "Configuration file saved.");
|
65
|
71
|
}
|
66
|
72
|
|