KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > core > mapping > ChangeSetAdapterFactory


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 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.core.mapping;
12
13 import org.eclipse.core.resources.mapping.ResourceMapping;
14 import org.eclipse.core.runtime.IAdapterFactory;
15
16 public class ChangeSetAdapterFactory implements IAdapterFactory {
17
18     public Object JavaDoc getAdapter(Object JavaDoc adaptableObject, Class JavaDoc adapterType) {
19         if (adaptableObject instanceof CVSActiveChangeSet && adapterType == ResourceMapping.class) {
20             CVSActiveChangeSet cs = (CVSActiveChangeSet) adaptableObject;
21             return new ChangeSetResourceMapping(cs);
22         }
23         if (adaptableObject instanceof CVSCheckedInChangeSet && adapterType == ResourceMapping.class) {
24             CVSCheckedInChangeSet cs = (CVSCheckedInChangeSet) adaptableObject;
25             return new ChangeSetResourceMapping(cs);
26         }
27         if (adaptableObject instanceof UnassignedDiffChangeSet && adapterType == ResourceMapping.class) {
28             UnassignedDiffChangeSet cs = (UnassignedDiffChangeSet) adaptableObject;
29             return new ChangeSetResourceMapping(cs);
30         }
31         return null;
32     }
33
34     public Class JavaDoc[] getAdapterList() {
35         return new Class JavaDoc[] { ResourceMapping.class };
36     }
37
38 }
39
Popular Tags