X-Git-Url: http://secure.phpeclipse.com
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java
index 22615e9..454705e 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java
@@ -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;
@@ -29,10 +29,10 @@ import net.sourceforge.phpdt.core.JavaCore;
import net.sourceforge.phpdt.core.JavaModelException;
import net.sourceforge.phpdt.internal.core.builder.PHPBuilder;
import net.sourceforge.phpdt.internal.core.util.Util;
-import net.sourceforge.phpdt.internal.core.util.PHPFileUtil;
+//import net.sourceforge.phpdt.internal.core.util.PHPFileUtil;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import org.eclipse.core.resources.IFile;
+//import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
@@ -40,12 +40,13 @@ 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.Platform;
+//import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.SafeRunner;
/**
* This class is used by JavaModelManager
to convert
@@ -316,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)
@@ -1208,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()));
- }
-
- // 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 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()));
+// }
+//
+// // 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
@@ -1304,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() {
@@ -1344,35 +1350,35 @@ public class DeltaProcessor implements IResourceChangeListener {
* Returns whether the given resource is in one of the given output folders
* and if it is filtered out from this output folder.
*/
- private boolean isResFilteredFromOutput(OutputsInfo info, IResource res,
- int elementType) {
- if (info != null) {
- IPath resPath = res.getFullPath();
- for (int i = 0; i < info.outputCount; i++) {
- if (info.paths[i].isPrefixOf(resPath)) {
- if (info.traverseModes[i] != IGNORE) {
- // case of bin=src
- if (info.traverseModes[i] == SOURCE
- && elementType == IJavaElement.CLASS_FILE) {
- return true;
- } else {
- // case of .class file under project and no source
- // folder
- // proj=bin
- if (elementType == IJavaElement.JAVA_PROJECT
- && res instanceof IFile
- && PHPFileUtil.isPHPFile((IFile) res)) {
- return true;
- }
- }
- } else {
- return true;
- }
- }
- }
- }
- return false;
- }
+// private boolean isResFilteredFromOutput(OutputsInfo info, IResource res,
+// int elementType) {
+// if (info != null) {
+// IPath resPath = res.getFullPath();
+// for (int i = 0; i < info.outputCount; i++) {
+// if (info.paths[i].isPrefixOf(resPath)) {
+// if (info.traverseModes[i] != IGNORE) {
+// // case of bin=src
+// if (info.traverseModes[i] == SOURCE
+// && elementType == IJavaElement.CLASS_FILE) {
+// return true;
+// } else {
+// // case of .class file under project and no source
+// // folder
+// // proj=bin
+// if (elementType == IJavaElement.JAVA_PROJECT
+// && res instanceof IFile
+// && PHPFileUtil.isPHPFile((IFile) res)) {
+// return true;
+// }
+// }
+// } else {
+// return true;
+// }
+// }
+// }
+// }
+// return false;
+// }
/*
* Merges all awaiting deltas.
@@ -2245,7 +2251,7 @@ public class DeltaProcessor implements IResourceChangeListener {
}
// wrap callbacks with Safe runnable for subsequent listeners to
// be called when some are causing grief
- Platform.run(new ISafeRunnable() {
+ SafeRunner.run(new ISafeRunnable() {
public void handleException(Throwable exception) {
Util
.log(exception,
@@ -2346,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
@@ -2455,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 IResourceDelta
and its children into the