1 package fr.ifremer.quadrige3.ui.swing.synchro.action;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 import fr.ifremer.quadrige3.ui.swing.synchro.SynchroDirection;
28 import fr.ifremer.quadrige3.ui.swing.synchro.SynchroUIHandler;
29
30
31
32
33
34
35 public class SynchroStopAction extends AbstractSynchroAction {
36
37 private AbstractSynchroAction nextAction;
38
39
40
41
42
43
44 public SynchroStopAction(SynchroUIHandler handler) {
45 super(handler);
46 }
47
48
49 @Override
50 public boolean initAction() {
51 super.initAction();
52
53
54 return getModel().isRunningStatus();
55
56 }
57
58
59 @Override
60 public void doAction() {
61
62 if (getModel().getDirection() == SynchroDirection.IMPORT) {
63 nextAction = getContext().getActionFactory().createNonBlockingUIAction(handler, ImportSynchroStopAction.class);
64 } else if (getModel().getDirection() == SynchroDirection.EXPORT) {
65 nextAction = getContext().getActionFactory().createNonBlockingUIAction(handler, ExportSynchroStopAction.class);
66 }
67
68 }
69
70
71 @Override
72 public void doneAction() {
73 if (nextAction != null) {
74 nextAction.execute();
75 }
76 }
77
78 }