1 | |
package org.jtheque.core.managers.view.impl.actions.module; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
import org.jtheque.core.managers.Managers; |
20 | |
import org.jtheque.core.managers.module.IModuleManager; |
21 | |
import org.jtheque.core.managers.module.beans.ModuleContainer; |
22 | |
import org.jtheque.core.managers.module.beans.ModuleState; |
23 | |
import org.jtheque.core.managers.view.able.IViewManager; |
24 | |
import org.jtheque.core.managers.view.able.update.IModuleView; |
25 | |
import org.jtheque.core.managers.view.impl.actions.JThequeAction; |
26 | |
import org.jtheque.core.utils.CoreUtils; |
27 | |
import org.jtheque.utils.bean.Version; |
28 | |
|
29 | |
import java.awt.event.ActionEvent; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
public final class EnableModuleAction extends JThequeAction { |
37 | |
|
38 | |
|
39 | |
|
40 | |
public EnableModuleAction() { |
41 | 0 | super("modules.actions.activate"); |
42 | 0 | } |
43 | |
|
44 | |
@Override |
45 | |
public void actionPerformed(ActionEvent arg0) { |
46 | 0 | IModuleView moduleView = CoreUtils.getBean("moduleView"); |
47 | |
|
48 | 0 | ModuleContainer module = moduleView.getSelectedModule(); |
49 | |
|
50 | 0 | if (module.getState() == ModuleState.DISABLED) { |
51 | 0 | if (new Version(module.getInfos().core()).isGreaterThan(Managers.getCore().getCoreCurrentVersion())) { |
52 | 0 | Managers.getManager(IViewManager.class).displayI18nText("modules.message.versionproblem"); |
53 | |
} else { |
54 | 0 | Managers.getManager(IModuleManager.class).enableModule(module); |
55 | 0 | moduleView.refreshList(); |
56 | |
|
57 | 0 | Managers.getManager(IViewManager.class).displayI18nText("message.module.enabled"); |
58 | |
} |
59 | |
} else { |
60 | 0 | Managers.getManager(IViewManager.class).displayI18nText("error.module.not.disabled"); |
61 | |
} |
62 | 0 | } |
63 | |
} |