How can I get the code from the current open file in Eclipse returned in a String
or String[]
? I need this for a plugin I'm making.
Let's say I have the following code:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
If I have HelloWorld.java open, how do I get that code returned in a String[]
? The String[]
would contain:
- "public class HelloWorld {"
- "public static void main(String[] args) {"
- "System.out.println("Hello, world!");"
- "}"
- "}"