Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Matching end string for each begin(How to match end for each begin)
Matching end string for each begin [message #1824335] Tue, 14 April 2020 06:36 Go to next message
Virag Purnam is currently offline Virag PurnamFriend
Messages: 130
Registered: June 2014
Senior Member
Hi,

In the below example, when i select begin, I want to highlight matching end.
And on double click i want to highlight the complete code between begin and end.
How can i achieve this. I have gone through BracePairMatcher class. But this accepts only characters. I would like to achieve similar functionality for string.

ex:
struct struct1 
    begin
        int a;
         struct struct 2
             begin
                   int b;
              end
    end




How can I achieve this ?



Thanks and regards,
Virag
Re: Matching end string for each begin [message #1824342 is a reply to message #1824335] Tue, 14 April 2020 07:11 Go to previous messageGo to next message
Tamas Miklossy is currently offline Tamas MiklossyFriend
Messages: 114
Registered: February 2016
Senior Member
Hi Virag,

- For matching more than one characters, you may take a look at the org.eclipse.jface.text.source.ICharacterPairMatcherExtension interface
- For selecting a certain region when double clicking, you may take a look at the org.eclipse.xtext.ui.editor.doubleClicking.DoubleClickStrategyProvider and the AbstractEditorDoubleClickTextSelectionTest classes. An example implementation and the corresponding test case can be found in the Eclipse GEF DOT project.

Hope that helps,
Tamás
Re: Matching end string for each begin [message #1824428 is a reply to message #1824342] Wed, 15 April 2020 08:11 Go to previous message
Virag Purnam is currently offline Virag PurnamFriend
Messages: 130
Registered: June 2014
Senior Member
Thanks Mr. Tamas Miklossy for the pointers.
I will look into the classes mentioned by you.

Regards,
Virag
Previous Topic:How to hold the attribute value even after xtext resource load.
Next Topic:Programatic Loading of Multiple XText Projects with dependencies
Goto Forum:
  


Current Time: Thu Oct 29 00:01:25 GMT 2020

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

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

Back to the top