| 1 | |
package org.jtheque.core.managers.view.impl.actions.module.update; |
| 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.beans.IBeansManager; |
| 21 | |
import org.jtheque.core.managers.update.IUpdateManager; |
| 22 | |
import org.jtheque.core.managers.view.able.IViewManager; |
| 23 | |
import org.jtheque.core.managers.view.able.update.IUpdateView; |
| 24 | |
import org.jtheque.core.managers.view.able.update.IUpdateView.Mode; |
| 25 | |
import org.jtheque.core.managers.view.edt.SimpleTask; |
| 26 | |
import org.jtheque.core.managers.view.impl.actions.JThequeAction; |
| 27 | |
|
| 28 | |
import javax.annotation.Resource; |
| 29 | |
import java.awt.event.ActionEvent; |
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | 0 | public final class AcValidateUpdateView extends JThequeAction { |
| 37 | |
@Resource |
| 38 | |
private IUpdateView updateView; |
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
public AcValidateUpdateView() { |
| 44 | 0 | super("update.actions.update"); |
| 45 | |
|
| 46 | 0 | Managers.getManager(IBeansManager.class).inject(this); |
| 47 | 0 | } |
| 48 | |
|
| 49 | |
@Override |
| 50 | |
public void actionPerformed(ActionEvent e) { |
| 51 | 0 | Managers.getManager(IViewManager.class).execute(new SimpleTask() { |
| 52 | |
@Override |
| 53 | |
public void run() { |
| 54 | 0 | updateView.startWait(); |
| 55 | |
|
| 56 | 0 | new Thread(new UpdateRunnable()).start(); |
| 57 | 0 | } |
| 58 | |
}); |
| 59 | 0 | } |
| 60 | |
|
| 61 | |
|
| 62 | |
|
| 63 | |
|
| 64 | |
|
| 65 | |
|
| 66 | 0 | private final class UpdateRunnable implements Runnable { |
| 67 | |
@Override |
| 68 | |
public void run() { |
| 69 | 0 | if (updateView.getMode() == Mode.KERNEL) { |
| 70 | 0 | Managers.getManager(IUpdateManager.class).update(updateView.getSelectedVersion()); |
| 71 | 0 | } else if (updateView.getMode() == Mode.MODULE) { |
| 72 | 0 | Managers.getManager(IUpdateManager.class).update(updateView.getModule(), updateView.getSelectedVersion()); |
| 73 | |
} else { |
| 74 | 0 | Managers.getManager(IUpdateManager.class).update(updateView.getUpdatable(), updateView.getSelectedVersion()); |
| 75 | |
} |
| 76 | |
|
| 77 | 0 | Managers.getManager(IViewManager.class).execute(new StopWaitTask()); |
| 78 | 0 | } |
| 79 | |
} |
| 80 | |
|
| 81 | |
|
| 82 | |
|
| 83 | |
|
| 84 | |
|
| 85 | |
|
| 86 | 0 | private final class StopWaitTask extends SimpleTask { |
| 87 | |
@Override |
| 88 | |
public void run() { |
| 89 | 0 | updateView.stopWait(); |
| 90 | 0 | } |
| 91 | |
} |
| 92 | |
} |