1 package fr.ifremer.quadrige2.ui.swing.common.content.db;
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.quadrige2.ui.swing.common.action.AbstractMainUIAction;
28 import fr.ifremer.quadrige2.ui.swing.common.content.AbstractMainUIHandler;
29
30
31
32
33
34
35 public class InstallOrReinstallDbAction extends AbstractMainUIAction {
36
37 protected AbstractMainUIAction delegateAction;
38
39
40
41
42
43
44 public InstallOrReinstallDbAction(AbstractMainUIHandler handler) {
45 super(handler, true);
46 }
47
48
49 @Override
50 public boolean prepareAction() throws Exception {
51
52 if (getContext().isDbExist()) {
53
54
55 delegateAction = getContext().getActionFactory().createLogicAction(getHandler(), ReinstallDbAction.class);
56 } else {
57
58
59 delegateAction = getContext().getActionFactory().createLogicAction(getHandler(), InstallDbAction.class);
60 }
61
62 setActionDescription(delegateAction.getActionDescription());
63
64 return delegateAction.prepareAction();
65 }
66
67
68 @Override
69 public void doAction() throws Exception {
70
71 getActionEngine().runInternalAction(delegateAction);
72 }
73
74
75 @Override
76 protected void releaseAction() {
77 delegateAction = null;
78 super.releaseAction();
79 }
80
81 }