ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r768290 - in /ant/ivy/ivyde/trunk: org.apache.ivyde.eclipse/ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ org.apache.ivyde.eclipse/src/java/org/apache/iv...
Date Fri, 24 Apr 2009 12:52:18 GMT
Author: hibou
Date: Fri Apr 24 12:52:17 2009
New Revision: 768290

URL: http://svn.apache.org/viewvc?rev=768290&view=rev
Log:
IVYDE-175: change IvyClasspathUtil so it doesn't assume that there only one ivy container
in a java project

Added:
    ant/ivy/ivyde/trunk/test/multiple-containers/   (with props)
    ant/ivy/ivyde/trunk/test/multiple-containers/.classpath
    ant/ivy/ivyde/trunk/test/multiple-containers/.project
    ant/ivy/ivyde/trunk/test/multiple-containers/ivy.xml   (with props)
    ant/ivy/ivyde/trunk/test/multiple-containers/ivysettings.xml   (with props)
    ant/ivy/ivyde/trunk/test/multiple-containers/src/
Modified:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAllAction.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyModuleDescriptorEditor.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvySettingsEditor.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/EclipseIvyModelSettings.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResourceChangeListener.java

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt?rev=768290&r1=768289&r2=768290&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt Fri Apr 24 12:52:17 2009
@@ -30,6 +30,7 @@
 - FIX: Branch in repository pattern and defaultBranch (IVYDE-168)
 - FIX: The resolve in workspace is being evicted by transitive dependencies (IVYDE-169)
 - FIX: Error messages when setting path to ivy settings file covers what is being typed in
(IVYDE-172)
+- FIX: ResolveAllAction does not resolve multiple IvyDE containers in a single project (IVYDE-175)
 
   version 2.0.0 beta1
 ==========================

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java?rev=768290&r1=768289&r2=768290&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
Fri Apr 24 12:52:17 2009
@@ -19,6 +19,8 @@
 
 import java.util.Collections;
 import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
@@ -147,9 +149,14 @@
     void prefStoreChanged() throws JavaModelException {
         IJavaProject[] projects = plugin.javaModel.getJavaProjects();
         for (int i = 0; i < projects.length; i++) {
-            IvyClasspathContainer cp = IvyClasspathUtil.getIvyClasspathContainer(projects[i]);
-            if (cp != null && !cp.getConf().isSettingsProjectSpecific()) {
-                cp.launchResolve(false, false, null);
+            List/* <IvyClasspathContainer> */containers = IvyClasspathUtil
+                    .getIvyClasspathContainers(projects[i]);
+            Iterator/* <IvyClasspathContainer> */itContainers = containers.iterator();
+            while (itContainers.hasNext()) {
+                IvyClasspathContainer ivycp = (IvyClasspathContainer) itContainers.next();
+                if (!ivycp.getConf().isSettingsProjectSpecific()) {
+                    ivycp.launchResolve(false, false, null);
+                }
             }
         }
     }

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java?rev=768290&r1=768289&r2=768290&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java
Fri Apr 24 12:52:17 2009
@@ -105,8 +105,9 @@
         return true;
     }
 
-    public void requestClasspathContainerUpdate(IPath containerPath, final IJavaProject project,
-            IClasspathContainer containerSuggestion) throws CoreException {
+    public void requestClasspathContainerUpdate(final IPath containerPath,
+            final IJavaProject project, IClasspathContainer containerSuggestion)
+            throws CoreException {
         if (IvyClasspathUtil.isIvyClasspathContainer(containerPath)) {
             IClasspathEntry[] ice = containerSuggestion.getClasspathEntries();
             IPackageFragmentExtraInfo ei = IvyPlugin.getDefault().getPackageFragmentExtraInfo();
@@ -122,10 +123,15 @@
             // force refresh of ivy classpath entry in ui thread
             Display.getDefault().asyncExec(new Runnable() {
                 public void run() {
-                    IvyClasspathContainer ivycp = IvyClasspathUtil
-                            .getIvyClasspathContainer(project);
-                    if (ivycp != null) {
-                        ivycp.launchResolve(false, true, null);
+                    IClasspathContainer cp;
+                    try {
+                        cp = JavaCore.getClasspathContainer(containerPath, project);
+                    } catch (JavaModelException e) {
+                        IvyPlugin.log(e);
+                        return;
+                    }
+                    if (cp instanceof IvyClasspathContainer) {
+                        ((IvyClasspathContainer) cp).launchResolve(false, true, null);
                     }
                 }
             });

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java?rev=768290&r1=768289&r2=768290&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java
Fri Apr 24 12:52:17 2009
@@ -26,6 +26,7 @@
 import java.util.List;
 
 import org.apache.ivyde.eclipse.IvyPlugin;
+import org.eclipse.core.resources.IFile;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
@@ -35,7 +36,6 @@
 import org.eclipse.jdt.core.IJavaProject;
 import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.corext.javadoc.JavaDocLocations;
 import org.eclipse.jdt.internal.ui.packageview.ClassPathContainer;
 import org.eclipse.jface.viewers.IStructuredSelection;
 
@@ -95,10 +95,6 @@
             if (cp != null) {
                 return cp;
             }
-            IJavaProject project = (IJavaProject) IvyPlugin.adapt(element, IJavaProject.class);
-            if (project != null) {
-                return getIvyClasspathContainer(project);
-            }
             if (element instanceof ClassPathContainer) {
                 // FIXME: we shouldn't check against internal JDT API but there are not adaptable
to
                 // useful class
@@ -135,13 +131,14 @@
     }
 
     /**
-     * Search the Ivy classpath container within the specified Java project
+     * Search the Ivy classpath containers within the specified Java project
      * 
      * @param javaProject
      *            the project to search into
-     * @return the Ivy classpath container if found, otherwise return <code>null</code>
+     * @return the Ivy classpath container if found
      */
-    public static IvyClasspathContainer getIvyClasspathContainer(IJavaProject javaProject)
{
+    public static List/*<IvyClasspathContainer>*/ getIvyClasspathContainers(IJavaProject
javaProject) {
+        List/*<IvyClasspathContainer>*/ containers = new ArrayList();
         try {
             IClasspathEntry[] entries = javaProject.getRawClasspath();
             for (int i = 0; i < entries.length; i++) {
@@ -151,7 +148,7 @@
                     if (isIvyClasspathContainer(path)) {
                         IClasspathContainer cp = JavaCore.getClasspathContainer(path, javaProject);
                         if (cp instanceof IvyClasspathContainer) {
-                            return (IvyClasspathContainer) cp;
+                            containers.add(cp);
                         }
                     }
                 }
@@ -160,7 +157,62 @@
             // unless there are issues with the JDT, this should never happen
             IvyPlugin.log(e);
         }
-        return null;
+        return containers;
+    }
+
+    public static List/*<IvyClasspathContainer>*/ getIvyFileClasspathContainers(IFile
ivyfile) {
+        IJavaProject javaProject = JavaCore.create(ivyfile.getProject());
+        List/*<IvyClasspathContainer>*/ containers = new ArrayList();
+        try {
+            IClasspathEntry[] entries = javaProject.getRawClasspath();
+            for (int i = 0; i < entries.length; i++) {
+                IClasspathEntry entry = entries[i];
+                if (entry != null && entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER)
{
+                    IPath path = entry.getPath();
+                    if (isIvyClasspathContainer(path)) {
+                        IClasspathContainer cp = JavaCore.getClasspathContainer(path, javaProject);
+                        if (cp instanceof IvyClasspathContainer) {
+                            IvyClasspathContainer ivycp = (IvyClasspathContainer) cp;
+                            if (ivycp.getConf().getIvyXmlPath().equals(ivyfile.getProjectRelativePath().toString()))
{
+                                containers.add(ivycp);
+                            }
+                        }
+                    }
+                }
+            }
+        } catch (JavaModelException e) {
+            // unless there are issues with the JDT, this should never happen
+            IvyPlugin.log(e);
+        }
+        return containers;
+    }
+
+    public static List/*<IvyClasspathContainer>*/ getIvySettingsClasspathContainers(IFile
ivySettings) {
+        IJavaProject javaProject = JavaCore.create(ivySettings.getProject());
+        List/*<IvyClasspathContainer>*/ containers = new ArrayList();
+        try {
+            IClasspathEntry[] entries = javaProject.getRawClasspath();
+            for (int i = 0; i < entries.length; i++) {
+                IClasspathEntry entry = entries[i];
+                if (entry != null && entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER)
{
+                    IPath path = entry.getPath();
+                    if (isIvyClasspathContainer(path)) {
+                        IClasspathContainer cp = JavaCore.getClasspathContainer(path, javaProject);
+                        if (cp instanceof IvyClasspathContainer) {
+                            IvyClasspathContainer ivycp = (IvyClasspathContainer) cp;
+                            if (ivycp.getConf().getInheritedIvySettingsPath().equals(
+                                ivySettings.getProjectRelativePath().toString())) {
+                                containers.add(ivycp);
+                            }
+                        }
+                    }
+                }
+            }
+        } catch (JavaModelException e) {
+            // unless there are issues with the JDT, this should never happen
+            IvyPlugin.log(e);
+        }
+        return containers;
     }
 
     public static List split(String str) {
@@ -192,7 +244,7 @@
 
     /**
      * Just a verbatim copy of the internal Eclipse function:
-     * {@link JavaDocLocations#getLibraryJavadocLocation(IClasspathEntry)}
+     * org.eclipse.jdt.internal.corext.javadoc.JavaDocLocations#getLibraryJavadocLocation(IClasspathEntry)
      * 
      * @param entry
      * @return

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAllAction.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAllAction.java?rev=768290&r1=768289&r2=768290&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAllAction.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAllAction.java
Fri Apr 24 12:52:17 2009
@@ -65,11 +65,7 @@
                 }
                 List containers = new ArrayList();
                 for (int i = 0; i < projects.length; i++) {
-                    IvyClasspathContainer cp = IvyClasspathUtil
-                            .getIvyClasspathContainer(projects[i]);
-                    if (cp != null) {
-                        containers.add(cp);
-                    }
+                    containers.addAll(IvyClasspathUtil.getIvyClasspathContainers(projects[i]));
                 }
                 monitor.beginTask("Resolve all dependencies", containers.size());
                 for (Iterator iter = containers.iterator(); iter.hasNext();) {

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyModuleDescriptorEditor.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyModuleDescriptorEditor.java?rev=768290&r1=768289&r2=768290&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyModuleDescriptorEditor.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyModuleDescriptorEditor.java
Fri Apr 24 12:52:17 2009
@@ -17,6 +17,9 @@
  */
 package org.apache.ivyde.eclipse.ui.editors;
 
+import java.util.Iterator;
+import java.util.List;
+
 import org.apache.ivyde.common.ivyfile.IvyModuleDescriptorModel;
 import org.apache.ivyde.common.model.IvyModel;
 import org.apache.ivyde.eclipse.IvyPlugin;
@@ -35,8 +38,6 @@
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jface.dialogs.ErrorDialog;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.SWT;
@@ -92,7 +93,7 @@
             xmlEditor = new XMLEditor(new IvyContentAssistProcessor() {
                 protected IvyModel newCompletionModel(IFile file) {
                     return new IvyModuleDescriptorModel(new EclipseIvyModelSettings(
-                            getJavaProject()));
+                            file));
                 }
             }) {
                 public void doSave(IProgressMonitor progressMonitor) {
@@ -163,11 +164,12 @@
 
     private void triggerResolve() {
         IFile file = ((IvyFileEditorInput) getEditorInput()).getFile();
-        IJavaProject project = JavaCore.create(file.getProject());
-        IvyClasspathContainer cp = IvyClasspathUtil.getIvyClasspathContainer(project);
-        if (cp != null
-                && cp.getConf().getIvyXmlPath().equals(file.getProjectRelativePath().toString()))
{
-            cp.launchResolve(false, true, null);
+        List/* <IvyClasspathContainer> */containers = IvyClasspathUtil
+                .getIvyFileClasspathContainers(file);
+        Iterator/* <IvyClasspathContainer> */itContainers = containers.iterator();
+        while (itContainers.hasNext()) {
+            IvyClasspathContainer ivycp = (IvyClasspathContainer) itContainers.next();
+            ivycp.launchResolve(false, true, null);
         }
     }
 

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvySettingsEditor.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvySettingsEditor.java?rev=768290&r1=768289&r2=768290&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvySettingsEditor.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvySettingsEditor.java
Fri Apr 24 12:52:17 2009
@@ -17,6 +17,9 @@
  */
 package org.apache.ivyde.eclipse.ui.editors;
 
+import java.util.Iterator;
+import java.util.List;
+
 import org.apache.ivyde.common.ivysettings.IvySettingsModel;
 import org.apache.ivyde.common.model.IvyModel;
 import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
@@ -32,8 +35,6 @@
 import org.eclipse.core.resources.IResourceChangeListener;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jface.dialogs.ErrorDialog;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.IEditorInput;
@@ -120,12 +121,12 @@
     public void doSave(IProgressMonitor monitor) {
         xmlEditor.doSave(monitor);
         IFile file = ((IvyFileEditorInput) getEditorInput()).getFile();
-        IJavaProject project = JavaCore.create(file.getProject());
-        IvyClasspathContainer cp = IvyClasspathUtil.getIvyClasspathContainer(project);
-        if (cp != null
-                && cp.getConf().getInheritedIvySettingsPath().equals(
-                    file.getProjectRelativePath().toString())) {
-            cp.launchResolve(false, true, null);
+        List/* <IvyClasspathContainer> */containers = IvyClasspathUtil
+                .getIvySettingsClasspathContainers(file);
+        Iterator/* <IvyClasspathContainer> */itContainers = containers.iterator();
+        while (itContainers.hasNext()) {
+            IvyClasspathContainer ivycp = (IvyClasspathContainer) itContainers.next();
+            ivycp.launchResolve(false, true, null);
         }
     }
 

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/EclipseIvyModelSettings.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/EclipseIvyModelSettings.java?rev=768290&r1=768289&r2=768290&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/EclipseIvyModelSettings.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/EclipseIvyModelSettings.java
Fri Apr 24 12:52:17 2009
@@ -17,6 +17,8 @@
  */
 package org.apache.ivyde.eclipse.ui.editors.xml;
 
+import java.util.List;
+
 import org.apache.ivy.Ivy;
 import org.apache.ivyde.common.model.IvyModelSettings;
 import org.apache.ivyde.eclipse.IvyDEException;
@@ -24,36 +26,46 @@
 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.IFile;
 import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
 import org.eclipse.jdt.core.IJavaProject;
 
 public class EclipseIvyModelSettings implements IvyModelSettings {
-    
-    private IJavaProject javaProject;
-    private IvyClasspathContainer cp;
-    
+
+    private final IvyClasspathContainer ivycp;
+
     public EclipseIvyModelSettings(IJavaProject javaProject) {
-        this.javaProject = javaProject;
-        cp = IvyClasspathUtil.getIvyClasspathContainer(javaProject);
+        this(IvyClasspathUtil.getIvyClasspathContainers(javaProject));
+    }
+
+    public EclipseIvyModelSettings(IFile ivyfile) {
+        this(IvyClasspathUtil.getIvyFileClasspathContainers(ivyfile));
+    }
+
+    private EclipseIvyModelSettings(List/* <IvyClasspathContainer> */containers) {
+        this(containers.isEmpty() ? null : (IvyClasspathContainer) containers.iterator().next());
+    }
+
+    private EclipseIvyModelSettings(IvyClasspathContainer ivycp) {
+        this.ivycp = ivycp;
     }
 
     public String getDefaultOrganization() {
-        return IvyPlugin.getDefault().getPreferenceStore()
-                        .getString(PreferenceConstants.ORGANISATION);
+        return IvyPlugin.getDefault().getPreferenceStore().getString(
+            PreferenceConstants.ORGANISATION);
     }
 
     public String getDefaultOrganizationURL() {
-        return IvyPlugin.getDefault().getPreferenceStore()
-            .getString(PreferenceConstants.ORGANISATION_URL);
+        return IvyPlugin.getDefault().getPreferenceStore().getString(
+            PreferenceConstants.ORGANISATION_URL);
     }
 
     public Ivy getIvyInstance() {
-        if (cp == null) {
+        if (ivycp == null) {
             return null;
         }
         try {
-            return cp.getConf().getIvy();
+            return ivycp.getConf().getIvy();
         } catch (IvyDEException e) {
             e.log(IStatus.WARNING, null);
             return null;
@@ -61,7 +73,7 @@
     }
 
     public void logError(String message, Exception e) {
-        IvyPlugin.log(Status.ERROR, message, e);
+        IvyPlugin.log(IStatus.ERROR, message, e);
     }
 
 }

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java?rev=768290&r1=768289&r2=768290&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java
Fri Apr 24 12:52:17 2009
@@ -21,6 +21,7 @@
 import java.io.IOException;
 import java.text.ParseException;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
@@ -157,8 +158,11 @@
             if (!javaProject.exists()) {
                 continue;
             }
-            IvyClasspathContainer ivycp = IvyClasspathUtil.getIvyClasspathContainer(javaProject);
-            if (ivycp != null) {
+            List/* <IvyClasspathContainer> */containers = IvyClasspathUtil
+                    .getIvyClasspathContainers(javaProject);
+            Iterator/* <IvyClasspathContainer> */itContainer = containers.iterator();
+            while (itContainer.hasNext()) {
+                IvyClasspathContainer ivycp = (IvyClasspathContainer) itContainer.next();
                 ModuleDescriptor md;
                 try {
                     md = ivycp.getConf().getCachedModuleDescriptor();

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResourceChangeListener.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResourceChangeListener.java?rev=768290&r1=768289&r2=768290&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResourceChangeListener.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResourceChangeListener.java
Fri Apr 24 12:52:17 2009
@@ -18,7 +18,9 @@
 package org.apache.ivyde.eclipse.workspaceresolver;
 
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.LinkedHashSet;
+import java.util.List;
 
 import org.apache.ivyde.eclipse.IvyPlugin;
 import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
@@ -96,8 +98,8 @@
 
     private void projectClosed(final IJavaProject javaProject) throws JavaModelException
{
         // Check if one of Ivy projects is being removed
-        IvyClasspathContainer ivycp = IvyClasspathUtil.getIvyClasspathContainer(javaProject);
-        if (ivycp == null) {
+        List containers = IvyClasspathUtil.getIvyClasspathContainers(javaProject);
+        if (containers.isEmpty()) {
             return;
         }
 
@@ -146,11 +148,16 @@
                 continue;
             }
             IJavaProject javaProject = JavaCore.create((IProject) resource);
-            IvyClasspathContainer ivycp = IvyClasspathUtil.getIvyClasspathContainer(javaProject);
-            if (ivycp == null || !ivycp.getConf().isInheritedResolveInWorkspace()) {
-                continue;
+            List/* <IvyClasspathContainer> */containers = IvyClasspathUtil
+                    .getIvyClasspathContainers(javaProject);
+            Iterator/* <IvyClasspathContainer> */itContainer = containers.iterator();
+            while (itContainer.hasNext()) {
+                IvyClasspathContainer ivycp = (IvyClasspathContainer) itContainer.next();
+                if (!ivycp.getConf().isInheritedResolveInWorkspace()) {
+                    continue;
+                }
+                projects.add(resource);
             }
-            projects.add(resource);
         }
 
         if (projects.size() == 0) {
@@ -189,28 +196,30 @@
 
         for (int i = 0; i < projects.length; i++) {
             IJavaProject javaProject = projects[i];
-            IvyClasspathContainer c = IvyClasspathUtil.getIvyClasspathContainer(javaProject);
-            if (c == null) {
-                continue;
-            }
-            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)) {
-                    continue;
-                }
+            List/* <IvyClasspathContainer> */containers = IvyClasspathUtil
+                    .getIvyClasspathContainers(javaProject);
+            Iterator/* <IvyClasspathContainer> */itContainer = containers.iterator();
+            while (itContainer.hasNext()) {
+                IvyClasspathContainer ivycp = (IvyClasspathContainer) itContainer.next();
+                IClasspathEntry[] containerEntries = ivycp.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)) {
+                        continue;
+                    }
 
-                SubProgressMonitor subMonitor = null;
-                if (monitor != null) {
-                    if (monitor.isCanceled()) {
-                        return;
+                    SubProgressMonitor subMonitor = null;
+                    if (monitor != null) {
+                        if (monitor.isCanceled()) {
+                            return;
+                        }
+                        subMonitor = new SubProgressMonitor(monitor, 1);
                     }
-                    subMonitor = new SubProgressMonitor(monitor, 1);
+                    ivycp.launchResolve(false, isUser, subMonitor);
+                    break;
                 }
-                c.launchResolve(false, isUser, subMonitor);
-                break;
             }
         }
     }
@@ -230,8 +239,13 @@
                 }
                 subMonitor = new SubProgressMonitor(monitor, 1);
             }
-            IvyClasspathContainer ivycp = IvyClasspathUtil.getIvyClasspathContainer(projects[i]);
-            ivycp.launchResolve(false, isUser, subMonitor);
+            List/* <IvyClasspathContainer> */containers = IvyClasspathUtil
+                    .getIvyClasspathContainers(projects[i]);
+            Iterator/* <IvyClasspathContainer> */itContainer = containers.iterator();
+            while (itContainer.hasNext()) {
+                IvyClasspathContainer ivycp = (IvyClasspathContainer) itContainer.next();
+                ivycp.launchResolve(false, isUser, subMonitor);
+            }
         }
     }
 

Propchange: ant/ivy/ivyde/trunk/test/multiple-containers/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 24 12:52:17 2009
@@ -0,0 +1,2 @@
+bin
+

Added: ant/ivy/ivyde/trunk/test/multiple-containers/.classpath
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/multiple-containers/.classpath?rev=768290&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/multiple-containers/.classpath (added)
+++ ant/ivy/ivyde/trunk/test/multiple-containers/.classpath Fri Apr 24 12:52:17 2009
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?ivyXmlPath=ivy.xml&amp;confs=default&amp;ivySettingsPath=project%3A%2F%2F%2Fivysettings.xml&amp;loadSettingsOnDemand=false&amp;propertyFiles=&amp;doRetrieve=false&amp;retrievePattern=lib%2F%5Bconf%5D%2F%5Bartifact%5D.%5Bext%5D&amp;retrieveSync=false&amp;retrieveConfs=*&amp;retrieveTypes=*&amp;acceptedTypes=jar&amp;sourceTypes=source&amp;javadocTypes=javadoc&amp;sourceSuffixes=-source%2C-sources%2C-src&amp;javadocSuffixes=-javadoc%2C-javadocs%2C-doc%2C-docs&amp;alphaOrder=false&amp;resolveInWorkspace=false"/>
+	<classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?ivyXmlPath=ivy.xml&amp;confs=other&amp;ivySettingsPath=project%3A%2F%2F%2Fivysettings.xml&amp;loadSettingsOnDemand=false&amp;propertyFiles="/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: ant/ivy/ivyde/trunk/test/multiple-containers/.project
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/multiple-containers/.project?rev=768290&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/multiple-containers/.project (added)
+++ ant/ivy/ivyde/trunk/test/multiple-containers/.project Fri Apr 24 12:52:17 2009
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>ivydetest-multiple-containers</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: ant/ivy/ivyde/trunk/test/multiple-containers/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/multiple-containers/ivy.xml?rev=768290&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/multiple-containers/ivy.xml (added)
+++ ant/ivy/ivyde/trunk/test/multiple-containers/ivy.xml Fri Apr 24 12:52:17 2009
@@ -0,0 +1,33 @@
+<!--
+   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.    
+-->
+<ivy-module version="1.0">
+    <info organisation="org.apache.ivyde" module="ivytest-multiple-containers">
+        <description>
+            Project having mutilple containers configured
+        </description>
+    </info>
+    <configurations>
+        <conf name="default" />
+        <conf name="other" />
+    </configurations>
+    <dependencies>
+        <dependency org="myorg" name="mymodule" rev="1.1" conf="default" />
+        <dependency org="myorg" name="helloworld" rev="1.1" conf="other->default" />
+    </dependencies>
+</ivy-module>

Propchange: ant/ivy/ivyde/trunk/test/multiple-containers/ivy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/test/multiple-containers/ivy.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/test/multiple-containers/ivy.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ant/ivy/ivyde/trunk/test/multiple-containers/ivysettings.xml
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/multiple-containers/ivysettings.xml?rev=768290&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/multiple-containers/ivysettings.xml (added)
+++ ant/ivy/ivyde/trunk/test/multiple-containers/ivysettings.xml Fri Apr 24 12:52:17 2009
@@ -0,0 +1,10 @@
+<ivysettings>
+    <caches defaultCacheDir="${ivy.settings.dir}/../cache-fakerepo" useOrigin="false"
/>
+    <settings defaultResolver="fakerepo" checkUpToDate="false" />
+    <resolvers>
+        <filesystem name="fakerepo">
+            <ivy pattern="${ivy.settings.dir}/../fakerepo/[organisation]/[module]/ivy-[revision].xml"/>
+            <artifact pattern="${ivy.settings.dir}/../fakerepo/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
+        </filesystem>
+    </resolvers>
+</ivysettings>

Propchange: ant/ivy/ivyde/trunk/test/multiple-containers/ivysettings.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/test/multiple-containers/ivysettings.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/test/multiple-containers/ivysettings.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message