|
| Re: How To Programmatically Create An HTML File Using The Eclipse Standard HTML Template [message #234001 is a reply to message #233921] |
Wed, 22 July 2009 09:16   |
|
Originally posted by: dcarver.starstandard.org
WTP has a DOM Level 1 implementation that you can use. If you do some
web searches on WTP DOM you should find some tutorials that will show
you how to get a WTP DOM and then use it to add your particular items.
Dave
Runzhou Li wrote:
> Hi,
>
> Just like how we can manually add an HTML file in a project with some
> prefilled content, how can this be done programmatically?
>
> Thank you in advance.
>
> --
> Runzhou Li
>
>
|
|
|
| Re: How To Programmatically Create An HTML File Using The Eclipse Standard HTML Template [message #234009 is a reply to message #234001] |
Wed, 22 July 2009 09:51   |
|
Originally posted by: runzhou.li.gmail.com
Actually even simpler, can I directly make use of the Eclipse built-in one?
Just want to programmatically call it.
--
Runzhou Li
"David Carver" <dcarver@starstandard.org> wrote in message
news:h473fd$hc2$1@build.eclipse.org...
> WTP has a DOM Level 1 implementation that you can use. If you do some
> web searches on WTP DOM you should find some tutorials that will show you
> how to get a WTP DOM and then use it to add your particular items.
>
> Dave
>
> Runzhou Li wrote:
>> Hi,
>>
>> Just like how we can manually add an HTML file in a project with some
>> prefilled content, how can this be done programmatically?
>>
>> Thank you in advance.
>>
>> --
>> Runzhou Li
|
|
|
| Re: How To Programmatically Create An HTML File Using The Eclipse Standard HTML Template [message #234022 is a reply to message #234009] |
Wed, 22 July 2009 13:32   |
|
Originally posted by: dcarver.starstandard.org
If you already have a template, you can contribute that template, to the
HTML templates, through the standard Template extension point.
Take a look at the org.eclipse.wst.html.ui plugin.xml for examples.
Dave
Runzhou Li wrote:
> Actually even simpler, can I directly make use of the Eclipse built-in one?
> Just want to programmatically call it.
>
> --
> Runzhou Li
>
> "David Carver" <dcarver@starstandard.org> wrote in message
> news:h473fd$hc2$1@build.eclipse.org...
>> WTP has a DOM Level 1 implementation that you can use. If you do some
>> web searches on WTP DOM you should find some tutorials that will show you
>> how to get a WTP DOM and then use it to add your particular items.
>>
>> Dave
>>
>> Runzhou Li wrote:
>>> Hi,
>>>
>>> Just like how we can manually add an HTML file in a project with some
>>> prefilled content, how can this be done programmatically?
>>>
>>> Thank you in advance.
>>>
>>> --
>>> Runzhou Li
>
>
|
|
|
| Re: How To Programmatically Create An HTML File Using The Eclipse Standard HTML Template [message #234122 is a reply to message #234022] |
Fri, 24 July 2009 09:28   |
|
Originally posted by: runzhou.li.gmail.com
Hi,
Is there a direct way of getting the template and make use of it? Because I
don't need to have my own template.
Regards,
--
Runzhou Li
"David Carver" <dcarver@starstandard.org> wrote in message
news:4A674D32.5010007@starstandard.org...
> If you already have a template, you can contribute that template, to the
> HTML templates, through the standard Template extension point.
>
> Take a look at the org.eclipse.wst.html.ui plugin.xml for examples.
>
> Dave
>
> Runzhou Li wrote:
>> Actually even simpler, can I directly make use of the Eclipse built-in
>> one? Just want to programmatically call it.
>>
>> --
>> Runzhou Li
>>
>> "David Carver" <dcarver@starstandard.org> wrote in message
>> news:h473fd$hc2$1@build.eclipse.org...
>>> WTP has a DOM Level 1 implementation that you can use. If you do some
>>> web searches on WTP DOM you should find some tutorials that will show
>>> you how to get a WTP DOM and then use it to add your particular items.
>>>
>>> Dave
>>>
>>> Runzhou Li wrote:
>>>> Hi,
>>>>
>>>> Just like how we can manually add an HTML file in a project with some
>>>> prefilled content, how can this be done programmatically?
>>>>
>>>> Thank you in advance.
>>>>
>>>> --
>>>> Runzhou Li
>>
|
|
|
|
| Re: How To Programmatically Create An HTML File Using The Eclipse Standard HTML Template [message #367698 is a reply to message #272663] |
Tue, 28 July 2009 10:29   |
|
Originally posted by: runzhou.li.gmail.com
Thank you so much Nitin.
I'm also trying to avoid using internal classes, so about creating my own
template, say I create a template through
"org.eclipse.ui.editors.templates -> template" called my_html_new but
instead of creating my own contextType, I reuse html_new as contextTypeId.
How can I get access to this template and use it to serve my original
purpose?
"Nitin Dahyabhai" <nitind@us.ibm.com> wrote in message
news:h4l80t$tef$1@build.eclipse.org...
> Runzhou Li wrote:
>> Is there a direct way of getting the template and make use of it? Because
>> I don't need to have my own template.
>
> Yes, but only with internals. We don't guarantee to keep the same
> templates and template names from release to release, so it's recommended
> you create your own.
>
> TemplateStore templateStore =
> HTMLUIPlugin.getDefault().getTemplateStore();
> Template template = templateStore.findTemplate(nameOftemplate);
> TemplateContextType contextType =
> HTMLUIPlugin.getDefault().getTemplateContextRegistry().getCo ntextType(template.getContextTypeId());
> IDocument document = new Document();
> TemplateContext context = new DocumentTemplateContext(contextType,
> document, 0, 0);
> TemplateBuffer buffer = context.evaluate(template);
> templateString = buffer.getString();
>
> Then you would write the string into a file using IFile.setContents().
>
> --
> ---
> Nitin Dahyabhai
> Eclipse WTP Source Editing
> IBM Rational
|
|
|
| Re: How To Programmatically Create An HTML File Using The Eclipse Standard HTML Template [message #369116 is a reply to message #367698] |
Tue, 28 July 2009 13:00   |
 |
Nitin Dahyabhai Messages: 1857 Registered: July 2009 |
Senior Member |
|
|
Runzhou Li wrote:
> I'm also trying to avoid using internal classes, so about creating my own
> template, say I create a template through
> "org.eclipse.ui.editors.templates -> template" called my_html_new but
> instead of creating my own contextType, I reuse html_new as contextTypeId.
> How can I get access to this template and use it to serve my original
> purpose?
Unless you want your template visible in our wizard, content assist,
and preference page, there's no reason to use an HTML context
type--it's perfectly fine to declare your own. I didn't work on
this myself, so there's not a lot of advice I can give past
examining how it's implemented in our plug-ins and those from the
Platform.
One piece of advice I *can* give is to avoid accidentally declaring
the same ID for a context type as anyone else. JSDT has a bug open
due to its contexts colliding with those of JDT (266680), causing
unpredictably incorrect behavior in the preferences UI and content
assist when both are installed.
--
---
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational
---
Nitin Dahyabhai
Eclipse WTP, IBM
|
|
|
| Re: How To Programmatically Create An HTML File Using The Eclipse Standard HTML Template [message #369125 is a reply to message #369116] |
Tue, 28 July 2009 14:00  |
|
Originally posted by: runzhou.li.gmail.com
I see, I'll take a look at how content type is done, and how to make use of
it.
Thank you for your valuable help :)
"Nitin Dahyabhai" <nitind@us.ibm.com> wrote in message
news:h4naqs$j2k$1@build.eclipse.org...
> Runzhou Li wrote:
>> I'm also trying to avoid using internal classes, so about creating my own
>> template, say I create a template through
>> "org.eclipse.ui.editors.templates -> template" called my_html_new but
>> instead of creating my own contextType, I reuse html_new as
>> contextTypeId. How can I get access to this template and use it to serve
>> my original purpose?
>
> Unless you want your template visible in our wizard, content assist, and
> preference page, there's no reason to use an HTML context type--it's
> perfectly fine to declare your own. I didn't work on this myself, so
> there's not a lot of advice I can give past examining how it's implemented
> in our plug-ins and those from the Platform.
>
> One piece of advice I *can* give is to avoid accidentally declaring the
> same ID for a context type as anyone else. JSDT has a bug open due to its
> contexts colliding with those of JDT (266680), causing unpredictably
> incorrect behavior in the preferences UI and content assist when both are
> installed.
>
> --
> ---
> Nitin Dahyabhai
> Eclipse WTP Source Editing
> IBM Rational
|
|
|
Powered by
FUDForum. Page generated in 0.01931 seconds