Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » CDT extension for the POP-C++ programming language
CDT extension for the POP-C++ programming language [message #211148] Wed, 05 March 2008 15:58 Go to next message
Eclipse UserFriend
Originally posted by: matthias.spicher.edu.hefr.ch

Hello everybody,
For our semester project, my colleague and I have to write an eclipse
plug-in for the mentioned programming language. This language extends
the C++ programming language (i.e. 5 or 6 new keywords are defined).

The first step consists in creating an editor which does the syntax
highlighting. We searched the whole newsgroup for some information (and
found some helpful posts ;-)). What we think to know:

- we have to use the extension point org.eclipse.cdt.core.language to
define a new language
- we have to define content types for our file extensions (.cc for
source code files, .ph for header fiels -> .cc already exists from the
CDT environment, .ph we have to create)
- we can derive our language from the
org.eclipse.cdt.core.dom.ast.gnu.gcc.GPPLanguage class (since we have to
add only some keywords)

Unfortunately, there are a lot of things that we don't understand how to do:

- is the link between the editor and the new language created
automagically or how can we create it (because for the .cc files we have
to "force" the plug-in to use "our" language)?
- how can we define a new content type (in the plugin.xml file) for the
new .ph file extension?
- how can we add the new keywords in order that they are highlighted?

Thanks for your help

Matthias
Re: CDT extension for the POP-C++ programming language [message #211203 is a reply to message #211148] Thu, 06 March 2008 10:10 Go to previous messageGo to next message
Anton Leherbauer is currently offline Anton LeherbauerFriend
Messages: 490
Registered: July 2009
Senior Member
Spicher Matthias wrote:
> Hello everybody,
> For our semester project, my colleague and I have to write an eclipse
> plug-in for the mentioned programming language. This language extends
> the C++ programming language (i.e. 5 or 6 new keywords are defined).
>
> The first step consists in creating an editor which does the syntax
> highlighting. We searched the whole newsgroup for some information (and
> found some helpful posts ;-)). What we think to know:
>
> - we have to use the extension point org.eclipse.cdt.core.language to
> define a new language
> - we have to define content types for our file extensions (.cc for
> source code files, .ph for header fiels -> .cc already exists from the
> CDT environment, .ph we have to create)
> - we can derive our language from the
> org.eclipse.cdt.core.dom.ast.gnu.gcc.GPPLanguage class (since we have to
> add only some keywords)
>
> Unfortunately, there are a lot of things that we don't understand how to
> do:
>
> - is the link between the editor and the new language created
> automagically or how can we create it (because for the .cc files we have
> to "force" the plug-in to use "our" language)?

The C/C++ editor is the default editor for all predefined C/C++
content-types (defined in org.eclipse.cdt.core/plugin.xml).
Languages are also associated with content-types, but this can be
overriden in the UI on the Language Mappings page (workspace preferences
and project properties). For .cc files you will probably need to
override the default association.
The C/C++ editor is language-aware in the sense that it uses the
interface ICLanguageKeywords to query the language for its keywords.
All predefined C/C++ language implement this interface.

> - how can we define a new content type (in the plugin.xml file) for the
> new .ph file extension?

Look at the examples in org.eclipse.cdt.core/plugin.xml
Important is that you derive the content-type from the predefined ones,
otherwise the C/C++ editor won't open by default for .ph files.

> - how can we add the new keywords in order that they are highlighted?

Extend method getKeywords() of the base language (GPPLanguage).
Or if you intend to have the keywords tokenized, specify them in the
IScannerExtensionConfiguration for you language.

How the parser will handle the new keywords is a different question, though.

> Thanks for your help
>
> Matthias

HTH,
Toni
--
Anton Leherbauer
Wind River CDT Team, Austria
Re: CDT extension for the POP-C++ programming language [message #211542 is a reply to message #211203] Mon, 10 March 2008 11:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: matthias.spicher.edu.hefr.ch

Anton Leherbauer wrote:
> Spicher Matthias wrote:
>> Hello everybody,
>> For our semester project, my colleague and I have to write an eclipse
>> plug-in for the mentioned programming language. This language extends
>> the C++ programming language (i.e. 5 or 6 new keywords are defined).
>>
>> The first step consists in creating an editor which does the syntax
>> highlighting. We searched the whole newsgroup for some information
>> (and found some helpful posts ;-)). What we think to know:
>>
>> - we have to use the extension point org.eclipse.cdt.core.language to
>> define a new language
>> - we have to define content types for our file extensions (.cc for
>> source code files, .ph for header fiels -> .cc already exists from the
>> CDT environment, .ph we have to create)
>> - we can derive our language from the
>> org.eclipse.cdt.core.dom.ast.gnu.gcc.GPPLanguage class (since we have
>> to add only some keywords)
>>
>> Unfortunately, there are a lot of things that we don't understand how
>> to do:
>>
>> - is the link between the editor and the new language created
>> automagically or how can we create it (because for the .cc files we
>> have to "force" the plug-in to use "our" language)?
>
> The C/C++ editor is the default editor for all predefined C/C++
> content-types (defined in org.eclipse.cdt.core/plugin.xml).
> Languages are also associated with content-types, but this can be
> overriden in the UI on the Language Mappings page (workspace preferences
> and project properties). For .cc files you will probably need to
> override the default association.
> The C/C++ editor is language-aware in the sense that it uses the
> interface ICLanguageKeywords to query the language for its keywords.
> All predefined C/C++ language implement this interface.
>
>> - how can we define a new content type (in the plugin.xml file) for
>> the new .ph file extension?
>
> Look at the examples in org.eclipse.cdt.core/plugin.xml
> Important is that you derive the content-type from the predefined ones,
> otherwise the C/C++ editor won't open by default for .ph files.
>
>> - how can we add the new keywords in order that they are highlighted?
>
> Extend method getKeywords() of the base language (GPPLanguage).
> Or if you intend to have the keywords tokenized, specify them in the
> IScannerExtensionConfiguration for you language.
>
> How the parser will handle the new keywords is a different question,
> though.
>
>> Thanks for your help
>>
>> Matthias
>
> HTH,
> Toni

Thank you for your fast and very helpful answers! I was able to create a
new language and the associated content type (.ph). For the .cc
extension I did a language mapping. I tried both, overload getKeywords()
method and specify an IScannerExtensionConfiguration. Both solutions
worked correctly. I also downloaded the sources of the CDT project from
the CVS server because I tried to understand how this scanner extension
configuration works. But unfortunately it's still not clear. I hope you
will help me for these questions:

What is the difference between creating an
IScannerExtensionConfiguration and overloading the getKeywords() method
(I think that the first one must have some advantages)?


What is the advantage (or disadvantage) of having the keywords tokenized?


In the Pop-C++ language there is a construct that I also would like to
highlight:

@{ //some configuration stuff }

I would like to highlight this with a special color, and since this can
not be handled as a keyword, how can I do this (do I have to write my
own parser -> if yes, where can i find the parser that handles
multi-line constructs like comments (as an example))?


Is it possible to create a "group" of keywords? E.g. I would put all the
Pop-C++ keywords in this group and therefore it should be possible in
the "Preferences -> C/C++ -> Editor -> Syntax Coloring" to change the
color of only this group (to distinguish C++ and Pop-C++ keywords)?

Thank you for your help!

Matthias
Re: CDT extension for the POP-C++ programming language [message #211550 is a reply to message #211542] Mon, 10 March 2008 16:05 Go to previous messageGo to next message
Anton Leherbauer is currently offline Anton LeherbauerFriend
Messages: 490
Registered: July 2009
Senior Member
Spicher Matthias wrote:
> Anton Leherbauer wrote:
>> Spicher Matthias wrote:
>>> Hello everybody,
>>> For our semester project, my colleague and I have to write an eclipse
>>> plug-in for the mentioned programming language. This language extends
>>> the C++ programming language (i.e. 5 or 6 new keywords are defined).
>>>
>>> The first step consists in creating an editor which does the syntax
>>> highlighting. We searched the whole newsgroup for some information
>>> (and found some helpful posts ;-)). What we think to know:
>>>
>>> - we have to use the extension point org.eclipse.cdt.core.language to
>>> define a new language
>>> - we have to define content types for our file extensions (.cc for
>>> source code files, .ph for header fiels -> .cc already exists from
>>> the CDT environment, .ph we have to create)
>>> - we can derive our language from the
>>> org.eclipse.cdt.core.dom.ast.gnu.gcc.GPPLanguage class (since we have
>>> to add only some keywords)
>>>
>>> Unfortunately, there are a lot of things that we don't understand how
>>> to do:
>>>
>>> - is the link between the editor and the new language created
>>> automagically or how can we create it (because for the .cc files we
>>> have to "force" the plug-in to use "our" language)?
>>
>> The C/C++ editor is the default editor for all predefined C/C++
>> content-types (defined in org.eclipse.cdt.core/plugin.xml).
>> Languages are also associated with content-types, but this can be
>> overriden in the UI on the Language Mappings page (workspace
>> preferences and project properties). For .cc files you will probably
>> need to override the default association.
>> The C/C++ editor is language-aware in the sense that it uses the
>> interface ICLanguageKeywords to query the language for its keywords.
>> All predefined C/C++ language implement this interface.
>>
>>> - how can we define a new content type (in the plugin.xml file) for
>>> the new .ph file extension?
>>
>> Look at the examples in org.eclipse.cdt.core/plugin.xml
>> Important is that you derive the content-type from the predefined ones,
>> otherwise the C/C++ editor won't open by default for .ph files.
>>
>>> - how can we add the new keywords in order that they are highlighted?
>>
>> Extend method getKeywords() of the base language (GPPLanguage).
>> Or if you intend to have the keywords tokenized, specify them in the
>> IScannerExtensionConfiguration for you language.
>>
>> How the parser will handle the new keywords is a different question,
>> though.
>>
>>> Thanks for your help
>>>
>>> Matthias
>>
>> HTH,
>> Toni
>
> Thank you for your fast and very helpful answers! I was able to create a
> new language and the associated content type (.ph). For the .cc
> extension I did a language mapping. I tried both, overload getKeywords()
> method and specify an IScannerExtensionConfiguration. Both solutions
> worked correctly. I also downloaded the sources of the CDT project from
> the CVS server because I tried to understand how this scanner extension
> configuration works. But unfortunately it's still not clear. I hope you
> will help me for these questions:
>
> What is the difference between creating an
> IScannerExtensionConfiguration and overloading the getKeywords() method
> (I think that the first one must have some advantages)?

The difference is that the keywords get tokenized. Whether this is an
advantage or not is explained below.

> What is the advantage (or disadvantage) of having the keywords tokenized?

Tokenizing the keywords is necessary if you want to implement your own
parser (maybe deriving from the CDT parser).

If the parser does not understand the keywords/tokens, you will get
syntax errors, regardless whether they are tokenized or not.

Depending on the nature of the keywords, it could be sufficient to
define builtin macros (in the scanner extension configuration) that
simply replace the keywords by an emtpy string, instead of tokenizing
and parsing them.


>
> In the Pop-C++ language there is a construct that I also would like to
> highlight:
>
> @{ //some configuration stuff }
>
> I would like to highlight this with a special color, and since this can
> not be handled as a keyword, how can I do this (do I have to write my
> own parser -> if yes, where can i find the parser that handles
> multi-line constructs like comments (as an example))?

Customizations of this kind are not supported.

>
> Is it possible to create a "group" of keywords? E.g. I would put all the
> Pop-C++ keywords in this group and therefore it should be possible in
> the "Preferences -> C/C++ -> Editor -> Syntax Coloring" to change the
> color of only this group (to distinguish C++ and Pop-C++ keywords)?

This is not possible.

> Thank you for your help!
>
> Matthias


--
Anton Leherbauer
Wind River CDT Team, Austria
Re: CDT extension for the POP-C++ programming language [message #211762 is a reply to message #211550] Wed, 12 March 2008 13:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: matthias.spicher.edu.hefr.ch

>> In the Pop-C++ language there is a construct that I also would like to
>> highlight:
>>
>> @{ //some configuration stuff }
>>
>> I would like to highlight this with a special color, and since this
>> can not be handled as a keyword, how can I do this (do I have to write
>> my own parser -> if yes, where can i find the parser that handles
>> multi-line constructs like comments (as an example))?
>
> Customizations of this kind are not supported.
>

OK, I understand that such a construct can't be added as easily as e.g.
keywords. But, I think there must be a way to highlight it anyway. The
question is, how can I do it? Or if it's absolutely not possible, why?

Have I to write a parser? Where can I find examples? Can you give me a
hint how to extend the CDT parser?

Or am I on the wrong way?

Thank you very much for your help!

Matthias
Re: CDT extension for the POP-C++ programming language [message #211818 is a reply to message #211762] Thu, 13 March 2008 09:41 Go to previous messageGo to next message
Anton Leherbauer is currently offline Anton LeherbauerFriend
Messages: 490
Registered: July 2009
Senior Member
Spicher Matthias wrote:
>>> In the Pop-C++ language there is a construct that I also would like
>>> to highlight:
>>>
>>> @{ //some configuration stuff }
>>>
>>> I would like to highlight this with a special color, and since this
>>> can not be handled as a keyword, how can I do this (do I have to
>>> write my own parser -> if yes, where can i find the parser that
>>> handles multi-line constructs like comments (as an example))?
>>
>> Customizations of this kind are not supported.
>>
>
> OK, I understand that such a construct can't be added as easily as e.g.
> keywords. But, I think there must be a way to highlight it anyway. The
> question is, how can I do it? Or if it's absolutely not possible, why?
>
> Have I to write a parser? Where can I find examples? Can you give me a
> hint how to extend the CDT parser?
>
> Or am I on the wrong way?
>
> Thank you very much for your help!
>
> Matthias

Well, it is certainly not impossible, but you need to change CDT code.

First of all, the basic syntax highlighting (comments, literals,
keywords, operators) is done independent of the parser.
Other highlightings require an AST (abstract syntax tree) which requires
a working parser.

So, if you only need the highlighting, you don't need to modify the parser.

Highlighting @{ ... } is similar to comment highlighting:
First, the partition scanner detects the basic "partitions" of the
source code, namely preprocessor directives, comments, string and
character literals. BTW, those partitions are not only used for
highlighting.
See FastCPartitionScanner.

Then, the highlighting is done for each partition type separately.
See CSourceViewerConfgiuration.getPresentationReconciler() where for
each partition type, another scanner is registered which in the simplest
case always returns the same token (=text style) for the whole partition
range, but it can also provide finer grained style ranges.

In your case, I would add support for @{ ... } in the partition scanner,
creating a new partition type and add a highlighting scanner for the
partition type in the source viewer configuration.

I am sorry, I don't have examples at hand. You need to look into the code.

HTH
--
Anton Leherbauer
Wind River CDT Team, Austria
Re: CDT extension for the POP-C++ programming language [message #212068 is a reply to message #211818] Wed, 19 March 2008 09:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: matthias.spicher.edu.hefr.ch

Anton Leherbauer wrote:
> Spicher Matthias wrote:
>>>> In the Pop-C++ language there is a construct that I also would like
>>>> to highlight:
>>>>
>>>> @{ //some configuration stuff }
>>>>
>>>> I would like to highlight this with a special color, and since this
>>>> can not be handled as a keyword, how can I do this (do I have to
>>>> write my own parser -> if yes, where can i find the parser that
>>>> handles multi-line constructs like comments (as an example))?
>>>
>>> Customizations of this kind are not supported.
>>>
>>
>> OK, I understand that such a construct can't be added as easily as
>> e.g. keywords. But, I think there must be a way to highlight it
>> anyway. The question is, how can I do it? Or if it's absolutely not
>> possible, why?
>>
>> Have I to write a parser? Where can I find examples? Can you give me a
>> hint how to extend the CDT parser?
>>
>> Or am I on the wrong way?
>>
>> Thank you very much for your help!
>>
>> Matthias
>
> Well, it is certainly not impossible, but you need to change CDT code.
>
> First of all, the basic syntax highlighting (comments, literals,
> keywords, operators) is done independent of the parser.
> Other highlightings require an AST (abstract syntax tree) which requires
> a working parser.
>
> So, if you only need the highlighting, you don't need to modify the parser.
>
> Highlighting @{ ... } is similar to comment highlighting:
> First, the partition scanner detects the basic "partitions" of the
> source code, namely preprocessor directives, comments, string and
> character literals. BTW, those partitions are not only used for
> highlighting.
> See FastCPartitionScanner.
>
> Then, the highlighting is done for each partition type separately.
> See CSourceViewerConfgiuration.getPresentationReconciler() where for
> each partition type, another scanner is registered which in the simplest
> case always returns the same token (=text style) for the whole partition
> range, but it can also provide finer grained style ranges.
>
> In your case, I would add support for @{ ... } in the partition scanner,
> creating a new partition type and add a highlighting scanner for the
> partition type in the source viewer configuration.
>
> I am sorry, I don't have examples at hand. You need to look into the code.
>
> HTH

Thank you for the hints! Well, for some reasons we decided to not change
the CDT code. Is it possible, instead, to add a second partition scanner
and source viewer configuration? The idea is that first, the
FastCPartitonScanner and CSourceViewerConfgiuration do their jobs and
then, your custom scanner and viewer configuration do their job. What we
want is a modest syntax highlighting for

@{...}

constructs (i.e. if this construct appears in comments or strings, it
doesn't matter if its highlighted or not...).
Perhaps this is not possible, since you already thought about the
problem and gave me an answer. In that case sorry for the time that I
have stolen you. I just want to be sure if it is really not possible to
implement without changing CDT code.

Thank you very much, I am very thankful for your help.

Matthias
Re: CDT extension for the POP-C++ programming language [message #212074 is a reply to message #212068] Wed, 19 March 2008 12:06 Go to previous messageGo to next message
Anton Leherbauer is currently offline Anton LeherbauerFriend
Messages: 490
Registered: July 2009
Senior Member
Spicher Matthias wrote:
> Anton Leherbauer wrote:
>> Spicher Matthias wrote:
>>>>> In the Pop-C++ language there is a construct that I also would like
>>>>> to highlight:
>>>>>
>>>>> @{ //some configuration stuff }
>>>>>
>>>>> I would like to highlight this with a special color, and since this
>>>>> can not be handled as a keyword, how can I do this (do I have to
>>>>> write my own parser -> if yes, where can i find the parser that
>>>>> handles multi-line constructs like comments (as an example))?
>>>>
>>>> Customizations of this kind are not supported.
>>>>
>>>
>>> OK, I understand that such a construct can't be added as easily as
>>> e.g. keywords. But, I think there must be a way to highlight it
>>> anyway. The question is, how can I do it? Or if it's absolutely not
>>> possible, why?
>>>
>>> Have I to write a parser? Where can I find examples? Can you give me
>>> a hint how to extend the CDT parser?
>>>
>>> Or am I on the wrong way?
>>>
>>> Thank you very much for your help!
>>>
>>> Matthias
>>
>> Well, it is certainly not impossible, but you need to change CDT code.
>>
>> First of all, the basic syntax highlighting (comments, literals,
>> keywords, operators) is done independent of the parser.
>> Other highlightings require an AST (abstract syntax tree) which
>> requires a working parser.
>>
>> So, if you only need the highlighting, you don't need to modify the
>> parser.
>>
>> Highlighting @{ ... } is similar to comment highlighting:
>> First, the partition scanner detects the basic "partitions" of the
>> source code, namely preprocessor directives, comments, string and
>> character literals. BTW, those partitions are not only used for
>> highlighting.
>> See FastCPartitionScanner.
>>
>> Then, the highlighting is done for each partition type separately.
>> See CSourceViewerConfgiuration.getPresentationReconciler() where for
>> each partition type, another scanner is registered which in the
>> simplest case always returns the same token (=text style) for the
>> whole partition range, but it can also provide finer grained style
>> ranges.
>>
>> In your case, I would add support for @{ ... } in the partition
>> scanner, creating a new partition type and add a highlighting scanner
>> for the partition type in the source viewer configuration.
>>
>> I am sorry, I don't have examples at hand. You need to look into the
>> code.
>>
>> HTH
>
> Thank you for the hints! Well, for some reasons we decided to not change
> the CDT code. Is it possible, instead, to add a second partition scanner
> and source viewer configuration? The idea is that first, the
> FastCPartitonScanner and CSourceViewerConfgiuration do their jobs and
> then, your custom scanner and viewer configuration do their job. What we
> want is a modest syntax highlighting for
>
> @{...}
>
> constructs (i.e. if this construct appears in comments or strings, it
> doesn't matter if its highlighted or not...).
> Perhaps this is not possible, since you already thought about the
> problem and gave me an answer. In that case sorry for the time that I
> have stolen you. I just want to be sure if it is really not possible to
> implement without changing CDT code.
>
> Thank you very much, I am very thankful for your help.
>
> Matthias

I would not say it is impossible without changing CDT code, but you will
certainly need to derive from internal classes and depend on
implementation details, but if that's OK, here you go:

1. To customize the partition scanner:
You can override the partition scanner by implementing and registering
your own "documentSetupParticipant" (see org.eclipse.cdt.ui/plugin.xml).
The Document setup participant initializes the partitioner for new
documents.
Document setup participants are registered per content-type, ie. files
of your language must be associated to a unique content-type.
It is also possible to attach a second partitioner (with a different
partitioning key). I am not sure what would be the better choice, though.

2. To customize the source viewer configuration:
Implement and register (plugin.xml) you own editor (derived from
CEditor), override the initialization of the source viewer configuration
with your custom one (derived from CSourceViewerConfiguration).

3. Voila

Disclaimer: I did not try all that...

--
Anton Leherbauer
Wind River CDT Team, Austria
Re: CDT extension for the POP-C++ programming language [message #212801 is a reply to message #212074] Thu, 27 March 2008 10:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: matthias.spicher.edu.hefr.ch

This is a multi-part message in MIME format.
--------------080901080405090300070000
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

>
> I would not say it is impossible without changing CDT code, but you will
> certainly need to derive from internal classes and depend on
> implementation details, but if that's OK, here you go:
>
> 1. To customize the partition scanner:
> You can override the partition scanner by implementing and registering
> your own "documentSetupParticipant" (see org.eclipse.cdt.ui/plugin.xml).
> The Document setup participant initializes the partitioner for new
> documents.
> Document setup participants are registered per content-type, ie. files
> of your language must be associated to a unique content-type.
> It is also possible to attach a second partitioner (with a different
> partitioning key). I am not sure what would be the better choice, though.
>
> 2. To customize the source viewer configuration:
> Implement and register (plugin.xml) you own editor (derived from
> CEditor), override the initialization of the source viewer configuration
> with your custom one (derived from CSourceViewerConfiguration).
>
> 3. Voila
>
> Disclaimer: I did not try all that...
>

Hello, you're great!
Almost everything works, but there's still something that I don't find
out how to do.

What I did:

- creation of a DocumentSetupParticipant (definition in plugin.xml)
- my DocumentSetupParticipant class calls setupCDocument of my TextTools
class
- overload the getPartitionScanner method in my TextTools class (derived
from CTextTools) -> the method returns my PartitionScanner
- for the partition scanner I used the same code as for the
FastCPartitionScanner, but I added some code.

This part seems to work correctly. The problem is in the following part:

- I defined an editor in the plugin.xml file
- my editor (derived from CEditor) calls setSourceViewerConfiguration at
the initialization -> my SourceViewerConfiguration (derived from
CSourceViewerConfiguration) is given as argument
- I think in the source viewer class the most important method to
override is getPresentationReconciler -> I did it and registered a
scanner (derived from AbstractCScanner) for the DefaultDamagerRepairer

All this seems to work (if this is the correct approach...).

The problem is that no coloration is done for my partition. My idea was
to bind() a color to a string in the IColorManager. The same string is
then returned by the getTokenProperties method of the scanner. But
nothing happens. I tried also to call the setValue method of the
IPreferenceStore, but that returns me an UnsupportedOperationException.
Can you tell me what I did wrong? Did I forget something?
If this explication is not clear, please see the attached code.

Thank you very much. Have a nice day!

Matthias

--------------080901080405090300070000
Content-Type: application/zip;
name="files.zip"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="files.zip"

UEsDBBQAAAAIADBwejiMBn7JuAwAAHM8AAAdABUARmFzdFBvcENQYXJ0aXRp b25TY2FubmVy
LmphdmFVVAkAAytJ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AABQb3BDU2Nh bm5lci5qYXZh
VVQFAAPsbetHVXgAAFBLAQIXAxQAAAAIAEdWezhR3BouFwQAAIMRAAAiAA0A AAAAAAEAAACk
gYgSAABQb3BDU291cmNlVmlld2VyQ29uZmlndXJhdGlvbi5qYXZhVVQFAAPV betHVXgAAFBL
AQIXAxQAAAAIAFhAdDiowkqipQAAABwBAAASAA0AAAAAAAEAAACkgfQWAABQ b3BDVGV4dFRv
b2xzLmphdmFVVAUAAxgM4kdVeAAAUEsFBgAAAAAGAAYA8wEAAN4XAAAAAA==
--------------080901080405090300070000--
Re: CDT extension for the POP-C++ programming language [message #212931 is a reply to message #212801] Fri, 28 March 2008 09:28 Go to previous messageGo to next message
Anton Leherbauer is currently offline Anton LeherbauerFriend
Messages: 490
Registered: July 2009
Senior Member
Spicher Matthias wrote:
>>
>> I would not say it is impossible without changing CDT code, but you
>> will certainly need to derive from internal classes and depend on
>> implementation details, but if that's OK, here you go:
>>
>> 1. To customize the partition scanner:
>> You can override the partition scanner by implementing and registering
>> your own "documentSetupParticipant" (see
>> org.eclipse.cdt.ui/plugin.xml). The Document setup participant
>> initializes the partitioner for new documents.
>> Document setup participants are registered per content-type, ie. files
>> of your language must be associated to a unique content-type.
>> It is also possible to attach a second partitioner (with a different
>> partitioning key). I am not sure what would be the better choice, though.
>>
>> 2. To customize the source viewer configuration:
>> Implement and register (plugin.xml) you own editor (derived from
>> CEditor), override the initialization of the source viewer
>> configuration with your custom one (derived from
>> CSourceViewerConfiguration).
>>
>> 3. Voila
>>
>> Disclaimer: I did not try all that...
>>
>
> Hello, you're great!
> Almost everything works, but there's still something that I don't find
> out how to do.
>
> What I did:
>
> - creation of a DocumentSetupParticipant (definition in plugin.xml)
> - my DocumentSetupParticipant class calls setupCDocument of my TextTools
> class
> - overload the getPartitionScanner method in my TextTools class (derived
> from CTextTools) -> the method returns my PartitionScanner
> - for the partition scanner I used the same code as for the
> FastCPartitionScanner, but I added some code.
>
> This part seems to work correctly. The problem is in the following part:
>
> - I defined an editor in the plugin.xml file
> - my editor (derived from CEditor) calls setSourceViewerConfiguration at
> the initialization -> my SourceViewerConfiguration (derived from
> CSourceViewerConfiguration) is given as argument
> - I think in the source viewer class the most important method to
> override is getPresentationReconciler -> I did it and registered a
> scanner (derived from AbstractCScanner) for the DefaultDamagerRepairer
>
> All this seems to work (if this is the correct approach...).
>
> The problem is that no coloration is done for my partition. My idea was
> to bind() a color to a string in the IColorManager. The same string is
> then returned by the getTokenProperties method of the scanner. But
> nothing happens. I tried also to call the setValue method of the
> IPreferenceStore, but that returns me an UnsupportedOperationException.
> Can you tell me what I did wrong? Did I forget something?
> If this explication is not clear, please see the attached code.
>
> Thank you very much. Have a nice day!
>
> Matthias

Some hints:
The PopCScanner should be a SingleTokenCScanner if it does not implement
a rule to scan the partition. Otherwise the token length will be 0.
The CTextTools (and therefore als PopCTextTools) should be used as a
singleton instance, otherwise it will leak resources.

HTH
--
Anton Leherbauer
Wind River CDT Team, Austria
Re: CDT extension for the POP-C++ programming language [message #213471 is a reply to message #212931] Mon, 07 April 2008 07:33 Go to previous message
Eclipse UserFriend
Originally posted by: matthias.spicher.edu.hefr.ch

Hello,

Everything works fine. Thank you very much for your help. Without, it
would not have been possible for me to implement it!

Have a nice day.

Matthias
Previous Topic:CDT 5.0 M6 available
Next Topic:How to access outline information
Goto Forum:
  


Current Time: Fri Apr 26 11:32:57 GMT 2024

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

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

Back to the top