Example usage for org.eclipse.jface.operation ModalContext setDebugMode

List of usage examples for org.eclipse.jface.operation ModalContext setDebugMode

Introduction

In this page you can find the example usage for org.eclipse.jface.operation ModalContext setDebugMode.

Prototype

public static void setDebugMode(boolean debugMode) 

Source Link

Document

Sets whether ModalContext is running in debug mode.

Usage

From source file:org.eclipse.ui.internal.Workbench.java

License:Open Source License

/**
 * Initializes the workbench now that the display is created.
 * //www  .j  ava  2s  .c  om
 * @return true if init succeeded.
 */
private boolean init() {
    // setup debug mode if required.
    if (WorkbenchPlugin.getDefault().isDebugging()) {
        WorkbenchPlugin.DEBUG = true;
        ModalContext.setDebugMode(true);
    }

    // Set up the JFace preference store
    JFaceUtil.initializeJFacePreferences();

    // create workbench window manager
    // windowManager = new WindowManager();
    // TODO compat: I've removed the window manager, now what

    // TODO Correctly order service initialization
    // there needs to be some serious consideration given to
    // the services, and hooking them up in the correct order
    e4Context.set("org.eclipse.core.runtime.Platform", Platform.class); //$NON-NLS-1$
    final EvaluationService evaluationService = new EvaluationService(e4Context);

    StartupThreading.runWithoutExceptions(new StartupRunnable() {

        public void runWithException() {
            serviceLocator.registerService(IEvaluationService.class, evaluationService);
        }
    });

    initializeLazyServices();

    // Initialize the activity support.

    activityHelper = ActivityPersistanceHelper.getInstance();
    StartupThreading.runWithoutExceptions(new StartupRunnable() {

        public void runWithException() {
            WorkbenchImages.getImageRegistry();
        }
    });
    initializeE4Services();
    initializeDefaultServices();
    initializeFonts();
    initializeColors();
    initializeApplicationColors();

    IIntroRegistry introRegistry = WorkbenchPlugin.getDefault().getIntroRegistry();
    if (introRegistry.getIntroCount() > 0) {
        IProduct product = Platform.getProduct();
        if (product != null) {
            introDescriptor = (IntroDescriptor) introRegistry.getIntroForProduct(product.getId());
        }
    }

    // now that the workbench is sufficiently initialized, let the advisor
    // have a turn.
    StartupThreading.runWithoutExceptions(new StartupRunnable() {

        public void runWithException() {
            advisor.internalBasicInitialize(getWorkbenchConfigurer());
        }
    });

    // configure use of color icons in toolbars
    boolean useColorIcons = PrefUtil.getInternalPreferenceStore().getBoolean(IPreferenceConstants.COLOR_ICONS);
    ActionContributionItem.setUseColorIconsInToolbars(useColorIcons);

    // initialize workbench single-click vs double-click behavior
    initializeSingleClickOption();

    initializeWorkbenchImages();

    StartupThreading.runWithoutExceptions(new StartupRunnable() {

        public void runWithException() {
            ((GrabFocus) Tweaklets.get(GrabFocus.KEY)).init(getDisplay());
        }
    });

    // attempt to restore a previous workbench state
    try {
        UIStats.start(UIStats.RESTORE_WORKBENCH, "Workbench"); //$NON-NLS-1$

        final boolean bail[] = new boolean[1];
        StartupThreading.runWithoutExceptions(new StartupRunnable() {

            public void runWithException() throws Throwable {
                advisor.preStartup();
                // TODO compat: open the windows here/instantiate the model
                // TODO compat: instantiate the WW around the model
                initializationDone = true;
                // if (isClosing() || !advisor.openWindows()) {
                if (isClosing()) {
                    bail[0] = true;
                }
            }
        });

        if (bail[0])
            return false;

    } finally {
        UIStats.end(UIStats.RESTORE_WORKBENCH, this, "Workbench"); //$NON-NLS-1$
    }

    // forceOpenPerspective();

    return true;
}