Refactory: remove unused classes, imports, fields and methods.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / core / DeltaProcessor.java
index 11028bb..454705e 100644 (file)
@@ -10,7 +10,7 @@
  *******************************************************************************/
 package net.sourceforge.phpdt.internal.core;
 
-import java.io.File;
+//import java.io.File;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -19,7 +19,7 @@ import java.util.Iterator;
 import java.util.Map;
 
 import net.sourceforge.phpdt.core.ElementChangedEvent;
-import net.sourceforge.phpdt.core.IClasspathEntry;
+//import net.sourceforge.phpdt.core.IClasspathEntry;
 import net.sourceforge.phpdt.core.IElementChangedListener;
 import net.sourceforge.phpdt.core.IJavaElement;
 import net.sourceforge.phpdt.core.IJavaElementDelta;
@@ -40,12 +40,12 @@ import org.eclipse.core.resources.IResourceChangeListener;
 import org.eclipse.core.resources.IResourceDelta;
 import org.eclipse.core.resources.IResourceDeltaVisitor;
 import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
+//import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.ISafeRunnable;
 //import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.QualifiedName;
+//import org.eclipse.core.runtime.QualifiedName;
 import org.eclipse.core.runtime.SafeRunner;
 
 /**
@@ -317,28 +317,28 @@ public class DeltaProcessor implements IResourceChangeListener {
         * Adds the given project and its dependents to the list of the projects to
         * update.
         */
-       void addToProjectsToUpdateWithDependents(IProject project) {
-               this.projectsToUpdate.add(JavaCore.create(project));
-               // this.addDependentProjects(project.getFullPath(),
-               // this.projectsToUpdate);
-       }
+//     void addToProjectsToUpdateWithDependents(IProject project) {
+//             this.projectsToUpdate.add(JavaCore.create(project));
+//             // this.addDependentProjects(project.getFullPath(),
+//             // this.projectsToUpdate);
+//     }
 
        /**
         * Adds the given child handle to its parent's cache of children.
         */
-       protected void addToParentInfo(Openable child) {
-
-               Openable parent = (Openable) child.getParent();
-               if (parent != null && parent.isOpen()) {
-                       try {
-                               JavaElementInfo info = (JavaElementInfo) parent
-                                               .getElementInfo();
-                               info.addChild(child);
-                       } catch (JavaModelException e) {
-                               // do nothing - we already checked if open
-                       }
-               }
-       }
+//     protected void addToParentInfo(Openable child) {
+//
+//             Openable parent = (Openable) child.getParent();
+//             if (parent != null && parent.isOpen()) {
+//                     try {
+//                             JavaElementInfo info = (JavaElementInfo) parent
+//                                             .getElementInfo();
+//                             info.addChild(child);
+//                     } catch (JavaModelException e) {
+//                             // do nothing - we already checked if open
+//                     }
+//             }
+//     }
 
        /**
         * Check all external archive (referenced by given roots, projects or model)
@@ -1209,91 +1209,91 @@ public class DeltaProcessor implements IResourceChangeListener {
         * Answer a combination of the lastModified stamp and the size. Used for
         * detecting external JAR changes
         */
-       public static long getTimeStamp(File file) {
-               return file.lastModified() + file.length();
-       }
-
-       public void initializeRoots() {
-               // remember roots infos as old roots infos
-               this.oldRoots = this.roots == null ? new HashMap() : this.roots;
-               this.oldOtherRoots = this.otherRoots == null ? new HashMap()
-                               : this.otherRoots;
-
-               // recompute root infos only if necessary
-               if (!rootsAreStale)
-                       return;
-
-               this.roots = new HashMap();
-               this.otherRoots = new HashMap();
-               this.sourceAttachments = new HashMap();
-
-               IJavaModel model = this.manager.getJavaModel();
-               IJavaProject[] projects;
-               try {
-                       projects = model.getJavaProjects();
-               } catch (JavaModelException e) {
-                       // nothing can be done
-                       return;
-               }
-               for (int i = 0, length = projects.length; i < length; i++) {
-                       IJavaProject project = projects[i];
-                       IClasspathEntry[] classpath;
-                       try {
-                               classpath = project.getResolvedClasspath(true);
-                       } catch (JavaModelException e) {
-                               // continue with next project
-                               continue;
-                       }
-                       for (int j = 0, classpathLength = classpath.length; j < classpathLength; j++) {
-                               IClasspathEntry entry = classpath[j];
-                               if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT)
-                                       continue;
-
-                               // root path
-                               IPath path = entry.getPath();
-                               if (this.roots.get(path) == null) {
-                                       this.roots.put(path, new RootInfo(project, path,
-                                                       ((ClasspathEntry) entry)
-                                                                       .fullExclusionPatternChars()));
-                               } else {
-                                       ArrayList rootList = (ArrayList) this.otherRoots.get(path);
-                                       if (rootList == null) {
-                                               rootList = new ArrayList();
-                                               this.otherRoots.put(path, rootList);
-                                       }
-                                       rootList.add(new RootInfo(project, path,
-                                                       ((ClasspathEntry) entry)
-                                                                       .fullExclusionPatternChars()));
-                               }
+//     public static long getTimeStamp(File file) {
+//             return file.lastModified() + file.length();
+//     }
 
-                               // source attachment path
-                               if (entry.getEntryKind() != IClasspathEntry.CPE_LIBRARY)
-                                       continue;
-                               QualifiedName qName = new QualifiedName(JavaCore.PLUGIN_ID,
-                                               "sourceattachment: " + path.toOSString()); //$NON-NLS-1$;
-                               String propertyString = null;
-                               try {
-                                       propertyString = ResourcesPlugin.getWorkspace().getRoot()
-                                                       .getPersistentProperty(qName);
-                               } catch (CoreException e) {
-                                       continue;
-                               }
-                               IPath sourceAttachmentPath;
-                               // if (propertyString != null) {
-                               // int index=
-                               // propertyString.lastIndexOf(JarPackageFragmentRoot.ATTACHMENT_PROPERTY_DELIMITER);
-                               // sourceAttachmentPath = (index < 0) ? new Path(propertyString)
-                               // : new Path(propertyString.substring(0, index));
-                               // } else {
-                               sourceAttachmentPath = entry.getSourceAttachmentPath();
-                               // }
-                               if (sourceAttachmentPath != null) {
-                                       this.sourceAttachments.put(sourceAttachmentPath, path);
-                               }
-                       }
-               }
-               this.rootsAreStale = false;
-       }
+//     public void initializeRoots() {
+//             // remember roots infos as old roots infos
+//             this.oldRoots = this.roots == null ? new HashMap() : this.roots;
+//             this.oldOtherRoots = this.otherRoots == null ? new HashMap()
+//                             : this.otherRoots;
+//
+//             // recompute root infos only if necessary
+//             if (!rootsAreStale)
+//                     return;
+//
+//             this.roots = new HashMap();
+//             this.otherRoots = new HashMap();
+//             this.sourceAttachments = new HashMap();
+//
+//             IJavaModel model = this.manager.getJavaModel();
+//             IJavaProject[] projects;
+//             try {
+//                     projects = model.getJavaProjects();
+//             } catch (JavaModelException e) {
+//                     // nothing can be done
+//                     return;
+//             }
+//             for (int i = 0, length = projects.length; i < length; i++) {
+//                     IJavaProject project = projects[i];
+//                     IClasspathEntry[] classpath;
+//                     try {
+//                             classpath = project.getResolvedClasspath(true);
+//                     } catch (JavaModelException e) {
+//                             // continue with next project
+//                             continue;
+//                     }
+//                     for (int j = 0, classpathLength = classpath.length; j < classpathLength; j++) {
+//                             IClasspathEntry entry = classpath[j];
+//                             if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT)
+//                                     continue;
+//
+//                             // root path
+//                             IPath path = entry.getPath();
+//                             if (this.roots.get(path) == null) {
+//                                     this.roots.put(path, new RootInfo(project, path,
+//                                                     ((ClasspathEntry) entry)
+//                                                                     .fullExclusionPatternChars()));
+//                             } else {
+//                                     ArrayList rootList = (ArrayList) this.otherRoots.get(path);
+//                                     if (rootList == null) {
+//                                             rootList = new ArrayList();
+//                                             this.otherRoots.put(path, rootList);
+//                                     }
+//                                     rootList.add(new RootInfo(project, path,
+//                                                     ((ClasspathEntry) entry)
+//                                                                     .fullExclusionPatternChars()));
+//                             }
+//
+//                             // source attachment path
+//                             if (entry.getEntryKind() != IClasspathEntry.CPE_LIBRARY)
+//                                     continue;
+//                             QualifiedName qName = new QualifiedName(JavaCore.PLUGIN_ID,
+//                                             "sourceattachment: " + path.toOSString()); //$NON-NLS-1$;
+//                             String propertyString = null;
+//                             try {
+//                                     propertyString = ResourcesPlugin.getWorkspace().getRoot()
+//                                                     .getPersistentProperty(qName);
+//                             } catch (CoreException e) {
+//                                     continue;
+//                             }
+//                             IPath sourceAttachmentPath;
+//                             // if (propertyString != null) {
+//                             // int index=
+//                             // propertyString.lastIndexOf(JarPackageFragmentRoot.ATTACHMENT_PROPERTY_DELIMITER);
+//                             // sourceAttachmentPath = (index < 0) ? new Path(propertyString)
+//                             // : new Path(propertyString.substring(0, index));
+//                             // } else {
+//                             sourceAttachmentPath = entry.getSourceAttachmentPath();
+//                             // }
+//                             if (sourceAttachmentPath != null) {
+//                                     this.sourceAttachments.put(sourceAttachmentPath, path);
+//                             }
+//                     }
+//             }
+//             this.rootsAreStale = false;
+//     }
 
        /*
         * Returns whether a given delta contains some information relevant to the
@@ -1305,6 +1305,11 @@ public class DeltaProcessor implements IResourceChangeListener {
                if (rootDelta != null) {
                        // use local exception to quickly escape from delta traversal
                        class FoundRelevantDeltaException extends RuntimeException {
+
+                               /**
+                                * 
+                                */
+                               private static final long serialVersionUID = -7732598607464929404L;
                        }
                        try {
                                rootDelta.accept(new IResourceDeltaVisitor() {
@@ -2347,15 +2352,15 @@ public class DeltaProcessor implements IResourceChangeListener {
        /*
         * Finds the root info this path is included in. Returns null if not found.
         */
-       RootInfo enclosingRootInfo(IPath path, int kind) {
-               while (path != null && path.segmentCount() > 0) {
-                       RootInfo rootInfo = this.rootInfo(path, kind);
-                       if (rootInfo != null)
-                               return rootInfo;
-                       path = path.removeLastSegments(1);
-               }
-               return null;
-       }
+//     RootInfo enclosingRootInfo(IPath path, int kind) {
+//             while (path != null && path.segmentCount() > 0) {
+//                     RootInfo rootInfo = this.rootInfo(path, kind);
+//                     if (rootInfo != null)
+//                             return rootInfo;
+//                     path = path.removeLastSegments(1);
+//             }
+//             return null;
+//     }
 
        /*
         * Fire Java Model delta, flushing them after the fact after post_change
@@ -2456,25 +2461,25 @@ public class DeltaProcessor implements IResourceChangeListener {
         * Returns the root info for the given path. Look in the old roots table if
         * kind is REMOVED.
         */
-       RootInfo rootInfo(IPath path, int kind) {
-               if (kind == IResourceDelta.REMOVED) {
-                       return (RootInfo) this.oldRoots.get(path);
-               } else {
-                       return (RootInfo) this.roots.get(path);
-               }
-       }
+//     RootInfo rootInfo(IPath path, int kind) {
+//             if (kind == IResourceDelta.REMOVED) {
+//                     return (RootInfo) this.oldRoots.get(path);
+//             } else {
+//                     return (RootInfo) this.roots.get(path);
+//             }
+//     }
 
        /*
         * Returns the other root infos for the given path. Look in the old other
         * roots table if kind is REMOVED.
         */
-       ArrayList otherRootsInfo(IPath path, int kind) {
-               if (kind == IResourceDelta.REMOVED) {
-                       return (ArrayList) this.oldOtherRoots.get(path);
-               } else {
-                       return (ArrayList) this.otherRoots.get(path);
-               }
-       }
+//     ArrayList otherRootsInfo(IPath path, int kind) {
+//             if (kind == IResourceDelta.REMOVED) {
+//                     return (ArrayList) this.oldOtherRoots.get(path);
+//             } else {
+//                     return (ArrayList) this.otherRoots.get(path);
+//             }
+//     }
 
        /**
         * Converts an <code>IResourceDelta</code> and its children into the