*******************************************************************************/
package net.sourceforge.phpdt.internal.core.builder;
import java.util.ArrayList;
-import net.sourceforge.phpdt.core.compiler.CharOperation;
+
import net.sourceforge.phpdt.core.compiler.IProblem;
import net.sourceforge.phpdt.internal.compiler.CompilationResult;
-import net.sourceforge.phpdt.internal.core.Util;
import net.sourceforge.phpdt.internal.core.util.SimpleLookupTable;
-import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil;
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import net.sourceforge.phpeclipse.builder.IdentifierIndexManager;
-import org.eclipse.core.resources.IContainer;
+import net.sourceforge.phpdt.internal.core.util.Util;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IMarker;
notifier.subTask(Util.bind("build.analyzingDeltas")); //$NON-NLS-1$
IResourceDelta sourceDelta = (IResourceDelta) deltas
.get(javaBuilder.currentProject);
- if (sourceDelta != null)
+ if (sourceDelta != null) {
+ sourceDelta.accept(new ParserVisitor(javaBuilder.currentProject, notifier.monitor));
+
if (!findSourceFiles(sourceDelta))
return false;
- notifier.updateProgressDelta(0.10f);
- Object[] keyTable = deltas.keyTable;
- Object[] valueTable = deltas.valueTable;
- final IdentifierIndexManager indexManager = PHPeclipsePlugin.getDefault()
- .getIndexManager(javaBuilder.currentProject);
- for (int i = 0, l = valueTable.length; i < l; i++) {
- IResourceDelta delta = (IResourceDelta) valueTable[i];
- if (delta != null) {
- IResource resource = delta.getResource();
- int resourceType = resource.getType();
- if (resourceType == IResource.FILE) {
- switch (delta.getKind()) {
- case IResourceDelta.ADDED :
- if ((resource.getFileExtension() != null)
- && PHPFileUtil.isPHPFile((IFile) resource)) {
- // update indexfile for the project:
- indexManager.addFile((IFile) resource);
- }
- break;
- case IResourceDelta.CHANGED :
- if ((resource.getFileExtension() != null)
- && PHPFileUtil.isPHPFile((IFile) resource)) {
- // update indexfile for the project:
- indexManager.changeFile((IFile) resource);
- }
- break;
- case IResourceDelta.REMOVED :
- if ((resource.getFileExtension() != null)
- && PHPFileUtil.isPHPFile((IFile) resource)) {
- // update indexfile for the project:
- indexManager.removeFile((IFile) resource);
- }
- break;
- }
- }
- // ClasspathLocation[] classFoldersAndJars = (ClasspathLocation[])
- // javaBuilder.binaryLocationsPerProject.get(keyTable[i]);
- // if (classFoldersAndJars != null)
- // if (!findAffectedSourceFiles(delta, classFoldersAndJars)) return
- // false;
- }
}
notifier.updateProgressDelta(0.10f);
+// Object[] keyTable = deltas.keyTable;
+// Object[] valueTable = deltas.valueTable;
+//// final IdentifierIndexManager indexManager = PHPeclipsePlugin.getDefault()
+//// .getIndexManager(javaBuilder.currentProject);
+// for (int i = 0, l = valueTable.length; i < l; i++) {
+// IResourceDelta delta = (IResourceDelta) valueTable[i];
+// if (delta != null) {
+// IResource resource = delta.getResource();
+// int resourceType = resource.getType();
+// if (resourceType == IResource.FILE) {
+// switch (delta.getKind()) {
+// case IResourceDelta.ADDED :
+// if ((resource.getFileExtension() != null)
+// && PHPFileUtil.isPHPFile((IFile) resource)) {
+// // update indexfile for the project:
+//// indexManager.addFile((IFile) resource);
+// }
+// break;
+// case IResourceDelta.CHANGED :
+// if ((resource.getFileExtension() != null)
+// && PHPFileUtil.isPHPFile((IFile) resource)) {
+// // update indexfile for the project:
+//// indexManager.changeFile((IFile) resource);
+// }
+// break;
+// case IResourceDelta.REMOVED :
+// if ((resource.getFileExtension() != null)
+// && PHPFileUtil.isPHPFile((IFile) resource)) {
+// // update indexfile for the project:
+//// indexManager.removeFile((IFile) resource);
+// }
+// break;
+// }
+// }
+// // ClasspathLocation[] classFoldersAndJars = (ClasspathLocation[])
+// // javaBuilder.binaryLocationsPerProject.get(keyTable[i]);
+// // if (classFoldersAndJars != null)
+// // if (!findAffectedSourceFiles(delta, classFoldersAndJars)) return
+// // false;
+// }
+// }
+ notifier.updateProgressDelta(0.10f);
notifier.subTask(Util.bind("build.analyzingSources")); //$NON-NLS-1$
addAffectedSourceFiles();
notifier.updateProgressDelta(0.05f);
return;
// the qualifiedStrings are of the form 'p1/p2' & the simpleStrings are
// just 'X'
- char[][][] qualifiedNames = ReferenceCollection
- .internQualifiedNames(qualifiedStrings);
+// char[][][] qualifiedNames = ReferenceCollection
+// .internQualifiedNames(qualifiedStrings);
// if a well known qualified name was found then we can skip over these
- if (qualifiedNames.length < qualifiedStrings.size())
- qualifiedNames = null;
- char[][] simpleNames = ReferenceCollection.internSimpleNames(simpleStrings);
+// if (qualifiedNames.length < qualifiedStrings.size())
+// qualifiedNames = null;
+// char[][] simpleNames = ReferenceCollection.internSimpleNames(simpleStrings);
// if a well known name was found then we can skip over these
- if (simpleNames.length < simpleStrings.size())
- simpleNames = null;
+// if (simpleNames.length < simpleStrings.size())
+// simpleNames = null;
// Object[] keyTable = newState.references.keyTable;
// Object[] valueTable = newState.references.valueTable;
// next : for (int i = 0, l = valueTable.length; i < l; i++) {
case IResourceDelta.ADDED :
IPath addedPackagePath = resource.getFullPath()
.removeFirstSegments(segmentCount);
- createFolder(addedPackagePath, md.binaryFolder); // ensure package
+ // createFolder(addedPackagePath, md.binaryFolder); // ensure package
// exists in the
// output folder
// add dependents even when the package thinks it exists to be on
removedPackagePath).exists()) {
// only a package fragment was removed, same as removing
// multiple source files
- createFolder(removedPackagePath, md.binaryFolder); // ensure
+// createFolder(removedPackagePath, md.binaryFolder); // ensure
// package
// exists
// in the
return;
case IResource.FILE :
String resourceName = resource.getName();
- if (Util.isJavaFileName(resourceName)) {
+ if (net.sourceforge.phpdt.internal.compiler.util.Util.isJavaFileName(resourceName)) {
IPath typePath = resource.getFullPath().removeFirstSegments(
segmentCount).removeFileExtension();
String typeLocator = resource.getProjectRelativePath().toString();
// copy all other resource deltas to the output folder
IPath resourcePath = resource.getFullPath().removeFirstSegments(
segmentCount);
- IResource outputFile = md.binaryFolder.getFile(resourcePath);
+// IResource outputFile = md.binaryFolder.getFile(resourcePath);
switch (sourceDelta.getKind()) {
case IResourceDelta.ADDED :
- if (outputFile.exists()) {
- if (PHPBuilder.DEBUG)
- System.out.println("Deleting existing file " + resourcePath); //$NON-NLS-1$
- outputFile.delete(IResource.FORCE, null);
- }
+// if (outputFile.exists()) {
+// if (PHPBuilder.DEBUG)
+// System.out.println("Deleting existing file " + resourcePath); //$NON-NLS-1$
+// outputFile.delete(IResource.FORCE, null);
+// }
if (PHPBuilder.DEBUG)
System.out.println("Copying added file " + resourcePath); //$NON-NLS-1$
- createFolder(resourcePath.removeLastSegments(1), md.binaryFolder); // ensure
+// createFolder(resourcePath.removeLastSegments(1), md.binaryFolder); // ensure
// package
// exists
// in
// the
// output
// folder
- resource.copy(outputFile.getFullPath(), IResource.FORCE, null);
- outputFile.setDerived(true);
+// resource.copy(outputFile.getFullPath(), IResource.FORCE, null);
+// outputFile.setDerived(true);
return;
case IResourceDelta.REMOVED :
- if (outputFile.exists()) {
- if (PHPBuilder.DEBUG)
- System.out.println("Deleting removed file " + resourcePath); //$NON-NLS-1$
- outputFile.delete(IResource.FORCE, null);
- }
+// if (outputFile.exists()) {
+// if (PHPBuilder.DEBUG)
+// System.out.println("Deleting removed file " + resourcePath); //$NON-NLS-1$
+// outputFile.delete(IResource.FORCE, null);
+// }
return;
case IResourceDelta.CHANGED :
if ((sourceDelta.getFlags() & IResourceDelta.CONTENT) == 0)
return; // skip it since it really isn't changed
- if (outputFile.exists()) {
- if (PHPBuilder.DEBUG)
- System.out.println("Deleting existing file " + resourcePath); //$NON-NLS-1$
- outputFile.delete(IResource.FORCE, null);
- }
+// if (outputFile.exists()) {
+// if (PHPBuilder.DEBUG)
+// System.out.println("Deleting existing file " + resourcePath); //$NON-NLS-1$
+// outputFile.delete(IResource.FORCE, null);
+// }
if (PHPBuilder.DEBUG)
System.out.println("Copying changed file " + resourcePath); //$NON-NLS-1$
- createFolder(resourcePath.removeLastSegments(1), md.binaryFolder); // ensure
+ // createFolder(resourcePath.removeLastSegments(1), md.binaryFolder); // ensure
// package
// exists
// in
// the
// output
// folder
- resource.copy(outputFile.getFullPath(), IResource.FORCE, null);
- outputFile.setDerived(true);
+// resource.copy(outputFile.getFullPath(), IResource.FORCE, null);
+// outputFile.setDerived(true);
}
return;
}