Difference between revisions of "Displaying Debug Messages"

From OpenJUMP Wiki
Jump to navigation Jump to search
(Created page with 'There are several ways to display debug, progress or even warning messages. * The common way is to write to the console, which only works if debugging is performed in a develop…')
 
(No difference)

Latest revision as of 23:29, 4 January 2010

There are several ways to display debug, progress or even warning messages.

  • The common way is to write to the console, which only works if debugging is performed in a development environment or so. Simply use:
    System.out.println("debugmessagehere")
  • If you only want to display a progress report (e.g. counting the number of items processed) you may use a ThreadedPlugIn (interface, or ThreadedBasePlugIn) and the TaskMonitor of the run method, e.g.
    monitor.report("prepare computation");
  • if you want to sent the user a warning message (or other message) you may use either
    context.getWorkbenchFrame().warnUser("blabla");
    or
    context.getWorkbenchFrame().setTimeMEssage("blabla");
  • a not so direct method, but useful for sending long reports at the end of the processing is to generate a new html output window as shown in the "Hello World" example of the Developer's Guide.
context.getWorkbenchFrame().getOutputFrame().createNewDocument();
context.getWorkbenchFrame().getOutputFrame().addText(getString("Hallo"));
context.getWorkbenchFrame().getOutputFrame().surface();