blob: 1a0390ceaa1744e9c969d3d1ea1fe9cf209e15c9 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2011-2018 EclipseSource Muenchen GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* EclipseSource Munich - initial API and implementation
*
******************************************************************************/
package org.eclipse.emf.ecp.e4.emfstore;
import javax.inject.Named;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.emf.ecp.emfstore.internal.ui.handler.EMFStoreLogInHelper;
import org.eclipse.emf.ecp.spi.core.InternalRepository;
import org.eclipse.swt.widgets.Shell;
/**
* Handler to trigger the login for an {@link InternalRepository}.
*
* @see EMFStoreLogInHelper#login(InternalRepository, Shell)
* @author Eugen Neufeld
*/
public class LogInHandler {
/**
* Called by the framework when handler is triggered.
*
* @param shell The current {@link Shell}
* @param ecpRepository The currently selected {@link InternalRepository}
*/
@Execute
public void execute(Shell shell,
@Named(IServiceConstants.ACTIVE_SELECTION) @Optional InternalRepository ecpRepository) {
if (ecpRepository != null) {
EMFStoreLogInHelper.login(ecpRepository, shell);
}
}
}