| /** |
| * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| */ |
| package org.eclipse.osbp.vaaclipse.common.ecview; |
| |
| import java.util.HashMap; |
| import java.util.Map; |
| |
| import javax.inject.Inject; |
| import javax.inject.Named; |
| |
| import org.eclipse.e4.core.contexts.IEclipseContext; |
| import org.eclipse.osbp.ecview.core.common.context.IViewContext; |
| import org.eclipse.osbp.runtime.common.i18n.II18nService; |
| import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService; |
| import org.eclipse.osbp.ui.api.user.IUser; |
| import org.eclipse.osbp.vaaclipse.common.ecview.api.IECViewSessionHelper; |
| import org.eclipse.osbp.vaaclipse.publicapi.authentication.AuthenticationConstants; |
| |
| public class ECViewSessionHelper implements IECViewSessionHelper { |
| |
| @Inject |
| @Named(AuthenticationConstants.USER_ID) |
| private String userId; |
| @Inject |
| private II18nService i18nService; |
| @Inject |
| private org.eclipse.e4.core.services.events.IEventBroker eventBroker; |
| @Inject |
| private IUser user; |
| @Inject |
| private IDSLMetadataService dslMetadataService; |
| @Inject |
| IEclipseContext context; |
| |
| @Override |
| public Map<String, Object> createBasicProperties() { |
| Map<String, Object> properties = new HashMap<String, Object>(); |
| properties.put("userId", userId); |
| |
| // register services to be used |
| Map<String, Object> services = new HashMap<String, Object>(); |
| services.put(org.eclipse.osbp.runtime.common.event.IEventBroker.class.getName(), new E4EventBrokerAdapter(eventBroker)); |
| services.put(IUser.class.getName(), user); |
| services.put(IViewContext.PARAM_THIRDPARTY_SERVICE_PROVIDER, new ECViewToE4ServiceBridge(context)); |
| properties.put(IViewContext.PARAM_SERVICES, services); |
| |
| return properties; |
| } |
| |
| } |