1 | |
package org.jtheque.core.managers.view.impl.actions.module; |
2 | |
|
3 | |
import org.jtheque.core.managers.Managers; |
4 | |
import org.jtheque.core.managers.beans.IBeansManager; |
5 | |
import org.jtheque.core.managers.error.IErrorManager; |
6 | |
import org.jtheque.core.managers.log.ILoggingManager; |
7 | |
import org.jtheque.core.managers.view.able.IViewManager; |
8 | |
import org.jtheque.core.managers.view.able.update.IUpdateView; |
9 | |
import org.jtheque.core.managers.view.impl.actions.JThequeAction; |
10 | |
|
11 | |
import javax.annotation.Resource; |
12 | |
import java.awt.HeadlessException; |
13 | |
import java.awt.event.ActionEvent; |
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
public abstract class AbstractUpdateAction extends JThequeAction { |
37 | |
@Resource |
38 | |
private IUpdateView updateView; |
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
AbstractUpdateAction(String key) { |
46 | 0 | super(key); |
47 | |
|
48 | 0 | Managers.getManager(IBeansManager.class).inject(this); |
49 | 0 | } |
50 | |
|
51 | |
@Override |
52 | |
public final void actionPerformed(ActionEvent e) { |
53 | |
try { |
54 | 0 | if (isUpToDate()) { |
55 | 0 | Managers.getManager(IViewManager.class).displayI18nText("message.update.no.version"); |
56 | |
} else { |
57 | 0 | updateView.sendMessage(getMessage(), getSelectedObject()); |
58 | 0 | updateView.display(); |
59 | |
} |
60 | 0 | } catch (HeadlessException e2) { |
61 | 0 | Managers.getManager(ILoggingManager.class).getLogger(getClass()).error(e2); |
62 | 0 | Managers.getManager(IErrorManager.class).addInternationalizedError("error.update.internet"); |
63 | 0 | } |
64 | 0 | } |
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
abstract boolean isUpToDate(); |
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
abstract String getMessage(); |
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
abstract Object getSelectedObject(); |
86 | |
} |