KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > ui > subscriber > CVSSynchronizeWizard


1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 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.ccvs.ui.subscriber;
12
13 import org.eclipse.core.resources.IResource;
14 import org.eclipse.jface.wizard.IWizard;
15 import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
16 import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
17 import org.eclipse.team.internal.ccvs.ui.wizards.CheckoutWizard;
18 import org.eclipse.team.internal.ui.synchronize.SubscriberParticipantWizard;
19 import org.eclipse.team.ui.TeamUI;
20 import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
21 import org.eclipse.team.ui.synchronize.ISynchronizeScope;
22 import org.eclipse.team.ui.synchronize.SubscriberParticipant;
23
24 /**
25  * This is the class registered with the org.eclipse.team.ui.synchronizeWizard
26  */

27 public class CVSSynchronizeWizard extends SubscriberParticipantWizard {
28     
29     protected IResource[] getRootResources() {
30         return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().roots();
31     }
32
33     
34     /* (non-Javadoc)
35      * @see org.eclipse.team.internal.ui.synchronize.SubscriberParticipantWizard#getName()
36      */

37     protected String JavaDoc getName() {
38         ISynchronizeParticipantDescriptor desc = TeamUI.getSynchronizeManager().getParticipantDescriptor(WorkspaceSynchronizeParticipant.ID);
39         if(desc != null) {
40             return desc.getName();
41         } else {
42             return CVSUIMessages.CVSSynchronizeWizard_0; //$NON-NLS-1$
43
}
44     }
45     
46     /* (non-Javadoc)
47      * @see org.eclipse.team.internal.ui.synchronize.SubscriberParticipantWizard#createParticipant(org.eclipse.core.resources.IResource[])
48      */

49     protected SubscriberParticipant createParticipant(ISynchronizeScope scope) {
50         // First check if there is an existing matching participant
51
IResource[] roots = scope.getRoots();
52         if (roots == null) {
53             roots = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().roots();
54         }
55         WorkspaceSynchronizeParticipant participant = (WorkspaceSynchronizeParticipant)SubscriberParticipant.getMatchingParticipant(WorkspaceSynchronizeParticipant.ID, roots);
56         // If there isn't, create one and add to the manager
57
if (participant == null) {
58             return new WorkspaceSynchronizeParticipant(scope);
59         } else {
60             return participant;
61         }
62     }
63     
64     /* (non-Javadoc)
65      * @see org.eclipse.team.internal.ui.synchronize.SubscriberParticipantWizard#getImportWizard()
66      */

67     protected IWizard getImportWizard() {
68         return new CheckoutWizard();
69     }
70 }
71
Popular Tags