TextViewer Console - change text presentation., [message #585153] |
Sun, 28 March 2004 12:48 |
Eclipse User |
|
|
|
Originally posted by: iriss.ndsisrael.com
Hello ,
I'm using the console view as a viewer but I can't change the text
presentation in it.
This is my code , but again it doesn't work.
IViewPart consoleView;
TextViewer viewer;
IDocument doc ;
public MyViewer() {
//define the viewer & doc
try {
consoleView = PlatformUI.getWorkbenc()
.getActiveWorkbenchWindow().getActivePage().
showView("org.eclipse.debug.ui.ConsoleView");
} catch (PartInitException e1) {
// Auto-generated catch block
e1.printStackTrace();
}
viewer = (TextViewer) ((AbstractDebugView) consoleView).getViewer();
doc = viewer.getDocument();
String str =
"This is plain text\n" + "This is bold text\n" + "This is red
text";
TextPresentation style = new TextPresentation();
style.addStyleRange( new StyleRange(1, 17, null, null, SWT.BOLD));
Color red = new Color(Display.getDefault() ,255, 40, 50);
style.addStyleRange( new StyleRange(0, 16, red, null));
viewer.setDocument( doc );
viewer.changeTextPresentation(style, true);
|
|
|
Powered by
FUDForum. Page generated in 0.02943 seconds