diff --git a/plugin.properties b/plugin.properties
index af0be47..f9f1580 100644
--- a/plugin.properties
+++ b/plugin.properties
@@ -78,3 +78,8 @@ CompareWithEachOtherAction.label= &Each Other
CompareWithEachOtherAction.tooltip= Compare the Selected Resources
ignoresTransferName= Team Ignored Resources Transfer
+
+Share_single_project_command.description = Share project using team provider
+Share_single_project_command.name = Share using {0}
+Share_single_project_command.parameter.name = Provider
+Share_single_project_command.parameter.name.0 = Project
diff --git a/plugin.xml b/plugin.xml
index 9ae149d..a6b496b 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -323,6 +323,24 @@
description="%Synchronizing.openPerspectiveDescription"
categoryId="org.eclipse.ui.category.perspectives"
id="org.eclipse.team.ui.TeamSynchronizingPerspective"/>
+
+
+
+
+
+
+ *
+ * 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.team.internal.ui.commands;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.commands.IParameterValues;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.team.core.RepositoryProvider;
+
+/**
+ * Provides list of accessible and non-shared projects' names for the Share
+ * Project command.
+ */
+public class ProjectNameParameterValues implements IParameterValues {
+
+ public Map getParameterValues() {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IProject[] projects = root.getProjects();
+ Map paramValues = new HashMap();
+ for (int i = 0; i < projects.length; i++) {
+ IProject project = projects[i];
+ final boolean notAlreadyShared = RepositoryProvider
+ .getProvider(project) == null;
+ if (project.isAccessible() && notAlreadyShared)
+ paramValues.put(project.getName(), project.getName());
+ }
+ return paramValues;
+ }
+
+}
diff --git a/src/org/eclipse/team/internal/ui/commands/ShareSingleProjectCommand.java b/src/org/eclipse/team/internal/ui/commands/ShareSingleProjectCommand.java
new file mode 100644
index 0000000..499a5d3
--- /dev/null
+++ b/src/org/eclipse/team/internal/ui/commands/ShareSingleProjectCommand.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (C) 2009, Mykola Nikishov
+ *
+ * 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.team.internal.ui.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.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.team.internal.ui.wizards.ConfigureProjectWizard;
+import org.eclipse.team.ui.IConfigurationWizard;
+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.
+ */
+public class ShareSingleProjectCommand extends AbstractHandler {
+
+ private static final String TEAM_WIZARD_NAME_PARAMETER = "org.eclipse.team.internal.ui.commands.TeamProviderNameParameter"; //$NON-NLS-1$
+
+ private static final String PROJECT_NAME_PARAMETER = "org.eclipse.team.internal.ui.commands.ProjectNameParameter"; //$NON-NLS-1$
+
+ static final String TEAM_UI_CONFIGURATION_WIZARD_EXTENSION = "org.eclipse.team.ui.configurationWizards"; //$NON-NLS-1$
+
+ /**
+ * Invokes a wizard dialog which associates a project with a given team
+ * provider. Wizard dialog must be declared in
+ * org.eclipse.team.ui.configurationWizards extension point and extend
+ * {@link IConfigurationWizard}.
+ *
+ * @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 IExtensionRegistry extensionRegistry = Platform
+ .getExtensionRegistry();
+ final IExtensionPoint extension = extensionRegistry
+ .getExtensionPoint(ShareSingleProjectCommand.TEAM_UI_CONFIGURATION_WIZARD_EXTENSION);
+ IConfigurationElement[] configurationElements = extension
+ .getConfigurationElements();
+ try {
+ IConfigurationWizard wizard = findAndInstantiateWizard(event,
+ configurationElements);
+ wizard.init(workbench, projectToShare);
+ final Shell shell = HandlerUtil.getActiveShell(event);
+ ConfigureProjectWizard.openWizard(shell, wizard);
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ private IConfigurationWizard findAndInstantiateWizard(ExecutionEvent event,
+ IConfigurationElement[] configurationElements) throws CoreException {
+ for (int i = 0; i < configurationElements.length; i++) {
+ IConfigurationElement element = configurationElements[i];
+ final String id = element.getAttribute("id");
+ if (id != null
+ && id
+ .equals(event
+ .getParameter(TEAM_WIZARD_NAME_PARAMETER))) {
+
+ return (IConfigurationWizard) element
+ .createExecutableExtension("class"); //$NON-NLS-1$
+ }
+ }
+ return null;
+ }
+}
diff --git a/src/org/eclipse/team/internal/ui/commands/TeamProviderNameParameterValues.java b/src/org/eclipse/team/internal/ui/commands/TeamProviderNameParameterValues.java
new file mode 100644
index 0000000..a93db0b
--- /dev/null
+++ b/src/org/eclipse/team/internal/ui/commands/TeamProviderNameParameterValues.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (C) 2009, Mykola Nikishov
+ *
+ * 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.team.internal.ui.commands;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.commands.IParameterValues;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+
+/**
+ * Provides list of available team providers' names for the Share Project
+ * command.
+ */
+public class TeamProviderNameParameterValues implements IParameterValues {
+
+ public Map getParameterValues() {
+ IConfigurationElement[] configurationElements = Platform
+ .getExtensionRegistry()
+ .getConfigurationElementsFor(
+ ShareSingleProjectCommand.TEAM_UI_CONFIGURATION_WIZARD_EXTENSION);
+ Map paramValues = new HashMap();
+ for (int i = 0; i < configurationElements.length; i++) {
+ IConfigurationElement teamWizard = configurationElements[i];
+ paramValues.put(teamWizard.getAttribute("name"), teamWizard //$NON-NLS-1$
+ .getAttribute("id")); //$NON-NLS-1$
+ }
+ return paramValues;
+ }
+
+}