1 package net.sourceforge.phpeclipse.resourcesview;
3 import net.sourceforge.phpeclipse.PHPCore;
5 import org.eclipse.core.resources.IFile;
6 import org.eclipse.core.resources.IProject;
7 import org.eclipse.core.runtime.IAdapterFactory;
9 public class ResourceAdapterFactory implements IAdapterFactory {
11 protected static Class[] ADAPTERS_I_CREATE = new Class[] { PHPElement.class, PHPFile.class, PHPProject.class };
13 public ResourceAdapterFactory() {
17 public Object getAdapter(Object adaptableObject, Class adapterType) {
18 if (PHPFile.class.equals(adapterType))
19 return PHPCore.create((IFile) adaptableObject);
21 if (PHPProject.class.equals(adapterType))
22 return PHPCore.create((IProject) adaptableObject);
24 if (PHPElement.class.equals(adapterType)) {
25 if (adaptableObject instanceof IFile)
26 return PHPCore.create((IFile) adaptableObject);
28 if (adaptableObject instanceof IProject)
29 return PHPCore.create((IProject) adaptableObject);
35 public Class[] getAdapterList() {
36 return ADAPTERS_I_CREATE;