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

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

Introduction

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

Prototype

int CPE_SOURCE

To view the source code for org.eclipse.jdt.core IClasspathEntry CPE_SOURCE.

Click Source Link

Document

Entry kind constant describing a classpath entry identifying a folder containing package fragments with source code to be compiled.

Usage

From source file:org.eclipse.pde.internal.core.builders.BuildErrorReporter.java

License:Open Source License

private void validateMissingLibraries(ArrayList<String> sourceEntryKeys, IClasspathEntry[] cpes) {
    boolean srcFolderExists = false;
    // no need to flag anything if the project contains no source folders.
    for (int j = 0; j < cpes.length; j++) {
        if (cpes[j].getEntryKind() == IClasspathEntry.CPE_SOURCE) {
            srcFolderExists = true;/*  w w w  . j  av a 2 s  .c om*/
            break;
        }
    }
    if (!srcFolderExists)
        return;

    IPluginModelBase model = PluginRegistry.findModel(fProject);
    if (model == null)
        return;
    if (model instanceof IBundlePluginModelBase && !(model instanceof IBundleFragmentModel)) {
        IBundleModel bm = ((IBundlePluginModelBase) model).getBundleModel();
        IManifestHeader mh = bm.getBundle().getManifestHeader(Constants.BUNDLE_CLASSPATH);
        if ((mh == null || mh.getValue() == null)) {
            if (!sourceEntryKeys.contains(DEF_SOURCE_ENTRY)) {
                prepareError(DEF_SOURCE_ENTRY, null, PDECoreMessages.BuildErrorReporter_sourceMissing,
                        PDEMarkerFactory.NO_RESOLUTION, fSrcLibSeverity, PDEMarkerFactory.CAT_OTHER);
            }
        }
    }
    IPluginLibrary[] libraries = model.getPluginBase().getLibraries();
    for (int i = 0; i < libraries.length; i++) {
        String libname = libraries[i].getName();
        if (libname.equals(".")) { //$NON-NLS-1$
            if (!sourceEntryKeys.contains(DEF_SOURCE_ENTRY)) {
                prepareError(DEF_SOURCE_ENTRY, null, PDECoreMessages.BuildErrorReporter_sourceMissing,
                        PDEMarkerFactory.NO_RESOLUTION, fSrcLibSeverity, PDEMarkerFactory.CAT_OTHER);
                continue;
            }
        } else if (fProject.findMember(libname) != null) {
            // non "." library entries that exist in the workspace
            // don't have to be referenced in the build properties
            continue;
        }
        String sourceEntryKey = PROPERTY_SOURCE_PREFIX + libname;
        if (!sourceEntryKeys.contains(sourceEntryKey)
                && !containedInFragment(model.getBundleDescription(), libname))
            prepareError(sourceEntryKey, null,
                    NLS.bind(PDECoreMessages.BuildErrorReporter_missingEntry, sourceEntryKey),
                    PDEMarkerFactory.B_ADDITION, PDEMarkerFactory.CAT_OTHER);
    }
}

From source file:org.eclipse.pde.internal.core.builders.BuildErrorReporter.java

License:Open Source License

private void validateSourceFoldersInSrcIncludes(IBuildEntry includes) {
    if (includes == null)
        return;// ww w. java 2s.  co m

    List<IPath> sourceFolderList = new ArrayList<IPath>(0);
    try {
        IJavaProject javaProject = JavaCore.create(fProject);
        if (javaProject.exists()) {
            IClasspathEntry[] classPathEntries = javaProject.getResolvedClasspath(true);

            for (int index = 0; index < classPathEntries.length; index++) {
                if (classPathEntries[index].getEntryKind() == IClasspathEntry.CPE_SOURCE) {
                    sourceFolderList.add(classPathEntries[index].getPath());
                }
            }
        }
    } catch (JavaModelException e) { //do nothing
    }

    List<String> reservedTokens = Arrays.asList(RESERVED_NAMES);

    String[] tokens = includes.getTokens();
    for (int i = 0; i < tokens.length; i++) {
        IResource res = fProject.findMember(tokens[i]);
        if (res == null)
            continue;
        String errorMessage = null;
        if (sourceFolderList.contains(res.getFullPath())) {
            errorMessage = PDECoreMessages.BuildErrorReporter_srcIncludesSourceFolder;
        } else if (tokens[i].startsWith(".") //$NON-NLS-1$
                || reservedTokens.contains(res.getName().toString().toLowerCase())) {
            errorMessage = NLS.bind(PDECoreMessages.BuildErrorReporter_srcIncludesSourceFolder1, res.getName());
        }

        if (errorMessage != null) {
            prepareError(includes.getName(), tokens[i], errorMessage, PDEMarkerFactory.B_REMOVAL,
                    fSrcInclSeverity, PDEMarkerFactory.CAT_OTHER);
        }
    }

}

From source file:org.eclipse.pde.internal.core.builders.PDEBuilderHelper.java

License:Open Source License

public static String[] getUnlistedClasspaths(ArrayList<?> sourceEntries, IProject project,
        IClasspathEntry[] cpes) {/*w  w  w.  j a  va2s.c om*/
    String[] unlisted = new String[cpes.length];
    int index = 0;
    for (int i = 0; i < cpes.length; i++) {
        if (cpes[i].getEntryKind() != IClasspathEntry.CPE_SOURCE)
            continue;
        IPath path = cpes[i].getPath();
        boolean found = false;
        for (int j = 0; j < sourceEntries.size(); j++) {
            IBuildEntry be = (IBuildEntry) sourceEntries.get(j);
            String[] tokens = be.getTokens();
            for (int k = 0; k < tokens.length; k++) {
                IResource res = project.findMember(tokens[k]);
                if (res == null)
                    continue;
                IPath ipath = res.getFullPath();
                if (ipath.equals(path))
                    found = true;
            }
        }
        if (!found)
            unlisted[index++] = path.removeFirstSegments(1).addTrailingSeparator().toString();
    }
    return unlisted;
}

From source file:org.eclipse.pde.internal.core.builders.SourceEntryErrorReporter.java

License:Open Source License

public void initialize(ArrayList<?> sourceEntries, ArrayList<?> outputEntries, IClasspathEntry[] cpes,
        IProject project) {//from ww  w .j a  v a  2  s  .  c  o m

    fProject = project;
    IPath defaultOutputLocation = null;
    IJavaProject javaProject = JavaCore.create(fProject);
    try {
        defaultOutputLocation = javaProject.getOutputLocation();
    } catch (JavaModelException e) {
    }

    List<String> pluginLibraryNames = new ArrayList<String>(1);
    IPluginModelBase pluginModel = PluginRegistry.findModel(fProject);
    if (pluginModel != null) {
        IPluginLibrary[] pluginLibraries = pluginModel.getPluginBase().getLibraries();
        for (int i = 0; i < pluginLibraries.length; i++) {
            pluginLibraryNames.add(pluginLibraries[i].getName());
        }
    }
    if (!pluginLibraryNames.contains(".")) { //$NON-NLS-1$
        pluginLibraryNames.add("."); //$NON-NLS-1$)
    }
    for (int i = 0; i < cpes.length; i++) {
        if (cpes[i].getEntryKind() == IClasspathEntry.CPE_SOURCE) {
            IPath sourcePath = getPath(cpes[i]);
            if (sourcePath == null)
                continue;

            IPath outputLocation = cpes[i].getOutputLocation();
            if (outputLocation == null)
                outputLocation = defaultOutputLocation;
            IPath outputPath = getPath(outputLocation);

            OutputFolder outputFolder = fOutputFolderMap.get(outputPath);
            if (outputFolder == null) {
                outputFolder = new OutputFolder(outputPath);
            }

            SourceFolder sourceFolder = fSourceFolderMap.get(sourcePath);
            if (sourceFolder == null) {
                sourceFolder = new SourceFolder(sourcePath, outputFolder);
            }

            outputFolder.addSourceFolder(sourceFolder);
            fOutputFolderMap.put(outputPath, outputFolder);
            fSourceFolderMap.put(sourcePath, sourceFolder);
        } else if (cpes[i].getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
            IClasspathEntry entry = cpes[i];
            IPackageFragmentRoot[] roots = javaProject.findPackageFragmentRoots(entry);
            IPath outputPath = null;
            if (roots.length == 1) { // should only be one entry for a library
                if (!roots[0].isArchive()) {
                    outputPath = getPath(entry);
                    OutputFolder outputFolder = new OutputFolder(outputPath, true);
                    fOutputFolderMap.put(outputPath, outputFolder);
                }
            }
        }
    }

    for (Iterator<?> iterator = sourceEntries.iterator(); iterator.hasNext();) {
        IBuildEntry sourceEntry = (IBuildEntry) iterator.next();
        String libName = sourceEntry.getName().substring(PROPERTY_SOURCE_PREFIX.length());
        if (!pluginLibraryNames.contains(libName)) {
            prepareError(sourceEntry.getName(), null,
                    NLS.bind(PDECoreMessages.SourceEntryErrorReporter_MissingLibrary, libName),
                    PDEMarkerFactory.B_REMOVAL, fSrcLibSeverity, PDEMarkerFactory.CAT_OTHER);
        }
        String[] tokens = sourceEntry.getTokens();
        for (int i = 0; i < tokens.length; i++) {
            IPath path = new Path(tokens[i]).addTrailingSeparator();
            SourceFolder sourceFolder = fSourceFolderMap.get(path);
            if (sourceFolder == null) {
                sourceFolder = new SourceFolder(path, null);
                fSourceFolderMap.put(path, sourceFolder);
            }
            sourceFolder.setToken(tokens[i]);
            sourceFolder.addLib(libName);
        }
    }

    for (Iterator<?> iterator = outputEntries.iterator(); iterator.hasNext();) {
        IBuildEntry outputEntry = (IBuildEntry) iterator.next();
        String libName = outputEntry.getName().substring(PROPERTY_OUTPUT_PREFIX.length());
        if (!pluginLibraryNames.contains(libName)) {
            prepareError(outputEntry.getName(), null,
                    NLS.bind(PDECoreMessages.SourceEntryErrorReporter_MissingLibrary, libName),
                    PDEMarkerFactory.B_REMOVAL, fOututLibSeverity, PDEMarkerFactory.CAT_OTHER);
        }
        String[] tokens = outputEntry.getTokens();
        for (int i = 0; i < tokens.length; i++) {
            IPath path = new Path(tokens[i]).addTrailingSeparator();
            if (path.segmentCount() == 1 && path.segment(0).equals(".")) { //$NON-NLS-1$
                // translate "." to root path
                path = Path.ROOT;
            }
            OutputFolder outputFolder = fOutputFolderMap.get(path);
            if (outputFolder == null) {
                outputFolder = new OutputFolder(path);
                fOutputFolderMap.put(path, outputFolder);
            }
            outputFolder.setToken(tokens[i]);
            outputFolder.addLib(libName);
        }
    }
}

From source file:org.eclipse.pde.internal.core.ClasspathComputer.java

License:Open Source License

private static void addSourceAndLibraries(IProject project, IPluginModelBase model, IBuild build, boolean clear,
        Map<?, ?> sourceLibraryMap, ArrayList<IClasspathEntry> result) throws CoreException {

    HashSet<IPath> paths = new HashSet<IPath>();

    // keep existing source folders
    if (!clear) {
        IClasspathEntry[] entries = JavaCore.create(project).getRawClasspath();
        for (int i = 0; i < entries.length; i++) {
            IClasspathEntry entry = entries[i];
            if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
                if (paths.add(entry.getPath()))
                    result.add(entry);/* w w  w.  j a va 2 s  . co  m*/
            }
        }
    }

    IClasspathAttribute[] attrs = getClasspathAttributes(project, model);
    IPluginLibrary[] libraries = model.getPluginBase().getLibraries();
    for (int i = 0; i < libraries.length; i++) {
        IBuildEntry buildEntry = build == null ? null : build.getEntry("source." + libraries[i].getName()); //$NON-NLS-1$
        if (buildEntry != null) {
            addSourceFolder(buildEntry, project, paths, result);
        } else {
            IPath sourceAttachment = sourceLibraryMap != null
                    ? (IPath) sourceLibraryMap.get(libraries[i].getName())
                    : null;
            if (libraries[i].getName().equals(".")) //$NON-NLS-1$
                addJARdPlugin(project, ClasspathUtilCore.getFilename(model), sourceAttachment, attrs, result);
            else
                addLibraryEntry(project, libraries[i], sourceAttachment, attrs, result);
        }
    }
    if (libraries.length == 0) {
        if (build != null) {
            IBuildEntry buildEntry = build.getEntry("source.."); //$NON-NLS-1$
            if (buildEntry != null) {
                addSourceFolder(buildEntry, project, paths, result);
            }
        } else if (ClasspathUtilCore.hasBundleStructure(model)) {
            IPath sourceAttachment = sourceLibraryMap != null ? (IPath) sourceLibraryMap.get(".") : null; //$NON-NLS-1$
            addJARdPlugin(project, ClasspathUtilCore.getFilename(model), sourceAttachment, attrs, result);
        }
    }
}

From source file:org.eclipse.pde.internal.core.ClasspathHelper.java

License:Open Source License

private static Map<IPath, ArrayList<IPath>> getClasspathMap(IProject project, boolean checkExcluded,
        boolean absolutePaths) throws JavaModelException {
    List<Path> excluded = getFoldersToExclude(project, checkExcluded);
    IJavaProject jProject = JavaCore.create(project);
    HashMap<IPath, ArrayList<IPath>> map = new HashMap<IPath, ArrayList<IPath>>();
    IClasspathEntry[] entries = jProject.getRawClasspath();
    for (int i = 0; i < entries.length; i++) {
        // most of the paths we get will be project relative, so we need to make the paths relative
        // we will have problems adding an "absolute" path that is workspace relative
        IPath output = null, source = null;
        if (entries[i].getEntryKind() == IClasspathEntry.CPE_SOURCE) {
            source = entries[i].getPath();
            output = entries[i].getOutputLocation();
            if (output == null)
                output = jProject.getOutputLocation();
        } else if (entries[i].getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
            source = entries[i].getPath();
            output = entries[i].getPath();
            if (source.segmentCount() == 1)
                source = new Path(DOT);
        }/*from w ww  .jav a  2  s .  com*/
        if (output != null && !excluded.contains(output)) {
            IResource file = project.findMember(output.removeFirstSegments(1));
            // make the path either relative or absolute
            if (file != null) {
                boolean isLinked = file.isLinked(IResource.CHECK_ANCESTORS);
                if (isLinked || absolutePaths) {
                    IPath location = file.getLocation();
                    if (location != null) {
                        output = location.makeAbsolute();
                    } else {
                        PDECore.log(new Status(IStatus.ERROR, PDECore.PLUGIN_ID,
                                NLS.bind(PDECoreMessages.ClasspathHelper_BadFileLocation, file.getFullPath())));
                        continue;
                    }
                } else {
                    output = output.makeRelative();
                }
            } else
                continue;
            ArrayList<IPath> list = map.get(source);
            if (list == null)
                list = new ArrayList<IPath>();
            list.add(output);
            map.put(source, list);
        }
    }

    // Add additional entries from contributed bundle classpath resolvers
    IBundleClasspathResolver[] resolvers = PDECore.getDefault().getClasspathContainerResolverManager()
            .getBundleClasspathResolvers(project);
    for (int i = 0; i < resolvers.length; i++) {
        Map<IPath, Collection<IPath>> resolved = resolvers[i].getAdditionalClasspathEntries(jProject);
        Iterator<Entry<IPath, Collection<IPath>>> resolvedIter = resolved.entrySet().iterator();
        while (resolvedIter.hasNext()) {
            Map.Entry<IPath, Collection<IPath>> resolvedEntry = resolvedIter.next();
            IPath ceSource = resolvedEntry.getKey();
            ArrayList<IPath> list = map.get(ceSource);
            if (list == null) {
                list = new ArrayList<IPath>();
                map.put(ceSource, list);
            }
            list.addAll(resolvedEntry.getValue());
        }
    }

    return map;
}

From source file:org.eclipse.pde.internal.core.exports.WorkspaceExportHelper.java

License:Open Source License

private Map<String, Set<IPath>> getPluginOutputFolders(IBuildModel buildModel, IJavaProject javaProject)
        throws JavaModelException {
    Map<String, Set<IPath>> outputEntries = new HashMap<String, Set<IPath>>();

    IBuildEntry[] buildEntries = buildModel.getBuild().getBuildEntries();
    for (int i = 0; i < buildEntries.length; i++) {
        String name = buildEntries[i].getName();
        if (name.startsWith(IBuildPropertiesConstants.PROPERTY_SOURCE_PREFIX)) {
            Set<IPath> outputPaths = new HashSet<IPath>();

            String[] sourceFolders = buildEntries[i].getTokens();
            for (int j = 0; j < sourceFolders.length; j++) {

                IClasspathEntry[] classpathEntries = javaProject.getRawClasspath();
                for (int k = 0; k < classpathEntries.length; k++) {
                    if (classpathEntries[k].getEntryKind() == IClasspathEntry.CPE_SOURCE) {
                        IPath sourcePath = classpathEntries[k].getPath().removeFirstSegments(1); // Entries include project as first segment
                        if (sourcePath.equals(new Path(sourceFolders[j]))) {
                            IPath outputPath = classpathEntries[k].getOutputLocation();
                            if (outputPath == null) {
                                outputPath = javaProject.getOutputLocation();
                            }/*w w w  .j a  va2  s  . co m*/
                            outputPaths.add(outputPath.removeFirstSegments(1)); // Entries include project as first segment
                        }
                    }
                }
            }
            if (!outputPaths.isEmpty()) {
                outputEntries.put(name.substring(IBuildPropertiesConstants.PROPERTY_SOURCE_PREFIX.length()),
                        outputPaths);
            }
        }
    }
    return outputEntries;
}

From source file:org.eclipse.pde.internal.launching.launcher.LaunchArgumentsHelper.java

License:Open Source License

/**
 * Returns the path to the equinox launcher jar.  If the launcher is available
 * in the workspace, the packageName will be used to determine the expected output
 * location.//from   w w w . j a  v a  2  s .c  o  m
 * 
 * @param packageName name of the launcher package, typically {@link IPDEBuildConstants#BUNDLE_EQUINOX_LAUNCHER}
 * @return the path to the equinox launcher jar or <code>null</code> 
 * @throws CoreException
 */
private static String getEquinoxStartupPath(String packageName) throws CoreException {
    // See if PDE has the launcher in the workspace or target
    IPluginModelBase model = PluginRegistry.findModel(IPDEBuildConstants.BUNDLE_EQUINOX_LAUNCHER);
    if (model != null) {
        IResource resource = model.getUnderlyingResource();
        if (resource == null) {
            // Found in the target
            String installLocation = model.getInstallLocation();
            if (installLocation == null) {
                return null;
            }

            File bundleFile = new File(installLocation);
            if (!bundleFile.isDirectory()) {
                // The launcher bundle is usually jarred, just return the bundle root
                return installLocation;
            }

            // Unjarred bundle, search for the built jar at the root of the folder
            File[] files = bundleFile.listFiles(new FilenameFilter() {
                public boolean accept(File dir, String name) {
                    return name.indexOf(IPDEBuildConstants.BUNDLE_EQUINOX_LAUNCHER) >= 0;
                }
            });
            for (int i = 0; i < files.length; i++) {
                if (files[i].isFile()) {
                    return files[i].getPath();
                }
            }

            // Source bundle from git://git.eclipse.org/gitroot/equinox/rt.equinox.framework.git
            File binFolder = new File(bundleFile, "bin"); //$NON-NLS-1$
            if (binFolder.isDirectory()) {
                return binFolder.getPath();
            }
            return null;
        }

        // Found in the workspace
        IProject project = resource.getProject();
        if (project.hasNature(JavaCore.NATURE_ID)) {
            IJavaProject jProject = JavaCore.create(project);
            IClasspathEntry[] entries = jProject.getRawClasspath();
            for (int i = 0; i < entries.length; i++) {
                int kind = entries[i].getEntryKind();
                if (kind == IClasspathEntry.CPE_SOURCE || kind == IClasspathEntry.CPE_LIBRARY) {
                    IPackageFragmentRoot[] roots = jProject.findPackageFragmentRoots(entries[i]);
                    for (int j = 0; j < roots.length; j++) {
                        if (roots[j].getPackageFragment(packageName).exists()) {
                            // if source folder, find the output folder
                            if (kind == IClasspathEntry.CPE_SOURCE) {
                                IPath path = entries[i].getOutputLocation();
                                if (path == null)
                                    path = jProject.getOutputLocation();
                                path = path.removeFirstSegments(1);
                                return project.getLocation().append(path).toOSString();
                            }
                            // else if is a library jar, then get the location of the jar itself
                            IResource jar = roots[j].getResource();
                            if (jar != null) {
                                return jar.getLocation().toOSString();
                            }
                        }
                    }
                }
            }
        }
    }

    // No PDE model, see if the launcher bundle is installed
    Bundle bundle = Platform.getBundle(IPDEBuildConstants.BUNDLE_EQUINOX_LAUNCHER);
    if (bundle != null) {
        try {
            URL url = FileLocator.resolve(bundle.getEntry("/")); //$NON-NLS-1$
            url = FileLocator.toFileURL(url);
            String path = url.getFile();
            if (path.startsWith("file:")) //$NON-NLS-1$
                path = path.substring(5);
            path = new File(path).getAbsolutePath();
            if (path.endsWith("!")) //$NON-NLS-1$
                path = path.substring(0, path.length() - 1);
            return path;
        } catch (IOException e) {
        }
    }
    return null;
}

From source file:org.eclipse.pde.internal.launching.launcher.LauncherUtils.java

License:Open Source License

private static String getTimeStamp(IProject project) {
    IJavaProject jp = JavaCore.create(project);
    try {/*ww  w. j  a va 2  s  . c o m*/
        long timeStamp = 0;
        IClasspathEntry[] entries = jp.getResolvedClasspath(true);
        for (int i = 0; i < entries.length; i++) {
            if (entries[i].getEntryKind() == IClasspathEntry.CPE_SOURCE) {
                File file;
                IPath location = entries[i].getOutputLocation();
                if (location == null)
                    location = jp.getOutputLocation();
                IResource res = project.getWorkspace().getRoot().findMember(location);
                IPath path = res == null ? null : res.getLocation();
                if (path == null)
                    continue;
                file = path.toFile();
                Stack<File> files = new Stack<File>();
                files.push(file);
                while (!files.isEmpty()) {
                    file = files.pop();
                    if (file.isDirectory()) {
                        File[] children = file.listFiles();
                        if (children != null) {
                            for (int j = 0; j < children.length; j++)
                                files.push(children[j]);
                        }
                    } else if (file.getName().endsWith(".class") && timeStamp < file.lastModified()) //$NON-NLS-1$
                        timeStamp = file.lastModified();
                }
            }
        }
        IFile[] otherFiles = new IFile[] { PDEProject.getManifest(project),
                PDEProject.getBuildProperties(project) };
        for (int i = 0; i < otherFiles.length; i++) {
            IFile file = otherFiles[i];
            if (file != null) {
                long fileTimeStamp = file.getRawLocation().toFile().lastModified();
                if (timeStamp < fileTimeStamp)
                    timeStamp = fileTimeStamp;
            }
        }
        return Long.toString(timeStamp);
    } catch (JavaModelException e) {
    }
    return "0"; //$NON-NLS-1$
}

From source file:org.eclipse.pde.internal.ui.editor.plugin.LibrarySection.java

License:Open Source License

private void configureSourceBuildEntry(IBuildModel bmodel, String oldPath, String newPath)
        throws CoreException {
    IBuild build = bmodel.getBuild();//from   w  w w .  j  a v  a2  s .co  m
    IBuildEntry entry = build.getEntry(PROPERTY_SOURCE_PREFIX + (oldPath != null ? oldPath : newPath));
    try {
        if (newPath != null) {
            if (entry == null) {
                IProject project = ((IModel) getPage().getModel()).getUnderlyingResource().getProject();
                IJavaProject jproject = JavaCore.create(project);
                ArrayList<String> tokens = new ArrayList<String>();
                IClasspathEntry[] entries = jproject.getRawClasspath();
                for (int i = 0; i < entries.length; i++)
                    if (entries[i].getEntryKind() == IClasspathEntry.CPE_SOURCE)
                        tokens.add(
                                entries[i].getPath().removeFirstSegments(1).addTrailingSeparator().toString());
                if (tokens.size() == 0)
                    return;

                entry = bmodel.getFactory().createEntry(PROPERTY_SOURCE_PREFIX + newPath);
                for (int i = 0; i < tokens.size(); i++)
                    entry.addToken(tokens.get(i));
                build.add(entry);
            } else
                entry.setName(PROPERTY_SOURCE_PREFIX + newPath);
        } else if (entry != null)
            build.remove(entry);
    } catch (JavaModelException e) {
    }
}