Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 76ec7119e3cf54c2afe1a798af3b988b1e97cffe (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
59
60
61
62
63
64
65
66
67
68
69
70
/*******************************************************************************
 * Copyright (c) 2000, 2004 IBM Corporation and others.
 * 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
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.subscriber;

import org.eclipse.core.resources.IResource;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
import org.eclipse.team.internal.ccvs.ui.wizards.CheckoutWizard;
import org.eclipse.team.internal.ui.synchronize.SubscriberParticipantWizard;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
import org.eclipse.team.ui.synchronize.ISynchronizeScope;
import org.eclipse.team.ui.synchronize.SubscriberParticipant;

/**
 * This is the class registered with the org.eclipse.team.ui.synchronizeWizard
 */
public class CVSSynchronizeWizard extends SubscriberParticipantWizard {
	
	protected IResource[] getRootResources() {
		return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().roots();
	}

	
	/* (non-Javadoc)
	 * @see org.eclipse.team.internal.ui.synchronize.SubscriberParticipantWizard#getName()
	 */
	protected String getName() {
		ISynchronizeParticipantDescriptor desc = TeamUI.getSynchronizeManager().getParticipantDescriptor(WorkspaceSynchronizeParticipant.ID);
		if(desc != null) {
			return desc.getName();
		} else {
			return CVSUIMessages.CVSSynchronizeWizard_0; //$NON-NLS-1$
		}
	}
	
	/* (non-Javadoc)
	 * @see org.eclipse.team.internal.ui.synchronize.SubscriberParticipantWizard#createParticipant(org.eclipse.core.resources.IResource[])
	 */
	protected SubscriberParticipant createParticipant(ISynchronizeScope scope) {
		// First check if there is an existing matching participant
		IResource[] roots = scope.getRoots();
		if (roots == null) {
			roots = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().roots();
		}
		WorkspaceSynchronizeParticipant participant = (WorkspaceSynchronizeParticipant)SubscriberParticipant.getMatchingParticipant(WorkspaceSynchronizeParticipant.ID, roots);	
		// If there isn't, create one and add to the manager
		if (participant == null) {
			return new WorkspaceSynchronizeParticipant(scope);
		} else {
			return participant;
		}
	}
	
	/* (non-Javadoc)
	 * @see org.eclipse.team.internal.ui.synchronize.SubscriberParticipantWizard#getImportWizard()
	 */
	protected IWizard getImportWizard() {
		return new CheckoutWizard();
	}
}

Back to the top