Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make IntelliJ recognize wicket html tags?

I'm using IntellIJ with Apache Wicket and IntelliJ is showing me that tags like <wicket:extend> and <wicket:container> and adding wicket:id to other html tags is not valid.

What steps do I need to take to make IntelliJ recognize the wicket tags?

I'm using IntelliJ Ultimate 9 with the wicketforge plugin.

like image 998
Alex B Avatar asked Jun 11 '10 18:06

Alex B


4 Answers

You can't really do it, adding the wicket namespace as in the other answer will only work for wicket:id, there is no dtd that also includes the wicket:container|panel etc.

There is this really old schema from the contrib project: http://wicket-contrib.googlecode.com/files/wicket.xsd but that doesn't include xhtml, so you'd need to create a schema to merge that and xhtml, and i don't believe there is a way other then manual.

The best you can do it add them to idea's ignored tags;

like image 76
slckin Avatar answered Nov 04 '22 01:11

slckin


I use Eclipse, but to make validation errors go away, I just add the wicket namespace:

<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" >
    ...
</html>
like image 43
rcl Avatar answered Nov 04 '22 00:11

rcl


I suspect @slckin may be right. and to contribute to his answer, In IDEA, File->Settings->Inspections->HTML "Unknown HTML tag" is where you can add a list of comma seperated tags, mine looks like this: nobr,noembed,comment,noscript,embed,script,wicket:head,wicket:panel,wicket:remove,wicket:extend,wicket:child,wicket:container,wicket:enclosure,wicket:message,wicket:link,wicket:fragment (not a complete list but covers most) The best list of the tags in one place I've found is here: https://cwiki.apache.org/WICKET/wickets-xhtml-tags.html
The next block section down is "Unknown HTML tag attribute" and if you add wicket:id to the "Custom HTML tag attributes" list it should stop throwing that warning as well.

like image 1
Raystorm Avatar answered Nov 04 '22 01:11

Raystorm


In "Project Settings - Schemas and DTDs" you can add the http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd DTD (download it save it somewhere, then browse to its location).

That will at least get rid of the warning about the undefined namespace, and make the red warnings less obtrusively brown, assuming your HTML files start with the following:

<?xml encoding="UTF-8" ?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"
  lang="en" xml:lang="en">

(The first <?xml encoding="UTF-8" ?> is stripped away by wicket, used just to specify UTF-8 encoding)

Then follow Raystorm's advice about adding the unknown HTML tag definitions.

Only problem I have now is that I get double type-completion suggestions for the <wicket:whatever elements, but it beats having error-markers everywhere.

like image 1
Stefan L Avatar answered Nov 04 '22 01:11

Stefan L