Implementing input messages to the Eclipse console

Source: Internet
Author: User
Tags stringbuffer

When developing eclipse extensions, it is sometimes necessary to output the information directly to the console, such as Debug. At the same time, in RCP applications, the end user may want to output the current operation information and so on. Then we can use the following method to output our message to the console view:

//org.eclipse.ui.console
Messageconsolestream console = This.openlogconsole ("RCP",
"Informatiol",
"Org.eclipse.workbench.ui.ide");
Console.println (New Date (System.currenttimemillis ())
+ ": selected!");
Public Messageconsolestream openlogconsole (string domainname,
String Stationid, String applicationid) {
System.err.println ("Openlogconsole" (domain= + domainname +),
station= "
+ Stationid +", app= "+ ApplicationID +" )");
/*
* Get console name and create a new console
*/
StringBuffer consolename = new StringBuffer (domainname) ;
if (Stationid!= null) {
Consolename.append (">" + stationid);
if (ApplicationID!= null) {
Consolename . Append (">" + ApplicationID);
}
}
Messageconsole console = new
Messageconsole (consolename.tostring (),
Null);
Final Messageconsolestream Consolestream =
Console.newmessagestream ();
Consolestream.setcolor (Display.getDefault (). Getsystemcolor (
SWT.Color_blue));
/*
* Show View
*/
Iconsolemanager manager = (iconsolemanager)
Consoleplugin.getdefault ()
. Getcon Solemanager ();
Manager
. Addconsoles (New org.eclipse.ui.console.iconsole[] {
(org.eclipse.ui.console.IConsole) Console} );
Manager.showconsoleview (console);
return consolestream;
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.