return serviceContext;
}
public static IEclipseContext createDefaultContext() {
IEclipseContext serviceContext = E4Workbench.getServiceContext();
final IEclipseContext appContext = serviceContext.createChild("WorkbenchContext");
IExtensionRegistry registry = RegistryFactory.getRegistry();
ExceptionHandler exceptionHandler = new ExceptionHandler();
ReflectionContributionFactory contributionFactory = new ReflectionContributionFactory(registry);
appContext.set(IContributionFactory.class.getName(), contributionFactory);
// No default log provider available
if (appContext.get(ILoggerProvider.class) == null) {
serviceContext.set(ILoggerProvider.class, ContextInjectionFactory.make(LoggerProviderImpl.class, serviceContext));
}
appContext.set(Logger.class.getName(), serviceContext.get(ILoggerProvider.class).getClassLogger(E4Workbench.class));
appContext.set(EModelService.class, new ModelServiceImpl(appContext));
appContext.set(EPlaceholderResolver.class, new PlaceholderResolver());
// translation
String locale = Locale.getDefault().toString();
appContext.set(TranslationService.LOCALE, locale);
TranslationService bundleTranslationProvider = TranslationProviderFactory.bundleTranslationService(appContext);
appContext.set(TranslationService.class, bundleTranslationProvider);
appContext.set(Adapter.class.getName(), ContextInjectionFactory.make(EclipseAdapter.class, appContext));
appContext.set(IServiceConstants.ACTIVE_PART, new ActivePartLookupFunction());
appContext.set(IExceptionHandler.class.getName(), exceptionHandler);
appContext.set(IExtensionRegistry.class.getName(), registry);
appContext.set(IServiceConstants.ACTIVE_SHELL, new ActiveChildLookupFunction(IServiceConstants.ACTIVE_SHELL, E4Workbench.LOCAL_ACTIVE_SHELL));
appContext.set(IExtensionRegistry.class.getName(), registry);
appContext.set(IContributionFactory.class.getName(), contributionFactory);
return appContext;
}