diff options
author | tle | 2012-05-29 15:10:46 +0000 |
---|---|---|
committer | tle | 2012-05-29 15:10:46 +0000 |
commit | 4e685ef421df244788c3c897af9ab098b4e187ed (patch) | |
tree | 3e633a35984ffdd9ec0fab79a8ea6dfc44f2f845 | |
parent | 8bf815cc02f2d2a205fd28f41240c1448678b5d5 (diff) | |
download | webtools.dali-4e685ef421df244788c3c897af9ab098b4e187ed.tar.gz webtools.dali-4e685ef421df244788c3c897af9ab098b4e187ed.tar.xz webtools.dali-4e685ef421df244788c3c897af9ab098b4e187ed.zip |
380735 - EclipseLink static weaving builder is not removed when JPA facet is removed - patch from Karen
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java index e269f96989..60ed303a78 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java @@ -9,7 +9,9 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.core.internal.facet; +import org.eclipse.core.resources.ICommand; import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; @@ -24,6 +26,25 @@ public class JpaFacetUninstallDelegate Object config, IProgressMonitor monitor) throws CoreException { (new JpaValidationPreferencesManager(project)).clearProjectPreferences(); + removeBuilder(project, STATIC_WEAVING_BUILDER_ID); JptJpaCorePlugin.clearProjectPersistentProperties(project); } + + //TODO hack to fix bug 380735 in RC2. We need to move this code into the eclipselink plug-in + private static String STATIC_WEAVING_BUILDER_ID = "org.eclipse.jpt.jpa.eclipselink.core.builder"; //$NON-NLS-1$ + + private static void removeBuilder(IProject project, String builderId) throws CoreException { + IProjectDescription description = project.getDescription(); + ICommand[] commands = description.getBuildSpec(); + for (int i = 0; i < commands.length; ++i) { + if (commands[i].getBuilderName().equals(builderId)) { + ICommand[] newCommands = new ICommand[commands.length - 1]; + System.arraycopy(commands, 0, newCommands, 0, i); + System.arraycopy(commands, i + 1, newCommands, i, commands.length - i - 1); + description.setBuildSpec(newCommands); + project.setDescription(description, null); + return; + } + } + } } |