65 |
* @author Grigor Iliev |
* @author Grigor Iliev |
66 |
*/ |
*/ |
67 |
public class JSAddDbInstrumentsFromDirDlg extends OkCancelDialog { |
public class JSAddDbInstrumentsFromDirDlg extends OkCancelDialog { |
68 |
private final JComboBox cbSource = new JComboBox(); |
private final JComboBox cbSource = StdUtils.createPathComboBox(); |
69 |
private JButton btnBrowse; |
private JButton btnBrowse; |
70 |
private final JCheckBox checkScanSubdirs = |
private final JCheckBox checkScanSubdirs = |
71 |
new JCheckBox(i18n.getLabel("JSAddDbInstrumentsFromDirDlg.checkScanSubdirs")); |
new JCheckBox(i18n.getLabel("JSAddDbInstrumentsFromDirDlg.checkScanSubdirs")); |
72 |
private final JCheckBox checkFlat = |
private final JCheckBox checkFlat = |
73 |
new JCheckBox(i18n.getLabel("JSAddDbInstrumentsFromDirDlg.checkFlat")); |
new JCheckBox(i18n.getLabel("JSAddDbInstrumentsFromDirDlg.checkFlat")); |
74 |
|
|
75 |
private final JComboBox cbDest = new JComboBox(); |
private final JComboBox cbDest = StdUtils.createPathComboBox(); |
76 |
private JButton btnBrowseDb; |
private JButton btnBrowseDb; |
77 |
|
|
78 |
/** |
/** |
172 |
checkScanSubdirs.doClick(0); |
checkScanSubdirs.doClick(0); |
173 |
checkFlat.doClick(0); |
checkFlat.doClick(0); |
174 |
|
|
|
cbSource.setEditable(true); |
|
175 |
String[] dirs = preferences().getStringListProperty("recentDirectories"); |
String[] dirs = preferences().getStringListProperty("recentDirectories"); |
176 |
for(String dir : dirs) cbSource.addItem(dir); |
for(String dir : dirs) cbSource.addItem(dir); |
177 |
cbSource.setSelectedItem(null); |
cbSource.setSelectedItem(null); |
182 |
|
|
183 |
cbSource.addActionListener(getHandler()); |
cbSource.addActionListener(getHandler()); |
184 |
|
|
|
cbDest.setEditable(true); |
|
185 |
dirs = preferences().getStringListProperty("recentDbDirectories"); |
dirs = preferences().getStringListProperty("recentDbDirectories"); |
186 |
for(String dir : dirs) cbDest.addItem(dir); |
for(String dir : dirs) cbDest.addItem(dir); |
187 |
cbDest.setSelectedItem(dbDir); |
cbDest.setSelectedItem(dbDir); |
220 |
int result = fc.showOpenDialog(this); |
int result = fc.showOpenDialog(this); |
221 |
if(result != JFileChooser.APPROVE_OPTION) return; |
if(result != JFileChooser.APPROVE_OPTION) return; |
222 |
|
|
223 |
String s = toEscapedString(fc.getSelectedFile().getPath()); |
path = fc.getSelectedFile().getAbsolutePath(); |
224 |
cbSource.setSelectedItem(s); |
if(java.io.File.separatorChar == '\\') { |
225 |
|
path = path.replace('\\', '/'); |
226 |
|
} |
227 |
|
path = toEscapedString(path); |
228 |
|
cbSource.setSelectedItem(path); |
229 |
path = fc.getCurrentDirectory().getAbsolutePath(); |
path = fc.getCurrentDirectory().getAbsolutePath(); |
230 |
preferences().setStringProperty("lastInstrumentLocation", path); |
preferences().setStringProperty("lastInstrumentLocation", path); |
231 |
} |
} |