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 05:01 Go to next message
Dani is currently offline Dani
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 10:22 Go to previous messageGo to next message
Devi Vara Prasad Bandaru is currently offline Devi Vara Prasad Bandaru
Messages: 98
Registered: March 2010
Location: Hyderabad
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 14:32 Go to previous messageGo to next message
Dani is currently offline Dani
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 15:57 Go to previous messageGo to next message
Devi Vara Prasad Bandaru is currently offline Devi Vara Prasad Bandaru
Messages: 98
Registered: March 2010
Location: Hyderabad
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 09:06 Go to previous message
Dani is currently offline Dani
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: Tue Sep 02 08:01:13 EDT 2014

Powered by FUDForum. Page generated in 0.03227 seconds