View | Details | Raw Unified | Return to bug 293453 | Differences between
and this patch

Collapse All | Expand All

(-)META-INF/MANIFEST.MF (+1 lines)
Lines 8-13 Link Here
8
Bundle-Localization: plugin
8
Bundle-Localization: plugin
9
Export-Package: org.eclipse.team.internal.ui;x-friends:="org.eclipse.team.cvs.ssh,org.eclipse.team.cvs.ssh2,org.eclipse.team.cvs.ui",
9
Export-Package: org.eclipse.team.internal.ui;x-friends:="org.eclipse.team.cvs.ssh,org.eclipse.team.cvs.ssh2,org.eclipse.team.cvs.ui",
10
 org.eclipse.team.internal.ui.actions;x-friends:="org.eclipse.team.cvs.ssh,org.eclipse.team.cvs.ssh2,org.eclipse.team.cvs.ui",
10
 org.eclipse.team.internal.ui.actions;x-friends:="org.eclipse.team.cvs.ssh,org.eclipse.team.cvs.ssh2,org.eclipse.team.cvs.ui",
11
 org.eclipse.team.internal.ui.commands;x-internal:=true,
11
 org.eclipse.team.internal.ui.dialogs;x-friends:="org.eclipse.team.cvs.ssh,org.eclipse.team.cvs.ssh2,org.eclipse.team.cvs.ui",
12
 org.eclipse.team.internal.ui.dialogs;x-friends:="org.eclipse.team.cvs.ssh,org.eclipse.team.cvs.ssh2,org.eclipse.team.cvs.ui",
12
 org.eclipse.team.internal.ui.history;x-friends:="org.eclipse.team.cvs.ssh,org.eclipse.team.cvs.ssh2,org.eclipse.team.cvs.ui",
13
 org.eclipse.team.internal.ui.history;x-friends:="org.eclipse.team.cvs.ssh,org.eclipse.team.cvs.ssh2,org.eclipse.team.cvs.ui",
13
 org.eclipse.team.internal.ui.mapping;x-friends:="org.eclipse.team.cvs.ssh,org.eclipse.team.cvs.ssh2,org.eclipse.team.cvs.ui",
14
 org.eclipse.team.internal.ui.mapping;x-friends:="org.eclipse.team.cvs.ssh,org.eclipse.team.cvs.ssh2,org.eclipse.team.cvs.ui",
(-)plugin.properties (+5 lines)
Lines 78-80 Link Here
78
CompareWithEachOtherAction.tooltip= Compare the Selected Resources
78
CompareWithEachOtherAction.tooltip= Compare the Selected Resources
79
79
80
ignoresTransferName= Team Ignored Resources Transfer
80
ignoresTransferName= Team Ignored Resources Transfer
81
82
Share_single_project_command.description = Share project using team provider
83
Share_single_project_command.name = Share using {0}
84
Share_single_project_command.parameter.name = Provider
85
Share_single_project_command.parameter.name.0 = Project
(-)plugin.xml (+18 lines)
Lines 329-334 Link Here
329
        	description="%Synchronizing.openPerspectiveDescription"
329
        	description="%Synchronizing.openPerspectiveDescription"
330
        	categoryId="org.eclipse.ui.category.perspectives"
330
        	categoryId="org.eclipse.ui.category.perspectives"
331
        	id="org.eclipse.team.ui.TeamSynchronizingPerspective"/>
331
        	id="org.eclipse.team.ui.TeamSynchronizingPerspective"/>
332
      <command
333
            defaultHandler="org.eclipse.team.internal.ui.commands.ShareSingleProjectCommand"
334
            description="%Share_single_project_command.description"
335
            id="org.eclipse.team.ui.ShareSingleProjectWithProvider"
336
            name="%Share_single_project_command.name">
337
         <commandParameter
338
               id="org.eclipse.team.internal.ui.commands.TeamProviderNameParameter"
339
               name="%Share_single_project_command.parameter.name"
340
               optional="false"
341
               values="org.eclipse.team.internal.ui.commands.TeamProviderNameParameterValues">
342
         </commandParameter>
343
         <commandParameter
344
               id="org.eclipse.team.internal.ui.commands.ProjectNameParameter"
345
               name="%Share_single_project_command.parameter.name.0"
346
               optional="false"
347
               values="org.eclipse.team.internal.ui.commands.ProjectNameParameterValues">
348
         </commandParameter>
349
      </command>
332
   </extension>
350
   </extension>
333
   
351
   
334
   <extension
352
   <extension
(-)src/org/eclipse/team/internal/ui/commands/ProjectNameParameterValues.java (+40 lines)
Added Link Here
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.team.internal.ui.commands;
10
11
import java.util.HashMap;
12
import java.util.Map;
13
14
import org.eclipse.core.commands.IParameterValues;
15
import org.eclipse.core.resources.IProject;
16
import org.eclipse.core.resources.IWorkspaceRoot;
17
import org.eclipse.core.resources.ResourcesPlugin;
18
import org.eclipse.team.core.RepositoryProvider;
19
20
/**
21
 * Provides list of accessible and non-shared projects' names for the Share
22
 * Project command.
23
 */
24
public class ProjectNameParameterValues implements IParameterValues {
25
26
	public Map getParameterValues() {
27
		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
28
		IProject[] projects = root.getProjects();
29
		Map paramValues = new HashMap();
30
		for (int i = 0; i < projects.length; i++) {
31
			IProject project = projects[i];
32
			final boolean notAlreadyShared = RepositoryProvider
33
					.getProvider(project) == null;
34
			if (project.isAccessible() && notAlreadyShared)
35
				paramValues.put(project.getName(), project.getName());
36
		}
37
		return paramValues;
38
	}
39
40
}
(-)src/org/eclipse/team/internal/ui/commands/ShareSingleProjectCommand.java (+82 lines)
Added Link Here
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.team.internal.ui.commands;
10
11
import org.eclipse.core.commands.*;
12
import org.eclipse.core.resources.IProject;
13
import org.eclipse.core.resources.ResourcesPlugin;
14
import org.eclipse.core.runtime.*;
15
import org.eclipse.swt.widgets.Shell;
16
import org.eclipse.team.internal.ui.wizards.ConfigureProjectWizard;
17
import org.eclipse.team.ui.IConfigurationWizard;
18
import org.eclipse.ui.IWorkbench;
19
import org.eclipse.ui.handlers.HandlerUtil;
20
21
/**
22
 * Provides a handler for the Share Project command. This can then be bound to
23
 * whatever keybinding the user prefers.
24
 */
25
public class ShareSingleProjectCommand extends AbstractHandler {
26
27
	private static final String TEAM_WIZARD_NAME_PARAMETER = "org.eclipse.team.internal.ui.commands.TeamProviderNameParameter"; //$NON-NLS-1$
28
29
	private static final String PROJECT_NAME_PARAMETER = "org.eclipse.team.internal.ui.commands.ProjectNameParameter"; //$NON-NLS-1$
30
31
	static final String TEAM_UI_CONFIGURATION_WIZARD_EXTENSION = "org.eclipse.team.ui.configurationWizards"; //$NON-NLS-1$
32
33
	/**
34
	 * Invokes a wizard dialog which associates a project with a given team
35
	 * provider. Wizard dialog must be declared in
36
	 * org.eclipse.team.ui.configurationWizards extension point and extend
37
	 * {@link IConfigurationWizard}.
38
	 *
39
	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
40
	 */
41
	public Object execute(ExecutionEvent event) throws ExecutionException {
42
		final String projectName = event.getParameter(PROJECT_NAME_PARAMETER);
43
		final IProject projectToShare = ResourcesPlugin.getWorkspace()
44
				.getRoot().getProject(projectName);
45
		IWorkbench workbench = HandlerUtil.getActiveWorkbenchWindow(event)
46
				.getWorkbench();
47
		final IExtensionRegistry extensionRegistry = Platform
48
				.getExtensionRegistry();
49
		final IExtensionPoint extension = extensionRegistry
50
				.getExtensionPoint(ShareSingleProjectCommand.TEAM_UI_CONFIGURATION_WIZARD_EXTENSION);
51
		IConfigurationElement[] configurationElements = extension
52
				.getConfigurationElements();
53
		try {
54
			IConfigurationWizard wizard = findAndInstantiateWizard(event,
55
					configurationElements);
56
			wizard.init(workbench, projectToShare);
57
			final Shell shell = HandlerUtil.getActiveShell(event);
58
			ConfigureProjectWizard.openWizard(shell, wizard);
59
		} catch (CoreException e) {
60
			// TODO Auto-generated catch block
61
			e.printStackTrace();
62
		}
63
		return null;
64
	}
65
66
	private IConfigurationWizard findAndInstantiateWizard(ExecutionEvent event,
67
			IConfigurationElement[] configurationElements) throws CoreException {
68
		for (int i = 0; i < configurationElements.length; i++) {
69
			IConfigurationElement element = configurationElements[i];
70
			final String id = element.getAttribute("id"); //$NON-NLS-1$
71
			if (id != null
72
					&& id
73
							.equals(event
74
									.getParameter(TEAM_WIZARD_NAME_PARAMETER))) {
75
76
				return (IConfigurationWizard) element
77
						.createExecutableExtension("class"); //$NON-NLS-1$
78
			}
79
		}
80
		return null;
81
	}
82
}
(-)src/org/eclipse/team/internal/ui/commands/TeamProviderNameParameterValues.java (+38 lines)
Added Link Here
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.team.internal.ui.commands;
10
11
import java.util.HashMap;
12
import java.util.Map;
13
14
import org.eclipse.core.commands.IParameterValues;
15
import org.eclipse.core.runtime.IConfigurationElement;
16
import org.eclipse.core.runtime.Platform;
17
18
/**
19
 * Provides list of available team providers' names for the Share Project
20
 * command.
21
 */
22
public class TeamProviderNameParameterValues implements IParameterValues {
23
24
	public Map getParameterValues() {
25
		IConfigurationElement[] configurationElements = Platform
26
				.getExtensionRegistry()
27
				.getConfigurationElementsFor(
28
						ShareSingleProjectCommand.TEAM_UI_CONFIGURATION_WIZARD_EXTENSION);
29
		Map paramValues = new HashMap();
30
		for (int i = 0; i < configurationElements.length; i++) {
31
			IConfigurationElement teamWizard = configurationElements[i];
32
			paramValues.put(teamWizard.getAttribute("name"), teamWizard //$NON-NLS-1$
33
					.getAttribute("id")); //$NON-NLS-1$
34
		}
35
		return paramValues;
36
	}
37
38
}

Return to bug 293453