KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > ui > synchronize > SubscriberParticipantWizard


1 /*******************************************************************************
2  * Copyright (c) 2004, 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.ui.synchronize;
12
13 import org.eclipse.core.resources.IResource;
14 import org.eclipse.jface.wizard.WizardPage;
15 import org.eclipse.team.internal.ui.synchronize.GlobalRefreshResourceSelectionPage;
16 import org.eclipse.team.ui.TeamUI;
17
18 /**
19  * This is a convenience class for creating wizards for use with the
20  * <code>org.eclipse.team.ui.synchronizeWizard</code> extension point
21  * that create a {@link SubscriberParticipant}.
22  *
23  * @since 3.2
24  */

25 public abstract class SubscriberParticipantWizard extends ParticipantSynchronizeWizard {
26
27     private GlobalRefreshResourceSelectionPage selectionPage;
28     
29     /* (non-Javadoc)
30      * @see org.eclipse.team.ui.synchronize.ParticipantSynchronizeWizard#createScopeSelectionPage()
31      */

32     protected final WizardPage createScopeSelectionPage() {
33         selectionPage = new GlobalRefreshResourceSelectionPage(getRootResources());
34         return selectionPage;
35     }
36     
37     /* (non-Javadoc)
38      * @see org.eclipse.team.ui.synchronize.ParticipantSynchronizeWizard#createParticipant()
39      */

40     protected final void createParticipant() {
41         IResource[] resources = selectionPage.getRootResources();
42         if (resources != null && resources.length > 0) {
43             SubscriberParticipant participant = createParticipant(selectionPage.getSynchronizeScope());
44             TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[]{participant});
45             // We don't know in which site to show progress because a participant could actually be shown in multiple sites.
46
participant.run(null /* no site */);
47         }
48     }
49     
50     /**
51      * Method called from {@link #createParticipant()} to create a
52      * {@link SubscriberParticipant} for the given scope.
53      *
54      * @param scope the selected scope
55      * @return a synchronize participant that will be added to the Synchronize
56      * view
57      */

58     protected abstract SubscriberParticipant createParticipant(ISynchronizeScope scope);
59
60 }
61
Popular Tags