Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Editor code templates(How to setup custom templates for CSS/JS/XHTML editors?)
Editor code templates [message #671651] Wed, 18 May 2011 15:08
Dwight Johnson is currently offline Dwight JohnsonFriend
Messages: 19
Registered: March 2011
Junior Member
Currently I am working on a plugin for Eclipse/Helios that is supposed to offer a development environment (adapted project, nature, perspective, views, code completion and templates) for static webcontent (xhtml, js and css) with reduced/modified syntax as compared to standard static web projects.

This is what I want to achieve: offer custom css/js/xhtml templates, visibly in TemplatesView, with my templates stored in my plugin. The Templates view should default be part of my custom perspective and adapt it's contents to the type of the active editor.

Here is the corresponding plugin extension:

 <extension
       point="org.eclipse.ui.views">
    <view
          name="My templates"
          icon="$nl$/icons/full/eview16/templates.gif"
          category="org.eclipse.ui"
          class="org.eclipse.ui.texteditor.templates.TemplatesView"
          id="org.eclipse.ui.texteditor.TemplatesView">
    </view>
 </extension>   


This extension points does indeed offer under window > Show Views > General > My Templates.

Now back to the template behavior of a standard static web project... the only time that the TemplatesView does indeed show content is for the java editor. In case of css/js/xhtml editors the template view displays the message 'No templates available', although under Windows / Preferences it can be seen that there are default templates defined. I do not understand this.

There are some vague pointers to be found on the web, like this, stating that I should provide for an adapter:
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/texteditor/templates/TemplatesView.html

I tried to find out what is happening via the debugger.

I was able to get the debugger into TemplatesView.doCreatePage...
http://www.google.com/codesearch/p?hl=nl#smBcNx65Jqw/src/org/eclipse/ui/texteditor/templates/TemplatesView.java&q=templatesview&sa=N&cd=1&ct=rc
...seeing that for java ITemplatesPage was indeed not null, in contrast to the other editors, but I could not get deeper into the code.

So, what do I need to do to have a populated templates view for css/js and xhtml editors? Are you aware of any example code? There is a javaeditorexample, but this relates to templates defined/displayed in the preferences.

Thanks in advance.

[Updated on: Wed, 18 May 2011 15:09]

Report message to a moderator

Previous Topic:Error when setting up JAX-WS project
Next Topic:Web Service + EMF + Teneo
Goto Forum:
  


Current Time: Wed Apr 24 13:31:55 GMT 2024

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

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

Back to the top