1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 package org.ximtec.igesture.tool.view.batch.action;
27
28 import java.awt.event.ActionEvent;
29 import java.io.File;
30
31 import javax.swing.JFileChooser;
32
33 import org.sigtec.graphix.widget.BasicAction;
34 import org.ximtec.igesture.tool.GestureConstants;
35 import org.ximtec.igesture.tool.core.Controller;
36 import org.ximtec.igesture.tool.service.GuiBundleService;
37 import org.ximtec.igesture.tool.view.batch.BatchView;
38
39 public class SelectOutputDirAction extends BasicAction {
40
41 private BatchView view;
42
43 public SelectOutputDirAction(Controller controller, BatchView view) {
44 super(GestureConstants.BATCH_BROWSE_OUTPUT, controller.getLocator().getService(GuiBundleService.IDENTIFIER,
45 GuiBundleService.class));
46
47 this.view = view;
48 }
49
50 @Override
51 public void actionPerformed(ActionEvent action) {
52 JFileChooser chooser = new JFileChooser();
53 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
54 chooser.showOpenDialog(null);
55 File file = chooser.getSelectedFile();
56 if (file != null) {
57 view.setOutputDir(file.getAbsolutePath());
58 }
59 }
60
61 }