Index: src/java/org/apache/ivyde/eclipse/resolver/WorkspaceResolver.java
===================================================================
--- src/java/org/apache/ivyde/eclipse/resolver/WorkspaceResolver.java	(révision 0)
+++ src/java/org/apache/ivyde/eclipse/resolver/WorkspaceResolver.java	(révision 0)
@@ -0,0 +1,321 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.resolver;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.core.module.descriptor.Configuration;
+import org.apache.ivy.core.module.descriptor.DefaultArtifact;
+import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
+import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
+import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.core.module.id.ModuleId;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.report.ArtifactDownloadReport;
+import org.apache.ivy.core.report.DownloadReport;
+import org.apache.ivy.core.report.DownloadStatus;
+import org.apache.ivy.core.report.MetadataArtifactDownloadReport;
+import org.apache.ivy.core.resolve.DownloadOptions;
+import org.apache.ivy.core.resolve.ResolveData;
+import org.apache.ivy.core.resolve.ResolvedModuleRevision;
+import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;
+import org.apache.ivy.plugins.resolver.AbstractResolver;
+import org.apache.ivy.plugins.resolver.util.ResolvedResource;
+import org.apache.ivy.util.Message;
+import org.apache.ivyde.eclipse.IvyPlugin;
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+
+/**
+ * This is an Eclipse workspace Ivy resolver.
+ *   When used with the custom IvyClasspathContainer changes,
+ *   this resolver will link dependent projects when they are open in the same workspace,
+ *   allowing full-fledged linked project functionality Eclipse provides, such as incremental
+ *   compilation, debugging, mouseover javadocs, and source browsing across projects.
+ *
+ * The resolver will not work until it is properly configured, see instructions below.
+ *
+ * <b>How it works</b>
+ * During a resolve, it looks at all open projects in the workspace that have
+ * Ivy containers.
+ * The <b>first</b> project that publishes the module 
+ * on which the project being resolved depends, will be picked and
+ * returned as a special type of artifact called "project".
+ * 
+ * The IvyClasspathContainer will recognize the artifact as a project and put the 
+ * eclipse project as a dependent project within the classpath container of the parent.
+ * 
+ * If you do not want a project to be linked as a dependency, close it or delete from the workspace.
+ * As soon as you do that, any projects that were linked to it will automatically re-resolve
+ * (see {@link WorkspaceResourceChangeListener})
+ * and use the standard Ivy means of finding the dependency.
+ * 
+ * The {@link WorkspaceResourceChangeListener} will also auto-resolve when a new
+ * project is added or opened, so opening a project will automatically link it into
+ * the currently open projects where necessary.
+ * 
+ * Since the resolver is not aware which module revision a project
+ * is publishing, it optimistically matches any revision of the module.
+ * 
+ * Since the resolver stops after finding the first open project which matches the module,
+ * having multiple open versions of the same project in the workspace
+ * (for example, different branches) may set the wrong version as a dependency.
+ * You are advised to only open the version of the project which you
+ * want other projects in the workspace to depend on.
+ * 
+ *   NOTE: Transitive dependencies are not passed from the dependent project
+ *   to the parent when projects are linked.  If you find you are missing some
+ *   transitive dependencies, just set your dependent eclipse project to export
+ *   its ivy dependencies.  
+ *   (Project->Properties->Java Build Path->Order and Export->
+ *           -> check the ivy container)
+ *   This will only export the configuration that project is using and not
+ *   what a dependent project may ask for when it's being resolved.
+ *   To do that, this resolver will need to be modified to pass transitive
+ *   dependencies along.  
+ *   
+ * <b>How to set it up</b>
+ * Set up a custom resolver in the resolve chain (see example below), 
+ *   
+ *   Usage Example:
+ *   
+ *   Suppose you have a main ivyconf.xml which sets up all your resolvers to be
+ *   executed at command-line.
+ *   
+ *   1) Create a new file which includes your main ivyconf.xml file
+ *   2) Define the custom eclipse resolver type.
+ *   3) Create a simple chain which uses the eclipse resolver first and then
+ *      the resolver which would normally be used in your config file.
+ *      It could be the default resolver or any other, depending on your situation.
+ *   4) (Optional) To optimize, if you know you will only be developing modules
+ *      in your organization, you may limit the calls to the eclipse resolver
+ *      to only modules in your organization, by using the module directives.
+ *      
+ *      IMPORTANT NOTE: If the main config file already restricts modules in your organization
+ *      to a specific resolver, you will not be able to override it in your own file.
+ *      Either completely duplicate the main file and add eclipse resolver there,
+ *      or have a base file without any org-specific restrictions and then two
+ *      files which include it: the eclipse config and the main config.
+ *       
+ *      (See Ivy manual for your reference).
+ *   5) In Eclipse preferences, navigate to Ivy preferences and select the
+ *      new config file just created as your default configuration file.  
+ *    
+ *   Sample ivyconf-eclipse.xml:
+ *   
+ * <ivyconf>
+ *
+ * <include file="/path/to/ivyconf.xml"/>
+ *
+ * <typedef name="eclipse" classname="org.apache.ivyde.eclipse.resolver.WorkspaceResolver"/>
+ *
+ * <resolvers>
+ *   <eclipse name="eclipse"/>
+ *       <chain name="eclipse-chain" returnFirst="true">
+ *           <resolver ref="eclipse"/>
+ *           <resolver ref="originalResolver"/>
+ *       </chain>
+ * </resolvers>
+ *
+ *   <modules>
+ *       <module organisation="myOrg" name=".*" resolver="eclipse-chain"/>
+ *   </modules>
+ *
+ * </ivyconf>
+ *   
+ * @author <a href="mailto:eugene.goldfarb@yahoo.com">Eugene Goldfarb</a>
+ *
+ */
+public class WorkspaceResolver extends AbstractResolver {
+
+    public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
+        // Not much to do here - downloads are not required for workspace projects.
+        DownloadReport dr = new DownloadReport();
+        for (int i = 0; i < artifacts.length; i++) {
+            final ArtifactDownloadReport adr = new ArtifactDownloadReport(artifacts[i]);
+            dr.addArtifactReport(adr);
+
+            // Only report java projects as downloaded
+            if (artifacts[i].getType().equals("project")) {
+                Message.verbose("\t[WORKSPACE   ] " + artifacts[i]);
+                adr.setDownloadStatus(DownloadStatus.NO);
+                adr.setSize(0);
+            } else {
+                Message.verbose("\t[Eclipse Workspace resolver - skipping non-project artifact] "
+                        + artifacts[i]);
+                adr.setDownloadStatus(DownloadStatus.NO);
+            }
+        }
+        return dr;
+    }
+
+    public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
+            throws ParseException {
+
+        ModuleId mid = dd.getDependencyId();
+
+        try {
+            IJavaProject[] projects = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot())
+                    .getJavaProjects();
+
+            // Iterate over workspace to find Java project which has an Ivy
+            // container for this dependency
+            for (int i = 0; i < projects.length; i++) {
+                IJavaProject javaProject = projects[i];
+                IClasspathEntry[] entries = javaProject.getRawClasspath();
+                for (int j = 0; j < entries.length; j++) {
+                    IClasspathEntry entry = entries[j];
+
+                    ModuleDescriptor md = findModuleDescriptor(javaProject, entry);
+
+                    if (md != null) {
+                        // Found one; check if it is for the module we need
+                        if (mid.equals(md.getModuleRevisionId().getModuleId())) {
+
+                            // Get a revision which will match desired revision
+                            ModuleRevisionId localId = generateLocalId(dd.getDependencyRevisionId());
+                            Artifact af = new DefaultArtifact(localId, md.getPublicationDate(),
+                                    javaProject.getPath().toString(), "project", "project");
+
+                            DefaultModuleDescriptor workspaceMd = DefaultModuleDescriptor
+                                    .newDefaultInstance(localId);
+
+                            // Find the configuration for which the resolve is running, and find out what configuration of
+                            // the dependency is required.  We will always try to accomodate the resolver and supply
+                            // the artifacts for every configuration
+                            //   String[] allConfs = dd.getDependencyConfigurations(data.getReport().getConfiguration());
+
+                            // In Ivy 1.4.1, Ivy behavior changed since 1.3 or 1.4 and this stopped working.  Before, it called resolve many times
+                            // when different configurations were needed.  Now, it looks like it's been
+                            // optimized and calls resolve once.
+                            // So, the resolver is supposed to return all possible configurations
+                            // in case they are needed later, and not what is asked for.
+                            String[] allConfs = md.getConfigurationsNames();
+                            if (allConfs.length == 0) {
+                                workspaceMd.addArtifact(ModuleDescriptor.DEFAULT_CONFIGURATION, af);
+                            } else {
+                                for (int k = 0; k < allConfs.length; k++) {
+                                    workspaceMd.addConfiguration(new Configuration(allConfs[k]));
+                                    workspaceMd.addArtifact(allConfs[k], af);
+                                }
+                            }
+
+                            MetadataArtifactDownloadReport madr = new MetadataArtifactDownloadReport(
+                                    af);
+                            madr.setDownloadStatus(DownloadStatus.SUCCESSFUL);
+                            madr.setSearched(true);
+
+                            return new ResolvedModuleRevision(this, this, workspaceMd, madr);
+                        }
+                    }
+                }
+            }
+
+            // Didn't find module in any open project, proceed to other resolvers.
+            return null;
+
+        } catch (JavaModelException e) {
+            IvyPlugin.log(IStatus.ERROR, "Errors occurred trying to get dependency", e);
+        }
+
+        return null;
+    }
+
+    /*
+     * This will ensure that the revision returned is a close match to the requested revision,
+     * but will not be rejected by Ivy for being a "dynamic" revision.
+     * Strips the "latest" and "+" designators and appends "-eclipse" and current timestamp to the revision.
+     */
+    private ModuleRevisionId generateLocalId(ModuleRevisionId requestedId) {
+        String rev = requestedId.getRevision();
+        if (rev.startsWith("latest.")) {
+            rev = rev.replaceFirst("latest.", "") + "-eclipse";
+        }
+
+        if (rev.endsWith("+")) {
+            rev = rev.substring(0, rev.length() - 1) + "-eclipse."
+                    + new SimpleDateFormat("yyyyMMddHHmm").format(new Date());
+        }
+
+        // Invoke copy constructor but with our custom revision to pick up any other attributes
+        return ModuleRevisionId.newInstance(requestedId, rev);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see fr.jayasoft.ivy.DependencyResolver#publish(fr.jayasoft.ivy.Artifact, java.io.File, boolean)
+     */
+    public void publish(Artifact artifact, File src, boolean overwrite) throws IOException {
+        throw new UnsupportedOperationException("publish not supported by WorkspaceResolver");
+    }
+
+    /*
+     * Finds and parses the ivy.xml file for the supplied project's classpath container
+     */
+    private ModuleDescriptor findModuleDescriptor(IJavaProject javaProject, IClasspathEntry entry)
+            throws ParseException, JavaModelException {
+
+        if (entry != null && entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
+            IPath path = entry.getPath();
+            if (IvyClasspathUtil.isIvyClasspathContainer(path)) {
+                IClasspathContainer cp = JavaCore.getClasspathContainer(path, javaProject);
+
+                if (cp instanceof IvyClasspathContainer) {
+                    IvyClasspathContainer c = (IvyClasspathContainer) cp;
+
+                    // TODO Can these be cached?  Need to invalidate using delta listener.
+                    try {
+                        IFile iFile = c.getIvyFile();
+                        File ivyFile = new File(iFile.getLocation().toOSString());
+                        URL ivyURL = ivyFile.toURL();
+                        ModuleDescriptor md;
+
+                        md = ModuleDescriptorParserRegistry.getInstance().parseDescriptor(
+                            getSettings(), ivyURL, true); // EG: try to validate even at refresh
+
+                        return md;
+                    } catch (Exception e) {
+                        throw new ParseException(
+                                "Error loading Ivy file for " + c.getDescription(), 0);
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
+    public ResolvedResource findIvyFileRef(DependencyDescriptor dd, ResolveData data) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+}

Modification de propriétés sur src/java/org/apache/ivyde/eclipse/resolver/WorkspaceResolver.java
___________________________________________________________________
Nom : svn:mime-type
   + text/plain
Nom : svn:keywords
   + Date Revision Author HeadURL Id
Nom : svn:eol-style
   + native

Index: src/java/org/apache/ivyde/eclipse/resolver/WorkspaceResourceChangeListener.java
===================================================================
--- src/java/org/apache/ivyde/eclipse/resolver/WorkspaceResourceChangeListener.java	(révision 0)
+++ src/java/org/apache/ivyde/eclipse/resolver/WorkspaceResourceChangeListener.java	(révision 0)
@@ -0,0 +1,219 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.resolver;
+
+import java.util.Collection;
+
+import org.apache.ivyde.eclipse.IvyPlugin;
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
+import org.apache.ivyde.eclipse.ui.preferences.PreferenceConstants;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceRuleFactory;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.WorkspaceJob;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.core.JavaModelManager;
+
+/**
+ * This ResourceChangeListener detects when projects linked in as Ivy
+ * dependencies are closed.
+ * When necessary, it will re-resolve Ivy projects which had the dependent project linked
+ * into the Ivy container before it was closed.
+ * 
+ * TODO: When a project is opened, run resolve on other Ivy projects in the workspace
+ * to automatically link it in where appropriate.
+ * 
+ * @author <a href="mailto:eugene.goldfarb@yahoo.com">Eugene Goldfarb</a>
+ *
+ */
+public class WorkspaceResourceChangeListener implements IResourceChangeListener {
+
+   public void resourceChanged(IResourceChangeEvent event) {
+       
+       try {
+           if (event.getType() == IResourceChangeEvent.PRE_CLOSE
+                   || event.getType() == IResourceChangeEvent.PRE_DELETE) {
+               
+               if (IvyPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.AUTO_RESOLVE_ON_CLOSE)) {
+
+                   // Check if one of Ivy projects is being removed
+                   final IResource res = event.getResource();
+                   final IJavaProject javaProject = JavaModelManager.getJavaModelManager().getJavaModel().getJavaProject(res);
+                   if (javaProject != null) {
+                       IPath path = null;
+                       IClasspathEntry[] entries = javaProject.getRawClasspath();
+                       for (int i= 0; i < entries.length; i++) {
+                           IClasspathEntry entry= entries[i];
+                           if (entry != null && entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER && 
+                               IvyClasspathUtil.isIvyClasspathContainer(entry.getPath())) {
+                                   path = entry.getPath();
+                                   break;
+                           }
+                       }
+                       
+                       if (path != null) {
+                           // Found an Ivy container in this project -- notify dependent projects to perform fresh resolve
+                               
+                           // Let's try to be nice and use the workspace method
+                           // to schedule resolves in dependent projects after the close operation
+                           // has finished.
+                           IWorkspace workspace = ResourcesPlugin.getWorkspace();
+                           IResourceRuleFactory ruleFactory = workspace.getRuleFactory();
+                           ISchedulingRule modifyRule = ruleFactory.modifyRule(res);
+                           class IvyClosedProjectJob extends WorkspaceJob {
+                               
+                               public IvyClosedProjectJob() {
+                                   super("IvyClosedProjectJob");
+                               }
+                                   public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
+                                       resolveAffectedProjects(javaProject.getPath());                                             
+                                       return Status.OK_STATUS;
+                                   }
+                           };
+                           IvyClosedProjectJob job = new IvyClosedProjectJob();
+                           job.setRule(modifyRule);
+                           job.schedule();
+   
+                       }
+                   }
+               }
+           } else if (event.getType() == IResourceChangeEvent.POST_CHANGE) {
+
+               if (IvyPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.AUTO_RESOLVE_ON_OPEN)) {
+
+                   /* FIXME: This is not working yet, it triggers too many events
+                   // Find out if a project was opened.
+                   IResourceDelta delta = event.getDelta();
+                   
+                   if (delta != null) {
+                       final IResourceDelta[] projDeltas = delta.getAffectedChildren(IResourceDelta.CHANGED);
+                       String deltaString = ((ResourceDelta)delta).toDeepDebugString();
+                       if (projDeltas.length > 0) {
+                           final Collection projects = new LinkedHashSet(projDeltas.length);
+                           for (int i =0; i < projDeltas.length; i++) {
+                               if ((projDeltas[i].getFlags() & IResourceDelta.OPEN) != 0) {
+                                   IResourceDelta rootDelta = projDeltas[i];
+                                   IResourceDelta[] childDeltas = rootDelta.getAffectedChildren();
+                                   if (childDeltas.length>0 && (childDeltas[0].getFlags() & IResourceDelta.ADDED) != 0)
+                                       projects.add(projDeltas[i].getResource());
+                               }
+                           }
+                           
+                           if (projects.size() > 0) {
+                               // Found an Ivy container in this project -- notify dependent projects to perform fresh resolve
+                               // Let's try to be nice and use the workspace method
+                               // to schedule resolves in dependent projects after the close operation
+                               // has finished.
+                               class IvyOpenProjectJob extends WorkspaceJob {
+                                   
+                                   public IvyOpenProjectJob() {
+                                       super("IvyOpenProjectJob");
+                                   }
+                                       public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
+                                           resolveAllProjectsExcept(projects);
+                                           return Status.OK_STATUS;
+                                       }
+                               };
+                               IvyOpenProjectJob job = new IvyOpenProjectJob();
+                               job.schedule();
+                           }
+                       }
+                   }
+                   */
+               }
+           }
+       } catch (JavaModelException jme) {
+            IvyPlugin.log(IStatus.ERROR, "Errors occurred trying to find projects affected by closure", jme);                          
+       } catch (OperationCanceledException oce) {
+           IvyPlugin.log(IStatus.CANCEL, "Ivy update of dependent proejects affected by project close operation canceled", null);                          
+       } catch (CoreException ce) {
+           IvyPlugin.log(IStatus.ERROR, "Errors occurred trying to find projects affected by closure", ce);                            
+           
+       }
+   }
+
+    /*
+     * Only resolve those projects which include the specified project path as ivy dependency
+     */
+    private void resolveAffectedProjects (IPath projectPath) {
+       
+       try {
+           IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
+           IJavaProject[] projects= JavaCore.create(root).getJavaProjects();
+                   
+           for (int i= 0; i < projects.length; i++) {
+               IJavaProject javaProject= projects[i];
+               IClasspathEntry[] entries= javaProject.getRawClasspath();
+               for (int k= 0; k < entries.length; k++) {
+                   IClasspathEntry entry= entries[k];
+                   if (entry != null && entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { 
+                       IPath path = entry.getPath();
+                       if (IvyClasspathUtil.isIvyClasspathContainer(path)) {
+                           IClasspathContainer cp = JavaCore.getClasspathContainer(path, javaProject);
+                           if (cp instanceof IvyClasspathContainer) {
+                               IvyClasspathContainer c = (IvyClasspathContainer)cp;
+                               IClasspathEntry[] containerEntries = c.getClasspathEntries();
+                               for (int j=0; j < containerEntries.length; j++) {
+                                   IClasspathEntry containerEntry = containerEntries[j];
+                                   if (containerEntry!=null && 
+                                           containerEntry.getEntryKind() == IClasspathEntry.CPE_PROJECT &&
+                                           containerEntry.getPath().equals(projectPath)) {
+                                       c.scheduleResolve();
+                                       break;
+                                   }
+                               }
+                           }
+                       }
+                   }
+               }
+           }
+       } catch (JavaModelException e) {
+           IvyPlugin.log(IStatus.ERROR, "Errors occurred trying to find dependent projects", e);                           
+       }
+    }
+    
+    private void resolveAllProjectsExcept (Collection sourceProjects) {
+        try {
+           IJavaProject[] projects = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()).getJavaProjects();
+           for (int i = 0; i < projects.length; i++) {
+               if (!sourceProjects.contains(projects[i])) {
+                   IvyClasspathUtil.getIvyClasspathContainer(projects[i]).scheduleResolve();
+               }
+           }
+       } catch (JavaModelException e) {
+           IvyPlugin.log(IStatus.ERROR, "Errors occurred trying to resolve all projects", e);                          
+       }
+    }
+
+}

Modification de propriétés sur src/java/org/apache/ivyde/eclipse/resolver/WorkspaceResourceChangeListener.java
___________________________________________________________________
Nom : svn:mime-type
   + text/plain
Nom : svn:keywords
   + Date Revision Author HeadURL Id
Nom : svn:eol-style
   + native

Index: src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
===================================================================
--- src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java	(révision 641334)
+++ src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java	(copie de travail)
@@ -408,7 +408,10 @@
             Collection paths = new LinkedHashSet();
             for (Iterator iter = all.iterator(); iter.hasNext();) {
                 ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();
-                if (artifact.getLocalFile() != null && accept(artifact.getArtifact())) {
+                if (artifact.getType().equals("project")) {
+                    // This is a java project in the workspace, add project path
+                    paths.add(JavaCore.newProjectEntry(new Path(artifact.getName()), true));
+                } else if (artifact.getLocalFile() != null && accept(artifact.getArtifact())) {
                     Path classpathArtifact = new Path(artifact.getLocalFile().getAbsolutePath());
                     Path sourcesArtifact = getSourcesArtifactPath(artifact, all);
                     Path javadocArtifact = getJavadocArtifactPath(artifact, all);
Index: src/java/org/apache/ivyde/eclipse/IvyPlugin.java
===================================================================
--- src/java/org/apache/ivyde/eclipse/IvyPlugin.java	(révision 641334)
+++ src/java/org/apache/ivyde/eclipse/IvyPlugin.java	(copie de travail)
@@ -32,6 +32,7 @@
 import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
 import org.apache.ivyde.eclipse.cpcontainer.fragmentinfo.IPackageFragmentExtraInfo;
 import org.apache.ivyde.eclipse.cpcontainer.fragmentinfo.PreferenceStoreInfo;
+import org.apache.ivyde.eclipse.resolver.WorkspaceResourceChangeListener;
 import org.apache.ivyde.eclipse.ui.console.IvyConsole;
 import org.apache.ivyde.eclipse.ui.preferences.IvyDEPreferenceStoreHelper;
 import org.apache.ivyde.eclipse.ui.preferences.PreferenceConstants;
@@ -122,6 +123,11 @@
                 }
             }
         });
+
+        // Listen for project open/close events to auto-update inter-project dependencies
+        ResourcesPlugin.getWorkspace().addResourceChangeListener(
+            new WorkspaceResourceChangeListener());
+
         log(IStatus.INFO, "IvyDE plugin started", null);
     }
 
@@ -236,7 +242,8 @@
     public ResourceBundle getResourceBundle() {
         try {
             if (resourceBundle == null)
-                resourceBundle = ResourceBundle.getBundle("org.apache.ivyde.eclipse.IvyPluginResources");
+                resourceBundle = ResourceBundle
+                        .getBundle("org.apache.ivyde.eclipse.IvyPluginResources");
         } catch (MissingResourceException x) {
             resourceBundle = new ResourceBundle() {
                 protected Object handleGetObject(String key) {
@@ -434,6 +441,6 @@
     }
 
     public BundleContext getBundleContext() {
-      return this.bundleContext;
+        return this.bundleContext;
     }
 }
Index: src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
===================================================================
--- src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java	(révision 641334)
+++ src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java	(copie de travail)
@@ -33,4 +33,8 @@
 
     public static final String ALPHABETICAL_ORDER = "order.alphabetical";
 
+    public static final String AUTO_RESOLVE_ON_OPEN = "autoResolve.open";
+
+    public static final String AUTO_RESOLVE_ON_CLOSE = "autoResolve.close";
+
 }
Index: src/java/org/apache/ivyde/eclipse/ui/preferences/WorkspaceResolverPreferencePage.java
===================================================================
--- src/java/org/apache/ivyde/eclipse/ui/preferences/WorkspaceResolverPreferencePage.java	(révision 0)
+++ src/java/org/apache/ivyde/eclipse/ui/preferences/WorkspaceResolverPreferencePage.java	(révision 0)
@@ -0,0 +1,96 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.ui.preferences;
+
+import org.apache.ivyde.eclipse.IvyPlugin;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * This class represents a preference page that is contributed to the Preferences dialog. By
+ * subclassing <samp>FieldEditorPreferencePage</samp>, we can use the field support built into
+ * JFace that allows us to create a page that is small and knows how to save, restore and apply
+ * itself.
+ * <p>
+ * This page is used to modify preferences only. They are stored in the preference store that
+ * belongs to the main plug-in class. That way, preferences can be accessed directly via the
+ * preference store.
+ */
+
+public class WorkspaceResolverPreferencePage extends FieldEditorPreferencePage implements
+        IWorkbenchPreferencePage {
+
+    public WorkspaceResolverPreferencePage() {
+        super(GRID);
+        setPreferenceStore(IvyPlugin.getDefault().getPreferenceStore());
+        setDescription("");
+    }
+
+    /**
+     * Creates the field editors. Field editors are abstractions of the common GUI blocks needed to
+     * manipulate various types of preferences. Each field editor knows how to save and restore
+     * itself.
+     */
+    public void createFieldEditors() {
+        final Composite fieldParent = getFieldEditorParent();
+
+        Label spacer = new Label(fieldParent, SWT.NONE);
+        GridData spacerData = new GridData();
+        spacerData.horizontalSpan = 3;
+        spacer.setLayoutData(spacerData);
+        spacer.setText("Workspace Resolver");
+        spacer = new Label(fieldParent, SWT.SEPARATOR | SWT.HORIZONTAL);
+        spacer.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));
+
+        BooleanFieldEditor aro = new BooleanFieldEditor(PreferenceConstants.AUTO_RESOLVE_ON_OPEN,
+                "Auto resolve on project open", fieldParent);
+        aro.setEnabled(false, fieldParent); // TODO: enable when it works
+        addField(aro);
+
+        new Label(fieldParent, SWT.NONE); // space
+        Label explanation = new Label(fieldParent, SWT.NONE);
+        explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2,
+                1));
+        explanation
+                .setText("Will automatically resolve projects in the workspace and link open project where necessary");
+        new Label(fieldParent, SWT.NONE).setLayoutData(new GridData(GridData.FILL,
+                GridData.BEGINNING, false, false, 3, 1)); // space
+
+        addField(new BooleanFieldEditor(PreferenceConstants.AUTO_RESOLVE_ON_CLOSE,
+                "Auto resolve on project close", fieldParent));
+
+        explanation = new Label(fieldParent, SWT.NONE);
+        explanation.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2,
+                1));
+        explanation
+                .setText("Will automatically resolve projects in the workspace after dependent project is closed");
+        new Label(fieldParent, SWT.NONE).setLayoutData(new GridData(GridData.FILL,
+                GridData.BEGINNING, false, false, 3, 1)); // space
+
+    }
+
+    public void init(IWorkbench workbench) {
+    }
+
+}

Modification de propriétés sur src/java/org/apache/ivyde/eclipse/ui/preferences/WorkspaceResolverPreferencePage.java
___________________________________________________________________
Nom : svn:mime-type
   + text/plain
Nom : svn:keywords
   + Date Revision Author HeadURL Id
Nom : svn:eol-style
   + native

Index: plugin.xml
===================================================================
--- plugin.xml	(révision 641334)
+++ plugin.xml	(copie de travail)
@@ -105,6 +105,12 @@
             class="org.apache.ivyde.eclipse.ui.preferences.IvyPreferencePage"
             id="org.apache.ivyde.eclipse.ui.preferences.IvyPreferencePage">
       </page>
+      <page
+            name="Workspace Resolver"
+            class="org.apache.ivyde.eclipse.ui.preferences.WorkspaceResolverPreferencePage"
+            id="org.apache.ivyde.eclipse.ui.preferences.WorkspaceResolverPreferencePage"
+            category="org.apache.ivyde.eclipse.ui.preferences.IvyPreferencePage">
+      </page>
    </extension>
    <extension
          point="org.eclipse.core.runtime.preferences">
