use of org.eclipse.jdt.core.ClasspathContainerInitializer in project flux by eclipse.
the class JavaModelUtil method getClasspathEntryToEdit.
/**
* Helper method that tests if an classpath entry can be found in a
* container. <code>null</code> is returned if the entry can not be found
* or if the container does not allows the configuration of source
* attachments
* @param jproject The container's parent project
* @param containerPath The path of the container
* @param libPath The path of the library to be found
* @return IClasspathEntry A classpath entry from the container of
* <code>null</code> if the container can not be modified.
* @throws JavaModelException thrown if accessing the container failed
*/
public static IClasspathEntry getClasspathEntryToEdit(IJavaProject jproject, IPath containerPath, IPath libPath) throws JavaModelException {
IClasspathContainer container = JavaCore.getClasspathContainer(containerPath, jproject);
ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
if (container != null && initializer != null && initializer.canUpdateClasspathContainer(containerPath, jproject)) {
return findEntryInContainer(container, libPath);
}
// attachment not possible
return null;
}
Aggregations