KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ui > synchronize > ScopableSubscriberParticipant


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.ui.synchronize;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.team.core.subscribers.Subscriber;
15 import org.eclipse.team.internal.ui.TeamUIPlugin;
16 import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
17 import org.eclipse.team.ui.synchronize.ISynchronizeScope;
18 import org.eclipse.team.ui.synchronize.SubscriberParticipant;
19
20 /**
21  * subscriber particpant that supports filtering using scopes.
22  */

23 public abstract class ScopableSubscriberParticipant extends SubscriberParticipant {
24     
25     /**
26      * No arg contructor used to create workspace scope and for
27      * creation of persisted participant after startup
28      */

29     public ScopableSubscriberParticipant() {
30     }
31     
32     public ScopableSubscriberParticipant(ISynchronizeScope scope) {
33         super(scope);
34     }
35     
36     
37     /* (non-Javadoc)
38      * @see org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant#setSubscriber(org.eclipse.team.core.subscribers.Subscriber)
39      */

40     protected void setSubscriber(Subscriber subscriber) {
41         super.setSubscriber(subscriber);
42         try {
43             ISynchronizeParticipantDescriptor descriptor = getDescriptor();
44             setInitializationData(descriptor);
45         } catch (CoreException e) {
46             TeamUIPlugin.log(e);
47         }
48         if (getSecondaryId() == null) {
49             setSecondaryId(Long.toString(System.currentTimeMillis()));
50         }
51     }
52     
53     /**
54      * Return the descriptor for this participant
55      * @return the descriptor for this participant
56      */

57     protected abstract ISynchronizeParticipantDescriptor getDescriptor();
58
59 }
60
Popular Tags