1
2
3
4
5
6
7
8
9
10
11
12
13 package org.abstracthorizon.aequo.file.action;
14
15 import java.awt.event.ActionEvent;
16 import java.awt.event.KeyEvent;
17
18 import javax.swing.Action;
19 import javax.swing.KeyStroke;
20 import javax.swing.ListSelectionModel;
21
22 import org.abstracthorizon.aequo.file.FileCompareEntry;
23
24
25
26
27
28
29 public class RefreshSubtreeAction extends FileBaseAction {
30
31 public RefreshSubtreeAction() {
32 setName("Refresh");
33 setMessage("Refresh Subtree");
34 setDescription("Refresh Subtree");
35 putValue(Action.MNEMONIC_KEY, KeyEvent.VK_R);
36 putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.CTRL_MASK));
37 }
38
39
40
41
42
43 public boolean isEnabled() {
44 return isSelectionValid();
45 }
46
47
48
49
50
51
52 public void perform(ActionEvent e) {
53 ListSelectionModel selModel = getFilesModel().getSelectionModel();
54 int index = selModel.getMinSelectionIndex();
55 FileCompareEntry entry = getFilesModel().get(index);
56 getFilesModel().refresh(entry, entry.getLevel(), true);
57 }
58 }