Parser detects wrong include files now
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / core / JavaModelManager.java
index 16347d2..01d7c40 100644 (file)
@@ -59,7 +59,6 @@ import org.eclipse.core.resources.IWorkspaceRoot;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IPluginDescriptor;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.ISafeRunnable;
 import org.eclipse.core.runtime.IStatus;
@@ -69,7 +68,6 @@ import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Plugin;
 import org.eclipse.core.runtime.Preferences;
 import org.eclipse.core.runtime.Status;
-import net.sourceforge.phpdt.internal.core.BufferManager;
 
 import net.sourceforge.phpdt.internal.core.DefaultWorkingCopyOwner;
 
@@ -310,12 +308,12 @@ public class JavaModelManager implements ISaveParticipant {
        
                if (file.getFileExtension() != null) {
                        String name = file.getName();
-//                     if (Util.isValidCompilationUnitName(name))
-                       if (PHPFileUtil.isPHPFile(file))
+                       if (PHPFileUtil.isValidPHPUnitName(name))
+                       //if (PHPFileUtil.isPHPFile(file))
                                return createCompilationUnitFrom(file, project);
-//                     if (Util.isValidClassFileName(name))
+//                     if (ProjectPrefUtil.isValidClassFileName(name))
 //                             return createClassFileFrom(file, project);
-//                     if (Util.isArchiveFileName(name))
+//                     if (ProjectPrefUtil.isArchiveFileName(name))
 //                             return createJarPackageFragmentRootFrom(file, project);
                }
                return null;
@@ -458,7 +456,8 @@ public class JavaModelManager implements ISaveParticipant {
                                                pkgPath = pkgPath.removeLastSegments(1);
                                                
                                                // don't check validity of package name (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=26706)
-                                               String pkgName = pkgPath.toString().replace('/', '.');
+//                                             String pkgName = pkgPath.toString().replace('/', '.');
+                                               String pkgName = pkgPath.toString();
                                                return root.getPackageFragment(pkgName);
                                        } else {
                                                String pkgName = Util.packageName(pkgPath);
@@ -609,7 +608,7 @@ public class JavaModelManager implements ISaveParticipant {
                        return buffer.toString();
                }
        }
-       public static boolean VERBOSE = true;
+       public static boolean VERBOSE = false;
        public static boolean CP_RESOLVE_VERBOSE = false;
        public static boolean ZIP_ACCESS_VERBOSE = false;
        
@@ -629,18 +628,17 @@ public class JavaModelManager implements ISaveParticipant {
                 * @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(PropertyChangeEvent)
                 */
                public void propertyChange(Preferences.PropertyChangeEvent event) {
-
-                       String propertyName = event.getProperty();
-                       if (propertyName.startsWith(CP_VARIABLE_PREFERENCES_PREFIX)) {
-                               String varName = propertyName.substring(CP_VARIABLE_PREFERENCES_PREFIX.length());
-                               String newValue = (String)event.getNewValue();
-                               if (newValue != null && !(newValue = newValue.trim()).equals(CP_ENTRY_IGNORE)) {
-                                       Variables.put(varName, new Path(newValue));
-                               } else {
-                                       Variables.remove(varName);
-                               }
-                       }
-//             TODO jsurfer temp-del
+//                     TODO : jsurfer temp-del
+//                     String propertyName = event.getProperty();
+//                     if (propertyName.startsWith(CP_VARIABLE_PREFERENCES_PREFIX)) {
+//                             String varName = propertyName.substring(CP_VARIABLE_PREFERENCES_PREFIX.length());
+//                             String newValue = (String)event.getNewValue();
+//                             if (newValue != null && !(newValue = newValue.trim()).equals(CP_ENTRY_IGNORE)) {
+//                                     Variables.put(varName, new Path(newValue));
+//                             } else {
+//                                     Variables.remove(varName);
+//                             }
+//                     }
 //                     if (propertyName.startsWith(CP_CONTAINER_PREFERENCES_PREFIX)) {
 //                             recreatePersistedContainer(propertyName, (String)event.getNewValue(), false);
 //                     }
@@ -842,7 +840,7 @@ public class JavaModelManager implements ISaveParticipant {
                        
                // Refresh internal scopes
                if (deltaToNotify != null) {
-//             TODO khartlage temp-del
+//             TODO  temp-del
 //                     Iterator scopes = this.scopes.keySet().iterator();
 //                     while (scopes.hasNext()) {
 //                             AbstractSearchScope scope = (AbstractSearchScope)scopes.next();
@@ -1021,7 +1019,7 @@ public class JavaModelManager implements ISaveParticipant {
                        return proj;
                }
                int rootEnd= memento.indexOf(JavaElement.JEM_PACKAGEFRAGMENT, projectEnd + 1);
-//     TODO khartlage temp-del
+//     TODO  temp-del
 //             if (rootEnd == -1) {
 //                     return model.getHandleFromMementoForRoot(memento, proj, projectEnd, memento.length());
 //             }
@@ -1202,8 +1200,7 @@ public class JavaModelManager implements ISaveParticipant {
         */
        private File getSerializationFile(IProject project) {
                if (!project.exists()) return null;
-               IPluginDescriptor descr= JavaCore.getJavaCore().getDescriptor();
-               IPath workingLocation= project.getPluginWorkingLocation(descr);
+               IPath workingLocation = project.getWorkingLocation(JavaCore.PLUGIN_ID);
                return workingLocation.append("state.dat").toFile(); //$NON-NLS-1$
        }
        /*
@@ -1808,7 +1805,7 @@ public class JavaModelManager implements ISaveParticipant {
        }
 
        public void shutdown () {
-//     TODO khartlage temp-del
+//     TODO  temp-del
 //             if (this.deltaProcessor.indexManager != null){ // no more indexing
 //                     this.deltaProcessor.indexManager.shutdown();
 //             }