*/
public void run() {
boolean phpFlag = false;
+
+ // try {
+ fileToParse = getPHPFile();
+ parseFile(fileToParse);
+ }
+
+ public static void parseFile(IFile fileToParse) {
+ boolean phpFlag = false;
try {
- fileToParse = getPHPFile();
+
if (fileToParse == null) {
// should never happen
System.err.println("Error : no file in the editor");
return;
}
String name = fileToParse.getName().toLowerCase();
- for (int i = 0; i<EXTENSIONS.length; i++) {
+ for (int i = 0; i < EXTENSIONS.length; i++) {
if (name.endsWith(EXTENSIONS[i])) {
- phpFlag = true; // php file extension
+ phpFlag = true; // php file extension
break;
}
}
try {
InputStream iStream = fileToParse.getContents();
// int c = iStream.read();
- parse(iStream);
+ parse(fileToParse, iStream);
iStream.close();
} catch (IOException e) {
}
}
}
-
/**
* Finds the file that's currently opened in the PHP Text Editor
*/
// return identifier.toString();
// }
- protected void parse(InputStream iStream) {
+ protected static void parse(IFile fileToParse, InputStream iStream) {
StringBuffer buf = new StringBuffer();
int c0;