/** * Adds a new source container specified by the container name to the source path of the specified * project * * @param jproject * @param containerName * @return the package fragment root of the container name * @throws CoreException */ public static IPackageFragmentRoot addSourceContainer(IJavaProject jproject, String containerName) throws CoreException { IProject project = jproject.getProject(); IPackageFragmentRoot root = jproject.getPackageFragmentRoot(addFolderToProject(project, containerName)); IClasspathEntry cpe = JavaCore.newSourceEntry(root.getPath()); addToClasspath(jproject, cpe); return root; }
/** * Adds a container entry to the specified java project * * @param project * @param container * @throws JavaModelException */ public static void addContainerEntry(IJavaProject project, IPath container) throws JavaModelException { IClasspathEntry cpe = JavaCore.newContainerEntry(container, false); addToClasspath(project, cpe); }