You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by xa...@apache.org on 2007/07/10 09:38:05 UTC

svn commit: r554886 - in /incubator/ivy/ivyde/trunk: ./ src/java/org/apache/ivyde/eclipse/cpcontainer/ src/java/org/apache/ivyde/eclipse/cpcontainer/core/ src/java/org/apache/ivyde/eclipse/ui/actions/

Author: xavier
Date: Tue Jul 10 02:38:03 2007
New Revision: 554886

URL: http://svn.apache.org/viewvc?view=rev&rev=554886
Log:
FIX: "Add Ivy library" not working in eclipse 3.3 (IVYDE-57)

Removed:
    incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/core/
Modified:
    incubator/ivy/ivyde/trunk/CHANGES.txt
    incubator/ivy/ivyde/trunk/plugin.xml
    incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java
    incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/CreateContainerAction.java

Modified: incubator/ivy/ivyde/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ivy/ivyde/trunk/CHANGES.txt?view=diff&rev=554886&r1=554885&r2=554886
==============================================================================
--- incubator/ivy/ivyde/trunk/CHANGES.txt (original)
+++ incubator/ivy/ivyde/trunk/CHANGES.txt Tue Jul 10 02:38:03 2007
@@ -6,6 +6,7 @@
 - IMPROVE: enable 'Resolve all' action (IVYDE-42) (thanks to Thomas FRIOL)
 - IMPROVE: Support javadoc and sources even in modules where they are not declared (IVYDE-46)
 
+- FIX: "Add Ivy library" not working in eclipse 3.3 (IVYDE-57)
 - FIX: Automatic javadoc attachment is not working (IVYDE-55)
 
 - moved to apache, packages renamed to org.apache.ivyde

Modified: incubator/ivy/ivyde/trunk/plugin.xml
URL: http://svn.apache.org/viewvc/incubator/ivy/ivyde/trunk/plugin.xml?view=diff&rev=554886&r1=554885&r2=554886
==============================================================================
--- incubator/ivy/ivyde/trunk/plugin.xml (original)
+++ incubator/ivy/ivyde/trunk/plugin.xml Tue Jul 10 02:38:03 2007
@@ -3,7 +3,7 @@
 <plugin
    id="org.apache.ivyde.eclipse"
    name="IvyDE Eclipse Plug-in"
-   version="1.3.0.20070706085200"
+   version="1.3.0.20070710103400"
    provider-name="Apache"
    class="org.apache.ivyde.eclipse.IvyPlugin">
 

Modified: incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java
URL: http://svn.apache.org/viewvc/incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java?view=diff&rev=554886&r1=554885&r2=554886
==============================================================================
--- incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java (original)
+++ incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java Tue Jul 10 02:38:03 2007
@@ -1,6 +1,13 @@
 package org.apache.ivyde.eclipse.cpcontainer;
 
-import org.apache.ivyde.eclipse.cpcontainer.core.AddClasspathContainer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.ivyde.eclipse.IvyPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.jdt.core.IClasspathContainer;
 import org.eclipse.jdt.core.IClasspathEntry;
 import org.eclipse.jdt.core.IJavaElement;
@@ -14,10 +21,37 @@
 import org.eclipse.ui.PlatformUI;
 
 public class IvyClasspathUtil {
-	private static AddClasspathContainer addClasspathContainer = new AddClasspathContainer();
-	
-	public static AddClasspathContainer getAddClasspathContainer() {
-		return addClasspathContainer;
+	/**
+	 * Adds an IvyDE classpath container to the list of existing classpath entries in the 
+	 * given project.
+	 * 
+	 * @param project 
+	 * 			the project to which the cp container should be added
+	 * @param projectRelativePath 
+	 * 			the path relative to the project of the module descriptor file
+	 * 			to use for the classpath container
+	 * @param confs 
+	 * 			the configurations to use in the classpath container.
+	 */
+	public static void addCPContainer(
+			IJavaProject project, IPath projectRelativePath, String confs) {
+		try {
+			IClasspathEntry newEntry = JavaCore.newContainerEntry(
+					new Path(IvyClasspathContainer.IVY_CLASSPATH_CONTAINER_ID)
+					.append(projectRelativePath)
+					.append(confs));
+			
+			IClasspathEntry[] entries= project.getRawClasspath();
+			
+			List newEntries = new ArrayList(Arrays.asList(entries));
+			newEntries.add(newEntry);
+			entries = (IClasspathEntry[]) newEntries
+					.toArray(new IClasspathEntry[newEntries.size()]);
+			
+			project.setRawClasspath(entries, project.getOutputLocation(), null);
+		} catch (CoreException e) {
+			IvyPlugin.getDefault().log(e);
+		}
 	}
 	
     public static void refreshContainer() {

Modified: incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/CreateContainerAction.java
URL: http://svn.apache.org/viewvc/incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/CreateContainerAction.java?view=diff&rev=554886&r1=554885&r2=554886
==============================================================================
--- incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/CreateContainerAction.java (original)
+++ incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/CreateContainerAction.java Tue Jul 10 02:38:03 2007
@@ -58,7 +58,7 @@
 	}
 	
 	private void addCPContainer(IJavaProject project, IPath projectRelativePath, String confs) {
-		IvyClasspathUtil.getAddClasspathContainer().addCPContainer(project, projectRelativePath, confs);
+		IvyClasspathUtil.addCPContainer(project, projectRelativePath, confs);
 	}
 
 	/**