Index: src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
===================================================================
--- src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java	(révision 595956)
+++ src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java	(copie de travail)
@@ -43,7 +43,6 @@
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.SubProgressMonitor;
@@ -457,18 +456,31 @@
 	private IvyResolveJob _job;
 
 
-	public IvyClasspathContainer(IJavaProject javaProject, IPath path, String ivyFile, String[] confs ) {
+	/**
+     * Create an Ivy class path container from some predefined classpath entries. The provided class
+     * path entries should come from the default "persisted" classpath container. Note that no
+     * resolve nor resolve are exectued here, so some inconsistencies might exist between the
+     * ivy.xml and the provided classpath entries.
+     * 
+     * @param javaProject
+     *            the project of containing this container
+     * @param path
+     *            the path the project
+     * @param ivyFile
+     *            the path to the ivy file
+     * @param confs
+     *            the configuration that will be resolved
+     * @param classpathEntries
+     *            the entries to start with
+     */
+	public IvyClasspathContainer(IJavaProject javaProject, IPath path, String ivyFile, String[] confs, IClasspathEntry[] classpathEntries ) {
 		_javaProject = javaProject;
         _path = path;
 		
         _ivyXmlPath = ivyFile;
 		_ivyXmlFile = resolveFile( ivyFile );
-        _confs = confs;   
-        //do  execute this job in current thread 
-        computeClasspathEntries(true, false).run(new NullProgressMonitor());
-        if (_classpathEntries == null) {
-            _classpathEntries = new IClasspathEntry[0];
-        }
+        _confs = confs;
+        _classpathEntries = classpathEntries;
         IvyPlugin.getDefault().register(this);
 	}
 	
@@ -519,7 +531,7 @@
     /* (non-Javadoc)
      * @see org.eclipse.jdt.core.IClasspathContainer#getClasspathEntries()
      */
-    private IvyResolveJob computeClasspathEntries(final boolean usePreviousResolveIfExist, boolean notify) {
+    private IvyResolveJob computeClasspathEntries(final boolean usePreviousResolveIfExist, boolean notify, boolean isUser) {
         try {
         	Ivy ivy = IvyPlugin.getIvy(_javaProject);
 
@@ -529,7 +541,7 @@
 	        		return _job;
 	        	}
 	        	_job = new IvyResolveJob(ivy, usePreviousResolveIfExist, notify);
-	        	_job.setUser(true);
+	        	_job.setUser(isUser);
 	        	_job.setRule(RESOLVE_EVENT_RULE);
 	        	return _job;
         	}
@@ -545,14 +557,17 @@
      * @param monitor
      */
     public void resolve(IProgressMonitor monitor) {
-        computeClasspathEntries(false, true).run(monitor);
+        computeClasspathEntries(false, true, false).run(monitor);
     }
     
     public void resolve() {
-        computeClasspathEntries(false, true).schedule();
+        computeClasspathEntries(false, true, true).schedule();
     }
+    public void refresh(boolean isUser) {
+        computeClasspathEntries(true, true, isUser).schedule();
+    }
     public void refresh() {
-        computeClasspathEntries(true, true).schedule();
+        refresh(true);
     }
 
 
Index: src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java
===================================================================
--- src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java	(révision 595956)
+++ src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java	(copie de travail)
@@ -5,7 +5,7 @@
 import org.apache.ivyde.eclipse.cpcontainer.fragmentinfo.IPackageFragmentExtraInfo;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.IStatus;
 import org.eclipse.jdt.core.ClasspathContainerInitializer;
 import org.eclipse.jdt.core.IClasspathContainer;
 import org.eclipse.jdt.core.IClasspathEntry;
@@ -16,28 +16,53 @@
 import org.eclipse.swt.widgets.Display;
 
 /**
- *
+ * Initializer the ivy class path container.
+ * 
+ * TODO : start the dependency resolving in the background, with the errors
+ * popuping more than getting silently logged
  */
 public class IvyClasspathInitializer extends ClasspathContainerInitializer {
 
-	/* (non-Javadoc)
-	 * @see org.eclipse.jdt.core.ClasspathContainerInitializer#initialize(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject)
-	 */
+    /**
+     * Initialize the container with the "persisted" class path entries, and then schedule the
+     * refresh
+     */
 	public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
         if (IvyClasspathContainer.isIvyClasspathContainer(containerPath)) {
-    	    try {
-                String ivyFilePath = IvyClasspathContainer.getIvyFilePath(containerPath);
-                String[] confs = IvyClasspathContainer.getConfigurations(containerPath);
-                IClasspathContainer ivyClasspathContainer = (IClasspathContainer)JavaCore.getClasspathContainer(containerPath, project);
-                if (!(ivyClasspathContainer instanceof IvyClasspathContainer)) {
-                    ivyClasspathContainer = new IvyClasspathContainer( project, containerPath, ivyFilePath, confs );
-                }
-                JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { project },   new IClasspathContainer[] { ivyClasspathContainer }, null);
-            } catch (JavaModelException e) {
-                e.printStackTrace();
+            String ivyFilePath = IvyClasspathContainer.getIvyFilePath(containerPath);
+            String[] confs = IvyClasspathContainer.getConfigurations(containerPath);
+
+            // try to get an existing one
+            IClasspathContainer container = null;
+            try {
+                container = JavaCore.getClasspathContainer(containerPath, project);
+            } catch (JavaModelException ex) {
+                IvyPlugin.log(IStatus.ERROR, "Unable to get container for "
+                        + containerPath.toString(), ex);
+                return;
             }
+
+            if (container == null) {
+                container = new IvyClasspathContainer(project, containerPath, ivyFilePath, confs,
+                        new IClasspathEntry[0]);
+            } else if (!(container instanceof IvyClasspathContainer)) {
+                // this might be the persisted one : reuse the persisted entries
+                container = new IvyClasspathContainer(project, containerPath, ivyFilePath, confs,
+                        container.getClasspathEntries());
+            }
+
+            try {
+                JavaCore.setClasspathContainer(containerPath, new IJavaProject[] {project},
+                    new IClasspathContainer[] {container}, null);
+            } catch (JavaModelException ex) {
+                IvyPlugin.log(IStatus.ERROR, "Unable to set container for "
+                        + containerPath.toString(), ex);
+            }
+
+            // now refresh the container to be synchronized with the ivy.xml
+            ((IvyClasspathContainer) container).refresh(false);
         }
-	}
+    }
 
 
 
