Community
Participate
Working Groups
Our project is built on top of Eclipse Helios. Our project has JSDT nature (org.eclipse.wst.jsdt.core.jsNature) and is not a WTP web project (it is not a faceted project). We create our projects using following APIs: BuildPathsBlock.createProject(project, uri, new SubProgressMonitor(monitor, 10)); BuildPathsBlock.addJavaNature(project, new SubProgressMonitor(monitor, 10)); IJavaScriptProject jsProject = JavaScriptCore.create(project); final IIncludePathEntry[] includepath = jsProject.getRawIncludepath(); ---- Setup classpath ---- The problem we encountered is that if you create a new project then includepath will have 3 entries (source + browser + default). But if you delete project and then create a new one without restarting the workbench its include path will not be reseted to default but will have 0 entries instead. It is because project description is cached by JSDT and is reused for the new project.
As a workaround we now explicitly reset include path on a new project: jsProject.setRawIncludepath(null, new SubProgressMonitor(monitor, 5));
Eugene, do you have more exact details about where this going wrong in the source?
We have no plans to work on this, especially if there is a work around. If anyone in the community would like to submit a patch for this, we will take it. If not, I plan to close by the end of WTP 3.6 development.
I cannot reproduce it using Kepler + WTP 3.5.1. Initially I have a project with various natures (including the JavaScript one). So, due to reproduce the issue: - I've deleted that project (but didn't remove its contents on the disk) - I've used New->Project->General Project wizard due to re-create the deleted project, typed the name of the project that I've removed on the previous step and pressed "Finish" button The project was successfully recreated and "Project->Properties->JavaScript->Include Path" had all the three mentioned items. When using "New->Project->JavaScript->JavaScript Project" wizard, I have the same result. The difference is only I have to select "Create project from existing source" option and select the folder that contains the deleted project. So, either I'm doing something wrong while trying to reproduce, or the issue is fixed somehow in Kepler, or there is a very special project setup.
So many things have changed since this was originally opened, so would not be surprised if this got fixed along the way. Victor, were you re-creating this using the wizards? The original bug was using API calls to create the project, I believe. Perhaps the problem is on a different code path than the wizard uses.
Yes, I did tested the issue by using the wizards only. But you're correct, we need to test it by the calls to the API. I'll create a test for this case.
Created attachment 238219 [details] JUnit Test is added for the issue The patch adds JUnit Test due to verify the issue. Due to test the issue, the test case performs the following steps: - Creates a JavaScript Project using BuildPathsBlock.createProject(...) and BuildPathsBlock.addJavaNature(...) API - Tests the Include Path of the created project (Should contain at least one Source, one Script Support and one Browser support containers) - Deletes the created project - On the same workspace the test creates a new JavaScript Project with the same name using BuildPathsBlock.createProject(...) and BuildPathsBlock.addJavaNature(...) API - Tests the Include Path of the created project (Should contain at least one Source, one Script Support and one Browser support containers)
I've attached the JUnit Test that should probably reproduce the issue (See the comment to the patch). In my environment the Test completes with success. Chris, WDYT? Probably, some other operations should be invoked between the deletion and the re-creation of the project due to reproduce the issue?