X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/ParserVisitor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/ParserVisitor.java index ef6491d..b34f40a 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/ParserVisitor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/ParserVisitor.java @@ -14,81 +14,88 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; /** - * + * * @see org.eclipse.core.resources.IResourceDelta * @see org.eclipse.core.resources.IResourceDeltaVisitor */ public class ParserVisitor implements IResourceDeltaVisitor { - final IProgressMonitor fMonitor; - final IProject fProject; - public ParserVisitor(IProject iProject, IProgressMonitor monitor) { - fMonitor = monitor; - fProject = iProject; - } - - protected void checkCancel() { - if (fMonitor.isCanceled()) { - throw new OperationCanceledException(); - } - } - - /** - * Visits the given resource delta. - * - * @return true if the resource delta's children should - * be visited; false if they should be skipped. - * @exception CoreException if the visit fails for some reason. - */ - public boolean visit(IResourceDelta delta) throws CoreException { - - IResource resource = delta.getResource(); - int resourceType = resource.getType(); - checkCancel(); - - final IdentifierIndexManager indexManager = PHPeclipsePlugin.getDefault().getIndexManager(fProject); - - switch (delta.getKind()) { - case IResourceDelta.ADDED : - if (resourceType == IResource.FILE) { - if ((resource.getFileExtension() != null) && PHPFileUtil.isPHPFile((IFile) resource)) { - fMonitor.worked(1); - fMonitor.subTask("Adding: " + resource.getFullPath()); - - // check for parsing errors - //PHPParserAction.parseFile((IFile) resource); - // update indexfile for the project: - indexManager.addFile((IFile) resource); - } - } - break; - - case IResourceDelta.CHANGED : - if (resourceType == IResource.FILE) { - if ((resource.getFileExtension() != null) && PHPFileUtil.isPHPFile((IFile) resource)) { - fMonitor.worked(1); - fMonitor.subTask("Changing: " + resource.getFullPath()); - - //check for parsing errors - //PHPParserAction.parseFile((IFile) resource); - // update indexfile for the project: - indexManager.changeFile((IFile) resource); - } - } - break; - - case IResourceDelta.REMOVED : - if (resourceType == IResource.FILE) { - if ((resource.getFileExtension() != null) && PHPFileUtil.isPHPFile((IFile) resource)) { - fMonitor.worked(1); - fMonitor.subTask("Removing: " + resource.getFullPath()); - - // update indexfile for the project: - indexManager.removeFile((IFile) resource); - } - } - break; - } - return true; // carry on - } + final IProgressMonitor fMonitor; + + final IProject fProject; + + public ParserVisitor(IProject iProject, IProgressMonitor monitor) { + fMonitor = monitor; + fProject = iProject; + } + + protected void checkCancel() { + if (fMonitor.isCanceled()) { + throw new OperationCanceledException(); + } + } + + /** + * Visits the given resource delta. + * + * @return true if the resource delta's children should be + * visited; false if they should be skipped. + * @exception CoreException + * if the visit fails for some reason. + */ + public boolean visit(IResourceDelta delta) throws CoreException { + + IResource resource = delta.getResource(); + int resourceType = resource.getType(); + checkCancel(); + + final IdentifierIndexManager indexManager = PHPeclipsePlugin + .getDefault().getIndexManager(fProject); + + switch (delta.getKind()) { + case IResourceDelta.ADDED: + if (resourceType == IResource.FILE) { + if ((resource.getFileExtension() != null) + && PHPFileUtil.isPHPFile((IFile) resource)) { + fMonitor.worked(1); + fMonitor.subTask("Adding: " + resource.getFullPath()); + + // check for parsing errors + // PHPParserAction.parseFile((IFile) resource); + // update indexfile for the project: + indexManager.addFile((IFile) resource); + } + } + break; + + case IResourceDelta.CHANGED: + if (resourceType == IResource.FILE) { + if ((resource.getFileExtension() != null) + && PHPFileUtil.isPHPFile((IFile) resource)) { + fMonitor.worked(1); + fMonitor.subTask("Changing: " + resource.getFullPath()); + + // check for parsing errors + // PHPParserAction.parseFile((IFile) resource); + // update indexfile for the project: + indexManager.changeFile((IFile) resource); + } + } + break; + + case IResourceDelta.REMOVED: + if (resourceType == IResource.FILE) { + if ((resource.getFileExtension() != null) + && PHPFileUtil.isPHPFile((IFile) resource)) { + fMonitor.worked(1); + fMonitor.subTask("Removing: " + resource.getFullPath()); + + // update indexfile for the project: + indexManager.removeFile((IFile) resource); + } + } + break; + } + return true; // carry on + } } \ No newline at end of file