// Path: me.gladwell.eclipse.m2e.android/src/main/java/me/gladwell/eclipse/m2e/android/configuration/Classpaths.java
// public static IClasspathEntryDescriptor findSourceEntryDescriptor(IClasspathDescriptor classpath, String path) {
//     for (IClasspathEntryDescriptor entry : classpath.getEntryDescriptors()) {
//         if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE && entry.getPath().toString().endsWith(path)) {
//             return entry;
//         }
//     }
//     return null;
// }
// 
// Path: me.gladwell.eclipse.m2e.android/src/main/java/me/gladwell/eclipse/m2e/android/configuration/Classpaths.java
// public static IClasspathEntryDescriptor findContainerContaining(final IClasspathDescriptor classpath, final String fragment) {
//     return matchContainer(classpath, new Predicate<IClasspathEntryDescriptor>() {
//         public boolean apply(IClasspathEntryDescriptor entry) {
//             return entry.getPath().toOSString().contains(fragment);
//         }
//     });
// }
// 
// Path: me.gladwell.eclipse.m2e.android/src/main/java/me/gladwell/eclipse/m2e/android/configuration/Classpaths.java
// public static IClasspathEntryDescriptor findContainerMatching(final IClasspathDescriptor classpath, final String path) {
//     return matchContainer(classpath, new Predicate<IClasspathEntryDescriptor>() {
//         public boolean apply(IClasspathEntryDescriptor entry) {
//             return entry.getPath().toOSString().equals(path);
//         }
//     });
// }
// 
// Path: me.gladwell.eclipse.m2e.android/src/main/java/me/gladwell/eclipse/m2e/android/configuration/ProjectConfigurationException.java
// public class ProjectConfigurationException extends AndroidMavenException {
// 
//     private static final long serialVersionUID = -4510508504367403748L;
// 
//     public ProjectConfigurationException(String message) {
//         super(message);
//     }
// 
//     public ProjectConfigurationException(Throwable cause) {
//         super(cause);
//     }
// 
//     public ProjectConfigurationException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
// }


import static me.gladwell.eclipse.m2e.android.configuration.Classpaths.findSourceEntryDescriptor;
import static me.gladwell.eclipse.m2e.android.configuration.Classpaths.findContainerContaining;
import static me.gladwell.eclipse.m2e.android.configuration.Classpaths.findContainerMatching;
import static org.eclipse.jdt.core.JavaCore.newContainerEntry;
import static org.eclipse.jdt.core.JavaCore.setClasspathContainer;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import me.gladwell.eclipse.m2e.android.configuration.ProjectConfigurationException;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.m2e.jdt.IClasspathDescriptor;
import org.eclipse.m2e.jdt.IClasspathEntryDescriptor;
        for(IClasspathEntryDescriptor entry : classpath.getEntryDescriptors()) {
            if(entry.getOutputLocation() != null && entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
                entries.add(new EclipseSourceEntry(project.getProject(), entry));
            }
        }
        return entries;
    }

    public void addContainer(IClasspathContainer container) {
        try {
            setClasspathContainer(container.getPath(),
                    new IJavaProject[] { project }, new IClasspathContainer[] { container },
                    new NullProgressMonitor());
            classpath.addEntry(newContainerEntry(container.getPath(), false));
        } catch (JavaModelException e) {
            throw new ProjectConfigurationException(e);
        }
    }

    public void removeContainer(String containerId) {
        IClasspathEntryDescriptor entry = findContainerContaining(classpath, containerId);
        classpath.removeEntry(entry.getPath());
    }

    public void addSourceEntry(String path) {
        IFolder folder = project.getProject().getFolder(path + File.separator);
        if (!folder.exists()) {
            try {
                folder.create(true, true, new NullProgressMonitor());
            } catch (CoreException e) {
// Path: me.gladwell.eclipse.m2e.android/src/main/java/me/gladwell/eclipse/m2e/android/configuration/Classpaths.java
// public static IClasspathEntryDescriptor findSourceEntryDescriptor(IClasspathDescriptor classpath, String path) {
//     for (IClasspathEntryDescriptor entry : classpath.getEntryDescriptors()) {
//         if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE && entry.getPath().toString().endsWith(path)) {
//             return entry;
//         }
//     }
//     return null;
// }
// 
// Path: me.gladwell.eclipse.m2e.android/src/main/java/me/gladwell/eclipse/m2e/android/configuration/Classpaths.java
// public static IClasspathEntryDescriptor findContainerContaining(final IClasspathDescriptor classpath, final String fragment) {
//     return matchContainer(classpath, new Predicate<IClasspathEntryDescriptor>() {
//         public boolean apply(IClasspathEntryDescriptor entry) {
//             return entry.getPath().toOSString().contains(fragment);
//         }
//     });
// }
// 
// Path: me.gladwell.eclipse.m2e.android/src/main/java/me/gladwell/eclipse/m2e/android/configuration/Classpaths.java
// public static IClasspathEntryDescriptor findContainerMatching(final IClasspathDescriptor classpath, final String path) {
//     return matchContainer(classpath, new Predicate<IClasspathEntryDescriptor>() {
//         public boolean apply(IClasspathEntryDescriptor entry) {
//             return entry.getPath().toOSString().equals(path);
//         }
//     });
// }
// 
// Path: me.gladwell.eclipse.m2e.android/src/main/java/me/gladwell/eclipse/m2e/android/configuration/ProjectConfigurationException.java
// public class ProjectConfigurationException extends AndroidMavenException {
// 
//     private static final long serialVersionUID = -4510508504367403748L;
// 
//     public ProjectConfigurationException(String message) {
//         super(message);
//     }
// 
//     public ProjectConfigurationException(Throwable cause) {
//         super(cause);
//     }
// 
//     public ProjectConfigurationException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
// }


// Path: me.gladwell.eclipse.m2e.android/src/main/java/me/gladwell/eclipse/m2e/android/project/EclipseClasspath.java
import static me.gladwell.eclipse.m2e.android.configuration.Classpaths.findSourceEntryDescriptor;
import static me.gladwell.eclipse.m2e.android.configuration.Classpaths.findContainerContaining;
import static me.gladwell.eclipse.m2e.android.configuration.Classpaths.findContainerMatching;
import static org.eclipse.jdt.core.JavaCore.newContainerEntry;
import static org.eclipse.jdt.core.JavaCore.setClasspathContainer;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import me.gladwell.eclipse.m2e.android.configuration.ProjectConfigurationException;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.m2e.jdt.IClasspathDescriptor;
import org.eclipse.m2e.jdt.IClasspathEntryDescriptor;

        for(IClasspathEntryDescriptor entry : classpath.getEntryDescriptors()) {
            if(entry.getOutputLocation() != null && entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
                entries.add(new EclipseSourceEntry(project.getProject(), entry));
            }
        }
        return entries;
    }

    public void addContainer(IClasspathContainer container) {
        try {
            setClasspathContainer(container.getPath(),
                    new IJavaProject[] { project }, new IClasspathContainer[] { container },
                    new NullProgressMonitor());
            classpath.addEntry(newContainerEntry(container.getPath(), false));
        } catch (JavaModelException e) {
            throw new ProjectConfigurationException(e);
        }
    }

    public void removeContainer(String containerId) {
        IClasspathEntryDescriptor entry = findContainerContaining(classpath, containerId);
        classpath.removeEntry(entry.getPath());
    }

    public void addSourceEntry(String path) {
        IFolder folder = project.getProject().getFolder(path + File.separator);
        if (!folder.exists()) {
            try {
                folder.create(true, true, new NullProgressMonitor());
            } catch (CoreException e) {
                throw new ProjectConfigurationException(e);