private void addJSLibToProj(IProject proj) {
IJavaScriptProject jsProj = JavaScriptCore.create(proj);
try {
IIncludePathEntry entries[] = jsProj.getRawIncludepath();
// an impl of IJsGlobalScopeContainerInitializer
LibInitializer jsLib = new LibInitializer();
// LibInitializer.getPath actually returns the LibraryID defined in the plugin.xml
// wrapped in a Path object. Funky, but okay.
IPath ourLibPath = jsLib.getPath();
IIncludePathEntry ourEntry = JavaScriptCore.newContainerEntry(ourLibPath);
IIncludePathEntry newEntries[] = new IIncludePathEntry[entries.length + 1];
System.arraycopy(entries, 0, newEntries, 0, entries.length);
newEntries[entries.length]= ourEntry;
jsProj.setRawIncludepath(newEntries, true, null);
} catch (JavaScriptModelException e) {
LogError( e );
}
}