public void execute(Object o) {
System.out.println("Monitor Canceled");
jobQueue.endCriticalSection(job);
}
});
FileImporter importer=null;
try {
importer=(FileImporter) ClassUtils.forName(opt.getImporter()).newInstance();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
importer.setJobQueue(jobQueue);
importer.setProjectFactory(ProjectFactory.getInstance());//used?
int count=projs.size();
int i=0;
for (final Project project : projs) {
//if projs.size()>1 opt.getFileName() must be null
String fileN=(opt.getFileName()==null)?project.getGuessedFileName():opt.getFileName();//+(count>1?("("+i+")"):""));
if (!FileHelper.isFileNameAllowed(fileN, true)){
fileN=SessionFactory.getInstance().getLocalSession().chooseFileName(true,FileHelper.changeFileExtension(fileN, /*project.getFileType()*/FileHelper.PROJITY_FILE_TYPE));
}
final String fileName=fileN;
if (fileName==null) continue;
importer.setFileName(fileName);
importer.setProject(project);
if (opt.getPreSaving() != null)
opt.getPreSaving().execute(project);
job.addJob(importer.getExportFileJob());
job.addRunnable(new JobRunnable("Local: saveProject end"){
public Object run() throws Exception{
project.setFileName(fileName);
project.setGroupDirty(false);
if (opt.getPostSaving()!=null) opt.getPostSaving().execute(project);