Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Syntax Highligting in org.eclipse.swt.widgets.Text(Syntax Higligting in Text Area)
Syntax Highligting in org.eclipse.swt.widgets.Text [message #633063] Fri, 15 October 2010 09:01 Go to next message
Dani is currently offline DaniFriend
Messages: 41
Registered: October 2010
Member
Hi,
I am working on eclipse plugin Development, I have a text area of type org.eclipse.swt.widgets.Text I want code highligting in that text area when a user type some thing. can any body suggest me how can I do it? waiting for you replies.


Jaguar
Re: Syntax Highligting in org.eclipse.swt.widgets.Text [message #633161 is a reply to message #633063] Fri, 15 October 2010 14:22 Go to previous messageGo to next message
Devi Vara Prasad Bandaru is currently offline Devi Vara Prasad BandaruFriend
Messages: 100
Registered: March 2010
Location: Hyderabad
Senior Member

Hi,
Try the styled text widget
http://www.eclipse.org/articles/StyledText%201/article1.html


Re: Syntax Highligting in org.eclipse.swt.widgets.Text [message #633343 is a reply to message #633161] Sat, 16 October 2010 18:32 Go to previous messageGo to next message
Dani is currently offline DaniFriend
Messages: 41
Registered: October 2010
Member
Dear Parasad,
Actually I am working with tabbed properties of eclipse plugins and there I am unable to use any other Text criteria other then simple text widgets is you have any idea to use StyledText in Tabbed Properties please let me know it will would be a great favor for me!


/Jaguar
Re: Syntax Highligting in org.eclipse.swt.widgets.Text [message #633354 is a reply to message #633343] Sat, 16 October 2010 19:57 Go to previous messageGo to next message
Devi Vara Prasad Bandaru is currently offline Devi Vara Prasad BandaruFriend
Messages: 100
Registered: March 2010
Location: Hyderabad
Senior Member

You can use any SWT widgets inside the tabbed properties sections. Here is the snippet of the usage of styled text in the properties sections.


	@Override
	public void createControls(Composite parent,
			TabbedPropertySheetPage aTabbedPropertySheetPage) {
		super.createControls(parent, aTabbedPropertySheetPage);
		
		Composite composite = new Composite(parent, SWT.NONE);
		composite.setLayout(new GridLayout(2, false));
		
		Label label = getWidgetFactory().createLabel(composite, "Text:");
		label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
		StyledText styledText = new StyledText(composite, SWT.MULTI | SWT.WRAP | SWT.BORDER);
		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
		gridData.heightHint = 200;
		styledText.setLayoutData(gridData);
		styledText.setText("This is a sample text");
		
		StyleRange styleRange = new StyleRange();
		styleRange.start = 0;
		styleRange.length = 4;
		styleRange.fontStyle = SWT.BOLD;
		styleRange.foreground = new Color(null, 255, 127, 0);
		styledText.setStyleRange(styleRange);
		


Re: Syntax Highligting in org.eclipse.swt.widgets.Text [message #633399 is a reply to message #633354] Sun, 17 October 2010 13:06 Go to previous message
Dani is currently offline DaniFriend
Messages: 41
Registered: October 2010
Member
Hi Parasad,
Thank you very much for helping me. one more thing to ask if you can guide me. is there any way to use parser for text entered in Styled text box. because in whole of the eclipse community they first save file and then parse it. is there any way I can take the entered Text and parse it?



/Jaguar
Previous Topic:How to update file contents in background?
Next Topic:Invoke maven goal
Goto Forum:
  


Current Time: Thu Apr 18 14:49:16 GMT 2024

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

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

Back to the top