Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » MessageConsole Background Color Does Not Change(I'm trying to change the background color of a MessageConsole object but the color does not change when I run the plugin)
MessageConsole Background Color Does Not Change [message #550053] Wed, 28 July 2010 22:14 Go to next message
No real name is currently offline No real nameFriend
Messages: 2
Registered: July 2010
Junior Member
I'm new to writing plugins so I'm playing around a bit trying to get a feel for how everything interacts. My goal for now is to write text of different colors to a MessageConsole and to make the colors stand out more I want to change the background color of the console to black. The problem is that even though I change the color in my code, when I launch the plugin the color remains the same (white).

Any help would be appreciated. Thanks.

public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;

Display display = Display.getCurrent();

MessageConsole myConsole = findConsole("myConsoleTest");
myConsole.setBackground(new Color(display,0,0,0));

MessageConsoleStream out = myConsole.newMessageStream();


out.setColor(new Color(display,0,0,200));
out.println("Hello from console plugin");

}
Re: MessageConsole Background Color Does Not Change [message #550464 is a reply to message #550053] Fri, 30 July 2010 13:14 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 4
Registered: July 2010
Junior Member
I'm just in the same situation than you, so I will also appreciate any help...thanks in advance.
Re: MessageConsole Background Color Does Not Change [message #550745 is a reply to message #550464] Wed, 04 August 2010 09:00 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 4
Registered: July 2010
Junior Member
Hi, I have found the solution, I don't know if still useful for you, but I will let it here for someone searching for the same problem.

The color isn't changed because the setBackground or setColor raise an "Invalid thread access" exception because trying to access the UI thread and then the color isn't changed. The calls should be done synchronized with the UI thread in the following way:

TextMessageConsole myConsole = findConsole("My Console");
// Set colors of console background, output and error
// but in a synchronized way with the UI-thread
Display.getDefault().syncExec(new Runnable() {
public void run() {
MessageConsoleStream out = myConsole.newMessageStream();
myConsole.setBackground(new Color(null, 0, 0, 0);
out.setColor(new Color(null, 255, 0, 0);
}

And color is changed. Hope it helps.
Re: MessageConsole Background Color Does Not Change [message #644017 is a reply to message #550745] Thu, 09 December 2010 05:22 Go to previous message
Shiv  is currently offline Shiv Friend
Messages: 1
Registered: December 2010
Junior Member
This is fix is not working for me. Is there any workaround/fix for this issue?
Previous Topic:Line Highlighting in active eclipse source code editor
Next Topic:Feature-based PDE-build and the unpack flag
Goto Forum:
  


Current Time: Thu Apr 25 05:47:23 GMT 2024

Powered by FUDForum. Page generated in 0.03780 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top