Tabs disregarded in message String in Dialog

I am trying to display a code snippet in a message dialog, but all of my tabs are disregarded so the code does not look good. I inserted a '\t' in my string literal to make sure that this is what is happening. Is there any way to retain tabs in the message dialog?

Here is my code:

String prettyText = document.getText();

/* Make sure the user likes the recommendation */
/* This method returns 0 for Yes, 1 for No */
int userWantsToApply = Messages.showYesNoDialog(project,
"Do you want to apply \n\tthis recommended change?\n\n"
+ prettyText, "Question", Messages.getQuestionIcon());

Here is the result of my code: link

2 comments

Those dialogs are not meant to show "formatted" text. I'd suggest to use a custom component with HTML to render formatted content.

0

Please sign in to leave a comment.