1 package net.sourceforge.phpeclipse.resourcesview;
3 import org.eclipse.core.resources.IFile;
4 import org.eclipse.core.resources.IProject;
5 import org.eclipse.core.runtime.IAdapterFactory;
7 import net.sourceforge.phpeclipse.PHPCore;
8 import net.sourceforge.phpeclipse.resourcesview.PHPElement;
9 import net.sourceforge.phpeclipse.resourcesview.PHPFile;
10 import net.sourceforge.phpeclipse.resourcesview.PHPProject;
12 public class ResourceAdapterFactory implements IAdapterFactory {
14 protected static Class[] ADAPTERS_I_CREATE = new Class[] { PHPElement.class, PHPFile.class, PHPProject.class };
16 public ResourceAdapterFactory() {
20 public Object getAdapter(Object adaptableObject, Class adapterType) {
21 if (PHPFile.class.equals(adapterType))
22 return PHPCore.create((IFile) adaptableObject);
24 if (PHPProject.class.equals(adapterType))
25 return PHPCore.create((IProject) adaptableObject);
27 if (PHPElement.class.equals(adapterType)) {
28 if (adaptableObject instanceof IFile)
29 return PHPCore.create((IFile) adaptableObject);
31 if (adaptableObject instanceof IProject)
32 return PHPCore.create((IProject) adaptableObject);
38 public Class[] getAdapterList() {
39 return ADAPTERS_I_CREATE;