KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > core > AdapterFactory


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.core;
12
13 import org.eclipse.core.resources.mapping.ModelProvider;
14 import org.eclipse.core.resources.mapping.ResourceMapping;
15 import org.eclipse.core.runtime.IAdapterFactory;
16 import org.eclipse.team.internal.core.mapping.ModelProviderResourceMapping;
17
18 public class AdapterFactory implements IAdapterFactory {
19
20     /* (non-Javadoc)
21      * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
22      */

23     public Object JavaDoc getAdapter(Object JavaDoc adaptableObject, Class JavaDoc adapterType) {
24         if (adaptableObject instanceof ModelProvider && adapterType == ResourceMapping.class) {
25             ModelProvider mp = (ModelProvider) adaptableObject;
26             return new ModelProviderResourceMapping(mp);
27         }
28         return null;
29     }
30
31     /* (non-Javadoc)
32      * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
33      */

34     public Class JavaDoc[] getAdapterList() {
35         return new Class JavaDoc[] { ResourceMapping.class};
36     }
37
38 }
39
Popular Tags