package com.intellij.psi.filters.getters;

import com.intellij.psi.PsiElement;
import com.intellij.psi.xml.XmlAttribute;
import com.intellij.xml.util.XmlUtil;
import org.jetbrains.annotations.NonNls;

/**
 * Created by IntelliJ IDEA.
 * User: ik
 * Date: 24.11.2003
 * Time: 14:17:59
 * To change this template use Options | File Templates.
 */
public class HtmlAttributeValueGetter extends XmlAttributeValueGetter {
  private boolean myCaseSensitive;

  public HtmlAttributeValueGetter(boolean _caseSensitive) {
    myCaseSensitive = _caseSensitive;
  }

  @NonNls protected String[] addSpecificCompletions(final PsiElement context) {
    if (!(context instanceof XmlAttribute)) return null;

    XmlAttribute attribute = (XmlAttribute)context;
    @NonNls String name = attribute.getName();
    if (!myCaseSensitive) name = name.toLowerCase();

    final String namespace = attribute.getParent().getNamespace();
    if (XmlUtil.XHTML_URI.equals(namespace) || XmlUtil.HTML_URI.equals(namespace)) {

      if ("target".equals(name)) {
        return new String[] {"_blank","_top","_self","_parent"};
      } else if ("enctype".equals(name)) {
        return new String[] {"multipart/form-data","application/x-www-form-urlencoded"};
      }
    }

    return null;
  }
}

@@ -1221,24 +1221,438 @@
 lencoded%22%7D;%0A
+      %7D else if (%22rel%22.equals(name)) %7B%0A        return new String%5B%5D %7B %22alternate%22, %22stylesheet%22, %22start%22, %22next%22, %22prev%22, %22contents%22, %22index%22, %22glossary%22, %22copyright%22, %22chapter%22,%0A          %22section%22, %22subsection%22, %22appendix%22, %22help%22, %22bookmark%22, %22script%22%7D;%0A      %7D else if (%22media%22.equals(name)) %7B%0A        return new String%5B%5D %7B %22screen%22, %22tty%22, %22tv%22, %22projection%22, %22handheld%22, %22print%22, %22all%22, %22aural%22, %22braille%22 %7D;%0A
       %7D%0A    

Add completion for link.rel & link.media (IDEADEV-5854)