}
protected ProjectData projectData;
public Job getImportFileJob(){
final Serializer serializer=new Serializer();
final FileImporter importer=this;
final Job job=new Job(importer.getJobQueue(),"importFile",Messages.getString("LocalFileImporter.Importing"),true); //$NON-NLS-1$ //$NON-NLS-2$
job.addRunnable(new JobRunnable("Import",1.0f){ //$NON-NLS-1$
public Object run() throws Exception{
//DataUtil serializer=new DataUtil();
System.out.println("Loading "+importer.getFileName()+"..."); //$NON-NLS-1$ //$NON-NLS-2$
long t1=System.currentTimeMillis();
ObjectInputStream in=new ObjectInputStream(new FileInputStream(importer.getFileName()));
Object obj=in.readObject();
if (obj instanceof String) obj=in.readObject(); //check version in the future
projectData=(ProjectData)obj;
projectData.setMaster(false);
projectData.setLocal(false);
long t2=System.currentTimeMillis();
System.out.println("Loading...Done in "+(t2-t1)+" ms"); //$NON-NLS-1$ //$NON-NLS-2$
Collection<ResourceData> rs=(Collection<ResourceData>)projectData.getResources();
List<EnterpriseResourceData> ers=new ArrayList<EnterpriseResourceData>(rs.size());
for (ResourceData r: rs){
ers.add(r.getEnterpriseResource());
}
((ServerFileImporter)importer).prepareResources(ers,null,false);
renumberProject();
setProgress(1.0f);
return null;
}
});
job.addSwingRunnable(new JobRunnable("Import resources",1.0f){ //$NON-NLS-1$
public Object run() throws Exception{
ResourceMappingForm form=getResourceMapping();
if (form!=null&&form.isLocal()) //if form==null we are in a case were have no server access. popup not needed
if (!job.okCancel(Messages.getString("Message.ServerUnreacheableReadOnlyProject"),true)){ //$NON-NLS-1$
setProgress(1.0f);
throw new Exception(ABORT);
}
if(!importResources()){
setProgress(1.0f);
throw new JobCanceledException(ABORT);
}
setProgress(1f);
return null;
}
});
job.addRunnable(new JobRunnable("Import",1.0f){ //$NON-NLS-1$
public Object run() throws Exception{
System.out.println("Deserializing..."); //$NON-NLS-1$
long t1=System.currentTimeMillis();
ResourceMappingForm form=getResourceMapping();
// project=serializer.deserializeProject(projectData,false,true,resourceMap);
//DEF165936: Projity: .pod file import fails mapped to resource with modified calendar
//pass the map into the serializer so it can grab the original impls
// serializer.SetStuffForPODDeserialization(form.getExistingProject(), _localResourceMap); //claur
Project project=serializer.deserializeProject(projectData,false,null,null,null,false);
if (project!=null&&!Environment.getStandAlone()) project.setAllDirty();
importer.setProject(project);
long t2=System.currentTimeMillis();
System.out.println("Deserializing...Done in "+(t2-t1)+" ms"); //$NON-NLS-1$ //$NON-NLS-2$