platform35/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/mapping/ResourceAdapterFactory.java
changeset 40 eb3c938c7fef
equal deleted inserted replaced
39:2a03ec4dbf31 40:eb3c938c7fef
       
     1 /*******************************************************************************
       
     2  * Copyright (c) 2005 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.core.internal.resources.mapping;
       
    12 
       
    13 import org.eclipse.core.resources.IResource;
       
    14 import org.eclipse.core.resources.mapping.ResourceMapping;
       
    15 import org.eclipse.core.runtime.IAdapterFactory;
       
    16 
       
    17 /**
       
    18  * Adapter factory converting IResource to ResourceMapping
       
    19  * 
       
    20  * @since 3.1
       
    21  */
       
    22 public class ResourceAdapterFactory implements IAdapterFactory {
       
    23 
       
    24 	/* (non-Javadoc)
       
    25 	 * Method declared on IAdapterFactory
       
    26 	 */
       
    27 	public Object getAdapter(Object adaptableObject, Class adapterType) {
       
    28 		if (adapterType == ResourceMapping.class && adaptableObject instanceof IResource) {
       
    29 			return new SimpleResourceMapping((IResource) adaptableObject);
       
    30 		}
       
    31 		return null;
       
    32 	}
       
    33 
       
    34 	/* (non-Javadoc)
       
    35 	 * Method declared on IAdapterFactory
       
    36 	 */
       
    37 	public Class[] getAdapterList() {
       
    38 		return new Class[] {ResourceMapping.class};
       
    39 	}
       
    40 }