1 | |
package org.jtheque.core.managers.view.impl.actions.module.repository; |
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.update.repository.ModuleDescription; |
22 | |
import org.jtheque.core.managers.view.able.IViewManager; |
23 | |
import org.jtheque.core.managers.view.able.update.IRepositoryView; |
24 | |
import org.jtheque.core.managers.view.impl.actions.JThequeAction; |
25 | |
import org.jtheque.core.utils.CoreUtils; |
26 | |
|
27 | |
import java.awt.event.ActionEvent; |
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
public final class InstallRepositoryModuleAction extends JThequeAction { |
35 | |
|
36 | |
|
37 | |
|
38 | |
public InstallRepositoryModuleAction() { |
39 | 0 | super("repository.actions.install"); |
40 | 0 | } |
41 | |
|
42 | |
@Override |
43 | |
public void actionPerformed(ActionEvent e) { |
44 | 0 | ModuleDescription description = CoreUtils.<IRepositoryView>getBean("repositoryView").getSelectedModule(); |
45 | |
|
46 | 0 | if (description.getCoreVersion().isGreaterThan(Managers.getCore().getCoreCurrentVersion())) { |
47 | 0 | Managers.getManager(IViewManager.class).displayI18nText("error.module.version.core"); |
48 | |
} else { |
49 | 0 | if (Managers.getManager(IModuleManager.class).isInstalled(description.getId())) { |
50 | 0 | Managers.getManager(IViewManager.class).displayI18nText("message.repository.module.installed"); |
51 | |
} else { |
52 | 0 | Managers.getManager(IModuleManager.class).install(description.getVersionsFileURL()); |
53 | |
} |
54 | |
} |
55 | 0 | } |
56 | |
} |