Example usage for org.eclipse.jdt.internal.core JavaModelManager PERF_CONTAINER_INITIALIZER

List of usage examples for org.eclipse.jdt.internal.core JavaModelManager PERF_CONTAINER_INITIALIZER

Introduction

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

Prototype

boolean PERF_CONTAINER_INITIALIZER

To view the source code for org.eclipse.jdt.internal.core JavaModelManager PERF_CONTAINER_INITIALIZER.

Click Source Link

Usage

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

License:Open Source License

/**
 * Configure the plugin with respect to option settings defined in ".options" file
 *//*from   w w  w.  java 2s  . c om*/
public void configurePluginDebugOptions() {
    if (JavaCore.getPlugin().isDebugging()) {
        String option = Platform.getDebugOption(BUFFER_MANAGER_DEBUG);
        if (option != null)
            BufferManager.VERBOSE = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(BUILDER_DEBUG);
        if (option != null)
            JavaBuilder.DEBUG = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(COMPILER_DEBUG);
        if (option != null)
            Compiler.DEBUG = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(BUILDER_STATS_DEBUG);
        if (option != null)
            JavaBuilder.SHOW_STATS = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(COMPLETION_DEBUG);
        if (option != null)
            CompletionEngine.DEBUG = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(CP_RESOLVE_DEBUG);
        if (option != null)
            JavaModelManager.CP_RESOLVE_VERBOSE = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(CP_RESOLVE_ADVANCED_DEBUG);
        if (option != null)
            JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(CP_RESOLVE_FAILURE_DEBUG);
        if (option != null)
            JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(DELTA_DEBUG);
        if (option != null)
            DeltaProcessor.DEBUG = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(DELTA_DEBUG_VERBOSE);
        if (option != null)
            DeltaProcessor.VERBOSE = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(HIERARCHY_DEBUG);
        if (option != null)
            TypeHierarchy.DEBUG = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(INDEX_MANAGER_DEBUG);
        if (option != null)
            JobManager.VERBOSE = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(INDEX_MANAGER_ADVANCED_DEBUG);
        if (option != null)
            IndexManager.DEBUG = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(JAVAMODEL_DEBUG);
        if (option != null)
            JavaModelManager.VERBOSE = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(JAVAMODELCACHE_DEBUG);
        if (option != null)
            JavaModelCache.VERBOSE = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(POST_ACTION_DEBUG);
        if (option != null)
            JavaModelOperation.POST_ACTION_VERBOSE = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(RESOLUTION_DEBUG);
        if (option != null)
            NameLookup.VERBOSE = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(SEARCH_DEBUG);
        if (option != null)
            BasicSearchEngine.VERBOSE = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(SELECTION_DEBUG);
        if (option != null)
            SelectionEngine.DEBUG = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(ZIP_ACCESS_DEBUG);
        if (option != null)
            JavaModelManager.ZIP_ACCESS_VERBOSE = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(SOURCE_MAPPER_DEBUG_VERBOSE);
        if (option != null)
            SourceMapper.VERBOSE = option.equalsIgnoreCase(TRUE);

        option = Platform.getDebugOption(FORMATTER_DEBUG);
        if (option != null)
            DefaultCodeFormatter.DEBUG = option.equalsIgnoreCase(TRUE);
    }

    // configure performance options
    if (PerformanceStats.ENABLED) {
        CompletionEngine.PERF = PerformanceStats.isEnabled(COMPLETION_PERF);
        SelectionEngine.PERF = PerformanceStats.isEnabled(SELECTION_PERF);
        DeltaProcessor.PERF = PerformanceStats.isEnabled(DELTA_LISTENER_PERF);
        JavaModelManager.PERF_VARIABLE_INITIALIZER = PerformanceStats.isEnabled(VARIABLE_INITIALIZER_PERF);
        JavaModelManager.PERF_CONTAINER_INITIALIZER = PerformanceStats.isEnabled(CONTAINER_INITIALIZER_PERF);
        ReconcileWorkingCopyOperation.PERF = PerformanceStats.isEnabled(RECONCILE_PERF);
    }
}

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;/*from w ww .j  av a2  s. com*/
        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;
}