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

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

Introduction

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

Prototype

IPath[] getInclusionPatterns();

Source Link

Document

Returns the set of patterns used to explicitly define resources or classes to be included with this classpath entry.

Usage

From source file:monolipse.core.internal.BooNature.java

License:Open Source License

private Map<IClasspathEntry, IClasspathEntry> addExclusionPatternsTo(IClasspathEntry[] classpath) {
    Map<IClasspathEntry, IClasspathEntry> modified = new HashMap<IClasspathEntry, IClasspathEntry>();
    for (int i = 0; i < classpath.length; i++) {
        IClasspathEntry entry = classpath[i];
        if (entry.getEntryKind() != IClasspathEntry.CPE_SOURCE)
            continue;

        IPath[] exclusionPatterns = entry.getExclusionPatterns();
        IPath[] newExclusionPatterns = addExclusionPatternsTo(exclusionPatterns);
        if (exclusionPatterns == newExclusionPatterns)
            continue;

        IClasspathEntry newSourceEntry = JavaCore.newSourceEntry(entry.getPath(), entry.getInclusionPatterns(),
                newExclusionPatterns, entry.getOutputLocation(), entry.getExtraAttributes());

        modified.put(entry, newSourceEntry);
    }/*from  ww w . jav  a2 s  .c om*/
    return modified;
}

From source file:net.rim.ejde.internal.util.ImportUtils.java

License:Open Source License

/**
 * Applies the Java Path exclusion patterns to a given project and returns the list of filtered IClasspathEntry
 *
 * @param eclipseProject//from w  w  w.  j  av  a2s  .c o m
 * @param legacyProject
 * @param originalClasspathEntries
 * @return
 */
static public List<IClasspathEntry> applyExclusionPatterns(IProject eclipseProject, Project legacyProject,
        List<IClasspathEntry> originalClasspathEntries) {
    if (null == eclipseProject) {
        throw new IllegalArgumentException("Can't process undefined Eclipse project!");
    }

    if (null == legacyProject) {
        throw new IllegalArgumentException("Can't process undefined legacy project!");
    }

    if (null == originalClasspathEntries) {
        throw new IllegalArgumentException("Can't process undefined Eclipse classpath entries!");
    }

    // TODO: call this when importing projects, rather than from the
    // Compilation Participant
    List<WorkspaceFile> excludedWorkspaceFiles = getFilesToBeExcluded(legacyProject);

    if (excludedWorkspaceFiles.isEmpty() && originalClasspathEntries.isEmpty()) {
        return originalClasspathEntries;
    }

    List<IClasspathEntry> excludedClasspathEntries = new ArrayList<IClasspathEntry>();
    HashMap<IPath, IClasspathEntry> filterMap = new HashMap<IPath, IClasspathEntry>();
    String projectNamePattern = IPath.SEPARATOR + eclipseProject.getName() + IPath.SEPARATOR;
    List<IPath> exclusionPatterns;
    IPath classpathEntryPath, exclusionPatternPath;
    boolean forProject;
    String lastSegment;
    IFolder folder;
    IPath srcLocation;
    IClasspathEntry newEntry;
    IPath[] excludedPaths;
    File file;
    String workspaceFilePath;
    String packageId;

    for (IClasspathEntry entry : originalClasspathEntries) {
        exclusionPatterns = new ArrayList<IPath>();

        classpathEntryPath = entry.getPath();

        if (IClasspathEntry.CPE_SOURCE == entry.getEntryKind()) {
            lastSegment = classpathEntryPath.lastSegment();

            if (lastSegment.equalsIgnoreCase(
                    ImportUtils.getImportPref(ResourceBuilder.LOCALE_INTERFACES_FOLDER_NAME))) {
                continue;
            }

            folder = eclipseProject.getFolder(lastSegment);

            if (folder.isDerived() || !folder.exists()) {
                continue;
            }

            forProject = classpathEntryPath.toString().startsWith(projectNamePattern);

            if (forProject) {
                srcLocation = folder.getLocation();

                if (srcLocation == null || srcLocation.isEmpty()) {
                    return originalClasspathEntries;
                }

                for (WorkspaceFile workspaceFile : excludedWorkspaceFiles) {
                    workspaceFilePath = workspaceFile.toString();
                    file = workspaceFile.getFile();

                    if (null != file && file.exists() && file.isFile()) {
                        // Fix for IDT 149988 - Check type of source folder and file type to prevent duplication for exclusion
                        // patterns
                        if (lastSegment.equalsIgnoreCase(
                                ImportUtils.getImportPref(LegacyImportHelper.PROJECT_SRC_FOLDER_NAME_KEY))) {
                            if (!workspaceFile.getIsJava()) {
                                continue;
                            }
                        } else {
                            if (workspaceFile.getIsJava()) {
                                continue;
                            }
                        }

                        if (workspaceFile.getIsJava() || workspaceFile.getIsResourceHeader()
                                || workspaceFile.getIsResource()) {
                            packageId = IConstants.EMPTY_STRING;
                            try {
                                packageId = PackageUtils.getFilePackageString(file, legacyProject);
                            } catch (CoreException e) {
                                _log.error(e.getMessage());
                                packageId = IConstants.EMPTY_STRING;
                            }
                            workspaceFilePath = File.separator + packageId + File.separator + workspaceFilePath;
                        }
                        exclusionPatternPath = getExclusionPattern(workspaceFile, lastSegment, eclipseProject,
                                legacyProject);

                        if (!exclusionPatternPath.isEmpty()) {
                            exclusionPatterns.add(exclusionPatternPath);
                        }
                    }
                }
            }

            if (exclusionPatterns.isEmpty()) {
                excludedPaths = new IPath[] {};
            } else {
                excludedPaths = exclusionPatterns.toArray(new IPath[exclusionPatterns.size()]);
            }

            newEntry = JavaCore.newSourceEntry(classpathEntryPath, entry.getInclusionPatterns(), excludedPaths,
                    entry.getOutputLocation(), entry.getExtraAttributes());
            filterMap.put(classpathEntryPath, newEntry);
        } else {// IClasspathEntry of type other than CPE_SOURCE
            filterMap.put(classpathEntryPath, entry);
        }
    }

    IPath elementPath;

    for (IClasspathEntry element : originalClasspathEntries) {
        elementPath = element.getPath();
        newEntry = filterMap.get(elementPath);
        if (null != newEntry) {
            excludedClasspathEntries.add(newEntry);
        }
    }

    return excludedClasspathEntries;
}

From source file:org.continuousassurance.swamp.eclipse.BuildfileGenerator.java

License:Apache License

/**
 * Returns an image descriptor for the image file at the given
 * plug-in relative path/*from   w  w  w  . j a  v a 2  s.c  o m*/
 *
 * @param doc the document
 * @param root the root element
 * @param prjOutputDirectory the output directory
 * @param list the list of projects that the calling project 
 * depends on
 * @param projectName the name of the calling project
 * @param isRoot is this project the root  
 * @return the image descriptor
 */
private static void setBuildTarget(Document doc, Element root, String outputDirectory,
        List<ImprovedClasspathHandler> dependentProjects, List<IClasspathEntry> srcEntries, String projectName,
        Set<String> filePaths, String prjEncoding) {

    String prjOutputDirectory = outputDirectory.substring(1); // unroot it
    System.out.println("Relative output directory: " + prjOutputDirectory);
    Element target = doc.createElement(ANT_TARGET);
    target.setAttribute(ANT_NAME, ANT_BUILD);
    //if (isRoot) {
    Element init = setInitTarget(doc, root, prjOutputDirectory);
    target.setAttribute(ANT_DEPENDS, ANT_INIT);
    //}

    root.appendChild(target);

    for (ImprovedClasspathHandler ich : dependentProjects) {
        BuildfileGenerator.generateBuildFile(ich, filePaths);
        String buildFilePath = ich.getProjectName() + BUILDFILE_EXT; // this will be in the same directory
        Element ant = doc.createElement(ANT_ANT);
        ant.setAttribute(ANT_ANTFILE, buildFilePath);
        ant.setAttribute(ANT_TARGET, ANT_BUILD);
        target.appendChild(ant);
    }

    // includesfile and excludesfile attributes - http://ant.apache.org/manual/Tasks/javac.html
    for (IClasspathEntry entry : srcEntries) {
        IPath[] inclusionPatterns = entry.getInclusionPatterns();
        IPath[] exclusionPatterns = entry.getExclusionPatterns();
        Element javac = doc.createElement(ANT_JAVAC);
        javac.setAttribute(ANT_INCLUDE_ANT_RUNTIME, ANT_FALSE);
        javac.setAttribute(ANT_CLASSPATHREF, CLASSPATH_NAME);
        javac.setAttribute(ANT_BOOTCLASSPATHREF, BOOTCLASSPATH_NAME);
        if (inclusionPatterns.length == 0 && exclusionPatterns.length == 0) {
            javac.setAttribute(ANT_SOURCEPATHREF, SOURCEPATH_NAME);
        } else {
            javac.setAttribute(ANT_SOURCEPATH, getModifiedSourcePath(entry, srcEntries));
        }
        String srcEncoding = getEncodingAttribute(entry);
        if (!("").equals(srcEncoding)) {
            javac.setAttribute(ANT_ENCODING, srcEncoding);
        } else if (!("".equals(prjEncoding)) && prjEncoding != null) {
            System.out.println("Project encoding: " + prjEncoding);
            javac.setAttribute(ANT_ENCODING, prjEncoding);
        }
        // Source entries may have a specific output location associated with them, otherwise, we use the project's default location
        IPath destPath = entry.getOutputLocation();
        String destDir;
        if (destPath != null) {
            String strPath = destPath.toOSString();
            destDir = strPath.substring(1);
        } else {
            destDir = prjOutputDirectory;
        }
        Element mkdir = doc.createElement(ANT_MKDIR);
        mkdir.setAttribute(ANT_DIR, destDir); // TODO Become smarter about when we actually need this
        init.appendChild(mkdir);
        javac.setAttribute(ANT_DESTDIR, destDir);
        javac.setAttribute(ANT_SOURCE, "${source}");
        javac.setAttribute(ANT_TARGET, "${target}");

        Element src = doc.createElement(ANT_SRC);
        addInclusionExclusionPatterns(doc, javac, ANT_INCLUDE, entry.getInclusionPatterns());
        addInclusionExclusionPatterns(doc, javac, ANT_EXCLUDE, entry.getExclusionPatterns());

        String absPath = entry.getPath().toOSString();
        String strRelPath = absPath.substring(1);
        System.out.println("Relative path: " + strRelPath);
        src.setAttribute(ANT_PATH, strRelPath);
        javac.appendChild(src);
        target.appendChild(javac);
    }

}

From source file:org.eclipse.ajdt.core.buildpath.BuildConfigurationUtils.java

License:Open Source License

public static void saveBuildConfiguration(IFile ifile) {
    File file = ifile.getLocation().toFile();
    IProject project = ifile.getProject();
    try {//from   ww  w  .jav  a2s  .co m
        IJavaProject jp = JavaCore.create(project);
        IClasspathEntry[] entries = jp.getRawClasspath();
        List srcIncludes = new ArrayList();
        List srcExcludes = new ArrayList();
        List srcInclusionpatterns = new ArrayList();
        for (int i = 0; i < entries.length; i++) {
            IClasspathEntry entry = entries[i];
            if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
                IPath srcpath = entry.getPath();
                srcpath = srcpath.removeFirstSegments(1);
                String path = srcpath.toString().trim();
                if (!path.endsWith("/")) { //$NON-NLS-1$
                    path = path + "/"; //$NON-NLS-1$
                }
                srcIncludes.add(path);
                IPath[] inclusions = entry.getInclusionPatterns();
                for (int j = 0; j < inclusions.length; j++) {
                    srcInclusionpatterns.add((path.length() > 1 ? path : "") + inclusions[j]); //$NON-NLS-1$   
                }
                IPath[] exclusions = entry.getExclusionPatterns();
                for (int j = 0; j < exclusions.length; j++) {
                    srcExcludes.add((path.length() > 1 ? path : "") + exclusions[j]); //$NON-NLS-1$
                }
            }
        }
        BufferedWriter bw = null;
        try {
            bw = new BufferedWriter(new FileWriter(file));
            printProperties(bw, "src.includes", srcIncludes); //$NON-NLS-1$
            printProperties(bw, "src.excludes", srcExcludes); //$NON-NLS-1$
            printProperties(bw, "src.inclusionpatterns", srcInclusionpatterns); //$NON-NLS-1$   
        } catch (IOException e) {
        } finally {
            if (bw != null) {
                try {
                    bw.close();
                } catch (IOException e) {
                }
            }
        }
    } catch (JavaModelException e) {
    }
}

From source file:org.eclipse.ant.internal.ui.datatransfer.EclipseClasspath.java

License:Open Source License

private void handleSources(IClasspathEntry entry) throws JavaModelException {
    String projectRoot = ExportUtil.getProjectRoot(project);
    String defaultClassDir = project.getOutputLocation().toString();
    String defaultClassDirAbsolute = ExportUtil.resolve(project.getOutputLocation());

    if (entry.getContentKind() == IPackageFragmentRoot.K_SOURCE
            && entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
        // found source path
        IPath srcDirPath = entry.getPath();
        IPath classDirPath = entry.getOutputLocation();
        String srcDir = handleLinkedResource(srcDirPath);
        ExportUtil.removeProjectRoot((srcDirPath != null) ? srcDirPath.toString() : projectRoot,
                project.getProject());//from  www . j  ava2 s  . c o m
        String classDir = ExportUtil.removeProjectRoot(
                (classDirPath != null) ? classDirPath.toString() : defaultClassDir, project.getProject());
        srcDirs.add(srcDir);
        classDirs.add(classDir);
        String classDirAbsolute = (classDirPath != null) ? ExportUtil.resolve(classDirPath)
                : defaultClassDirAbsolute;
        rawClassPathEntries.add(classDir);
        rawClassPathEntriesAbsolute.add(classDirAbsolute);
        IPath[] inclusions = entry.getInclusionPatterns();
        List<String> inclusionList = new ArrayList<>();
        for (int j = 0; j < inclusions.length; j++) {
            if (inclusions[j] != null) {
                inclusionList.add(ExportUtil.removeProjectRoot(inclusions[j].toString(), project.getProject()));
            }
        }
        inclusionLists.add(inclusionList);
        IPath[] exclusions = entry.getExclusionPatterns();
        List<String> exclusionList = new ArrayList<>();
        for (int j = 0; j < exclusions.length; j++) {
            if (exclusions[j] != null) {
                exclusionList.add(ExportUtil.removeProjectRoot(exclusions[j].toString(), project.getProject()));
            }
        }
        exclusionLists.add(exclusionList);
    }
}

From source file:org.eclipse.che.plugin.maven.server.core.classpath.ClasspathEntryHelper.java

License:Open Source License

private void setClasspathEntry(IClasspathEntry entry) {
    this.kind = entry.getEntryKind();
    this.path = entry.getPath();
    this.exported = entry.isExported();
    this.outputLocation = entry.getOutputLocation();

    this.accessRules = new ArrayList<>();
    for (IAccessRule rule : entry.getAccessRules()) {
        this.accessRules.add(rule);
    }//from  w  w w .  j  a  v a2s  .  c  o  m

    this.attributes = new HashMap<>();
    for (IClasspathAttribute attribute : entry.getExtraAttributes()) {
        attributes.put(attribute.getName(), attribute.getValue());
    }

    this.sourcePath = entry.getSourceAttachmentPath();
    this.sourceRootPath = entry.getSourceAttachmentRootPath();
    setInclusionPatterns(entry.getInclusionPatterns());
    setExclusionPatterns(entry.getExclusionPatterns());
    this.combineAccessRules = entry.combineAccessRules();

    String groupId = attributes.get(ClasspathManager.GROUP_ID_ATTRIBUTE);
    String artifactId = attributes.get(ClasspathManager.ARTIFACT_ID_ATTRIBUTE);
    String version = attributes.get(ClasspathManager.VERSION_ATTRIBUTE);
    String packaging = attributes.get(ClasspathManager.PACKAGING_ATTRIBUTE);
    String classifier = attributes.get(ClasspathManager.CLASSIFIER_ATTRIBUTE);
    if (groupId != null && artifactId != null && version != null) {
        this.artifactKey = new MavenArtifactKey(groupId, artifactId, version, packaging, classifier);
    }
}

From source file:org.eclipse.imp.java.hosted.BuildPathUtils.java

License:Open Source License

/**
 * @param filePath// w w w .j a  v  a  2 s .c om
 * @param srcEntry
 * @return true if the given file is excluded from the given IClasspathEntry
 */
public static boolean isExcluded(final IPath filePath, final IClasspathEntry srcEntry) {
    final IPath relFilePath = filePath.makeRelativeTo(srcEntry.getPath());
    final IPath[] inclusionPatterns = srcEntry.getInclusionPatterns();
    if (inclusionPatterns != null && inclusionPatterns.length != 0) {
        boolean foundMatch = false;
        for (IPath pattern : inclusionPatterns) {
            if (matches(relFilePath, pattern)) {
                foundMatch = true;
                break;
            }
        }
        if (!foundMatch) {
            return true;
        }
    }
    final IPath[] exclusionPatterns = srcEntry.getExclusionPatterns();
    if (exclusionPatterns != null && exclusionPatterns.length != 0) {
        for (IPath pattern : exclusionPatterns) {
            if (matches(relFilePath, pattern)) {
                return true;
            }
        }
    }
    return false;
}

From source file:org.eclipse.jst.common.project.facet.core.internal.ClasspathUtil.java

License:Open Source License

private static IClasspathEntry setOwners(final IClasspathEntry cpe, final String owners) {
    final List<IClasspathAttribute> attrs = new ArrayList<IClasspathAttribute>();

    for (IClasspathAttribute attr : cpe.getExtraAttributes()) {
        if (!attr.getName().equals(OWNER_PROJECT_FACETS_ATTR)) {
            attrs.add(attr);//from   www. j  ava 2  s  .c o  m
        }
    }

    if (owners != null) {
        attrs.add(JavaCore.newClasspathAttribute(OWNER_PROJECT_FACETS_ATTR, owners));
    }

    return new ClasspathEntry(cpe.getContentKind(), cpe.getEntryKind(), cpe.getPath(),
            cpe.getInclusionPatterns(), cpe.getExclusionPatterns(), cpe.getSourceAttachmentPath(),
            cpe.getSourceAttachmentRootPath(), cpe.getOutputLocation(), cpe.isExported(), cpe.getAccessRules(),
            cpe.combineAccessRules(), attrs.toArray(new IClasspathAttribute[attrs.size()]));
}

From source file:org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil.java

License:Open Source License

public static IClasspathEntry modifyDependencyPath(IClasspathEntry entry, IPath dependencyPath) {
    IClasspathEntry newEntry = null;//from  w w w  .  j  av  a2s . c  om
    IClasspathAttribute[] newAttributes = modifyDependencyPath(entry.getExtraAttributes(), dependencyPath);

    switch (entry.getEntryKind()) {
    case IClasspathEntry.CPE_CONTAINER:
        newEntry = JavaCore.newContainerEntry(entry.getPath(), entry.getAccessRules(), newAttributes,
                entry.isExported());
        break;
    case IClasspathEntry.CPE_LIBRARY:
        newEntry = JavaCore.newLibraryEntry(entry.getPath(), entry.getSourceAttachmentPath(),
                entry.getSourceAttachmentRootPath(), entry.getAccessRules(), newAttributes, entry.isExported());
        break;
    case IClasspathEntry.CPE_VARIABLE:
        newEntry = JavaCore.newVariableEntry(entry.getPath(), entry.getSourceAttachmentPath(),
                entry.getSourceAttachmentRootPath(), entry.getAccessRules(), newAttributes, entry.isExported());
        break;
    case IClasspathEntry.CPE_PROJECT:
        newEntry = JavaCore.newProjectEntry(entry.getPath(), entry.getAccessRules(), entry.combineAccessRules(),
                newAttributes, entry.isExported());
        break;
    case IClasspathEntry.CPE_SOURCE:
        newEntry = JavaCore.newSourceEntry(entry.getPath(), entry.getInclusionPatterns(),
                entry.getExclusionPatterns(), entry.getOutputLocation(), newAttributes);
        break;
    }
    return newEntry;
}

From source file:org.eclipse.jst.j2ee.internal.classpathdep.UpdateClasspathAttributesOperation.java

License:Open Source License

/**
 * Updates the specified Java project so that only the specified classpath entries have
 * the WTP component dependency attribute.
 * @param javaProject Target Java project.
 * @param entries Classpath entries that should have the component dependency attribute. Map from IClasspathEntry
 * to the IClasspathAttribute for the WTP classpath component dependency.
 * @param modifyComponentDep True if modifying the dependency attribute, false if modifying the non-dependency attribute.
 * @throws CoreException Thrown if an error is encountered.
 *//*from w ww .  java 2  s  . c  o  m*/
private void updateDependencyAttributes(final IJavaProject javaProject, final Map entriesWithAttrib,
        final boolean modifyComponentDep, final boolean isLegacyJ2EE) throws CoreException {
    if (javaProject == null || !javaProject.getProject().isAccessible()) {
        return;
    }

    final List updatedClasspath = new ArrayList();
    final IClasspathEntry[] rawClasspath = javaProject.getRawClasspath();
    boolean needToUpdateClasspath = false;
    IClasspathAttribute attrib = UpdateClasspathAttributeUtil.createDependencyAttribute();
    if (!modifyComponentDep) {
        attrib = UpdateClasspathAttributeUtil.createNonDependencyAttribute();
    }
    for (int i = 0; i < rawClasspath.length; i++) {
        IClasspathEntry entry = rawClasspath[i];
        final int kind = entry.getEntryKind();
        boolean hasAttribute = ClasspathDependencyUtil
                .checkForComponentDependencyAttribute(entry,
                        modifyComponentDep ? DependencyAttributeType.CLASSPATH_COMPONENT_DEPENDENCY
                                : DependencyAttributeType.CLASSPATH_COMPONENT_NONDEPENDENCY,
                        isLegacyJ2EE) != null;
        boolean shouldHaveAttribute = entriesWithAttrib.containsKey(entry);
        boolean updateAttributes = false;
        IClasspathAttribute[] updatedAttributes = null;
        if (shouldHaveAttribute) {
            if (!hasAttribute) {
                // should have the attribute and currently missing it
                attrib = (IClasspathAttribute) entriesWithAttrib.get(entry);
                updatedAttributes = updateAttributes(entry.getExtraAttributes(), attrib, true);
                needToUpdateClasspath = true;
                updateAttributes = true;
            }
        } else if (hasAttribute) {
            // should not have the attribute and currently has it
            updatedAttributes = updateAttributes(entry.getExtraAttributes(), attrib, false);
            needToUpdateClasspath = true;
            updateAttributes = true;
        }

        if (updateAttributes) {
            switch (kind) {
            case IClasspathEntry.CPE_CONTAINER:
                entry = JavaCore.newContainerEntry(entry.getPath(), entry.getAccessRules(), updatedAttributes,
                        entry.isExported());
                break;
            case IClasspathEntry.CPE_LIBRARY:
                entry = JavaCore.newLibraryEntry(entry.getPath(), entry.getSourceAttachmentPath(),
                        entry.getSourceAttachmentRootPath(), entry.getAccessRules(), updatedAttributes,
                        entry.isExported());
                break;
            case IClasspathEntry.CPE_VARIABLE:
                entry = JavaCore.newVariableEntry(entry.getPath(), entry.getSourceAttachmentPath(),
                        entry.getSourceAttachmentRootPath(), entry.getAccessRules(), updatedAttributes,
                        entry.isExported());
                break;
            case IClasspathEntry.CPE_PROJECT: // although project entries are not yet supported, allow the attribute here and let the validator flag as an error
                entry = JavaCore.newProjectEntry(entry.getPath(), entry.getAccessRules(),
                        entry.combineAccessRules(), updatedAttributes, entry.isExported());
                break;
            case IClasspathEntry.CPE_SOURCE: // although source entries are not supported, allow the attribute here and let the validator flag as an error
                entry = JavaCore.newSourceEntry(entry.getPath(), entry.getInclusionPatterns(),
                        entry.getExclusionPatterns(), entry.getOutputLocation(), updatedAttributes);
                break;
            }
        }

        updatedClasspath.add(entry);
    }
    if (needToUpdateClasspath) {
        final IClasspathEntry[] updatedCPArray = (IClasspathEntry[]) updatedClasspath
                .toArray(new IClasspathEntry[updatedClasspath.size()]);
        javaProject.setRawClasspath(updatedCPArray, null);
    }
}