KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > ui > mappings > ModelCompareParticipant


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.internal.ccvs.ui.mappings;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.team.core.mapping.provider.SynchronizationContext;
15 import org.eclipse.team.core.subscribers.Subscriber;
16 import org.eclipse.team.core.subscribers.SubscriberMergeContext;
17 import org.eclipse.team.internal.ui.TeamUIPlugin;
18 import org.eclipse.team.internal.ui.synchronize.ChangeSetCapability;
19 import org.eclipse.team.internal.ui.synchronize.IChangeSetProvider;
20 import org.eclipse.team.ui.TeamUI;
21 import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
22
23 public class ModelCompareParticipant extends CVSModelSynchronizeParticipant implements IChangeSetProvider {
24
25     public static final String JavaDoc VIEWER_ID = "org.eclipse.team.cvs.ui.compareSynchronization"; //$NON-NLS-1$
26

27     public class CompareChangeSetCapability extends ModelParticipantChangeSetCapability {
28         public CheckedInChangeSetCollector createCheckedInChangeSetCollector(ISynchronizePageConfiguration configuration) {
29             return new CheckedInChangeSetCollector(configuration, getSubscriber());
30         }
31     }
32
33     private CompareChangeSetCapability capability;
34     
35     public ModelCompareParticipant(SynchronizationContext context) {
36         super(context);
37         try {
38             setInitializationData(TeamUI.getSynchronizeManager().getParticipantDescriptor("org.eclipse.team.cvs.ui.modelCompareParticipant")); //$NON-NLS-1$
39
} catch (CoreException e) {
40             TeamUIPlugin.log(e);
41         }
42         setSecondaryId(Long.toString(System.currentTimeMillis()));
43     }
44
45     /* (non-Javadoc)
46      * @see org.eclipse.team.ui.operations.ModelSynchronizeParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
47      */

48     protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
49         configuration.setProperty(ISynchronizePageConfiguration.P_VIEWER_ID, VIEWER_ID);
50         super.initializeConfiguration(configuration);
51     }
52     
53     public Subscriber getSubscriber() {
54         return ((SubscriberMergeContext)getContext()).getSubscriber();
55     }
56     
57     public ChangeSetCapability getChangeSetCapability() {
58         if (capability == null) {
59             capability = new CompareChangeSetCapability();
60         }
61         return capability;
62     }
63 }
64
Popular Tags