How can i display a Error Message Box in a Refactoring?

Hi,

can anyone provide me with a hint how i can get an Error Message Box in a refactoring.

I have to display some text while in the

refactor(refactoringContext) -> void {

???  MessagBox.showError("error text here"); ???

}

function ....

Best,
Dan
5 comments
Hi, Dan

I really don't know if my solution is the best, but you can add the java_stub import for javax.swing to your refactorings model and use the JOptionPane class (it has several static methods for displaying message boxes).

Alexey
0
Hi Alexey,

but don´t i need a parent component or something like that? I do not have any reference to the ui thread ....

Dan
0
You can provide null as the parent component
0
Just tried:
JOptionPane.showMessageDialog(null,
     "Message", "Caption" JOptionPane.ERROR_MESSAGE);
prettyPrint();
result in correct modal message box.
0
Indeed - perfect ...

Thanks,
Alexey
0

Please sign in to leave a comment.