Skip to main content
summaryrefslogtreecommitdiffstats
blob: cf0731df96a5ae1c8f637a12eb308716825b2bbe (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
54
55
56
57
58
/*******************************************************************************
 * Copyright (c) 2002 IBM Corporation and others.
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Common Public License v0.5
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v05.html
 * 
 * Contributors:
 * IBM - Initial implementation
 ******************************************************************************/
package org.eclipse.team.internal.ui.target;

import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.sync.CatchupReleaseViewer;
import org.eclipse.team.internal.ui.sync.SyncView;

public class TargetCatchupReleaseViewer extends CatchupReleaseViewer {
	private GetSyncAction getAction;
	private PutSyncAction putAction;
	
	public TargetCatchupReleaseViewer(Composite parent, TargetSyncCompareInput input) {
		super(parent, input);
		initializeActions(input);
	}
	
	/**
	 * Creates the actions for this viewer.
	 */
	private void initializeActions(final TargetSyncCompareInput diffModel) {
		Shell shell = getControl().getShell();
		getAction = new GetSyncAction(diffModel, this, Policy.bind("TargetCatchupReleaseViewer.Get_1"), shell); //$NON-NLS-1$
		putAction = new PutSyncAction(diffModel, this, Policy.bind("TargetCatchupReleaseViewer.Put_2"), shell); //$NON-NLS-1$
	}
	protected void fillContextMenu(IMenuManager manager) {
		super.fillContextMenu(manager);
		manager.add(new Separator());
		switch (getSyncMode()) {
			case SyncView.SYNC_INCOMING:
				getAction.update(SyncView.SYNC_INCOMING);
				manager.add(getAction);
				break;
			case SyncView.SYNC_OUTGOING:
				putAction.update(SyncView.SYNC_INCOMING);
				manager.add(putAction);
				break;
			case SyncView.SYNC_BOTH:
				getAction.update(SyncView.SYNC_INCOMING);
				manager.add(getAction);
				putAction.update(SyncView.SYNC_INCOMING);
				manager.add(putAction);
				break;
		}
	}
}

Back to the top