Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 173457 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/team/internal/ui/history/CompareLocalHistoryHandler.java (+24 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.team.internal.ui.history;
12
13
import org.eclipse.team.internal.ui.TeamUIMessages;
14
15
public class CompareLocalHistoryHandler extends ShowLocalHistoryHandler {
16
17
	protected boolean isCompare() {
18
		return true;
19
	}
20
	
21
	protected String getPromptTitle() {
22
		return TeamUIMessages.CompareLocalHistory_0;
23
	}
24
}
(-)src/org/eclipse/team/internal/ui/handlers/TeamHandler.java (+167 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.team.internal.ui.handlers;
12
13
import java.lang.reflect.InvocationTargetException;
14
import java.util.ArrayList;
15
16
import org.eclipse.core.commands.AbstractHandler;
17
import org.eclipse.core.commands.ExecutionEvent;
18
import org.eclipse.core.resources.IProject;
19
import org.eclipse.core.resources.IResource;
20
import org.eclipse.core.runtime.NullProgressMonitor;
21
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
22
import org.eclipse.jface.operation.IRunnableWithProgress;
23
import org.eclipse.jface.viewers.*;
24
import org.eclipse.swt.custom.BusyIndicator;
25
import org.eclipse.swt.widgets.Display;
26
import org.eclipse.swt.widgets.Shell;
27
import org.eclipse.team.internal.ui.TeamUIPlugin;
28
import org.eclipse.team.internal.ui.Utils;
29
import org.eclipse.ui.*;
30
import org.eclipse.ui.handlers.HandlerUtil;
31
32
public abstract class TeamHandler extends AbstractHandler {
33
34
	// Constants for determining the type of progress. Subclasses may
35
	// pass one of these values to the run method.
36
	public final static int PROGRESS_DIALOG = 1;
37
	public final static int PROGRESS_BUSYCURSOR = 2;
38
39
	/**
40
	 * Convenience method for running an operation with progress and error
41
	 * feedback.
42
	 * 
43
	 * @param runnable
44
	 *            the runnable which executes the operation
45
	 * @param problemMessage
46
	 *            the message to display in the case of errors
47
	 * @param progressKind
48
	 *            one of PROGRESS_BUSYCURSOR or PROGRESS_DIALOG
49
	 */
50
	final protected void run(final IRunnableWithProgress runnable,
51
			final String problemMessage, int progressKind, ExecutionEvent event) {
52
		final Exception[] exceptions = new Exception[] { null };
53
		switch (progressKind) {
54
		case PROGRESS_BUSYCURSOR:
55
			BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
56
				public void run() {
57
					try {
58
						runnable.run(new NullProgressMonitor());
59
					} catch (InvocationTargetException e) {
60
						exceptions[0] = e;
61
					} catch (InterruptedException e) {
62
						exceptions[0] = null;
63
					}
64
				}
65
			});
66
			break;
67
		default:
68
		case PROGRESS_DIALOG:
69
			try {
70
				new ProgressMonitorDialog(HandlerUtil.getActiveShell(event))
71
						.run(true, true, runnable);
72
			} catch (InvocationTargetException e) {
73
				exceptions[0] = e;
74
			} catch (InterruptedException e) {
75
				exceptions[0] = null;
76
			}
77
			break;
78
		}
79
		if (exceptions[0] != null) {
80
			handle(exceptions[0], null, problemMessage, event);
81
		}
82
	}
83
84
	/**
85
	 * Shows the given errors to the user.
86
	 * 
87
	 * @param exception
88
	 *            the status containing the error
89
	 * @param title
90
	 *            the title of the error dialog
91
	 * @param message
92
	 *            the message for the error dialog
93
	 */
94
	protected void handle(Exception exception, String title, String message,
95
			ExecutionEvent event) {
96
		Utils.handleError(HandlerUtil.getActiveShell(event), exception, title,
97
				message);
98
	}
99
100
	protected IResource[] getSelectedResources(ExecutionEvent event) {
101
		ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
102
		if (currentSelection == null
103
				|| !(currentSelection instanceof IStructuredSelection))
104
			currentSelection = StructuredSelection.EMPTY;
105
106
		return Utils
107
				.getContributedResources(((IStructuredSelection) currentSelection)
108
						.toArray());
109
	}
110
111
	protected IProject[] getSelectedProjects(ExecutionEvent event) {
112
		IResource[] selectedResources = getSelectedResources(event);
113
		if (selectedResources.length == 0)
114
			return new IProject[0];
115
		ArrayList projects = new ArrayList();
116
		for (int i = 0; i < selectedResources.length; i++) {
117
			IResource resource = selectedResources[i];
118
			if (resource.getType() == IResource.PROJECT) {
119
				projects.add(resource);
120
			}
121
		}
122
		return (IProject[]) projects.toArray(new IProject[projects.size()]);
123
	}
124
125
	protected IWorkbenchPart getTargetPart(ExecutionEvent event) {
126
		return HandlerUtil.getActivePart(event);
127
	}
128
129
	protected Shell getShell(ExecutionEvent event) {
130
		Shell shell = HandlerUtil.getActiveShell(event);
131
		if (shell != null) {
132
			return shell;
133
		} else if (HandlerUtil.getActivePart(event) != null) {
134
			return HandlerUtil.getActivePart(event).getSite().getShell();
135
		} else if (HandlerUtil.getActiveWorkbenchWindow(event) != null) {
136
			return HandlerUtil.getActiveWorkbenchWindow(event).getShell();
137
		} else {
138
			IWorkbench workbench = TeamUIPlugin.getPlugin().getWorkbench();
139
			if (workbench == null)
140
				return null;
141
			IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
142
			if (window == null)
143
				return null;
144
			return window.getShell();
145
		}
146
147
	}
148
149
	protected ISelection getSelection(ExecutionEvent event) {
150
		// ISelection selection = (ISelection) context
151
		// .getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
152
		ISelection selection = HandlerUtil.getCurrentSelection(event);
153
		if (selection != null)
154
			return selection;
155
		// IWorkbenchWindow activeWorkbenchWindow =
156
		// getActiveWorkbenchWindow(context);
157
		IWorkbenchWindow activeWorkbenchWindow = HandlerUtil
158
				.getActiveWorkbenchWindow(event);
159
		if (activeWorkbenchWindow != null) {
160
			IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
161
			if (activePage != null) {
162
				return activePage.getSelection();
163
			}
164
		}
165
		return null;
166
	}
167
}
(-)src/org/eclipse/team/internal/ui/handlers/ApplyPatchHandler.java (+41 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.team.internal.ui.handlers;
12
13
import org.eclipse.compare.patch.ApplyPatchOperation;
14
import org.eclipse.core.commands.ExecutionEvent;
15
import org.eclipse.core.commands.ExecutionException;
16
import org.eclipse.core.resources.IResource;
17
import org.eclipse.swt.custom.BusyIndicator;
18
import org.eclipse.swt.widgets.Display;
19
20
public class ApplyPatchHandler extends TeamHandler {
21
22
	public Object execute(ExecutionEvent event) throws ExecutionException {
23
		System.out.println("applyPatchHandler");
24
		IResource[] resources = getSelectedResources(event);
25
26
		IResource resource = null;
27
		if (resources.length > 0) {
28
			resource = resources[0];
29
		}
30
		ApplyPatchOperation op = new ApplyPatchOperation(getTargetPart(event),
31
				resource);
32
		BusyIndicator.showWhile(Display.getDefault(), op);
33
34
		return null;
35
	}
36
37
	public boolean isEnabled() {
38
		return true;
39
	}
40
41
}
(-)src/org/eclipse/team/internal/ui/actions/ApplyPatchAction.java (+43 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.team.internal.ui.actions;
12
13
import org.eclipse.compare.patch.ApplyPatchOperation;
14
import org.eclipse.core.resources.IResource;
15
import org.eclipse.jface.action.IAction;
16
import org.eclipse.swt.custom.BusyIndicator;
17
import org.eclipse.swt.widgets.Display;
18
import org.eclipse.team.core.TeamException;
19
20
/**
21
 * @deprecated Use
22
 *             <code>org.eclipse.team.internal.ui.handlers.ApplyPatchHandler</code>
23
 *             instead.
24
 */
25
public class ApplyPatchAction extends TeamAction {
26
27
	protected boolean isEnabled() throws TeamException {
28
		return true;
29
	}
30
31
	public void run(IAction action) {
32
		System.out.println("applyPatchAction");
33
		IResource[] resources = getSelectedResources();
34
		IResource resource = null;
35
		if (resources.length > 0) {
36
			resource = resources[0];
37
		}
38
		ApplyPatchOperation op = new ApplyPatchOperation(getTargetPart(),
39
				resource);
40
		BusyIndicator.showWhile(Display.getDefault(), op);
41
	}
42
43
}
(-)src/org/eclipse/team/internal/ui/handlers/ConfigureProjectHandler.java (+66 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.team.internal.ui.handlers;
12
13
import java.lang.reflect.InvocationTargetException;
14
15
import org.eclipse.core.commands.ExecutionEvent;
16
import org.eclipse.core.commands.ExecutionException;
17
import org.eclipse.core.resources.IProject;
18
import org.eclipse.core.runtime.IProgressMonitor;
19
import org.eclipse.jface.operation.IRunnableWithProgress;
20
import org.eclipse.jface.wizard.IWizard;
21
import org.eclipse.jface.wizard.WizardDialog;
22
import org.eclipse.swt.SWT;
23
import org.eclipse.swt.widgets.Shell;
24
import org.eclipse.team.internal.ui.TeamUIMessages;
25
import org.eclipse.team.internal.ui.actions.TeamAction;
26
import org.eclipse.team.internal.ui.wizards.ConfigureProjectWizard;
27
28
public class ConfigureProjectHandler extends TeamHandler {
29
	
30
	private static class ResizeWizardDialog extends WizardDialog {
31
		public ResizeWizardDialog(Shell parentShell, IWizard newWizard) {
32
			super(parentShell, newWizard);
33
			setShellStyle(getShellStyle() | SWT.RESIZE);
34
		}		
35
	}
36
	
37
	public Object execute(final ExecutionEvent event) throws ExecutionException {
38
		System.out.println("ConfigureProjectHandler:execute");
39
		run(new IRunnableWithProgress() {
40
			public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
41
				try {
42
					IProject project = getSelectedProjects(event)[0];
43
					ConfigureProjectWizard wizard = new ConfigureProjectWizard();
44
					wizard.init(null, project);
45
					WizardDialog dialog = new ResizeWizardDialog(getShell(event), wizard);
46
					//dialog.
47
					dialog.open();
48
				} catch (Exception e) {
49
					throw new InvocationTargetException(e);
50
				}
51
			}
52
		}, TeamUIMessages.ConfigureProjectAction_configureProject, TeamAction.PROGRESS_BUSYCURSOR,event); 
53
54
		return null;
55
	}
56
	
57
	public boolean isEnabled() {
58
//		IProject[] selectedProjects = getSelectedProjects();
59
//		if (selectedProjects.length != 1) return false;
60
//		if (!selectedProjects[0].isAccessible()) return false;
61
//		if (!RepositoryProvider.isShared(selectedProjects[0])) return true;
62
//		return false;
63
		return true;
64
	}
65
	
66
}
(-)src/org/eclipse/team/internal/ui/handlers/ImportProjectSetHandler.java (+62 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.team.internal.ui.handlers;
12
13
import java.lang.reflect.InvocationTargetException;
14
import java.util.Iterator;
15
16
import org.eclipse.core.commands.ExecutionEvent;
17
import org.eclipse.core.commands.ExecutionException;
18
import org.eclipse.core.resources.IFile;
19
import org.eclipse.core.runtime.*;
20
import org.eclipse.jface.dialogs.ErrorDialog;
21
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
22
import org.eclipse.jface.operation.IRunnableWithProgress;
23
import org.eclipse.jface.viewers.ITreeSelection;
24
import org.eclipse.swt.widgets.Display;
25
import org.eclipse.swt.widgets.Shell;
26
import org.eclipse.team.internal.ui.*;
27
import org.eclipse.ui.handlers.HandlerUtil;
28
29
public class ImportProjectSetHandler extends TeamHandler {
30
31
	public Object execute(final ExecutionEvent event) throws ExecutionException {
32
33
		final ITreeSelection treeSelection = ((ITreeSelection) HandlerUtil
34
				.getCurrentSelection(event));
35
36
		final Shell shell = Display.getDefault().getActiveShell();
37
		try {
38
			new ProgressMonitorDialog(shell).run(true, true,
39
					new IRunnableWithProgress() {
40
						public void run(IProgressMonitor monitor)
41
								throws InvocationTargetException,
42
								InterruptedException {
43
							Iterator iterator = treeSelection.iterator();
44
							while (iterator.hasNext()) {
45
								IFile file = (IFile) iterator.next();
46
								ProjectSetImporter.importProjectSet(file
47
										.getLocation().toString(), shell,
48
										monitor);
49
							}
50
						}
51
					});
52
		} catch (InvocationTargetException exception) {
53
			ErrorDialog.openError(shell, null, null, new Status(IStatus.ERROR,
54
					TeamUIPlugin.PLUGIN_ID, IStatus.ERROR,
55
					TeamUIMessages.ImportProjectSetAction_0, exception
56
							.getTargetException()));
57
		} catch (InterruptedException exception) {
58
		}
59
60
		return null;
61
	}
62
}
(-)src/org/eclipse/team/internal/ui/actions/ImportProjectSetAction.java (+78 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.team.internal.ui.actions;
12
13
import java.lang.reflect.InvocationTargetException;
14
import java.util.Iterator;
15
16
import org.eclipse.core.resources.IFile;
17
import org.eclipse.core.runtime.IProgressMonitor;
18
import org.eclipse.core.runtime.IStatus;
19
import org.eclipse.core.runtime.Status;
20
import org.eclipse.jface.action.IAction;
21
import org.eclipse.jface.dialogs.ErrorDialog;
22
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
23
import org.eclipse.jface.operation.IRunnableWithProgress;
24
import org.eclipse.jface.viewers.ISelection;
25
import org.eclipse.jface.viewers.IStructuredSelection;
26
import org.eclipse.swt.widgets.Display;
27
import org.eclipse.swt.widgets.Shell;
28
import org.eclipse.team.internal.ui.*;
29
import org.eclipse.ui.IObjectActionDelegate;
30
import org.eclipse.ui.IWorkbenchPart;
31
import org.eclipse.ui.actions.ActionDelegate;
32
33
/**
34
 * @deprecated Use
35
 *             <code>org.eclipse.team.internal.ui.handlers.ImportProjectSetHandler</code>
36
 *             instead.
37
 */
38
public class ImportProjectSetAction extends ActionDelegate implements
39
		IObjectActionDelegate {
40
41
	private IStructuredSelection fSelection;
42
43
	public void run(IAction action) {
44
		final Shell shell = Display.getDefault().getActiveShell();
45
		try {
46
			new ProgressMonitorDialog(shell).run(true, true,
47
					new IRunnableWithProgress() {
48
						public void run(IProgressMonitor monitor)
49
								throws InvocationTargetException,
50
								InterruptedException {
51
							Iterator iterator = fSelection.iterator();
52
							while (iterator.hasNext()) {
53
								IFile file = (IFile) iterator.next();
54
								ProjectSetImporter.importProjectSet(file
55
										.getLocation().toString(), shell,
56
										monitor);
57
							}
58
						}
59
					});
60
		} catch (InvocationTargetException exception) {
61
			ErrorDialog.openError(shell, null, null, new Status(IStatus.ERROR,
62
					TeamUIPlugin.PLUGIN_ID, IStatus.ERROR,
63
					TeamUIMessages.ImportProjectSetAction_0, exception
64
							.getTargetException()));
65
		} catch (InterruptedException exception) {
66
		}
67
	}
68
69
	public void selectionChanged(IAction action, ISelection sel) {
70
		if (sel instanceof IStructuredSelection) {
71
			fSelection = (IStructuredSelection) sel;
72
		}
73
	}
74
75
	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
76
	}
77
78
}
(-)src/org/eclipse/team/internal/ui/history/ShowLocalHistoryHandler.java (+158 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.team.internal.ui.history;
12
13
import java.lang.reflect.InvocationTargetException;
14
15
import org.eclipse.core.commands.*;
16
import org.eclipse.core.resources.*;
17
import org.eclipse.core.runtime.*;
18
import org.eclipse.jface.dialogs.ErrorDialog;
19
import org.eclipse.jface.dialogs.MessageDialog;
20
import org.eclipse.jface.operation.IRunnableWithProgress;
21
import org.eclipse.jface.viewers.*;
22
import org.eclipse.swt.widgets.Shell;
23
import org.eclipse.team.internal.ui.TeamUIMessages;
24
import org.eclipse.team.internal.ui.TeamUIPlugin;
25
import org.eclipse.team.ui.TeamUI;
26
import org.eclipse.team.ui.history.IHistoryPage;
27
import org.eclipse.team.ui.history.IHistoryView;
28
import org.eclipse.ui.*;
29
import org.eclipse.ui.handlers.HandlerUtil;
30
31
public class ShowLocalHistoryHandler extends AbstractHandler /*ActionDelegate implements IObjectActionDelegate */{
32
33
//	private IStructuredSelection fSelection;
34
//	private IWorkbenchPart targetPart;
35
	
36
	public Object execute(final ExecutionEvent event) throws ExecutionException {
37
		System.out.println("ShowLocalHistoryHandler:execute");
38
		IFileState states[]= getLocalHistory(event);
39
		if (states == null || states.length == 0)
40
			return null;
41
		try {
42
			PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
43
				public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
44
					final IResource resource = (IResource) getSelection(event).getFirstElement();
45
					Runnable r = new Runnable() {
46
						public void run() {
47
							IHistoryView view = TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), resource,  LocalHistoryPageSource.getInstance());
48
							IHistoryPage page = view.getHistoryPage();
49
							if (page instanceof LocalHistoryPage){
50
								LocalHistoryPage historyPage = (LocalHistoryPage) page;
51
								historyPage.setClickAction(isCompare());
52
							}
53
						}
54
					};
55
					TeamUIPlugin.getStandardDisplay().asyncExec(r);				
56
				}
57
			});
58
		} catch (InvocationTargetException exception) {
59
			ErrorDialog.openError(getShell(event), null, null, new Status(IStatus.ERROR, TeamUIPlugin.PLUGIN_ID, IStatus.ERROR, TeamUIMessages.ShowLocalHistory_1, exception.getTargetException()));
60
		} catch (InterruptedException exception) {
61
		}
62
		return null;
63
	}
64
	
65
//	public void run(IAction action) {
66
//		IFileState states[]= getLocalHistory();
67
//		if (states == null || states.length == 0)
68
//			return;
69
//		try {
70
//			PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
71
//				public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
72
//					final IResource resource = (IResource) fSelection.getFirstElement();
73
//					Runnable r = new Runnable() {
74
//						public void run() {
75
//							IHistoryView view = TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), resource,  LocalHistoryPageSource.getInstance());
76
//							IHistoryPage page = view.getHistoryPage();
77
//							if (page instanceof LocalHistoryPage){
78
//								LocalHistoryPage historyPage = (LocalHistoryPage) page;
79
//								historyPage.setClickAction(isCompare());
80
//							}
81
//						}
82
//					};
83
//					TeamUIPlugin.getStandardDisplay().asyncExec(r);				
84
//				}
85
//			});
86
//		} catch (InvocationTargetException exception) {
87
//			ErrorDialog.openError(getShell(), null, null, new Status(IStatus.ERROR, TeamUIPlugin.PLUGIN_ID, IStatus.ERROR, TeamUIMessages.ShowLocalHistory_1, exception.getTargetException()));
88
//		} catch (InterruptedException exception) {
89
//		}
90
//	}
91
	
92
//	public void selectionChanged(IAction action, ISelection sel) {
93
//		if (sel instanceof IStructuredSelection) {
94
//			fSelection= (IStructuredSelection) sel;
95
//		}
96
//	}
97
//	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
98
//		this.targetPart = targetPart;
99
//	}
100
	
101
	protected Shell getShell(ExecutionEvent event) {
102
//		if (targetPart != null)
103
//			return targetPart.getSite().getShell();
104
//		return TeamUIPlugin.getActivePage().getActivePart().getSite().getShell();
105
		Shell shell = HandlerUtil.getActiveShell(event);
106
		if (shell != null) {
107
			return shell;
108
		} else if (HandlerUtil.getActivePart(event) != null) {
109
			return HandlerUtil.getActivePart(event).getSite().getShell();
110
		} else if (HandlerUtil.getActiveWorkbenchWindow(event) != null) {
111
			return HandlerUtil.getActiveWorkbenchWindow(event).getShell();
112
		} else {
113
			IWorkbench workbench = TeamUIPlugin.getPlugin().getWorkbench();
114
			if (workbench == null)
115
				return null;
116
			IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
117
			if (window == null)
118
				return null;
119
			return window.getShell();
120
		}
121
	}
122
123
	protected boolean isCompare() {
124
		return false;
125
	}
126
127
	public IStructuredSelection getSelection(ExecutionEvent event) {
128
//		return fSelection;
129
		ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
130
		if (currentSelection == null
131
				|| !(currentSelection instanceof IStructuredSelection))
132
			currentSelection = StructuredSelection.EMPTY;
133
		
134
		return (IStructuredSelection) currentSelection;
135
	}
136
	
137
	protected IFileState[] getLocalHistory(ExecutionEvent event) {
138
		final IFile file = (IFile) getSelection(event).getFirstElement();
139
		IFileState states[];
140
		try {
141
			states= file.getHistory(null);
142
		} catch (CoreException ex) {		
143
			MessageDialog.openError(getShell(event), getPromptTitle(), ex.getMessage());
144
			return null;
145
		}
146
		
147
		if (states == null || states.length <= 0) {
148
			MessageDialog.openInformation(getShell(event), getPromptTitle(), TeamUIMessages.ShowLocalHistory_0);
149
			return states;
150
		}
151
		return states;
152
	}
153
154
	protected String getPromptTitle() {
155
		return TeamUIMessages.ShowLocalHistory_2;
156
	}
157
158
}
(-)plugin.properties (+98 lines)
Added Link Here
1
###############################################################################
2
# Copyright (c) 2000, 2006 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#     IBM Corporation - initial API and implementation
10
###############################################################################
11
providerName=Eclipse.org
12
pluginName=Team Support UI
13
14
Team=Team
15
configurationWizards=Configuration Wizards
16
synchronizeParticipants=Synchronize Participants
17
synchronizeWizards=Synchronize Wizards
18
logicalViews=Logical Synchronize Views
19
20
PreferenceKeywords.Team=team
21
PreferenceKeywords.FileContent=team file content type
22
TeamPreferencePage.name=Team
23
TextPreferencePage.name=File Content
24
IgnorePreferencePage.name=Ignored Resources
25
26
ConfigureProject.label=Share Project...
27
ConfigureProject.tooltip=Share the project with others using a version and configuration management system.
28
ConfigureProject.mnemonic=S
29
30
ApplyPatch.label=Apply Patch...
31
ApplyPatch.tooltip=Apply a patch to one or more workspace projects.
32
ApplyPatch.mnemonic=y
33
Command.applyPatch.name=Apply Patch...
34
Command.applyPatch.description=Apply a patch to one or more workspace projects.
35
36
ImportProjectSet.label=Import Project &Set...
37
38
TeamGroupMenu.label=Team
39
TeamGroupMenu.mnemonic=e
40
Team.viewCategory=Team
41
42
Synchronizing.perspective=Team Synchronizing
43
Synchronizing.openPerspectiveDescription=Open the Team Synchronizing Perspective
44
SyncView.name=Synchronize
45
Synchronizing.perspective.description=This perspective is designed to support the synchronization of resources in the local workspace with their counterparts shared in a repository. It incorporates views for synchronizing, browsing history and comparing resource content.
46
47
ViewCommand.synchronizeView.name=Synchronize
48
ViewCommand.synchronizeView.description=Show the Synchronize view
49
ViewCommand.historyView.name=History
50
ViewCommand.historyView.description=Show the Team History view
51
52
ProjectSetImportWizard.name=Team Project Set
53
ProjectSetImportWizard.description=A wizard that imports a Team Project Set
54
ProjectSetExportWizard.name=Team Project Set
55
ProjectSetExportWizard.description=A wizard that exports a Team Project Set
56
57
Command.category.name=Team
58
Command.category.description=Actions that apply when working with a Team
59
60
Command.syncAll.name=Synchronize...
61
Command.syncAll.description=Synchronize resources in the workspace with another location
62
63
Command.syncLast.name=Repeat last synchronization
64
Command.syncLast.description=Repeat the last synchronization
65
66
Command.importProjectSet.name=Import Project Set...
67
Command.importProjectSet.description=Import Project Set into the workspace
68
69
Command.showLocalHistory.name=Show Local History
70
Command.showLocalHistory.description=Show Local History
71
72
Command.compareLocalHistory.name=Local History...
73
Command.compareLocalHistory.description=Compare the Selected Resource with Local History
74
75
Command.configureProject.name=Share Project...
76
77
CompressFolderView.name=Compress Folders
78
CompressFolderView.description=Compress in-sync folders paths
79
80
FileRevision.OpenAction.name=&Open
81
FileRevision.Compare.name=&Compare
82
83
TeamContentProvider = Team Content Providers
84
TeamDecorators = Team Decorators
85
HistoryView = History
86
ModelSyncParticipant = Synchronization
87
ResourcesContentExtension = Resources
88
EnabledModels = Models
89
Workspace=Workspace
90
91
ShowLocalHistory.label=Show Local History
92
ShowLocalHistory.mnemonic=H
93
CompareLocalHistory.label=Local History...
94
CompareLocalHistory.tooltip=Compare the Selected Resource with Local History
95
CompareLocalHistory.mnemonic=L
96
ReplaceLocalHistory.label= Local History...
97
ReplaceLocalHistory.tooltip= Replace the Selected Resource with Local History
98
ReplaceLocalHistory.mnemonic=L
(-)src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java (+80 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.team.internal.ui.actions;
12
13
 
14
import java.lang.reflect.InvocationTargetException;
15
16
import org.eclipse.core.resources.IProject;
17
import org.eclipse.core.runtime.IProgressMonitor;
18
import org.eclipse.jface.action.IAction;
19
import org.eclipse.jface.operation.IRunnableWithProgress;
20
import org.eclipse.jface.wizard.IWizard;
21
import org.eclipse.jface.wizard.WizardDialog;
22
import org.eclipse.swt.SWT;
23
import org.eclipse.swt.widgets.Shell;
24
import org.eclipse.team.core.RepositoryProvider;
25
import org.eclipse.team.internal.ui.TeamUIMessages;
26
import org.eclipse.team.internal.ui.wizards.ConfigureProjectWizard;
27
import org.eclipse.ui.IWorkbenchWindow;
28
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
29
30
/**
31
 * Action for configuring a project. Configuring involves associating
32
 * the project with a Team provider and performing any provider-specific
33
 * configuration that is necessary.
34
 * 
35
 * @deprecated Use <code>org.eclipse.team.internal.ui.handlers.ConfigureProjectHandler</code> instead. 
36
 */
37
public class ConfigureProjectAction extends TeamAction implements IWorkbenchWindowActionDelegate {
38
	private static class ResizeWizardDialog extends WizardDialog {
39
		public ResizeWizardDialog(Shell parentShell, IWizard newWizard) {
40
			super(parentShell, newWizard);
41
			setShellStyle(getShellStyle() | SWT.RESIZE);
42
		}		
43
	}
44
	
45
	/*
46
	 * Method declared on IActionDelegate.
47
	 */
48
	public void run(IAction action) {
49
		run(new IRunnableWithProgress() {
50
			public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
51
				try {
52
					IProject project = getSelectedProjects()[0];
53
					ConfigureProjectWizard wizard = new ConfigureProjectWizard();
54
					wizard.init(null, project);
55
					WizardDialog dialog = new ResizeWizardDialog(getShell(), wizard);
56
					//dialog.
57
					dialog.open();
58
				} catch (Exception e) {
59
					throw new InvocationTargetException(e);
60
				}
61
			}
62
		}, TeamUIMessages.ConfigureProjectAction_configureProject, PROGRESS_BUSYCURSOR); 
63
	}
64
	/**
65
	 * @see TeamAction#isEnabled()
66
	 */
67
	protected boolean isEnabled() {
68
		IProject[] selectedProjects = getSelectedProjects();
69
		if (selectedProjects.length != 1) return false;
70
		if (!selectedProjects[0].isAccessible()) return false;
71
		if (!RepositoryProvider.isShared(selectedProjects[0])) return true;
72
		return false;
73
	}
74
	
75
	/* (non-Javadoc)
76
	 * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
77
	 */
78
	public void init(IWorkbenchWindow window) {
79
	}
80
}
(-)plugin.xml (+696 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.0"?>
3
<plugin>
4
5
     <extension-point id="configurationWizards" name="%configurationWizards" schema="schema/configurationWizards.exsd"/>
6
   <extension-point id="synchronizeParticipants" name="%synchronizeParticipants" schema="schema/synchronizeParticipants.exsd"/>
7
   <extension-point id="synchronizeWizards" name="%synchronizeWizards" schema="schema/synchronizeWizards.exsd"/>
8
   <extension-point id="teamContentProviders" name="%TeamContentProvider" schema="schema/teamContentProviders.exsd"/>
9
   <extension-point id="teamDecorators" name="%TeamDecorators" schema="schema/teamDecorators.exsd"/>
10
11
<!-- **************** PREFERENCES ******************* -->
12
   <extension
13
   		point="org.eclipse.ui.keywords">
14
    <keyword
15
            label="%PreferenceKeywords.Team"
16
            id="org.eclipse.team.ui.team"/>
17
    <keyword
18
            label="%PreferenceKeywords.FileContent"
19
            id="org.eclipse.team.ui.team.fileContent"/>
20
   </extension>   
21
   <extension
22
         point="org.eclipse.ui.preferencePages">
23
      <page
24
            name="%TeamPreferencePage.name"
25
            class="org.eclipse.team.internal.ui.preferences.SyncViewerPreferencePage"
26
            id="org.eclipse.team.ui.TeamPreferences">
27
            <keywordReference id="org.eclipse.team.ui.team"/>
28
      </page>
29
      <page
30
            name="%TextPreferencePage.name"
31
            category="org.eclipse.team.ui.TeamPreferences"
32
            class="org.eclipse.team.internal.ui.preferences.TextPreferencePage"
33
            id="org.eclipse.team.ui.TextPreferences">
34
            <keywordReference id="org.eclipse.team.ui.team.fileContent"/>
35
      </page>
36
      <page
37
            name="%IgnorePreferencePage.name"
38
            category="org.eclipse.team.ui.TeamPreferences"
39
            class="org.eclipse.team.internal.ui.preferences.IgnorePreferencePage"
40
            id="org.eclipse.team.ui.IgnorePreferences">
41
            <keywordReference id="org.eclipse.team.ui.team"/>
42
      </page>
43
      <page
44
            category="org.eclipse.team.ui.TeamPreferences"
45
            class="org.eclipse.team.internal.ui.mapping.ModelEnablementPreferencePage"
46
            id="org.eclipse.team.ui.enabledModels"
47
            name="%EnabledModels"/>
48
   </extension>
49
<!-- ****************** POPUP ACTIONS *************** -->
50
   <extension
51
         point="org.eclipse.ui.popupMenus">
52
      <!--objectContribution
53
            objectClass="org.eclipse.core.resources.mapping.ResourceMapping"
54
            adaptable="true"
55
            id="org.eclipse.team.ui.ResourceContributions">
56
         <menu
57
               label="%TeamGroupMenu.label"
58
               path="additions"
59
               id="team.main">
60
            <separator
61
                  name="group1">
62
            </separator>
63
            <separator
64
                  name="group2">
65
            </separator>
66
            <separator
67
                  name="group3">
68
            </separator>
69
            <separator
70
                  name="group4">
71
            </separator>
72
            <separator
73
                  name="group5">
74
            </separator>
75
            <separator
76
                  name="group6">
77
            </separator>
78
            <separator
79
                  name="group7">
80
            </separator>
81
            <separator
82
                  name="group8">
83
            </separator>
84
            <separator
85
                  name="group9">
86
            </separator>
87
            <separator
88
                  name="group10">
89
            </separator>
90
            <separator
91
                  name="targetGroup">
92
            </separator>
93
            <separator
94
                  name="projectGroup">
95
            </separator>
96
         </menu>
97
      </objectContribution-->
98
      <!--objectContribution
99
            objectClass="org.eclipse.core.resources.mapping.ResourceMapping"
100
            adaptable="true"
101
            id="org.eclipse.team.ui.ProjectContributions">
102
         <action
103
               label="%ConfigureProject.label"
104
               tooltip="%ConfigureProject.tooltip"
105
               class="org.eclipse.team.internal.ui.actions.ConfigureProjectAction"
106
               menubarPath="team.main/projectGroup"
107
               enablesFor="1"
108
               id="nonbound.org.eclipse.team.ui.ConfigureProject">
109
         </action>
110
        <enablement>
111
		  <not>
112
           <adapt type="org.eclipse.core.resources.mapping.ResourceMapping">
113
              <test property="org.eclipse.core.resources.projectPersistentProperty" args="org.eclipse.team.core.repository" />
114
           </adapt>
115
           </not>
116
         </enablement>
117
      </objectContribution-->
118
      <!--objectContribution
119
            objectClass="org.eclipse.core.resources.IFile"
120
            nameFilter="*.psf"
121
            id="org.eclipse.team.ui.ProjectSetFileContributions">
122
         <action
123
               label="%ImportProjectSet.label"
124
               class="org.eclipse.team.internal.ui.actions.ImportProjectSetAction"
125
               menubarPath="team.main"
126
               enablesFor="*"
127
               id="nonbound.org.eclipse.team.ui.ImportProjectSetAction">
128
         </action>
129
      </objectContribution-->
130
      <objectContribution
131
            adaptable="true"
132
            id="org.eclipse.team.ui.UnmanagedFileContributions"
133
            objectClass="org.eclipse.core.resources.IFile">
134
         <!--action
135
               class="org.eclipse.team.internal.ui.history.ShowLocalHistory"
136
               id="org.eclipse.team.ui.showLocalHistory"
137
               label="%ShowLocalHistory.label"
138
               menubarPath="team.main/group4"
139
               enablesFor="1"
140
               tooltip="%ShowLocalHistory.label"/-->
141
         <!--action
142
               class="org.eclipse.team.internal.ui.history.CompareLocalHistory"
143
               id="org.eclipse.team.ui.compareLocalHistory"
144
               label="%CompareLocalHistory.label"
145
               menubarPath="compareWithMenu/compareWithGroup"
146
               enablesFor="1"
147
               overrideActionId="compareWithHistory"
148
               tooltip="%CompareLocalHistory.tooltip"/-->
149
         <action
150
               class="org.eclipse.team.internal.ui.history.ReplaceLocalHistory"
151
               id="org.eclipse.team.ui.replaceLocalHistory"
152
               label="%ReplaceLocalHistory.label"
153
               menubarPath="replaceWithMenu/replaceWithGroup"
154
               enablesFor="1"
155
               overrideActionId="replaceFromHistory"
156
               tooltip="%ReplaceLocalHistory.tooltip"/>
157
      </objectContribution>
158
   </extension>
159
<!-- ************** Views ********************** -->
160
   <extension
161
         point="org.eclipse.ui.views">
162
      <category
163
            name="%Team.viewCategory"
164
            id="org.eclipse.team.ui">
165
      </category>
166
      <view
167
            name="%SyncView.name"
168
            icon="$nl$/icons/full/eview16/synch_synch.gif"
169
            fastViewWidthRatio="0.25"
170
            category="org.eclipse.team.ui"
171
            allowMultiple="true"
172
            class="org.eclipse.team.internal.ui.synchronize.SynchronizeView"
173
            id="org.eclipse.team.sync.views.SynchronizeView">
174
      </view>
175
      <view
176
            allowMultiple="true"
177
            category="org.eclipse.team.ui"
178
            class="org.eclipse.team.internal.ui.history.GenericHistoryView"
179
            icon="icons/full/eview16/history_view.gif"
180
            id="org.eclipse.team.ui.GenericHistoryView"
181
            name="%HistoryView"/>
182
    <!--  <view
183
            name="%CompareView.name"
184
            icon="$nl$/icons/full/eview16/compare_view.gif"
185
            fastViewWidthRatio="0.25"
186
            category="org.eclipse.team.ui"
187
            class="org.eclipse.team.internal.ui.synchronize.CompareView"
188
            id="org.eclipse.team.sync.views.CompareView">
189
      </view> -->
190
   </extension>
191
<!-- **************** Synchronizing Perspective ******************* -->
192
   <extension
193
         point="org.eclipse.ui.perspectives">
194
      <perspective
195
            name="%Synchronizing.perspective"
196
            icon="$nl$/icons/full/eview16/synch_synch.gif"
197
            class="org.eclipse.team.internal.ui.synchronize.TeamSynchronizingPerspective"
198
            id="org.eclipse.team.ui.TeamSynchronizingPerspective">
199
         <description>
200
            %Synchronizing.perspective.description 
201
         </description>
202
      </perspective>
203
   </extension>
204
   <extension
205
         point="org.eclipse.ui.perspectiveExtensions">
206
      <perspectiveExtension
207
            targetID="org.eclipse.ui.resourcePerspective">
208
         <perspectiveShortcut
209
               id="org.eclipse.team.ui.TeamSynchronizingPerspective">
210
         </perspectiveShortcut>
211
         <showInPart
212
               id="org.eclipse.team.ui.GenericHistoryView">
213
         </showInPart>
214
      </perspectiveExtension>
215
   </extension>
216
   
217
<!-- ********** New Project Wizard ************** --> 
218
   <extension
219
         point="org.eclipse.ui.newWizards">
220
         <category name="%Team" id="org.eclipse.team.ui.newWizards">
221
         </category>
222
   </extension>
223
<!-- ****************** Import Wizards ********************* -->
224
   <extension
225
         point="org.eclipse.ui.importWizards">
226
      <category
227
            name="%Team"
228
            id="org.eclipse.team.ui.importWizards">
229
      </category>
230
         
231
      <wizard
232
            name="%ProjectSetImportWizard.name"
233
            icon="$nl$/icons/full/obj/import_projectset.gif"
234
            class="org.eclipse.team.internal.ui.wizards.ProjectSetImportWizard"
235
            category="org.eclipse.team.ui.importWizards"
236
            id="org.eclipse.team.ui.ProjectSetImportWizard">
237
         <description>
238
            %ProjectSetImportWizard.description
239
         </description>
240
         <selection
241
               class="org.eclipse.core.resources.IProject">
242
         </selection>
243
      </wizard>
244
   </extension>
245
<!-- ****************** Export Wizards ********************* -->
246
   <extension
247
         point="org.eclipse.ui.exportWizards">
248
      <category
249
            name="%Team"
250
            id="org.eclipse.team.ui.exportWizards">
251
      </category>
252
      <wizard
253
            name="%ProjectSetExportWizard.name"
254
            icon="$nl$/icons/full/obj/export_projectset.gif"
255
            class="org.eclipse.team.internal.ui.wizards.ProjectSetExportWizard"
256
            category="org.eclipse.team.ui.exportWizards"
257
            id="org.eclipse.team.ui.ProjectSetExportWizard">
258
         <description>
259
            %ProjectSetExportWizard.description
260
         </description>
261
         <selection
262
               class="org.eclipse.core.resources.IProject">
263
         </selection>
264
      </wizard>
265
   </extension>
266
<!-- ***************** Perspective Extensions ********************** -->
267
   <extension
268
         point="org.eclipse.ui.perspectiveExtensions">
269
      <perspectiveExtension
270
            targetID="org.eclipse.team.ui.TeamSynchronizingPerspective">
271
         <showInPart
272
               id="org.eclipse.ui.views.ResourceNavigator">
273
         </showInPart>
274
         <showInPart
275
               id="org.eclipse.team.ui.GenericHistoryView">
276
         </showInPart>
277
      </perspectiveExtension>
278
   </extension>
279
<!-- ***************** Actions ********************** -->
280
   <extension
281
         point="org.eclipse.ui.commands">
282
      <category
283
            name="%Command.category.name"
284
            description="%Command.category.description"
285
            id="org.eclipse.team.ui.category.team">
286
      </category>
287
      <command
288
            name="%Command.syncAll.name"
289
            categoryId="org.eclipse.team.ui.category.team"
290
            description="%Command.syncAll.description"
291
            id="org.eclipse.team.ui.synchronizeAll">
292
      </command>
293
      <command
294
            name="%Command.syncLast.name"
295
            categoryId="org.eclipse.team.ui.category.team"
296
            description="%Command.syncLast.description"
297
            id="org.eclipse.team.ui.synchronizeLast">
298
      </command>
299
      <command
300
            name="%Command.applyPatch.name"
301
            categoryId="org.eclipse.team.ui.category.team"
302
            description="%Command.applyPatch.description"
303
            id="org.eclipse.team.ui.applyPatch">
304
      </command>
305
      <command
306
       		name="%Synchronizing.perspective"
307
        	description="%Synchronizing.openPerspectiveDescription"
308
        	categoryId="org.eclipse.ui.category.perspectives"
309
        	id="org.eclipse.team.ui.TeamSynchronizingPerspective"/>
310
      <command
311
            name="%ViewCommand.synchronizeView.name"
312
            description="%ViewCommand.synchronizeView.description"
313
            categoryId="org.eclipse.ui.category.views"
314
            id="org.eclipse.team.sync.views.SynchronizeView"/>
315
      <command
316
            name="%ViewCommand.historyView.name"
317
            description="%ViewCommand.historyView.description"
318
            categoryId="org.eclipse.ui.category.views"
319
            id="org.eclipse.team.ui.GenericHistoryView"/>
320
      <!-- TZarna: added commands -->
321
      <command
322
            categoryId="org.eclipse.team.ui.category.team"
323
            defaultHandler="org.eclipse.team.internal.ui.handlers.ApplyPatchHandler"
324
            description="%Command.applyPatch.description"
325
            id="org.eclipse.team.ui.applyPatch"
326
            name="%Command.applyPatch.name">
327
      </command>
328
      <command
329
            categoryId="org.eclipse.team.ui.category.team"
330
            defaultHandler="org.eclipse.team.internal.ui.handlers.ConfigureProjectHandler"
331
            id="org.eclipse.team.ui.configureProject"
332
            name="%Command.configureProject.name">
333
      </command>
334
      <command
335
            categoryId="org.eclipse.team.ui.category.team"
336
            defaultHandler="org.eclipse.team.internal.ui.handlers.SynchronizeHandler"
337
            description="%Command.syncAll.description"
338
            id="org.eclipse.team.ui.synchronizeAll"
339
            name="%Command.syncAll.name">
340
      </command>
341
      <command
342
            categoryId="org.eclipse.team.ui.category.team"
343
            defaultHandler="org.eclipse.team.internal.ui.handlers.ImportProjectSetHandler"
344
            description="%Command.importProjectSet.description"
345
            id="org.eclipse.team.ui.importProjectSet"
346
            name="%Command.importProjectSet.name">
347
      </command>
348
      <command
349
            categoryId="org.eclipse.team.ui.category.team"
350
            defaultHandler="org.eclipse.team.internal.ui.history.ShowLocalHistoryHandler"
351
            description="%Command.showLocalHistory.description"
352
            id="org.eclipse.team.ui.showLocalHistory"
353
            name="%Command.showLocalHistory.name">
354
      </command>
355
      <command
356
            categoryId="org.eclipse.team.ui.category.team"
357
            defaultHandler="org.eclipse.team.internal.ui.history.CompareLocalHistoryHandler"
358
            description="%Command.compareLocalHistory.description"
359
            id="org.eclipse.team.ui.compareLocalHistory"
360
            name="%Command.compareLocalHistory.name">
361
      </command>
362
   </extension>
363
   
364
   <extension
365
         point="org.eclipse.ui.bindings">
366
      <key
367
            sequence="M3+M2+Q Y"
368
            contextId="org.eclipse.ui.globalScope"
369
            commandId="org.eclipse.team.sync.views.SynchronizeView"
370
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
371
      <key
372
            sequence="M3+M2+Q Z"
373
            contextId="org.eclipse.ui.globalScope"
374
            commandId="org.eclipse.team.ui.GenericHistoryView"
375
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
376
   </extension>
377
<!-- action sets -->
378
   <!--extension
379
         point="org.eclipse.ui.actionSets">
380
      <actionSet
381
            label="%Command.category.name"
382
            description="%Command.category.description"
383
            visible="false"
384
            id="org.eclipse.team.ui.actionSet">
385
         <action
386
               allowLabelUpdate="true"
387
               toolbarPath="Normal/Team"
388
               label="%Command.syncAll.name"
389
               tooltip="%Command.syncAll.name"
390
               class="org.eclipse.team.internal.ui.synchronize.actions.GlobalRefreshAction"
391
               icon="$nl$/icons/full/elcl16/synch_participants.gif"
392
               style="pulldown"
393
               id="org.eclipse.team.ui.synchronizeAll">
394
         </action>
395
         <action
396
               allowLabelUpdate="true"
397
               label="%ConfigureProject.label"
398
               tooltip="%ConfigureProject.tooltip"
399
               class="org.eclipse.team.internal.ui.actions.ConfigureProjectAction"
400
               menubarPath="project/open.ext"
401
               id="org.eclipse.team.ui.ConfigureProject"/>
402
         <action
403
               allowLabelUpdate="true"
404
               class="org.eclipse.team.internal.ui.actions.ApplyPatchAction"
405
               definitionId="org.eclipse.team.ui.applyPatch"
406
               id="org.eclipse.team.ui.ApplyPatchAction"
407
               label="%ApplyPatch.label"
408
               menubarPath="project/additions"
409
               tooltip="%ApplyPatch.tooltip"/>
410
      </actionSet>
411
   </extension-->
412
   
413
 <!-- file modification validator -->
414
   
415
   <extension
416
         point="org.eclipse.team.core.defaultFileModificationValidator">
417
      <validator class="org.eclipse.team.internal.ui.DefaultUIFileModificationValidator"/>
418
   </extension>
419
   
420
    <!-- adapter factory -->
421
    
422
   <extension
423
         point="org.eclipse.core.runtime.adapters">
424
      <factory
425
            adaptableType="org.eclipse.compare.structuremergeviewer.DiffNode"
426
            class="org.eclipse.team.internal.ui.TeamAdapterFactory">
427
         <adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
428
      </factory>
429
      <factory
430
            adaptableType="org.eclipse.core.resources.mapping.ModelProvider"
431
            class="org.eclipse.team.internal.ui.TeamAdapterFactory">
432
         <adapter type="org.eclipse.team.core.mapping.IResourceMappingMerger"/>
433
         <adapter type="org.eclipse.team.ui.mapping.ISynchronizationCompareAdapter"/>
434
         <adapter type="org.eclipse.team.core.mapping.ISynchronizationScopeParticipantFactory"/>
435
      </factory>
436
      <factory
437
            adaptableType="org.eclipse.team.core.RepositoryProviderType"
438
            class="org.eclipse.team.internal.ui.TeamAdapterFactory">
439
         <adapter type="org.eclipse.team.ui.mapping.ITeamStateProvider"/>
440
      </factory>
441
   </extension>
442
   <extension
443
         point="org.eclipse.ui.navigator.navigatorContent">
444
      <navigatorContent
445
            contentProvider="org.eclipse.team.internal.ui.mapping.ResourceModelContentProvider"
446
            id="org.eclipse.team.ui.resourceContent"
447
            labelProvider="org.eclipse.team.internal.ui.mapping.ResourceModelLabelProvider"
448
            name="%ResourcesContentExtension"
449
            priority="lowest">
450
         <enablement>
451
           <or>         
452
            <instanceof value="org.eclipse.core.internal.resources.mapping.ResourceModelProvider"/>
453
            <instanceof value="org.eclipse.core.resources.IResource"/>
454
            <instanceof value="org.eclipse.team.core.mapping.ISynchronizationScope"/>
455
            <instanceof value="org.eclipse.team.core.mapping.ISynchronizationContext"/>
456
           </or>
457
         </enablement>
458
         <actionProvider class="org.eclipse.team.internal.ui.mapping.ResourceModelActionProvider"/>
459
         <commonSorter
460
            class="org.eclipse.team.internal.ui.mapping.ResourceModelSorter"
461
            id="org.eclipse.team.ui.resourceSorter"/>
462
       </navigatorContent>
463
   </extension>
464
   <extension
465
         point="org.eclipse.ui.navigator.viewer">
466
       <viewer
467
             viewerId="org.eclipse.team.ui.navigatorViewer">
468
           <popupMenu
469
                allowsPlatformContributions="false"
470
                id="org.eclipse.team.ui.navigatorViewer#PopupMenu">  
471
             <insertionPoint name="file"/>  
472
             <insertionPoint name="edit"/>          
473
             <insertionPoint name="synchronize"/>
474
             <insertionPoint
475
                   name="navigate"
476
                   separator="true"/>
477
             <insertionPoint
478
                   name="merge"
479
                   separator="true"/>
480
             <insertionPoint
481
                   name="other"
482
                   separator="true"/> 
483
             <insertionPoint
484
                   name="sort"
485
                   separator="true"/>
486
             <insertionPoint
487
                   name="additions"
488
                   separator="true"/>              
489
             <insertionPoint
490
                   name="properties"
491
                   separator="true"/>
492
          </popupMenu>
493
       </viewer>
494
   </extension>
495
   
496
   <!-- *************** Synchronize View Participant **************** -->
497
   <extension
498
         point="org.eclipse.team.ui.synchronizeParticipants">
499
      <participant
500
            class="org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant"
501
            icon="$nl$/icons/full/eview16/synch_synch.gif"
502
            id="org.eclipse.team.ui.synchronization_context_synchronize_participant"
503
            name="%ModelSyncParticipant"
504
            persistent="false">
505
      </participant>
506
   </extension>
507
   <extension
508
         id="teamContentProvider"
509
         name="%Workspace"
510
         point="org.eclipse.team.ui.teamContentProviders">
511
      <teamContentProvider
512
            contentExtensionId="org.eclipse.team.ui.resourceContent"
513
            icon="/$nl$/icons/full/obj/workspace_obj.gif"
514
            modelProviderId="org.eclipse.core.resources.modelProvider"
515
            preferencePage="org.eclipse.team.internal.ui.preferences.ResourceModelPreferencePage"
516
            supportsFlatLayout="true"/>
517
   </extension>
518
   <extension
519
         point="org.eclipse.team.core.storageMergers">
520
      <storageMerger
521
            class="org.eclipse.team.internal.ui.mapping.TextStorageMerger"
522
            extensions="txt"
523
            id="org.eclipse.team.ui.textStorageMerger"/>
524
      <contentTypeBinding
525
            contentTypeId="org.eclipse.core.runtime.text"
526
            storageMergerId="org.eclipse.team.ui.textStorageMerger"/>
527
   </extension>
528
529
   <!-- *************** Activity Support **************** -->
530
    <extension
531
          point="org.eclipse.ui.activitySupport">
532
      <triggerPoint id="org.eclipse.team.ui.activityTriggerPoint">
533
         <hint
534
               id="interactive"
535
               value="true"/>
536
      </triggerPoint>
537
    </extension>
538
    
539
    <!-- *************** Menus **************** -->
540
    <extension
541
          point="org.eclipse.ui.menus">
542
       <menuContribution
543
             locationURI="menu:project?after=additions">
544
             <!-- always enabled -->
545
             <command
546
                   commandId="org.eclipse.team.ui.applyPatch"
547
                   label="%ApplyPatch.label"
548
                   mnemonic="%ApplyPatch.mnemonic"
549
                   style="push"
550
                   tooltip="%ApplyPatch.tooltip">
551
                <visibleWhen
552
                      checkEnabled="false">
553
                </visibleWhen>
554
             </command>
555
       </menuContribution>
556
       <menuContribution
557
             locationURI="menu:project?after=open.ext">
558
             <!-- enablement? -->
559
             <command
560
                   commandId="org.eclipse.team.ui.configureProject"
561
                   id="org.eclipse.team.ui.ConfigureProject"
562
                   label="%ConfigureProject.label"
563
                   mnemonic="%ConfigureProject.mnemonic"
564
                   style="push"
565
                   tooltip="%ConfigureProject.tooltip">
566
             </command>
567
       </menuContribution>
568
       <menuContribution
569
             locationURI="toolbar:org.eclipse.ui.main.toolbar">
570
          <toolbar
571
                id="whatever">
572
             <command
573
                   commandId="org.eclipse.team.ui.synchronizeAll"
574
                   icon="$nl$/icons/full/elcl16/synch_participants.gif"
575
                   label="%Command.syncAll.name"
576
                   style="pulldown">
577
             </command>
578
             </toolbar>
579
          <!--toolbar
580
                id="toolbar:org.eclipse.ui.main.toolbar?after=search">
581
                         <command
582
                   commandId="org.eclipse.team.ui.synchronizeAll2"
583
                   icon="$nl$/icons/full/elcl16/synch_participants.gif"
584
                   label="%Command.syncAll.name"
585
                   style="pulldown">
586
             </command>
587
          </toolbar-->
588
       </menuContribution>
589
       <menuContribution
590
             locationURI="popup:org.eclipse.ui.popup.any?after=team.main">
591
          <!-- should be enabled only for IFiles with *.psf extension, multiselection is allowed -->
592
          <command
593
                commandId="org.eclipse.team.ui.importProjectSet"
594
                label="%Command.importProjectSet.name"
595
                style="push">
596
          </command>
597
       </menuContribution>
598
       <menuContribution
599
             locationURI="popup:team.main?after=projectGroup">
600
          <command
601
                commandId="org.eclipse.team.ui.configureProject"
602
                id="nonbound.org.eclipse.team.ui.ConfigureProject"
603
                label="%ConfigureProject.label"
604
                mnemonic="%ConfigureProject.mnemonic"
605
                style="push"
606
                tooltip="%ConfigureProject.tooltip">
607
          </command>
608
       </menuContribution>
609
       <menuContribution
610
             locationURI="popup:org.eclipse.ui.popup.any">
611
             <menu
612
                   id="team.main"
613
                   label="%TeamGroupMenu.label"
614
                   mnemonic="%TeamGroupMenu.mnemonic">
615
                  <separator
616
                        name="group1"
617
                        visible="true">
618
            </separator>
619
            <separator
620
                  name="group2"
621
                  visible="true">
622
            </separator>
623
            <separator
624
                  name="group3"
625
                  visible="true">
626
            </separator>
627
            <separator
628
                  name="group4"
629
                  visible="true">
630
            </separator>
631
            <separator
632
                  name="group5"
633
                  visible="true">
634
            </separator>
635
            <separator
636
                  name="group6"
637
                  visible="true">
638
            </separator>
639
            <separator
640
                  name="group7"
641
                  visible="true">
642
            </separator>
643
            <separator
644
                  name="group8"
645
                  visible="true">
646
            </separator>
647
            <separator
648
                  name="group9"
649
                  visible="true">
650
            </separator>
651
            <separator
652
                  name="group10"
653
                  visible="true">
654
            </separator>
655
            <separator
656
                  name="targetGroup"
657
                  visible="true">
658
                  </separator>
659
    <separator
660
                  name="projectGroup"
661
                  visible="true">
662
            </separator>
663
            </menu>
664
       </menuContribution>
665
       <menuContribution
666
             locationURI="popup:compareWithMenu?after=compareWithGroup">
667
          <command
668
                commandId="org.eclipse.team.ui.compareLocalHistory"
669
                label="%CompareLocalHistory.label"
670
                style="push"
671
                tooltip="%CompareLocalHistory.tooltip">
672
          </command>
673
       </menuContribution>
674
       <menuContribution
675
             locationURI="popup:team.main?after=group4">
676
          <command
677
                commandId="org.eclipse.team.ui.showLocalHistory"
678
                label="%ShowLocalHistory.label"
679
                mnemonic="%ShowLocalHistory.mnemonic"
680
                style="push"
681
                >
682
          </command>
683
       </menuContribution>
684
       <menuContribution
685
             locationURI="popup:compareWithMenu?after=compareWithGroup">
686
          <command
687
                commandId="org.eclipse.team.ui.compareLocalHistory"
688
                label="%CompareLocalHistory.label"
689
                mnemonic="%CompareLocalHistory.mnemonic"
690
                style="push"
691
                tooltip="%CompareLocalHistory.tooltip">
692
          </command>
693
       </menuContribution>
694
    </extension>
695
    
696
</plugin>
(-)src/org/eclipse/team/internal/ui/handlers/SynchronizeHandler.java (+29 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.team.internal.ui.handlers;
12
13
import org.eclipse.core.commands.*;
14
import org.eclipse.jface.dialogs.MessageDialog;
15
import org.eclipse.ui.IWorkbenchWindow;
16
import org.eclipse.ui.handlers.HandlerUtil;
17
18
public class SynchronizeHandler extends AbstractHandler {
19
20
	public Object execute(ExecutionEvent event) throws ExecutionException {
21
		IWorkbenchWindow window = HandlerUtil
22
				.getActiveWorkbenchWindowChecked(event);
23
		MessageDialog.openInformation(window.getShell(), "Synchronize",
24
				"Synchronize Handler Dialog!");
25
26
		return null;
27
	}
28
29
}

Return to bug 173457