facebook

HTML templates

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #217136 Reply

    frantuma
    Member

    I am struggling with HTML templates.

    My goal is to have a code assist (called with Ctrl-Space or any other option) to insert personalized pieces of code inside the HTML editor

    I have tried creating new templates such as:

    <!– @${cursor}:s ${date} ${time} –>

    but there is no way I can manage to get it to pop up inside the editor.

    When I use Ctrl-Space or type “<” only standard tags appear and no sign of the newly inserted ones.

    Another issue is that there seem to be an inconsistency of behaviour between HTML files and JHTML (ATG dynamo) hich I am using often.

    Any help on this?

    Thanks

    Francesco

    #217143 Reply

    Riyad Kalla
    Member

    What are you naming the templates? This is what you type into the HTML editor… for example, the following template ships with MyEclipse:
    Name: comment
    Pattern: <!– ${cursor} –>

    So when you are in HTML code you type:

    <table>
    comment| <– Hit CTRL-Space here
    </table>

    And then from the dropdown you can select the “#comment” template. Is this not what you are seeing?

    #217152 Reply

    frantuma
    Member

    I am calling it for example “State”

    Thus, my template called State, defined in context “HTML Tags” (I don-t quite understand what is meant by context.) has pattern:

    <!– @${cursor}:f ${date} ${time} –>

    I try to insert it as the first row of my HTML page.
    I place the cursor at the beginning of the first empty row and hit Ctrl-Space.
    Only results in drop-down are:

    ?-?<xml version…>
    #comment… xml comment

    Same if I type ‘<‘

    I tried even to type the name of the template and then hit Ctrl-Space but same result..

    State<– and here I hit Ctrl-Space

    Could be a problem of file type not recognized correctly or something?

    #217153 Reply

    frantuma
    Member

    By the way with latest eclipse 3.1 and MyEclipse 3.8.2..

    #217157 Reply

    Riyad Kalla
    Member

    Hmmm… we don’t support Eclipse 3.1 (its not comming out until atleast may of next year)… can you please downgrade to Eclipse 3.0.1

    On a side note, I just tried exactly your example and it seemed to work fine:

    #217158 Reply

    Riyad Kalla
    Member

    BTW “Context” means where this template will be available to you, in the case of “HTML Tags” it means in your HTML source. For example, the Javadoc Templates have Contexts like “Code” and “Javadoc” meaning some templates are only available while editing Javadoc.

    #217174 Reply

    frantuma
    Member

    Actually I meant eclipse 3.0.1. I was wondering if actually context could be the problem, I see two proposed contexts “HTML tags” and “All HTML” and I was thinking that maybe no template is showing because of lackness of DOCTTYPE decalration, .jhtml extension, not recognized html tag (DROPLET, etc.) or something like that.

    Or it there could be some kind of conflict with other plug-ins (I am complete ignorant about plugin development in eclipse).

    I think I understand that templates or at least HTML code-assist show up differently depending on position inside HTML tags, to say that assist showed inside a <TABLE> is different from the one inside <BODY> or other tags. Thus there is a “context” representing the cursor tag position. Is that right?

    Thanks

    #217180 Reply

    Riyad Kalla
    Member

    Yes I believe you are right. Try changing it to all and see if it helps.

    #217219 Reply

    frantuma
    Member

    Seems actually not to be the context but the type of file. For some strange reason my Jhtml files are interpreted as XML, seems like.

    I tried same template in XML templates and it works fine.

    Still Jhtml is actually extended HTML and not XML, thus I would need to have access to HTML templates. Is there a way to map jhtml files to a “HTML context” or do you know how XML/HTML is chosen inside the editor?

    Thanks

    #217244 Reply

    Riyad Kalla
    Member

    Are the JHTML files being opened with the XML editor? (right click > open with > MyEclipse HTML Editor) you can also make that association via the Window > Preferneces > Workbench > File Association page, add “*.jhtml” and map it to the HTML Editor.

    #217246 Reply

    frantuma
    Member

    The JHTML are actually associated with HTML editor, that seems weird to me. I have removed any other association from Window > Preferneces > Workbench > File Association page for the *.jhtml and MyEclipse HTML Editor is the only choice in right click > open with >.

    But it’s like the editor believes to be handling a XML file (I guess same engine for both is used..).

    #217252 Reply

    Riyad Kalla
    Member

    Before I check with the devs, please close the JHTML page, right click > Open With > MyEclipse HTML Editor… does the shortcut still not work?

    #217339 Reply

    frantuma
    Member

    I’ve done what you said but still the same. I have closed all editors and reopened a jhtml with right click > Open With > MyEclipse HTML Editor. Still I get XML templates instead of HTML.

    Eclipse 3.0.1, MyEclipse 3.8.2 (200408201200-3.8.2), Windows 2000 pro.

    Pls advise if you need configuration spec or logs, etc.

    Thanks

    #217364 Reply

    Riyad Kalla
    Member

    Do me a favor, try and open that file with the JSP editor and see if your template works… I filed a bug on this and found that the HTML templates only seem to be available in the JSP editor (strange).

    #217434 Reply

    frantuma
    Member

    With JSP editors they don’t work.

    But I tried to open an HTML (NOT JHTML) file with HTML editor and I got all my HTML templates there no problem.

    It’s only when I open a JHTML file that the HTML Editor doesn’t seem to recognize them as HTML..

    I guess you can try it yourself by creating a new file test.jhtml and open it in the HTML editor.

Viewing 15 posts - 1 through 15 (of 17 total)
Reply To: HTML templates

You must be logged in to post in the forum log in