avoid NPE
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / resourcesview / ResourceAdapterFactory.java
index 0e403f7..4a5799c 100644 (file)
@@ -1,6 +1,7 @@
 package net.sourceforge.phpeclipse.resourcesview;
 
-import net.sourceforge.phpeclipse.PHPCore;
+import net.sourceforge.phpdt.core.JavaCore;
+import net.sourceforge.phpdt.internal.core.JavaProject;
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
@@ -8,7 +9,7 @@ import org.eclipse.core.runtime.IAdapterFactory;
 
 public class ResourceAdapterFactory implements IAdapterFactory {
 
-       protected static Class[] ADAPTERS_I_CREATE = new Class[] { PHPElement.class, PHPFile.class, PHPProject.class };
+       protected static Class[] ADAPTERS_I_CREATE = new Class[] { PHPElement.class, PHPFile.class, JavaProject.class };
 
        public ResourceAdapterFactory() {
                super();
@@ -16,17 +17,17 @@ public class ResourceAdapterFactory implements IAdapterFactory {
 
        public Object getAdapter(Object adaptableObject, Class adapterType) {
                if (PHPFile.class.equals(adapterType))
-                       return PHPCore.create((IFile) adaptableObject);
+                       return JavaCore.create((IFile) adaptableObject);
 
-               if (PHPProject.class.equals(adapterType))
-                       return PHPCore.create((IProject) adaptableObject);
+               if (JavaProject.class.equals(adapterType))
+                       return JavaCore.create((IProject) adaptableObject);
 
                if (PHPElement.class.equals(adapterType)) {
                        if (adaptableObject instanceof IFile)
-                               return PHPCore.create((IFile) adaptableObject);
+                               return JavaCore.create((IFile) adaptableObject);
 
                        if (adaptableObject instanceof IProject)
-                               return PHPCore.create((IProject) adaptableObject);
+                               return JavaCore.create((IProject) adaptableObject);
                }
 
                return null;