1 package net.sourceforge.phpdt.internal.ui.util;
3 import java.util.ArrayList;
6 import org.eclipse.core.resources.IFile;
7 import org.eclipse.core.resources.IFolder;
8 import org.eclipse.core.resources.IResource;
9 import org.eclipse.core.resources.IResourceVisitor;
10 import org.eclipse.core.runtime.CoreException;
12 public class PHPElementVisitor implements IResourceVisitor {
13 protected List phpFiles = new ArrayList();
15 public PHPElementVisitor() {
19 public boolean visit(IResource resource) throws CoreException {
20 switch (resource.getType()) {
21 case IResource.PROJECT :
24 case IResource.FOLDER :
28 IFile fileResource = (IFile) resource;
29 if ( "php".equals(fileResource.getFileExtension()) ||
30 "php3".equals(fileResource.getFileExtension()) ||
31 "php4".equals(fileResource.getFileExtension()) ) {
32 phpFiles.add(fileResource);
41 public Object[] getCollectedPHPFiles() {
42 return phpFiles.toArray();