Example usage for org.eclipse.jdt.internal.core JavaProject encodeClasspathEntry

List of usage examples for org.eclipse.jdt.internal.core JavaProject encodeClasspathEntry

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core JavaProject encodeClasspathEntry.

Prototype

@Override
    public String encodeClasspathEntry(IClasspathEntry classpathEntry) 

Source Link

Usage

From source file:org.eclipse.virgo.ide.jdt.internal.core.classpath.ServerClasspathUtils.java

License:Open Source License

/**
 * Persists the given {@link IClasspathEntry}s to a file
 *//*from w ww  .jav  a2 s . co  m*/
protected static void persistClasspathEntries(IJavaProject project, IClasspathEntry[] entries) {

    // Get the line separator from the platform configuration
    String lineSeparator = Util.getLineSeparator((String) null, project);

    // Create the xml string representation of the classpath entries
    StringBuilder builder = new StringBuilder("<classpath>").append(lineSeparator);
    if (project instanceof JavaProject) {
        JavaProject javaProject = (JavaProject) project;
        for (IClasspathEntry entry : entries) {
            builder.append(javaProject.encodeClasspathEntry(entry));
        }
    }
    builder.append("</classpath>").append(lineSeparator);

    // Save the contents to the settings file
    saveFile(project, builder);
}

From source file:org.springsource.ide.eclipse.gradle.core.classpathcontainer.GradleClassPathContainer.java

License:Open Source License

private Serializable encode(IClasspathEntry[] entries) {
    JavaProject jp = (JavaProject) project.getJavaProject();
    if (entries != null) {
        String[] encoded = new String[entries.length];
        for (int i = 0; i < encoded.length; i++) {
            encoded[i] = jp.encodeClasspathEntry(entries[i]);
        }//www .  j a  v a 2s  .c  o  m
        return encoded;
    }
    return null;
}