Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 380735
Collapse All | Expand All

(-)src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java (+21 lines)
Lines 9-15 Link Here
9
 ******************************************************************************/
9
 ******************************************************************************/
10
package org.eclipse.jpt.jpa.core.internal.facet;
10
package org.eclipse.jpt.jpa.core.internal.facet;
11
11
12
import org.eclipse.core.resources.ICommand;
12
import org.eclipse.core.resources.IProject;
13
import org.eclipse.core.resources.IProject;
14
import org.eclipse.core.resources.IProjectDescription;
13
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.core.runtime.IProgressMonitor;
15
import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
17
import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
Lines 24-29 Link Here
24
			Object config, IProgressMonitor monitor) throws CoreException {
26
			Object config, IProgressMonitor monitor) throws CoreException {
25
		
27
		
26
		(new JpaValidationPreferencesManager(project)).clearProjectPreferences();
28
		(new JpaValidationPreferencesManager(project)).clearProjectPreferences();
29
		removeBuilder(project, STATIC_WEAVING_BUILDER_ID);
27
		JptJpaCorePlugin.clearProjectPersistentProperties(project);
30
		JptJpaCorePlugin.clearProjectPersistentProperties(project);
28
	}
31
	}
32
33
	//TODO hack to fix bug 380735 in RC2. We need to move this code into the eclipselink plug-in
34
	private static String STATIC_WEAVING_BUILDER_ID = "org.eclipse.jpt.jpa.eclipselink.core.builder"; //$NON-NLS-1$
35
36
	private static void removeBuilder(IProject project, String builderId) throws CoreException {
37
		IProjectDescription description = project.getDescription();
38
		ICommand[] commands = description.getBuildSpec();
39
		for (int i = 0; i < commands.length; ++i) {
40
			if (commands[i].getBuilderName().equals(builderId)) {
41
				ICommand[] newCommands = new ICommand[commands.length - 1];
42
				System.arraycopy(commands, 0, newCommands, 0, i);
43
				System.arraycopy(commands, i + 1, newCommands, i, commands.length - i - 1);
44
				description.setBuildSpec(newCommands);
45
				project.setDescription(description, null);
46
				return;
47
			}
48
		}
49
	}
29
}
50
}

Return to bug 380735