/** * Returns a JavaScript model status describing the problem related to this includepath entry if * any, a status object with code <code>IStatus.OK</code> if the entry is fine (that is, if the * given includepath entry denotes a valid element to be referenced onto a includepath). * * @param project the given javaScript project * @param entry the given includepath entry * @param checkSourceAttachment a flag to determine if source attachement should be checked * @return a javaScript model status describing the problem related to this includepath entry if * any, a status object with code <code>IStatus.OK</code> if the entry is fine */ public static IJavaScriptModelStatus validateClasspathEntry( IJavaScriptProject project, IIncludePathEntry entry, boolean checkSourceAttachment) { IJavaScriptModelStatus status = ClasspathEntry.validateClasspathEntry( project, entry, checkSourceAttachment, true /*recurse in container*/); if (status.getCode() == IJavaScriptModelStatusConstants.INVALID_INCLUDEPATH && ((ClasspathEntry) entry).isOptional()) return JavaModelStatus.VERIFIED_OK; return status; }
/** * Validate a given includepath location for a project, using the following rules: * * <ul> * <li>Includepath entries cannot collide with each other; that is, all entry paths must be * unique. * <li>A project entry cannot refer to itself directly (that is, a project cannot prerequisite * itself). * <li>Includepath entries cannot coincidate or be nested in each other, except for the * following scenarii listed below: * <li>A source/library folder can be nested in any source folder as long as the nested folder * is excluded from the enclosing one. * </ul> * * </ul> * * Note that the includepath entries are not validated automatically. Only bound variables or * containers are considered in the checking process (this allows to perform a consistency check * on a includepath which has references to yet non existing projects, folders, ...). * * <p>This validation is intended to anticipate includepath issues prior to assigning it to a * project. In particular, it will automatically be performed during the includepath setting * operation (if validation fails, the includepath setting will not complete). * * <p> * * @param javaProject the given javaScript project * @param rawClasspath the given includepath * @return a status object with code <code>IStatus.OK</code> if the given includepath are * compatible, otherwise a status object indicating what is wrong with the includepath */ public static IJavaScriptModelStatus validateClasspath( IJavaScriptProject javaProject, IIncludePathEntry[] rawClasspath) { return ClasspathEntry.validateClasspath(javaProject, rawClasspath); }