Search in sources :

Example 1 with IIntroRegistry

use of org.eclipse.ui.internal.intro.IIntroRegistry in project eclipse.platform.ui by eclipse-platform.

the class Workbench method init.

/**
 * Initializes the workbench now that the display is created.
 *
 * @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();
    // TODO Correctly order service initialization
    // there needs to be some serious consideration given to
    // the services, and hooking them up in the correct order
    // $NON-NLS-1$
    e4Context.set("org.eclipse.core.runtime.Platform", Platform.class);
    final EvaluationService evaluationService = new EvaluationService(e4Context);
    StartupThreading.runWithoutExceptions(new StartupRunnable() {

        @Override
        public void runWithException() {
            serviceLocator.registerService(IEvaluationService.class, evaluationService);
        }
    });
    initializeLazyServices();
    // Initialize the activity support.
    activityHelper = ActivityPersistanceHelper.getInstance();
    StartupThreading.runWithoutExceptions(new StartupRunnable() {

        @Override
        public void runWithException() {
            WorkbenchImages.getImageRegistry();
        }
    });
    initializeE4Services();
    IIntroRegistry introRegistry = WorkbenchPlugin.getDefault().getIntroRegistry();
    if (introRegistry.getIntroCount() > 0) {
        IProduct product = Platform.getProduct();
        if (product != null) {
            introDescriptor = (IntroDescriptor) introRegistry.getIntroForProduct(product.getId());
        }
    }
    initializeDefaultServices();
    initializeFonts();
    initializeApplicationColors();
    // now that the workbench is sufficiently initialized, let the advisor
    // have a turn.
    StartupThreading.runWithoutExceptions(new StartupRunnable() {

        @Override
        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();
    initializeGlobalization();
    initializeNLExtensions();
    initializeWorkbenchImages();
    // hook shortcut visualizer
    StartupThreading.runWithoutExceptions(new StartupRunnable() {

        @Override
        public void runWithException() {
            new ShowKeysListener(Workbench.this, PrefUtil.getInternalPreferenceStore());
        }
    });
    // attempt to restore a previous workbench state
    try {
        // $NON-NLS-1$
        UIStats.start(UIStats.RESTORE_WORKBENCH, "Workbench");
        final boolean[] bail = new boolean[1];
        StartupThreading.runWithoutExceptions(new StartupRunnable() {

            @Override
            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;
                }
                restoreWorkbenchState();
            }
        });
        if (bail[0])
            return false;
    } finally {
        // $NON-NLS-1$
        UIStats.end(UIStats.RESTORE_WORKBENCH, this, "Workbench");
    }
    return true;
}
Also used : ShowKeysListener(org.eclipse.ui.internal.keys.show.ShowKeysListener) IIntroRegistry(org.eclipse.ui.internal.intro.IIntroRegistry) StartupRunnable(org.eclipse.ui.internal.StartupThreading.StartupRunnable) IProduct(org.eclipse.core.runtime.IProduct) IEvaluationService(org.eclipse.ui.services.IEvaluationService) EvaluationService(org.eclipse.ui.internal.services.EvaluationService) IEvaluationService(org.eclipse.ui.services.IEvaluationService)

Example 2 with IIntroRegistry

use of org.eclipse.ui.internal.intro.IIntroRegistry in project eclipse.platform.ui by eclipse-platform.

the class IntroTests method testIntroProperties.

@Test
public void testIntroProperties() {
    IIntroRegistry registry = WorkbenchPlugin.getDefault().getIntroRegistry();
    assertNull(registry.getIntroForProduct(PRODUCT_ID));
    assertNull(registry.getIntro(INTRO_ID));
    getBundle();
    assertNotNull(registry.getIntroForProduct(PRODUCT_ID));
    IIntroDescriptor desc = registry.getIntro(INTRO_ID);
    assertNotNull(desc);
    try {
        testIntroProperties(desc);
    } catch (CoreException e) {
        fail(e.getMessage());
    }
    removeBundle();
    assertNull(registry.getIntro(INTRO_ID));
    assertNull(registry.getIntroForProduct(PRODUCT_ID));
    try {
        testIntroProperties(desc);
        fail();
    } catch (CoreException e) {
        fail(e.getMessage());
    } catch (RuntimeException e) {
    }
}
Also used : IIntroDescriptor(org.eclipse.ui.internal.intro.IIntroDescriptor) CoreException(org.eclipse.core.runtime.CoreException) IIntroRegistry(org.eclipse.ui.internal.intro.IIntroRegistry) Test(org.junit.Test)

Aggregations

IIntroRegistry (org.eclipse.ui.internal.intro.IIntroRegistry)2 CoreException (org.eclipse.core.runtime.CoreException)1 IProduct (org.eclipse.core.runtime.IProduct)1 StartupRunnable (org.eclipse.ui.internal.StartupThreading.StartupRunnable)1 IIntroDescriptor (org.eclipse.ui.internal.intro.IIntroDescriptor)1 ShowKeysListener (org.eclipse.ui.internal.keys.show.ShowKeysListener)1 EvaluationService (org.eclipse.ui.internal.services.EvaluationService)1 IEvaluationService (org.eclipse.ui.services.IEvaluationService)1 Test (org.junit.Test)1