blob: 3d9468dd3183f905c0a4ff80e12ac772ede81c2a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/*******************************************************************************
* Copyright (C) 2009, Mykola Nikishov <mn@mn.com.ua>
*
* 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
*******************************************************************************/
package org.eclipse.egit.ui.internal.commands;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.egit.ui.internal.sharing.SharingWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.handlers.HandlerUtil;
/**
* Provides a handler for the Share Project command. This can then be bound to
* whatever keybinding the user prefers.
*
* @since 0.6.0
*/
public class ShareSingleProjectCommand extends AbstractHandler {
private static final String PROJECT_NAME_PARAMETER = "org.eclipse.egit.ui.command.projectNameParameter"; //$NON-NLS-1$
/**
* Invokes 'Configure Git Repository' dialog to share given project.
*
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
final String projectName = event.getParameter(PROJECT_NAME_PARAMETER);
final IProject projectToShare = ResourcesPlugin.getWorkspace()
.getRoot().getProject(projectName);
IWorkbench workbench = HandlerUtil.getActiveWorkbenchWindow(event)
.getWorkbench();
final SharingWizard wizard = new SharingWizard();
wizard.init(workbench, projectToShare);
final Shell shell = HandlerUtil.getActiveShell(event);
WizardDialog wizardDialog = new WizardDialog(shell, wizard);
wizardDialog.setHelpAvailable(false);
wizardDialog.open();
return null;
}
}
|