1 package net.sourceforge.phpeclipse.resourcesview;
3 import net.sourceforge.phpdt.core.JavaCore;
4 import net.sourceforge.phpdt.internal.core.JavaProject;
6 import org.eclipse.core.resources.IFile;
7 import org.eclipse.core.resources.IProject;
8 import org.eclipse.core.runtime.IAdapterFactory;
10 public class ResourceAdapterFactory implements IAdapterFactory {
12 protected static Class[] ADAPTERS_I_CREATE = new Class[] { PHPElement.class, PHPFile.class, JavaProject.class };
14 public ResourceAdapterFactory() {
18 public Object getAdapter(Object adaptableObject, Class adapterType) {
19 if (PHPFile.class.equals(adapterType))
20 return JavaCore.create((IFile) adaptableObject);
22 if (JavaProject.class.equals(adapterType))
23 return JavaCore.create((IProject) adaptableObject);
25 if (PHPElement.class.equals(adapterType)) {
26 if (adaptableObject instanceof IFile)
27 return JavaCore.create((IFile) adaptableObject);
29 if (adaptableObject instanceof IProject)
30 return JavaCore.create((IProject) adaptableObject);
36 public Class[] getAdapterList() {
37 return ADAPTERS_I_CREATE;