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.IResource;
8 import org.eclipse.core.resources.IResourceVisitor;
9 import org.eclipse.core.runtime.CoreException;
11 public class PHPElementVisitor implements IResourceVisitor {
12 protected List phpFiles = new ArrayList();
14 public PHPElementVisitor() {
18 public boolean visit(IResource resource) throws CoreException {
19 switch (resource.getType()) {
20 case IResource.PROJECT :
23 case IResource.FOLDER :
27 IFile fileResource = (IFile) resource;
28 if ( "php".equals(fileResource.getFileExtension()) ||
29 "php3".equals(fileResource.getFileExtension()) ||
30 "php4".equals(fileResource.getFileExtension()) ) {
31 phpFiles.add(fileResource);
40 public Object[] getCollectedPHPFiles() {
41 return phpFiles.toArray();