Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » TextEditor connection
TextEditor connection [message #526935] Tue, 13 April 2010 14:16 Go to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
Hi All,
I am cross-posting on emf and rcp because I am actually asking two,
tightly bound, questions.

I need to connect a (simple) model to a TextEditor Syntax scanner.
More precisely I need:

1) highlight with a certain color/font all words in a certain list; list
is dynamic and list is in the model; color/font is in the model.
Usage case: I have a list of locations in the model and each time I type
in the Text Editor the name of a known place I want it highlighted in
the text. Of course I can add a location to the model and I want to have
the Text to be updated accordingly. I can have different classes of
locations, hence the different colors/fonts.

2) highlight with a certain color/font everything *between* two matched
tags; start-tag, end-tag and TextAttribute are in the model.
Usage case: implement several kind of semantic quoting in the Text: this
is a place description, this is a touristic information, this is
historical note, ...

I have tried using the usual partition/syntax scanners, but those have
(at least) two issues:

a) they are virtually static, I found no (easy) way to change them "on
the fly", while I would like to be able to add a new "location" or even
a new "semantic class" (adding them to the model, that's the easy part!)
while I'm typing in the TextEditor.

b) I would like to recognize the class (1) (keywords) even inside the
class (2) (semantic tagging), sometimes it would even make sense to nest
one semantic class into another (I am speaking about history and I then
insert info about a specific museum, which is touristic info).
All this doesn't seem possible with stock partition/syntax scanners.

Nearest thing I found would be to implement Semantic via
IDocumentPartitioner and Keyword using DefaultDamagerRepairer.
This approach still suffers from (a) and does not allow for nested
semantic sections.

Before I start (re)writing a huge portion of code:
Can someone tell me if something along these lines is available somewhere?
If the answer is "no": can someone tell me what is the "eclipse correct"
way to tackle the problem?

Thanks in advance.
Re: TextEditor connection [message #526964 is a reply to message #526935] Tue, 13 April 2010 15:04 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050300040209090600070302
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Mauro,

Comments below.


Mauro Condarelli wrote:
> Hi All,
> I am cross-posting on emf and rcp because I am actually asking two,
> tightly bound, questions.
>
> I need to connect a (simple) model to a TextEditor Syntax scanner.
> More precisely I need:
Sounds like a job for Xtext <http://www.eclipse.org/Xtext/>...
>
> 1) highlight with a certain color/font all words in a certain list;
> list is dynamic and list is in the model; color/font is in the model.
> Usage case: I have a list of locations in the model and each time I
> type in the Text Editor the name of a known place I want it
> highlighted in the text. Of course I can add a location to the model
> and I want to have the Text to be updated accordingly. I can have
> different classes of locations, hence the different colors/fonts.
>
> 2) highlight with a certain color/font everything *between* two
> matched tags; start-tag, end-tag and TextAttribute are in the model.
> Usage case: implement several kind of semantic quoting in the Text:
> this is a place description, this is a touristic information, this is
> historical note, ...
>
> I have tried using the usual partition/syntax scanners, but those have
> (at least) two issues:
>
> a) they are virtually static, I found no (easy) way to change them "on
> the fly", while I would like to be able to add a new "location" or
> even a new "semantic class" (adding them to the model, that's the easy
> part!) while I'm typing in the TextEditor.
>
> b) I would like to recognize the class (1) (keywords) even inside the
> class (2) (semantic tagging), sometimes it would even make sense to
> nest one semantic class into another (I am speaking about history and
> I then insert info about a specific museum, which is touristic info).
> All this doesn't seem possible with stock partition/syntax scanners.
>
> Nearest thing I found would be to implement Semantic via
> IDocumentPartitioner and Keyword using DefaultDamagerRepairer.
> This approach still suffers from (a) and does not allow for nested
> semantic sections.
>
> Before I start (re)writing a huge portion of code:
> Can someone tell me if something along these lines is available
> somewhere?
> If the answer is "no": can someone tell me what is the "eclipse
> correct" way to tackle the problem?
Before you write a line of code, you need to explore Xtext. It
generates everything you describe from BNF-style grammar.
>
> Thanks in advance.

--------------050300040209090600070302
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Mauro,<br>
<br>
Comments below.<br>
<br>
<br>
Mauro Condarelli wrote:
<blockquote cite="mid:hq1ubo$p2d$1@build.eclipse.org" type="cite">Hi
All,
<br>
I am cross-posting on emf and rcp because I am actually asking two,
tightly bound, questions.
<br>
<br>
I need to connect a (simple) model to a TextEditor Syntax scanner.
<br>
More precisely I need:
<br>
</blockquote>
Sounds like a job for <a href="http://www.eclipse.org/Xtext/">Xtext</a>...<br>
<blockquote cite="mid:hq1ubo$p2d$1@build.eclipse.org" type="cite"><br>
1) highlight with a certain color/font all words in a certain list;
list is dynamic and list is in the model; color/font is in the model.
<br>
Usage case: I have a list of locations in the model and each time I
type in the Text Editor the name of a known place I want it highlighted
in the text. Of course I can add a location to the model and I want to
have the Text to be updated accordingly. I can have different classes
of locations, hence the different colors/fonts.
<br>
<br>
2) highlight with a certain color/font everything *between* two matched
tags; start-tag, end-tag and TextAttribute are in the model.
<br>
Usage case: implement several kind of semantic quoting in the Text:
this is a place description, this is a touristic information, this is
historical note, ...
<br>
<br>
I have tried using the usual partition/syntax scanners, but those have
(at least) two issues:
<br>
<br>
a) they are virtually static, I found no (easy) way to change them "on
the fly", while I would like to be able to add a new "location" or even
a new "semantic class" (adding them to the model, that's the easy
part!) while I'm typing in the TextEditor.
<br>
<br>
b) I would like to recognize the class (1) (keywords) even inside the
class (2) (semantic tagging), sometimes it would even make sense to
nest one semantic class into another (I am speaking about history and I
then insert info about a specific museum, which is touristic info).
<br>
All this doesn't seem possible with stock partition/syntax scanners.
<br>
<br>
Nearest thing I found would be to implement Semantic via
IDocumentPartitioner and Keyword using DefaultDamagerRepairer.
<br>
This approach still suffers from (a) and does not allow for nested
semantic sections.
<br>
<br>
Before I start (re)writing a huge portion of code:
<br>
Can someone tell me if something along these lines is available
somewhere?
<br>
If the answer is "no": can someone tell me what is the "eclipse
correct" way to tackle the problem?
<br>
</blockquote>
Before you write a line of code, you need to explore Xtext.&nbsp; It
generates everything you describe from BNF-style grammar.<br>
<blockquote cite="mid:hq1ubo$p2d$1@build.eclipse.org" type="cite"><br>
Thanks in advance.
<br>
</blockquote>
</body>
</html>

--------------050300040209090600070302--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Tabs INSIDE a view??
Next Topic:problem with menu extension
Goto Forum:
  


Current Time: Sat Apr 27 00:05:47 GMT 2024

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

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

Back to the top