Added
Link Here
|
0 |
- |
1 |
/******************************************************************************* |
|
|
2 |
* Copyright (C) 2009, Mykola Nikishov <mn@mn.com.ua> |
3 |
* |
4 |
* All rights reserved. This program and the accompanying materials |
5 |
* are made available under the terms of the Eclipse Public License v1.0 |
6 |
* which accompanies this distribution, and is available at |
7 |
* http://www.eclipse.org/legal/epl-v10.html |
8 |
*******************************************************************************/ |
9 |
package org.eclipse.egit.ui.internal.commands; |
10 |
|
11 |
import org.eclipse.core.commands.AbstractHandler; |
12 |
import org.eclipse.core.commands.ExecutionEvent; |
13 |
import org.eclipse.core.commands.ExecutionException; |
14 |
import org.eclipse.core.resources.IProject; |
15 |
import org.eclipse.core.resources.ResourcesPlugin; |
16 |
import org.eclipse.egit.ui.internal.sharing.SharingWizard; |
17 |
import org.eclipse.swt.widgets.Shell; |
18 |
import org.eclipse.team.internal.ui.wizards.ConfigureProjectWizard; |
19 |
import org.eclipse.ui.IWorkbench; |
20 |
import org.eclipse.ui.handlers.HandlerUtil; |
21 |
|
22 |
/** |
23 |
* Provides a handler for the Share Project command. This can then be bound to |
24 |
* whatever keybinding the user prefers. |
25 |
* |
26 |
* @since 0.6.0 |
27 |
*/ |
28 |
public class ShareSingleProjectCommand extends AbstractHandler { |
29 |
|
30 |
private static final String PROJECT_NAME_PARAMETER = "org.eclipse.egit.ui.command.projectNameParameter"; //$NON-NLS-1$ |
31 |
|
32 |
/** |
33 |
* Invokes 'Configure Git Repository' dialog to share given project. |
34 |
* |
35 |
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
36 |
*/ |
37 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
38 |
final String projectName = event.getParameter(PROJECT_NAME_PARAMETER); |
39 |
final IProject projectToShare = ResourcesPlugin.getWorkspace() |
40 |
.getRoot().getProject(projectName); |
41 |
IWorkbench workbench = HandlerUtil.getActiveWorkbenchWindow(event) |
42 |
.getWorkbench(); |
43 |
|
44 |
final SharingWizard wizard = new SharingWizard(); |
45 |
wizard.init(workbench, projectToShare); |
46 |
final Shell shell = HandlerUtil.getActiveShell(event); |
47 |
ConfigureProjectWizard.openWizard(shell, wizard); |
48 |
return null; |
49 |
} |
50 |
|
51 |
} |