Skip to content

Package: CommitProjectHelper

CommitProjectHelper

nameinstructionbranchcomplexitylinemethod
commitProject(InternalProject, Shell)
M: 24 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2014 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Eugen - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.emfstore.internal.ui.handler;
15:
16: import java.util.Collections;
17:
18: import org.eclipse.emf.ecp.emfstore.core.internal.EMFStoreProvider;
19: import org.eclipse.emf.ecp.spi.core.InternalProject;
20: import org.eclipse.emf.emfstore.client.ESLocalProject;
21: import org.eclipse.emf.emfstore.internal.client.ui.controller.UICommitProjectController;
22: import org.eclipse.swt.widgets.Shell;
23:
24: /**
25: * This is the EMFStore Commit Helper delegating to the EMFStore {@link UICommitProjectController}.
26: *
27: * @author Eugen Neufeld
28: *
29: */
30: public final class CommitProjectHelper {
31:
32:         private CommitProjectHelper() {
33:
34:         }
35:
36:         /**
37:          * Delegates the call to {@link UICommitProjectController} and triggers an update of the provided
38:          * {@link InternalProject}.
39:          *
40:          * @param project the {@link InternalProject} to commit
41:          * @param shell the {@link Shell}
42:          */
43:         public static void commitProject(InternalProject project, Shell shell) {
44:                 final ESLocalProject localProject = EMFStoreProvider.INSTANCE.getProjectSpace(project);
45:                 // TODO EMFStore how to set usersession?
46:                 // -> why is this necessary? The project is already checked out
47:                 // if (localProject.getUsersession() == null) {
48:                 // ESServerImpl server = (ESServerImpl) EMFStoreProvider.INSTANCE.getServerInfo(project.getRepository());
49:                 // ServerInfo serverInfo = server.getInternalAPIImpl();
50:                 // RunESCommand
51:                 // ((ESLocalProjectImpl) localProject).getInternalAPIImpl().setUsersession(serverInfo.getLastUsersession());
52:                 // }
53:                 // ESUIControllerFactory.INSTANCE.commitProject(HandlerUtil.getActiveShell(event), projectSpace);
54:                 new UICommitProjectController(shell, localProject).execute();
55:                 // is structural because of possible merge
56:                 project.notifyObjectsChanged(Collections.singleton((Object) project.getRepository()), true);
57:                 project.getRepository().notifyObjectsChanged(Collections.singleton((Object) project.getRepository()));
58:         }
59: }