Source:
private boolean importTraces() { boolean success = false; IOverwriteQuery overwriteQuery = new IOverwriteQuery() { @Override public String queryOverwrite(String file) { return fOverwrite ? IOverwriteQuery.ALL : IOverwriteQuery.NO_ALL; } }; FileSystemStructureProvider fileSystemStructureProvider = FileSystemStructureProvider.INSTANCE; for (FileAndName traceToImport : fTraces) { try { if (fLinked) { createLink(fTargetFolder, Path.fromOSString(traceToImport.getFile().getAbsolutePath()), traceToImport.getName()); success = setTraceType(traceToImport).isOK(); } else { List<File> subList = new ArrayList<File>(); IPath path = fTargetFolder.getFullPath(); File parentFile = traceToImport.getFile(); final boolean isFile = parentFile.isFile(); if (isFile) { IFile resource = ResourcesPlugin.getWorkspace().getRoot().getFile(path.append(traceToImport.getName())); if (fOverwrite || !resource.exists()) { subList.add(parentFile); parentFile = parentFile.getParentFile(); final FileInputStream source = new FileInputStream(traceToImport.getFile()); if( resource.exists()) { resource.delete(IResource.FORCE, new NullProgressMonitor()); } resource.create(source, true, new NullProgressMonitor()); source.close(); setTraceType(traceToImport); success = true; } } else { path = fTargetFolder.getFullPath().append(traceToImport.getName()); File[] fileList = traceToImport.getFile().listFiles(); for (File child : fileList) { subList.add(child); } Collections.sort(subList, new Comparator<File>() { @Override public int compare(File o1, File o2) { return o1.getAbsolutePath().compareTo(o2.getAbsolutePath()); } }); ImportOperation operation = new ImportOperation( path, parentFile, fileSystemStructureProvider, overwriteQuery, subList); operation.setContext(getShell()); operation.setCreateContainerStructure(false); if (executeImportOperation(operation)) { setTraceType(traceToImport); success = true; } } } } catch (Exception e) { e.printStackTrace(); } } return success; }

Target:
private boolean importTraces() { boolean success = false; IOverwriteQuery overwriteQuery = new IOverwriteQuery() { @Override public String queryOverwrite(String file) { return fOverwrite ? IOverwriteQuery.ALL : IOverwriteQuery.NO_ALL; } }; FileSystemStructureProvider fileSystemStructureProvider = FileSystemStructureProvider.INSTANCE; for (FileAndName traceToImport : fTraces) { try { if (fLinked) { createLink(fTargetFolder, Path.fromOSString(traceToImport.getFile().getAbsolutePath()), traceToImport.getName()); success = setTraceType(traceToImport).isOK(); } else { List<File> subList = new ArrayList<File>(); IPath path = fTargetFolder.getFullPath(); File parentFile = traceToImport.getFile(); final boolean isFile = parentFile.isFile(); if (isFile) { IFile resource = ResourcesPlugin.getWorkspace().getRoot().getFile(path.append(traceToImport.getName())); if (fOverwrite || !resource.exists()) { subList.add(parentFile); parentFile = parentFile.getParentFile(); final FileInputStream source = new FileInputStream(traceToImport.getFile()); if( resource.exists()) { resource.delete(IResource.FORCE, new NullProgressMonitor()); } resource.create(source, true, new NullProgressMonitor()); source.close(); setTraceType(traceToImport); success = true; } } else { path = fTargetFolder.getFullPath().append(traceToImport.getName()); File[] fileList = traceToImport.getFile().listFiles(); for (File child : fileList) { subList.add(child); } Collections.sort(subList, new Comparator<File>() { @Override public int compare(File o1, File o2) { return o1.getAbsolutePath().compareTo(o2.getAbsolutePath()); } }); ImportOperation operation = new ImportOperation( path, parentFile, fileSystemStructureProvider, overwriteQuery, subList); operation.setContext(getShell()); operation.setCreateContainerStructure(false); if (executeImportOperation(operation)) { setTraceType(traceToImport); success = true; } } } } catch (Exception e) { } } return success; }