Example usage for org.eclipse.jdt.core IClasspathEntry getPath

List of usage examples for org.eclipse.jdt.core IClasspathEntry getPath

Introduction

In this page you can find the example usage for org.eclipse.jdt.core IClasspathEntry getPath.

Prototype

IPath getPath();

Source Link

Document

Returns the path of this classpath entry.

Usage

From source file:com.amazonaws.eclipse.sdk.ui.classpath.AwsSdkClasspathUtils.java

License:Open Source License

/**
 * Modifies the classpath of the specified Java project to contain the classpath container
 * for the AWS SDK for Java./*from ww  w.  j  a v a2 s  .  c o m*/
 * 
 * @param javaProject The Java project to modify.
 * @param sdkInstall The AWS SDK for Java installation to add.
 */
public static void addAwsSdkToProjectClasspath(IJavaProject javaProject, SdkInstall sdkInstall) {
    try {
        AwsClasspathContainer classpathContainer = new AwsClasspathContainer(sdkInstall);

        IClasspathEntry[] rawClasspath = javaProject.getRawClasspath();
        List<IClasspathEntry> newList = new ArrayList<IClasspathEntry>();
        for (IClasspathEntry entry : rawClasspath) {
            if (entry.getPath().equals(classpathContainer.getPath()) == false) {
                newList.add(entry);
            }
        }

        newList.add(JavaCore.newContainerEntry(classpathContainer.getPath()));

        javaProject.setRawClasspath(newList.toArray(new IClasspathEntry[newList.size()]), null);
    } catch (JavaModelException e) {
        e.printStackTrace();
    }
}

From source file:com.amazonaws.eclipse.sdk.ui.classpath.AwsSdkClasspathUtils.java

License:Open Source License

/**
 * Modifies the classpath of the specified Java project to remove the classpath container
 * for the AWS SDK for Java./*from  w  w w  .  ja v  a  2 s.  co m*/
 * 
 * If the specified SDK installation is not already present on the project's classpath,
 * nothing is done, and no error is returned.
 * 
 * @param javaProject The Java project to modify.
 * @param sdkInstall The AWS SDK for Java installation to remove.
 */
public static void removeAwsSdkFromProjectClasspath(IJavaProject javaProject, SdkInstall sdkInstall) {
    try {
        AwsClasspathContainer classpathContainer = new AwsClasspathContainer(sdkInstall);

        IClasspathEntry[] rawClasspath = javaProject.getRawClasspath();
        List<IClasspathEntry> newList = new ArrayList<IClasspathEntry>();
        for (IClasspathEntry entry : rawClasspath) {
            if (entry.getPath().equals(classpathContainer.getPath()) == false) {
                newList.add(entry);
            }
        }

        javaProject.setRawClasspath(newList.toArray(new IClasspathEntry[newList.size()]), null);
    } catch (JavaModelException e) {
        e.printStackTrace();
    }
}

From source file:com.android.ide.eclipse.adt.build.BaseBuilder.java

License:Open Source License

/**
 * Returns an array of external jar files used by the project.
 * @return an array of OS-specific absolute file paths
 *///from www  .  j a v a  2s  .c o  m
protected final String[] getExternalJars() {
    // get the current project
    IProject project = getProject();

    // get a java project from it
    IJavaProject javaProject = JavaCore.create(project);

    IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();

    ArrayList<String> oslibraryList = new ArrayList<String>();
    IClasspathEntry[] classpaths = javaProject.readRawClasspath();
    if (classpaths != null) {
        for (IClasspathEntry e : classpaths) {
            if (e.getEntryKind() == IClasspathEntry.CPE_LIBRARY
                    || e.getEntryKind() == IClasspathEntry.CPE_VARIABLE) {
                // if this is a classpath variable reference, we resolve it.
                if (e.getEntryKind() == IClasspathEntry.CPE_VARIABLE) {
                    e = JavaCore.getResolvedClasspathEntry(e);
                }

                // get the IPath
                IPath path = e.getPath();

                // check the name ends with .jar
                if (AndroidConstants.EXT_JAR.equalsIgnoreCase(path.getFileExtension())) {
                    boolean local = false;
                    IResource resource = wsRoot.findMember(path);
                    if (resource != null && resource.exists() && resource.getType() == IResource.FILE) {
                        local = true;
                        oslibraryList.add(resource.getLocation().toOSString());
                    }

                    if (local == false) {
                        // if the jar path doesn't match a workspace resource,
                        // then we get an OSString and check if this links to a valid file.
                        String osFullPath = path.toOSString();

                        File f = new File(osFullPath);
                        if (f.exists()) {
                            oslibraryList.add(osFullPath);
                        } else {
                            String message = String.format(Messages.Couldnt_Locate_s_Error, path);
                            AdtPlugin.printBuildToConsole(AdtConstants.BUILD_VERBOSE, project, message);

                            // Also put a warning marker on the project
                            markProject(AdtConstants.MARKER_ADT, message, IMarker.SEVERITY_WARNING);
                        }
                    }
                }
            }
        }
    }

    return oslibraryList.toArray(new String[oslibraryList.size()]);
}

From source file:com.android.ide.eclipse.adt.build.ResourceManagerBuilder.java

License:Open Source License

@SuppressWarnings("unchecked")
@Override/*from  w w  w .  j  a  va  2 s . c  om*/
protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
    // Get the project.
    IProject project = getProject();

    // Clear the project of the generic markers
    BaseBuilder.removeMarkersFromProject(project, AdtConstants.MARKER_ADT);

    // check for existing target marker, in which case we abort.
    // (this means: no SDK, no target, or unresolvable target.)
    abortOnBadSetup(project);

    // Check the compiler compliance level, displaying the error message
    // since this is the first builder.
    int res = ProjectHelper.checkCompilerCompliance(project);
    String errorMessage = null;
    switch (res) {
    case ProjectHelper.COMPILER_COMPLIANCE_LEVEL:
        errorMessage = Messages.Requires_Compiler_Compliance_5;
    case ProjectHelper.COMPILER_COMPLIANCE_SOURCE:
        errorMessage = Messages.Requires_Source_Compatibility_5;
    case ProjectHelper.COMPILER_COMPLIANCE_CODEGEN_TARGET:
        errorMessage = Messages.Requires_Class_Compatibility_5;
    }

    if (errorMessage != null) {
        BaseProjectHelper.addMarker(project, AdtConstants.MARKER_ADT, errorMessage, IMarker.SEVERITY_ERROR);
        AdtPlugin.printErrorToConsole(project, errorMessage);

        // interrupt the build. The next builders will not run.
        stopBuild(errorMessage);
    }

    // Check that the SDK directory has been setup.
    String osSdkFolder = AdtPlugin.getOsSdkFolder();

    if (osSdkFolder == null || osSdkFolder.length() == 0) {
        AdtPlugin.printErrorToConsole(project, Messages.No_SDK_Setup_Error);
        markProject(AdtConstants.MARKER_ADT, Messages.No_SDK_Setup_Error, IMarker.SEVERITY_ERROR);

        // This interrupts the build. The next builders will not run.
        stopBuild(Messages.No_SDK_Setup_Error);
    }

    // check the project has a target
    IAndroidTarget projectTarget = Sdk.getCurrent().getTarget(project);
    if (projectTarget == null) {
        // no target. marker has been set by the container initializer: exit silently.
        // This interrupts the build. The next builders will not run.
        stopBuild("Project has no target");
    }

    // check the 'gen' source folder is present
    boolean hasGenSrcFolder = false; // whether the project has a 'gen' source folder setup
    IJavaProject javaProject = JavaCore.create(project);

    IClasspathEntry[] classpaths = javaProject.readRawClasspath();
    if (classpaths != null) {
        for (IClasspathEntry e : classpaths) {
            if (e.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
                IPath path = e.getPath();
                if (path.segmentCount() == 2 && path.segment(1).equals(SdkConstants.FD_GEN_SOURCES)) {
                    hasGenSrcFolder = true;
                    break;
                }
            }
        }
    }

    boolean genFolderPresent = false; // whether the gen folder actually exists
    IResource resource = project.findMember(SdkConstants.FD_GEN_SOURCES);
    genFolderPresent = resource != null && resource.exists();

    if (hasGenSrcFolder == false && genFolderPresent) {
        // No source folder setup for 'gen' in the project, but there's already a
        // 'gen' resource (file or folder).
        String message;
        if (resource.getType() == IResource.FOLDER) {
            // folder exists already! This is an error. If the folder had been created
            // by the NewProjectWizard, it'd be a source folder.
            message = String.format(
                    "%1$s already exists but is not a source folder. Convert to a source folder or rename it.",
                    resource.getFullPath().toString());
        } else {
            // resource exists but is not a folder.
            message = String.format(
                    "Resource %1$s is in the way. ADT needs a source folder called 'gen' to work. Rename or delete resource.",
                    resource.getFullPath().toString());
        }

        AdtPlugin.printErrorToConsole(project, message);
        markProject(AdtConstants.MARKER_ADT, message, IMarker.SEVERITY_ERROR);

        // This interrupts the build. The next builders will not run.
        stopBuild(message);
    } else if (hasGenSrcFolder == false || genFolderPresent == false) {
        // either there is no 'gen' source folder in the project (older SDK),
        // or the folder does not exist (was deleted, or was a fresh svn checkout maybe.)

        // In case we are migrating from an older SDK, we go through the current source
        // folders and delete the generated Java files.
        ArrayList<IPath> sourceFolders = BaseProjectHelper.getSourceClasspaths(javaProject);
        IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
        for (IPath path : sourceFolders) {
            IResource member = root.findMember(path);
            if (member != null) {
                removeDerivedResources(member, monitor);
            }
        }

        // create the new source folder, if needed
        IFolder genFolder = project.getFolder(SdkConstants.FD_GEN_SOURCES);
        if (genFolderPresent == false) {
            AdtPlugin.printBuildToConsole(AdtConstants.BUILD_VERBOSE, project,
                    "Creating 'gen' source folder for generated Java files");
            genFolder.create(true /* force */, true /* local */, new SubProgressMonitor(monitor, 10));
            genFolder.setDerived(true);
        }

        // add it to the source folder list, if needed only (or it will throw)
        if (hasGenSrcFolder == false) {
            IClasspathEntry[] entries = javaProject.getRawClasspath();
            entries = ProjectHelper.addEntryToClasspath(entries,
                    JavaCore.newSourceEntry(genFolder.getFullPath()));
            javaProject.setRawClasspath(entries, new SubProgressMonitor(monitor, 10));
        }

        // refresh the whole project
        project.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 10));
    }

    // Check the preference to be sure we are supposed to refresh
    // the folders.
    if (AdtPlugin.getAutoResRefresh()) {
        AdtPlugin.printBuildToConsole(AdtConstants.BUILD_VERBOSE, project, Messages.Refreshing_Res);

        // refresh the res folder.
        IFolder resFolder = project.getFolder(AndroidConstants.WS_RESOURCES);
        resFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor);

        // Also refresh the assets folder to make sure the ApkBuilder
        // will now it's changed and will force a new resource packaging.
        IFolder assetsFolder = project.getFolder(AndroidConstants.WS_ASSETS);
        assetsFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
    }

    return null;
}

From source file:com.android.ide.eclipse.adt.internal.build.BuildHelper.java

License:Open Source License

/**
 * Computes all the project output and dependencies that must go into building the apk.
 *
 * @param resMarker/*from  w  w  w .  j  a  v a2s  . co m*/
 * @throws CoreException
 */
private void gatherPaths(ResourceMarker resMarker) throws CoreException {
    IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();

    // get a java project for the project.
    IJavaProject javaProject = JavaCore.create(mProject);

    // get the output of the main project
    IPath path = javaProject.getOutputLocation();
    IResource outputResource = wsRoot.findMember(path);
    if (outputResource != null && outputResource.getType() == IResource.FOLDER) {
        mCompiledCodePaths.add(outputResource.getLocation().toOSString());
    }

    // we could use IJavaProject.getResolvedClasspath directly, but we actually
    // want to see the containers themselves.
    IClasspathEntry[] classpaths = javaProject.readRawClasspath();
    if (classpaths != null) {
        for (IClasspathEntry e : classpaths) {
            // ignore non exported entries, unless they're in the DEPEDENCIES container,
            // in which case we always want it (there may be some older projects that
            // have it as non exported).
            if (e.isExported() || (e.getEntryKind() == IClasspathEntry.CPE_CONTAINER
                    && e.getPath().toString().equals(AdtConstants.CONTAINER_DEPENDENCIES))) {
                handleCPE(e, javaProject, wsRoot, resMarker);
            }
        }
    }
}

From source file:com.android.ide.eclipse.adt.internal.build.BuildHelper.java

License:Open Source License

private void handleCPE(IClasspathEntry entry, IJavaProject javaProject, IWorkspaceRoot wsRoot,
        ResourceMarker resMarker) {//  ww  w  .ja  v a2s  .com

    // if this is a classpath variable reference, we resolve it.
    if (entry.getEntryKind() == IClasspathEntry.CPE_VARIABLE) {
        entry = JavaCore.getResolvedClasspathEntry(entry);
    }

    if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
        IProject refProject = wsRoot.getProject(entry.getPath().lastSegment());
        try {
            // ignore if it's an Android project, or if it's not a Java Project
            if (refProject.hasNature(JavaCore.NATURE_ID)
                    && refProject.hasNature(AdtConstants.NATURE_DEFAULT) == false) {
                IJavaProject refJavaProject = JavaCore.create(refProject);

                // get the output folder
                IPath path = refJavaProject.getOutputLocation();
                IResource outputResource = wsRoot.findMember(path);
                if (outputResource != null && outputResource.getType() == IResource.FOLDER) {
                    mCompiledCodePaths.add(outputResource.getLocation().toOSString());
                }
            }
        } catch (CoreException exception) {
            // can't query the project nature? ignore
        }

    } else if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
        handleClasspathLibrary(entry, wsRoot, resMarker);
    } else if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
        // get the container
        try {
            IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), javaProject);
            // ignore the system and default_system types as they represent
            // libraries that are part of the runtime.
            if (container != null && container.getKind() == IClasspathContainer.K_APPLICATION) {
                IClasspathEntry[] entries = container.getClasspathEntries();
                for (IClasspathEntry cpe : entries) {
                    handleCPE(cpe, javaProject, wsRoot, resMarker);
                }
            }
        } catch (JavaModelException jme) {
            // can't resolve the container? ignore it.
            AdtPlugin.log(jme, "Failed to resolve ClasspathContainer: %s", entry.getPath());
        }
    }
}

From source file:com.android.ide.eclipse.adt.internal.build.BuildHelper.java

License:Open Source License

private void handleClasspathLibrary(IClasspathEntry e, IWorkspaceRoot wsRoot, ResourceMarker resMarker) {
    // get the IPath
    IPath path = e.getPath();

    IResource resource = wsRoot.findMember(path);

    if (resource != null && resource.getType() == IResource.PROJECT) {
        // if it's a project we should just ignore it because it's going to be added
        // later when we add all the referenced projects.

    } else if (SdkConstants.EXT_JAR.equalsIgnoreCase(path.getFileExtension())) {
        // case of a jar file (which could be relative to the workspace or a full path)
        if (resource != null && resource.exists() && resource.getType() == IResource.FILE) {
            mCompiledCodePaths.add(resource.getLocation().toOSString());
        } else {//from   w  w w. j  av a 2 s  . co m
            // if the jar path doesn't match a workspace resource,
            // then we get an OSString and check if this links to a valid file.
            String osFullPath = path.toOSString();

            File f = new File(osFullPath);
            if (f.isFile()) {
                mCompiledCodePaths.add(osFullPath);
            } else {
                String message = String.format(Messages.Couldnt_Locate_s_Error, path);
                // always output to the console
                mOutStream.println(message);

                // put a marker
                if (resMarker != null) {
                    resMarker.setWarning(mProject, message);
                }
            }
        }
    } else {
        // this can be the case for a class folder.
        if (resource != null && resource.exists() && resource.getType() == IResource.FOLDER) {
            mCompiledCodePaths.add(resource.getLocation().toOSString());
        } else {
            // if the path doesn't match a workspace resource,
            // then we get an OSString and check if this links to a valid folder.
            String osFullPath = path.toOSString();

            File f = new File(osFullPath);
            if (f.isDirectory()) {
                mCompiledCodePaths.add(osFullPath);
            }
        }
    }
}

From source file:com.android.ide.eclipse.adt.internal.build.PostCompilerHelper.java

License:Open Source License

/**
 * Returns an array of external jar files used by the project.
 * @return an array of OS-specific absolute file paths
 *//*from www .  ja  va  2  s.c om*/
private final String[] getExternalJars() {
    // get a java project from it
    IJavaProject javaProject = JavaCore.create(mProject);

    IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();

    ArrayList<String> oslibraryList = new ArrayList<String>();
    IClasspathEntry[] classpaths = javaProject.readRawClasspath();
    if (classpaths != null) {
        for (IClasspathEntry e : classpaths) {
            if (e.getEntryKind() == IClasspathEntry.CPE_LIBRARY
                    || e.getEntryKind() == IClasspathEntry.CPE_VARIABLE) {
                // if this is a classpath variable reference, we resolve it.
                if (e.getEntryKind() == IClasspathEntry.CPE_VARIABLE) {
                    e = JavaCore.getResolvedClasspathEntry(e);
                }

                // get the IPath
                IPath path = e.getPath();

                // check the name ends with .jar
                if (AndroidConstants.EXT_JAR.equalsIgnoreCase(path.getFileExtension())) {
                    IResource resource = wsRoot.findMember(path);
                    if (resource != null && resource.exists() && resource.getType() == IResource.FILE) {
                        oslibraryList.add(resource.getLocation().toOSString());
                    } else {
                        // if the jar path doesn't match a workspace resource,
                        // then we get an OSString and check if this links to a valid file.
                        String osFullPath = path.toOSString();

                        File f = new File(osFullPath);
                        if (f.exists()) {
                            oslibraryList.add(osFullPath);
                        } else {
                            String message = String.format(Messages.Couldnt_Locate_s_Error, path);
                            AdtPlugin.printBuildToConsole(BuildVerbosity.VERBOSE, mProject, message);

                            // Also put a warning marker on the project
                            BaseProjectHelper.markResource(mProject, AndroidConstants.MARKER_PACKAGING, message,
                                    IMarker.SEVERITY_WARNING);
                        }
                    }
                }
            }
        }
    }

    return oslibraryList.toArray(new String[oslibraryList.size()]);
}

From source file:com.android.ide.eclipse.adt.internal.lint.EclipseLintClient.java

License:Open Source License

@Override
@NonNull//from   w ww  . ja  v a 2  s. c  om
protected ClassPathInfo getClassPath(@NonNull Project project) {
    ClassPathInfo info;
    if (mProjectInfo == null) {
        mProjectInfo = Maps.newHashMap();
        info = null;
    } else {
        info = mProjectInfo.get(project);
    }

    if (info == null) {
        List<File> sources = null;
        List<File> classes = null;
        List<File> libraries = null;

        IProject p = getProject(project);
        if (p != null) {
            try {
                IJavaProject javaProject = BaseProjectHelper.getJavaProject(p);

                // Output path
                File file = workspacePathToFile(javaProject.getOutputLocation());
                classes = Collections.singletonList(file);

                // Source path
                IClasspathEntry[] entries = javaProject.getRawClasspath();
                sources = new ArrayList<File>(entries.length);
                libraries = new ArrayList<File>(entries.length);
                for (int i = 0; i < entries.length; i++) {
                    IClasspathEntry entry = entries[i];
                    int kind = entry.getEntryKind();

                    if (kind == IClasspathEntry.CPE_VARIABLE) {
                        entry = JavaCore.getResolvedClasspathEntry(entry);
                        if (entry == null) {
                            // It's possible that the variable is no longer valid; ignore
                            continue;
                        }
                        kind = entry.getEntryKind();
                    }

                    if (kind == IClasspathEntry.CPE_SOURCE) {
                        sources.add(workspacePathToFile(entry.getPath()));
                    } else if (kind == IClasspathEntry.CPE_LIBRARY) {
                        libraries.add(entry.getPath().toFile());
                    }
                    // Note that we ignore IClasspathEntry.CPE_CONTAINER:
                    // Normal Android Eclipse projects supply both
                    //   AdtConstants.CONTAINER_FRAMEWORK
                    // and
                    //   AdtConstants.CONTAINER_LIBRARIES
                    // here. We ignore the framework classes for obvious reasons,
                    // but we also ignore the library container because lint will
                    // process the libraries differently. When Eclipse builds a
                    // project, it gets the .jar output of the library projects
                    // from this container, which means it doesn't have to process
                    // the library sources. Lint on the other hand wants to process
                    // the source code, so instead it actually looks at the
                    // project.properties file to find the libraries, and then it
                    // iterates over all the library projects in turn and analyzes
                    // those separately (but passing the main project for context,
                    // such that the including project's manifest declarations
                    // are used for data like minSdkVersion level).
                    //
                    // Note that this container will also contain *other*
                    // libraries (Java libraries, not library projects) that we
                    // *should* include. However, we can't distinguish these
                    // class path entries from the library project jars,
                    // so instead of looking at these, we simply listFiles() in
                    // the libs/ folder after processing the classpath info
                }

                // Add in libraries
                File libs = new File(project.getDir(), FD_NATIVE_LIBS);
                if (libs.isDirectory()) {
                    File[] jars = libs.listFiles();
                    if (jars != null) {
                        for (File jar : jars) {
                            if (SdkUtils.endsWith(jar.getPath(), DOT_JAR)) {
                                libraries.add(jar);
                            }
                        }
                    }
                }
            } catch (CoreException e) {
                AdtPlugin.log(e, null);
            }
        }

        if (sources == null) {
            sources = super.getClassPath(project).getSourceFolders();
        }
        if (classes == null) {
            classes = super.getClassPath(project).getClassFolders();
        }
        if (libraries == null) {
            libraries = super.getClassPath(project).getLibraries();
        }

        // No test folders in Eclipse:
        // https://bugs.eclipse.org/bugs/show_bug.cgi?id=224708
        List<File> tests = Collections.emptyList();

        info = new ClassPathInfo(sources, classes, libraries, tests);
        mProjectInfo.put(project, info);
    }

    return info;
}

From source file:com.android.ide.eclipse.adt.internal.project.AndroidClasspathContainerInitializer.java

License:Open Source License

@Override
public void requestClasspathContainerUpdate(IPath containerPath, IJavaProject project,
        IClasspathContainer containerSuggestion) throws CoreException {
    AdtPlugin plugin = AdtPlugin.getDefault();

    synchronized (Sdk.getLock()) {
        boolean sdkIsLoaded = plugin.getSdkLoadStatus() == LoadStatus.LOADED;

        // check if the project has a valid target.
        IAndroidTarget target = null;/*  www .j av  a2 s. co m*/
        if (sdkIsLoaded) {
            target = Sdk.getCurrent().getTarget(project.getProject());
        }
        if (sdkIsLoaded && target != null) {
            String[] paths = getTargetPaths(target);
            IPath android_lib = new Path(paths[CACHE_INDEX_JAR]);
            IClasspathEntry[] entries = containerSuggestion.getClasspathEntries();
            for (int i = 0; i < entries.length; i++) {
                IClasspathEntry entry = entries[i];
                if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
                    IPath entryPath = entry.getPath();

                    if (entryPath != null) {
                        if (entryPath.equals(android_lib)) {
                            IPath entrySrcPath = entry.getSourceAttachmentPath();
                            IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
                            if (entrySrcPath != null) {
                                ProjectHelper.saveStringProperty(root, getAndroidSourceProperty(target),
                                        entrySrcPath.toString());
                            } else {
                                ProjectHelper.saveStringProperty(root, getAndroidSourceProperty(target), null);
                            }
                            IClasspathAttribute[] extraAttributtes = entry.getExtraAttributes();
                            if (extraAttributtes.length == 0) {
                                ProjectHelper.saveStringProperty(root, PROPERTY_ANDROID_API, NULL_API_URL);
                            }
                            for (int j = 0; j < extraAttributtes.length; j++) {
                                IClasspathAttribute extraAttribute = extraAttributtes[j];
                                String value = extraAttribute.getValue();
                                if ((value == null || value.trim().length() == 0)
                                        && IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME
                                                .equals(extraAttribute.getName())) {
                                    value = NULL_API_URL;
                                }
                                if (IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME
                                        .equals(extraAttribute.getName())) {
                                    ProjectHelper.saveStringProperty(root, PROPERTY_ANDROID_API, value);

                                }
                            }
                        }
                    }
                }
            }
            rebindClasspathEntries(project.getJavaModel(), containerPath);
        }
    }
}