Home » Archived » Visual Editor (VE) » TextViewer Console - change text presentation.,
TextViewer Console - change text presentation., [message #27303] |
Sun, 28 March 2004 07: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);
|
|
|
Re: TextViewer Console - change text presentation., [message #27733 is a reply to message #27303] |
Sun, 28 March 2004 14:27  |
Eclipse User |
|
|
|
Inbar Riss wrote:
I believe you have the wrong newsgroup - this newsgroup is for users of
the Visual Editor. The newsgroup eclipse.platform or eclipse.tools.jdt
would be my guess.
- Jeff
>
> 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);
>
|
|
|
Re: TextViewer Console - change text presentation., [message #585210 is a reply to message #27303] |
Sun, 28 March 2004 14:27  |
Eclipse User |
|
|
|
Inbar Riss wrote:
I believe you have the wrong newsgroup - this newsgroup is for users of
the Visual Editor. The newsgroup eclipse.platform or eclipse.tools.jdt
would be my guess.
- Jeff
>
> 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);
>
|
|
|
Goto Forum:
Current Time: Fri Sep 12 15:33:14 EDT 2025
Powered by FUDForum. Page generated in 0.12462 seconds
|