X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/ParserBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/ParserBuilder.java index 4b9babe..4fd5108 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/ParserBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/ParserBuilder.java @@ -1,9 +1,12 @@ package net.sourceforge.phpeclipse.builder; +import java.io.File; import java.util.Map; import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil; +import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.PHPParserAction; +import net.sourceforge.phpeclipse.resourcesview.PHPProject; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; @@ -35,8 +38,7 @@ public class ParserBuilder extends IncrementalProjectBuilder { /** * */ - protected IProject[] build(int kind, Map args, IProgressMonitor monitor) - throws CoreException { + protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException { monitor.beginTask("Parsing files", TOTAL_WORK); if (kind == IncrementalProjectBuilder.FULL_BUILD) { @@ -48,7 +50,7 @@ public class ParserBuilder extends IncrementalProjectBuilder { IResourceDelta delta = getDelta(getProject()); if (delta != null) { - delta.accept(new ParserVisitor(monitor)); + delta.accept(new ParserVisitor(getProject(), monitor)); } } @@ -62,8 +64,8 @@ public class ParserBuilder extends IncrementalProjectBuilder { * * @param iProject */ - public void processFull(IProject iProject, final IProgressMonitor monitor) { - + public void processFull(final IProject iProject, final IProgressMonitor monitor) { + final IdentifierIndexManager indexManager = PHPeclipsePlugin.getDefault().getIndexManager(iProject); // Create resource visitor logic IResourceVisitor myVisitor = new IResourceVisitor() { public boolean visit(IResource resource) throws CoreException { @@ -71,11 +73,14 @@ public class ParserBuilder extends IncrementalProjectBuilder { if (monitor.isCanceled()) { throw new OperationCanceledException(); } - if ((resource.getFileExtension() != null) - && PHPFileUtil.isPHPFile((IFile) resource)) { + if ((resource.getFileExtension() != null) && PHPFileUtil.isPHPFile((IFile) resource)) { monitor.worked(1); monitor.subTask("Parsing: " + resource.getFullPath()); + // check for parsing errors PHPParserAction.parseFile((IFile) resource); + // update indexfile for the project: + PHPProject nature = (PHPProject) iProject.getNature(PHPeclipsePlugin.PHP_NATURE_ID); + indexManager.addFile((IFile) resource); } } @@ -85,7 +90,14 @@ public class ParserBuilder extends IncrementalProjectBuilder { // Process the project using the visitor just created try { + +// if (iProject.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)) { +// thePHPProject = new PHPProject(); +// thePHPProject.setProject(iProject); +// } + indexManager.initialize(); iProject.accept(myVisitor); + indexManager.writeFile(); } catch (CoreException e) { e.printStackTrace(); } @@ -120,11 +132,7 @@ public class ParserBuilder extends IncrementalProjectBuilder { * *

*/ - public void setInitializationData( - IConfigurationElement config, - String propertyName, - Object data) - throws CoreException { + public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { super.setInitializationData(config, propertyName, data); }