1 /*******************************************************************************
2 * Copyright (C) 2009, Mykola Nikishov <mn@mn.com.ua>
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
;
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
.jface
.wizard
.WizardDialog
;
18 import org
.eclipse
.swt
.widgets
.Shell
;
19 import org
.eclipse
.ui
.IWorkbench
;
20 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
23 * Provides a handler for the Share Project command. This can then be bound to
24 * whatever keybinding the user prefers.
28 public class ShareSingleProjectCommand
extends AbstractHandler
{
30 private static final String PROJECT_NAME_PARAMETER
= "org.eclipse.egit.ui.command.projectNameParameter"; //$NON-NLS-1$
33 * Invokes 'Configure Git Repository' dialog to share given project.
35 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
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
)
44 final SharingWizard wizard
= new SharingWizard();
45 wizard
.init(workbench
, projectToShare
);
46 final Shell shell
= HandlerUtil
.getActiveShell(event
);
47 WizardDialog wizardDialog
= new WizardDialog(shell
, wizard
);