modification to debug on a remote server
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / resourcesview / ResourceAdapterFactory.java
1 package net.sourceforge.phpeclipse.resourcesview;
2
3 import net.sourceforge.phpdt.internal.core.JavaProject;
4 import net.sourceforge.phpeclipse.PHPCore;
5
6 import org.eclipse.core.resources.IFile;
7 import org.eclipse.core.resources.IProject;
8 import org.eclipse.core.runtime.IAdapterFactory;
9
10 public class ResourceAdapterFactory implements IAdapterFactory {
11
12         protected static Class[] ADAPTERS_I_CREATE = new Class[] { PHPElement.class, PHPFile.class, JavaProject.class };
13
14         public ResourceAdapterFactory() {
15                 super();
16         }
17
18         public Object getAdapter(Object adaptableObject, Class adapterType) {
19                 if (PHPFile.class.equals(adapterType))
20                         return PHPCore.create((IFile) adaptableObject);
21
22                 if (JavaProject.class.equals(adapterType))
23                         return PHPCore.create((IProject) adaptableObject);
24
25                 if (PHPElement.class.equals(adapterType)) {
26                         if (adaptableObject instanceof IFile)
27                                 return PHPCore.create((IFile) adaptableObject);
28
29                         if (adaptableObject instanceof IProject)
30                                 return PHPCore.create((IProject) adaptableObject);
31                 }
32
33                 return null;
34         }
35
36         public Class[] getAdapterList() {
37                 return ADAPTERS_I_CREATE;
38         }
39
40 }