public static IPath getPath()

in org.apache.ivyde.eclipse/src/java/org/apache/ivyde/internal/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java [404:478]


    public static IPath getPath(IvyClasspathContainerConfiguration conf) {
        StringBuffer path = new StringBuffer();
        path.append('?');
        IJavaProject javaProject = conf.getJavaProject();
        try {
            /*
             * Implementation note about why the project is serialized in the path. This is related
             * to https://issues.apache.org/jira/browse/IVYDE-237
             *
             * For some reason, when we add a project to the source path of a launch configuration,
             * any IvyDE container involved of that project lose its reference to its project. Then
             * when the JDT call the IvyDERuntimeClasspathEntryResolver to resolve the source of
             * that container, the IRuntimeClasspathEntry doesn't reference a Java project. In most
             * case, an IvyDE classpath container reference an ivy.xml relatively to the project. So
             * in that context, the classpath cannot be resolved without a reference to the project
             * in the path of the container.
             *
             * Another reason for having the project in the path of the container, is to make the
             * path unique. Again the source path in a launch configuration would consider two
             * containers with exactly the configurations the same, even if the
             * IRuntimeClasspathEntry reference different projects.
             *
             * To reproduce the issue, some test project is available and configured accordingly.
             * See in the test folder of the IvyDE project, check out the project 'jetty' and
             * 'jetty-webapp'.
             */
            path.append("project=");
            if (javaProject != null) {
                path.append(URLEncoder.encode(javaProject.getElementName(), "UTF-8"));
            }
            path.append("&ivyXmlPath=");
            path.append(URLEncoder.encode(conf.getIvyXmlPath(), "UTF-8"));
            append(path, "confs", conf.getConfs());
            if (conf.isSettingsProjectSpecific()) {
                SettingsSetup setup = conf.getIvySettingsSetup();
                append(path, "ivySettingsPath", setup.getRawIvySettingsPath());
                append(path, "loadSettingsOnDemand", setup.isLoadSettingsOnDemand());
                append(path, "ivyUserDir", setup.getRawIvyUserDir());
                append(path, "propertyFiles", setup.getRawPropertyFiles());
            }
            if (conf.isClassthProjectSpecific()) {
                ClasspathSetup setup = conf.getClasspathSetup();
                append(path, "acceptedTypes", setup.getAcceptedTypes());
                append(path, "alphaOrder", setup.isAlphaOrder());
                append(path, "resolveInWorkspace", setup.isResolveInWorkspace());
                append(path, "transitiveResolve", setup.isTransitiveResolve());
                append(path, "readOSGiMetadata", setup.isReadOSGiMetadata());
                append(path, "retrievedClasspath", setup.isRetrievedClasspath());
                if (setup.isRetrievedClasspath()) {
                    RetrieveSetup retrieveSetup = setup.getRetrieveSetup();
                    append(path, "retrievedClasspathPattern", retrieveSetup.getRetrievePattern());
                    append(path, "retrievedClasspathSync", retrieveSetup.isRetrieveSync());
                    append(path, "retrievedClasspathTypes", retrieveSetup.getRetrieveTypes());
                }
            }
            if (conf.isMappingProjectSpecific()) {
                MappingSetup setup = conf.getMappingSetup();
                append(path, "sourceTypes", setup.getSourceTypes());
                append(path, "javadocTypes", setup.getJavadocTypes());
                append(path, "sourceSuffixes", setup.getSourceSuffixes());
                append(path, "javadocSuffixes", setup.getJavadocSuffixes());
                append(path, "mapIfOnlyOneSource", setup.isMapIfOnlyOneSource());
                append(path, "mapIfOnlyOneJavadoc", setup.isMapIfOnlyOneJavadoc());
            }
            if (conf.isAdvancedProjectSpecific()) {
                AdvancedSetup setup = conf.getAdvancedSetup();
                append(path, "resolveBeforeLaunch", setup.isResolveBeforeLaunch());
                append(path, "useExtendedResolveId", setup.isUseExtendedResolveId());
            }
        } catch (UnsupportedEncodingException e) {
            IvyPlugin.logError(UTF8_ERROR, e);
            throw new RuntimeException(UTF8_ERROR, e);
        }
        return new Path(IvyClasspathContainer.ID).append(path.toString());
    }