Example usage for org.eclipse.jdt.internal.core.util Messages javamodel_configuring

List of usage examples for org.eclipse.jdt.internal.core.util Messages javamodel_configuring

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core.util Messages javamodel_configuring.

Prototype

String javamodel_configuring

To view the source code for org.eclipse.jdt.internal.core.util Messages javamodel_configuring.

Click Source Link

Usage

From source file:org.eclipse.jdt.internal.core.JavaModelManager.java

License:Open Source License

IClasspathContainer initializeContainer(IJavaProject project, IPath containerPath) throws JavaModelException {

    IProgressMonitor monitor = this.batchContainerInitializationsProgress;
    if (monitor != null && monitor.isCanceled())
        throw new OperationCanceledException();

    IClasspathContainer container = null;
    final ClasspathContainerInitializer initializer = JavaCore
            .getClasspathContainerInitializer(containerPath.segment(0));
    if (initializer != null) {
        if (CP_RESOLVE_VERBOSE)
            verbose_triggering_container_initialization(project, containerPath, initializer);
        if (CP_RESOLVE_VERBOSE_ADVANCED)
            verbose_triggering_container_initialization_invocation_trace();
        PerformanceStats stats = null;/*ww w  . j  a  v a  2 s.  c  o  m*/
        if (JavaModelManager.PERF_CONTAINER_INITIALIZER) {
            stats = PerformanceStats.getStats(JavaModelManager.CONTAINER_INITIALIZER_PERF, this);
            stats.startRun(containerPath + " of " + project.getPath()); //$NON-NLS-1$
        }
        containerPut(project, containerPath, CONTAINER_INITIALIZATION_IN_PROGRESS); // avoid initialization cycles
        boolean ok = false;
        try {
            if (monitor != null)
                monitor.subTask(Messages.bind(Messages.javamodel_configuring,
                        initializer.getDescription(containerPath, project)));

            // let OperationCanceledException go through
            // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=59363)
            initializer.initialize(containerPath, project);

            if (monitor != null)
                monitor.subTask(""); //$NON-NLS-1$

            // retrieve value (if initialization was successful)
            container = containerBeingInitializedGet(project, containerPath);
            if (container == null
                    && containerGet(project, containerPath) == CONTAINER_INITIALIZATION_IN_PROGRESS) {
                // initializer failed to do its job: redirect to the failure container
                container = initializer.getFailureContainer(containerPath, project);
                if (container == null) {
                    if (CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE)
                        verbose_container_null_failure_container(project, containerPath, initializer);
                    return null; // break cycle
                }
                if (CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE)
                    verbose_container_using_failure_container(project, containerPath, initializer);
                containerPut(project, containerPath, container);
            }
            ok = true;
        } catch (CoreException e) {
            if (e instanceof JavaModelException) {
                throw (JavaModelException) e;
            } else {
                throw new JavaModelException(e);
            }
        } catch (RuntimeException e) {
            if (JavaModelManager.CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE)
                e.printStackTrace();
            throw e;
        } catch (Error e) {
            if (JavaModelManager.CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE)
                e.printStackTrace();
            throw e;
        } finally {
            if (JavaModelManager.PERF_CONTAINER_INITIALIZER) {
                stats.endRun();
            }
            if (!ok) {
                // just remove initialization in progress and keep previous session container so as to avoid a full build
                // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=92588
                containerRemoveInitializationInProgress(project, containerPath);
                if (CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE)
                    verbose_container_initialization_failed(project, containerPath, container, initializer);
            }
        }
        if (CP_RESOLVE_VERBOSE_ADVANCED)
            verbose_container_value_after_initialization(project, containerPath, container);
    } else {
        // create a dummy initializer and get the default failure container
        container = (new ClasspathContainerInitializer() {
            public void initialize(IPath path, IJavaProject javaProject) throws CoreException {
                // not used
            }
        }).getFailureContainer(containerPath, project);
        if (CP_RESOLVE_VERBOSE_ADVANCED || CP_RESOLVE_VERBOSE_FAILURE)
            verbose_no_container_initializer_found(project, containerPath);
    }
    return container;
}