| 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.view.able.IViewManager; |
| 22 | |
import org.jtheque.core.managers.view.impl.actions.JThequeAction; |
| 23 | |
import org.jtheque.utils.io.SimpleFilter; |
| 24 | |
|
| 25 | |
import java.awt.event.ActionEvent; |
| 26 | |
import java.io.File; |
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
public final class InstallModuleAction extends JThequeAction { |
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
public InstallModuleAction() { |
| 38 | 0 | super("modules.actions.new"); |
| 39 | 0 | } |
| 40 | |
|
| 41 | |
@Override |
| 42 | |
public void actionPerformed(ActionEvent e) { |
| 43 | 0 | File file = new File(Managers.getManager(IViewManager.class).chooseFile(new SimpleFilter("JAR File (*.jar)", "jar"))); |
| 44 | |
|
| 45 | 0 | boolean installed = Managers.getManager(IModuleManager.class).installModule(file); |
| 46 | |
|
| 47 | 0 | if (installed) { |
| 48 | 0 | Managers.getManager(IViewManager.class).displayI18nText("message.module.installed"); |
| 49 | |
} else { |
| 50 | 0 | Managers.getManager(IViewManager.class).displayI18nText("error.module.not.installed"); |
| 51 | |
} |
| 52 | 0 | } |
| 53 | |
} |