changes for new Action
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / resourcesview / PHPElementAdapterFactory.java
1 package net.sourceforge.phpeclipse.resourcesview;
2
3 import org.eclipse.core.resources.IResource;
4 import org.eclipse.core.runtime.IAdapterFactory;
5
6 public class PHPElementAdapterFactory implements IAdapterFactory {
7         
8         protected static Class[] ADAPTERS_I_CREATE = new Class[] {
9                 IResource.class
10         };
11
12         public PHPElementAdapterFactory() {
13                 super();
14         }
15
16         public Object getAdapter(Object adaptableObject, Class adapterType) {
17                 PHPElement phpElement = (PHPElement) adaptableObject;
18                 
19                 if (IResource.class.equals(adapterType))
20                         return getResource(phpElement);
21
22                 return null;
23         }
24
25         public Class[] getAdapterList() {
26                 return ADAPTERS_I_CREATE;
27         }
28
29         protected IResource getResource(PHPElement phpElement) {
30                 return phpElement.getUnderlyingResource();
31         }
32 }