use of org.eclipse.ui.internal.keys.show.ShowKeysListener 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;
}
Aggregations