Sometimes it is useful to display some message to the user from the code running on the server side (in D2-Plugin). At the first sight there doesn’t seem to be a way to do this but thanks to Dariusz R. (thanks!) who has decompiled half of D2 code 🙂 we have learned that it is actually possible. And it is also extremely simple:
The trick is to use D2fsExceptionManager.throwD2SilentException(D2fsContext context, String eventName, String messageToPublish) exception with appropriate event name and message, for example:
D2fsExceptionManager.throwD2SilentException(context, "D2_ACTION_DISPLAY_DIALOG", "DIALOG_NAME==VeryImportantDialog!!CHANNEL_EVENT==D2_ACTION_DISPLAY_DIALOG");
That’s all! Try it for yourself.