Skip to content

Package: CreateRemoteProjectHelper

CreateRemoteProjectHelper

nameinstructionbranchcomplexitylinemethod
createRemoteProject(InternalRepository, Shell)
M: 38 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 12 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.InternalRepository;
20: import org.eclipse.emf.emfstore.client.ESServer;
21: import org.eclipse.emf.emfstore.internal.client.ui.controller.UICreateRemoteProjectController;
22: import org.eclipse.jface.dialogs.InputDialog;
23: import org.eclipse.jface.window.Window;
24: import org.eclipse.swt.widgets.Shell;
25:
26: /**
27: * This is the EMFStore Create Remote Project helper delegating to the EMFStore {@link UICreateRemoteProjectController}.
28: *
29: * @author Eugen Neufeld
30: *
31: */
32: public final class CreateRemoteProjectHelper {
33:
34:         private CreateRemoteProjectHelper() {
35:         }
36:
37:         /**
38:          * Create a remote project on an {@link InternalRepository}. Delegates to {@link UICreateRemoteProjectController}.
39:          *
40:          * @param ecpRepository the {@link InternalRepository}
41:          * @param shell the {@link Shell}
42:          */
43:         public static void createRemoteProject(InternalRepository ecpRepository, Shell shell) {
44:                 final ESServer server = EMFStoreProvider.INSTANCE.getServerInfo(ecpRepository);
45:                 // FIXME:
46:                 final InputDialog dialog = new InputDialog(shell, Messages.CreateRemoteProjectHelper_RemoteProjectName,
47:                         Messages.CreateRemoteProjectHelper_EnterName, "", null); //$NON-NLS-1$
48:
49:                 String projectName = null;
50:•                if (dialog.open() == Window.OK) {
51:                         projectName = dialog.getValue();
52:                 }
53:
54:•                if (projectName == null) {
55:                         return;
56:                 }
57:                 // TODO EMFStore Contructor is missing
58:                 new UICreateRemoteProjectController(shell, server.getLastUsersession(), projectName)
59:                         .execute();
60:                 ecpRepository.notifyObjectsChanged(Collections.singleton((Object) ecpRepository));
61:         }
62: }