private void but_chercher_entreeactionChercherEntree( ActionEvent evt) { // GEN-FIRST:event_but_chercher_entreeactionChercherEntree JFileChooser jfc = new JFileChooser(); jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); jfc.setCurrentDirectory(ENV.getPath()); int val = jfc.showOpenDialog(this); if (val == JFileChooser.APPROVE_OPTION) { File f = jfc.getSelectedFile(); jtf_entree.setText(f.getPath()); ENV.updatePath(f.getAbsoluteFile()); } } // GEN-LAST:event_but_chercher_entreeactionChercherEntree
public ProcessObject[] createProcesses() { List<File> allfiles = new ArrayList<File>(); List<String> okfiles = new ArrayList<String>(); List<ProcessObject> processes = new ArrayList<ProcessObject>(); String ext_entree = ""; switch (format_entree.getSelectedIndex()) { case 0: ext_entree = ".img"; break; case 1: ext_entree = ".ecw"; break; case 2: ext_entree = ".jpg"; break; case 3: ext_entree = ".jp2"; break; case 4: ext_entree = ".png"; break; case 5: ext_entree = ".tif"; break; } String type_sortie = ""; String ext_sortie = ""; switch (format_sortie.getSelectedIndex()) { case 0: type_sortie = "HFA"; ext_sortie = ".img"; break; case 1: type_sortie = "ECW"; ext_sortie = ".ecw"; break; case 2: type_sortie = "JPEG"; ext_sortie = ".jpg"; break; case 3: type_sortie = "JPEG2000"; ext_sortie = ".j2k"; break; case 4: type_sortie = "PNG"; ext_sortie = ".png"; break; case 5: type_sortie = "GTiff"; ext_sortie = ".tif"; break; } getFilesRec(allfiles, jtf_entree.getText(), chk_sub.isSelected()); for (int i = 0; i < allfiles.size(); i++) { if (allfiles.get(i).getPath().toLowerCase().endsWith(ext_entree)) { okfiles.add(allfiles.get(i).getPath()); } } for (int i = 0; i < okfiles.size(); i++) { repertoire = okfiles.get(i).substring(0, okfiles.get(i).lastIndexOf(File.separator) + 1); String shortname = okfiles .get(i) .substring(okfiles.get(i).lastIndexOf(File.separator), okfiles.get(i).length()); shortname = shortname.substring(0, shortname.lastIndexOf(".")) + ext_sortie; String[] parametres = new String[5]; parametres[0] = ENV.getGDAL_TRANSLATEPath(); parametres[1] = "-of"; parametres[2] = type_sortie; parametres[3] = okfiles.get(i); parametres[4] = jtf_sortie.getText() + shortname; ProcessObject po = new ProcessObject(parametres, shortname); processes.add(po); } return processes.toArray(EMPTY_PROCESS_OBJECT_ARRAY); }