import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import net.sourceforge.phpdt.core.compiler.ITerminalSymbols;
import net.sourceforge.phpdt.core.compiler.InvalidInputException;
public class IncludesScanner implements ITerminalSymbols {
- private final PHPOpenAllIncludesEditorAction fLineCreator;
+// private final PHPOpenAllIncludesEditorAction fOpenAllIncludesAction;
private IProject fProject;
private IFileEditorInput fEditorInput;
- HashSet fSet;
- public IncludesScanner(PHPOpenAllIncludesEditorAction action, IProject project, IFileEditorInput editorInput) {
+ private HashSet fSet;
+ public IncludesScanner(IProject project, IFileEditorInput editorInput) {
fProject = project;
- this.fLineCreator = action;
+// fOpenAllIncludesAction = action;
fEditorInput = editorInput;
fSet = new HashSet();
}
try {
if (fileToParse.exists()) {
- addInputStream(new BufferedInputStream(fileToParse.getContents()), fileToParse.getFullPath().toString());
+ addInputStream(new BufferedInputStream(fileToParse.getContents()), fileToParse.getProjectRelativePath().toString());
}
} catch (CoreException e1) {
e1.printStackTrace();
String identifier;
int counter = 0;
- Scanner scanner = new Scanner(false, false, false, false, true, null, null);
+ Scanner scanner = new Scanner(false, false, false, false, true, null, null, true /*taskCaseSensitive*/);
scanner.setSource(charArray);
scanner.setPHPMode(false);
int token = getNextToken(scanner);
// e.printStackTrace();
}
}
+
+ private IContainer getWorkingLocation(IFileEditorInput editorInput) {
+ if (editorInput == null || editorInput.getFile() == null) {
+ return null;
+ }
+ return editorInput.getFile().getParent();
+ }
public IFile getIncludeFile(String relativeFilename) {
- IContainer container = this.fLineCreator.getWorkingLocation(fEditorInput);
+ IContainer container = getWorkingLocation(fEditorInput);
String fullPath = fProject.getLocation().toString();
IFile file = null;
if (relativeFilename.startsWith("../")) {
return list;
}
+ /**
+ * @return Returns the set.
+ */
+ public Set getSet() {
+ return fSet;
+ }
}
\ No newline at end of file