Execute a Java method in Editor and show the result in Console
I am writing a plugin for Java/Kotlin projects for which I need the below functionality.
Let's say I have a method like this in my editor:
private void getPosition(String value, String input) {
String item = globalValue.item;
... // lot of code
String result = compute(value + input);
... // lot of code
}
I am looking for a way to execute this method and print the output in the Console.
So my questions:
1. How do I execute a piece of Java/Kotlin code which is present in the Editor?
2. How do I inject values for "value", "globalValue", etc?
3. Is it possible to access the value of "result" variable during the execution in my plugin?
Any help is appreciated. I am going through the intellij-community codebase to see if we have some extension that does this.
请先登录再写评论。