|
(no subject) [message #675639 is a reply to message #674529] |
Wed, 01 June 2011 04:32 |
|
On 5/27/2011 5:20 AM, MarcoGT wrote:
> as said I am trying to extend the default XML editors with some features.
> Yesterday I downloaded the source code from repositoy "webtools", okay.
>
> But, to start a new project based on the default XML editor shouldn't I
> create a new Plug-in Development Project and use the Editor template?
>
> I am a little bit confused about this.
The default editor template creates A XML Editor, but it's not the same
XML Editor that we provide from WTP (which is considerably more
complicated). The template is a nice and more straightforward way to
examine how the editor class and viewers are used.
So the question really is, what kind of features are you looking to add?
Is this for a different editor, or do you plan to just add some
functionality to the existing XML Editor?
--
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
|
Re: (no subject) [message #676023 is a reply to message #675988] |
Thu, 02 June 2011 14:29 |
Robert Gruendler Messages: 66 Registered: June 2011 |
Member |
|
|
i'm actually trying a similar thing, except that i would like to extend the html editor to provide syntax highlighting for a templating language which looks like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<title>My Webpage</title>
</head>
<body>
<ul id="navigation">
{% for item in navigation %}
<li><a href="{{ item.href }}">{{ item.caption }}</a></li>
{% endfor %}
</ul>
<h1>My Webpage</h1>
{{ a_variable }}
</body>
</html>
What i've found out so far is for that to work i need to do the following:
1. Declare a org.eclipse.wst.sse.core.modelHandler
2. In that ModelHandler, implement "getDocumentLoader()" and return a custom DocumentLoader, which extends "HTMLDocumentLoader".
3. In the DocumentLoader, override "getParser()" and return a custom RegionParser (which in turn extends XMLSourceParser)
4. The SourceParser overrides the "getTokenizer()" method.
I assume that the Tokenizer is responsible for detecting the Tokens in the InputString - which are the tokens of the custom templating grammar.
This is where i'm stuck though. The Tokenizer which is returned by the XMLSourceParser is a XMLTokenizer. From what i could find out, the source code
of the XMLTokenizer has been generated by jflex - from a file like
org.eclipse.wst.sse.core/DevTimeSupport/SedModel/HTMLTokenizer/devel/XMLTokenizer.jflex
My question now is: To add syntax-highlighting for a templating engine which adds non-xml structures to the Document, do i need to specify such a .jflex
grammar and generate the corresponding tokenizer from that "jflex" library?
thanks!
[Updated on: Thu, 02 June 2011 14:36] Report message to a moderator
|
|
|
|
|
|
Re: (no subject) [message #677215 is a reply to message #675988] |
Tue, 07 June 2011 20:38 |
|
On 6/2/2011 5:37 AM, MarcoGT wrote:
> Ok, in these days I studied the editor.
>
> I would like to add some features to the content assist, for example.
>
> I tried to start a new plugin project using the template but this has
> less features than the "default" one, for example no outline, no tag
> folding and so on.
>
> So, my plan is to check-out sources that build up the standard XML
> editor and start to implement my features from there.
>
> Is it a good point?
Yes, just be conscious of which branch of CVS you check out from
compared to what version of Eclipse you're working in. HEAD is intended
to be our 3.3 release on top of Eclipse 3.7 while Helios is 3.2.x on top
of Eclipse 3.6.
--
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
Powered by
FUDForum. Page generated in 0.04341 seconds