public static void importArchiveProject( Shell shell, String technicalName, String sourcePath, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException, TarException, IOException { IImportStructureProvider provider; Object source; if (ArchiveFileManipulations.isZipFile(sourcePath)) { ZipLeveledStructureProvider zipProvider = new ZipLeveledStructureProvider(new ZipFile(sourcePath)); source = zipProvider.getRoot(); boolean ok = true; for (Object o : zipProvider.getChildren(source)) { String label = zipProvider.getLabel(o); if (!label.equals(IProjectDescription.DESCRIPTION_FILE_NAME) && ok) { source = o; } else { ok = false; } } if (!ok) { source = zipProvider.getRoot(); } provider = zipProvider; } else if (ArchiveFileManipulations.isTarFile(sourcePath)) { TarLeveledStructureProvider tarProvider = new TarLeveledStructureProvider(new TarFile(sourcePath)); source = tarProvider.getRoot(); boolean ok = true; for (Object o : tarProvider.getChildren(source)) { String label = tarProvider.getLabel(o); if (!label.equals(IProjectDescription.DESCRIPTION_FILE_NAME) && ok) { source = o; } else { ok = false; } } if (!ok) { source = tarProvider.getRoot(); } provider = tarProvider; } else { throw new IllegalArgumentException( Messages.getString("ImportProjectsUtilities.fileFormatError", sourcePath)); // $NON-NLS-1$ } importProject(shell, provider, source, new Path(technicalName), false, false, monitor); }