private void exportExternalClassFolderElement(IJavaElement javaElement, IPath classFolderPath, IProgressMonitor progressMonitor) throws JavaModelException, InterruptedException { if (javaElement instanceof IClassFile) { IClassFile classFile= (IClassFile) javaElement; IPath path= classFile.getPath(); IPath destination= path.removeFirstSegments(classFolderPath.segmentCount()).setDevice(null); try { ((IJarBuilderExtension) fJarBuilder).writeFile(path.toFile(), destination); } catch (CoreException e) { handleCoreExceptionOnExport(e); } finally { progressMonitor.worked(1); ModalContext.checkCanceled(progressMonitor); } } else if (javaElement instanceof IPackageFragment) { IJavaElement[] children= ((IPackageFragment) javaElement).getChildren(); for (int i= 0; i < children.length; i++) { exportExternalClassFolderElement(children[i], classFolderPath, progressMonitor); } } }
private void exportExternalClassFolderElement(IJavaElement javaElement, IPath classFolderPath, IProgressMonitor progressMonitor) throws JavaModelException, InterruptedException { if (javaElement instanceof IClassFile) { IClassFile classFile= (IClassFile) javaElement; IPath path= classFile.getPath(); IPath destination= path.removeFirstSegments(classFolderPath.segmentCount()).setDevice(null); try { ((IJarBuilderExtension) fJarBuilder).writeFile(path.toFile(), destination); } catch (CoreException e) { handleCoreExceptionOnExport(e); } finally { progressMonitor.worked(1); ModalContext.checkCanceled(progressMonitor); } } else if (javaElement instanceof IPackageFragment) { IJavaElement[] children= ((IPackageFragment) javaElement).getChildren(); for (int i= 0; i < children.length; i++) { exportExternalClassFolderElement(children[i], classFolderPath, progressMonitor); } } }