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

  • 13
  • 5

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
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

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

You can provide null as the parent component

Just tried:
JOptionPane.showMessageDialog(null,
     "Message", "Caption" JOptionPane.ERROR_MESSAGE);

result in correct modal message box.