KickJava   Java API By Example, From Geeks To Geeks.

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


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.ui.synchronize;
12
13 import org.eclipse.core.resources.mapping.ResourceMapping;
14 import org.eclipse.jface.wizard.WizardPage;
15 import org.eclipse.team.internal.ui.mapping.ModelElementSelectionPage;
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 ModelSynchronizeParticipant}.
22  *
23  * @since 3.2
24  */

25 public abstract class ModelParticipantWizard extends ParticipantSynchronizeWizard {
26
27
28     private ModelElementSelectionPage selectionPage;
29     
30     public ModelParticipantWizard() {
31         super();
32         setNeedsProgressMonitor(true);
33     }
34     
35     /* (non-Javadoc)
36      * @see org.eclipse.team.ui.synchronize.ParticipantSynchronizeWizard#createParticipant()
37      */

38     protected final void createParticipant() {
39         ISynchronizeParticipant participant = createParticipant(selectionPage.getSelectedMappings());
40         TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[]{participant});
41         // We don't know in which site to show progress because a participant could actually be shown in multiple sites.
42
participant.run(null /* no site */);
43     }
44     
45     /* (non-Javadoc)
46      * @see org.eclipse.team.ui.synchronize.ParticipantSynchronizeWizard#createScopeSelectionPage()
47      */

48     protected final WizardPage createScopeSelectionPage() {
49         selectionPage = new ModelElementSelectionPage(getRootResources());
50         return selectionPage;
51     }
52
53     /**
54      * Method called from {@link #createParticipant()} to create a
55      * {@link ModelSynchronizeParticipant} for the given resource mappings.
56      *
57      * @param selectedMappings
58      * the selected mappings that define the scope
59      * @return a synchronize participant that will be added to the Synchronize
60      * view
61      */

62     protected abstract ISynchronizeParticipant createParticipant(ResourceMapping[] selectedMappings);
63
64 }
65
Popular Tags