Snapshot of commit d5ec1d5018ed24f1b4f32b1d09df6dbd7e2fc425

from branch master of git://git.jetbrains.org/idea/community.git
diff --git a/java/jsp-base-openapi/jsp-base-openapi.iml b/java/jsp-base-openapi/jsp-base-openapi.iml
new file mode 100644
index 0000000..7060fe7
--- /dev/null
+++ b/java/jsp-base-openapi/jsp-base-openapi.iml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module relativePaths="true" type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="platform-api" />
+    <orderEntry type="module" module-name="xml-openapi" exported="" />
+    <orderEntry type="module" module-name="lang-api" />
+  </component>
+</module>
+
diff --git a/java/jsp-base-openapi/src/com/intellij/lang/jsp/IBaseJspManager.java b/java/jsp-base-openapi/src/com/intellij/lang/jsp/IBaseJspManager.java
new file mode 100644
index 0000000..a7fabc4
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/lang/jsp/IBaseJspManager.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.lang.jsp;
+
+import com.intellij.psi.PsiFile;
+import com.intellij.xml.XmlElementDescriptor;
+import com.intellij.xml.XmlNSDescriptor;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author Maxim.Mossienko
+ */
+public interface IBaseJspManager {
+  XmlNSDescriptor getActionsLibrary(@NotNull PsiFile containingFile);
+
+  @Nullable
+  XmlElementDescriptor getDirectiveDescriptorByName(String name, @NotNull PsiFile context);
+}
diff --git a/java/jsp-base-openapi/src/com/intellij/lang/jsp/JspFileViewProvider.java b/java/jsp-base-openapi/src/com/intellij/lang/jsp/JspFileViewProvider.java
new file mode 100644
index 0000000..e926f53
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/lang/jsp/JspFileViewProvider.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.intellij.lang.jsp;
+
+import java.util.Set;
+
+/**
+ * @author ik
+ */
+public interface JspFileViewProvider extends JspxFileViewProvider {
+
+  Set<String> getKnownTaglibPrefixes();
+
+  Set<String> getKnownTaglibPrefixes(CharSequence newContent);
+}
diff --git a/java/jsp-base-openapi/src/com/intellij/lang/jsp/JspVersion.java b/java/jsp-base-openapi/src/com/intellij/lang/jsp/JspVersion.java
new file mode 100644
index 0000000..207b7c5
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/lang/jsp/JspVersion.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.intellij.lang.jsp;
+
+/**
+ * @author Dmitry Avdeev
+ */
+public interface JspVersion {
+
+  JspVersion JSP_2_0 = new JspVersion() {
+
+    public String getNumber() {
+      return "2.0";
+    }
+
+    public boolean betterThan(JspVersion other) {
+      return getNumber().compareTo(other.getNumber()) > 0;
+    }
+  };
+
+  JspVersion JSP_2_1 = new JspVersion() {
+
+    public String getNumber() {
+      return "2.1";
+    }
+
+    public boolean betterThan(JspVersion other) {
+      return getNumber().compareTo(other.getNumber()) > 0;
+    }
+  };
+
+  JspVersion JSP_2_2 = new JspVersion() {
+
+    public String getNumber() {
+      return "2.2";
+    }
+
+    public boolean betterThan(JspVersion other) {
+      return getNumber().compareTo(other.getNumber()) > 0;
+    }
+  };
+
+  String getNumber();
+
+  boolean betterThan(JspVersion other);
+
+}
diff --git a/java/jsp-base-openapi/src/com/intellij/lang/jsp/JspxFileViewProvider.java b/java/jsp-base-openapi/src/com/intellij/lang/jsp/JspxFileViewProvider.java
new file mode 100644
index 0000000..3178403
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/lang/jsp/JspxFileViewProvider.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.intellij.lang.jsp;
+
+import com.intellij.lang.DependentLanguage;
+import com.intellij.lang.Language;
+import com.intellij.psi.templateLanguages.TemplateLanguageFileViewProvider;
+
+/**
+ * @author ik
+ */
+public interface JspxFileViewProvider extends TemplateLanguageFileViewProvider {
+  Language JAVA_HOLDER_METHOD_TREE_LANGUAGE = new JavaHolderMethodTreeLanguage();
+
+  class JavaHolderMethodTreeLanguage extends Language implements DependentLanguage{
+    public JavaHolderMethodTreeLanguage() {
+      super("JAVA_HOLDER_METHOD_TREE", "");
+    }
+  }
+}
diff --git a/java/jsp-base-openapi/src/com/intellij/lexer/ELHostLexer.java b/java/jsp-base-openapi/src/com/intellij/lexer/ELHostLexer.java
new file mode 100644
index 0000000..9a8c602
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/lexer/ELHostLexer.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.lexer;
+
+import com.intellij.psi.tree.IElementType;
+
+/**
+ * @author Maxim.Mossienko
+ */
+public interface ELHostLexer {
+  void setElTypes(IElementType elTokenTypeForContent, IElementType elTokenTypeForAttribute);
+}
diff --git a/java/jsp-base-openapi/src/com/intellij/openapi/editor/JspHighlighterColors.java b/java/jsp-base-openapi/src/com/intellij/openapi/editor/JspHighlighterColors.java
new file mode 100644
index 0000000..f50331d
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/openapi/editor/JspHighlighterColors.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.editor;
+
+import com.intellij.openapi.editor.colors.TextAttributesKey;
+
+/**
+ * @author yole
+ */
+public class JspHighlighterColors {
+  private JspHighlighterColors() {
+  }
+
+  public static final TextAttributesKey JSP_COMMENT = TextAttributesKey.createTextAttributesKey("JSP_COMMENT");
+  public static final TextAttributesKey JSP_SCRIPTING_BACKGROUND = TextAttributesKey.createTextAttributesKey("JSP_SCRIPTING_BACKGROUND");
+  public static final TextAttributesKey JSP_ACTION_AND_DIRECTIVE_BACKGROUND = TextAttributesKey.createTextAttributesKey("JSP_DIRECTIVE_BACKGROUND");
+  public static final TextAttributesKey JSP_ACTION_AND_DIRECTIVE_NAME = TextAttributesKey.createTextAttributesKey("JSP_DIRECTIVE_NAME");
+  public static final TextAttributesKey JSP_ATTRIBUTE_NAME = TextAttributesKey.createTextAttributesKey("JSP_ATTRIBUTE_NAME");
+  public static final TextAttributesKey JSP_ATTRIBUTE_VALUE = TextAttributesKey.createTextAttributesKey("JSP_ATTRIBUTE_VALUE");
+}
diff --git a/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspDeclaration.java b/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspDeclaration.java
new file mode 100644
index 0000000..b5a5b23
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspDeclaration.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.psi.impl.source.jsp.jspXml;
+
+/**
+ * @author peter
+ */
+public interface JspDeclaration extends JspXmlTagBase {
+}
diff --git a/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspDirective.java b/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspDirective.java
new file mode 100644
index 0000000..19ef687
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspDirective.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.psi.impl.source.jsp.jspXml;
+
+/**
+ * @author peter
+ */
+public interface JspDirective extends JspTag {
+}
diff --git a/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspExpression.java b/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspExpression.java
new file mode 100644
index 0000000..18d5444
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspExpression.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.psi.impl.source.jsp.jspXml;
+
+/**
+ * @author peter
+ */
+public interface JspExpression extends JspXmlTagBase {
+}
diff --git a/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspScriptlet.java b/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspScriptlet.java
new file mode 100644
index 0000000..1d5b76c
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspScriptlet.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.psi.impl.source.jsp.jspXml;
+
+/**
+ * @author peter
+ */
+public interface JspScriptlet extends JspXmlTagBase {
+}
diff --git a/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspTag.java b/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspTag.java
new file mode 100644
index 0000000..f577f72
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspTag.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.psi.impl.source.jsp.jspXml;
+
+import com.intellij.psi.xml.XmlTag;
+
+public interface JspTag extends XmlTag {
+}
diff --git a/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspXmlRootTag.java b/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspXmlRootTag.java
new file mode 100644
index 0000000..742a47f
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspXmlRootTag.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.psi.impl.source.jsp.jspXml;
+
+/**
+ * @author peter
+ */
+public interface JspXmlRootTag extends JspTag {
+}
diff --git a/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspXmlTagBase.java b/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspXmlTagBase.java
new file mode 100644
index 0000000..71ce5d1
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/psi/impl/source/jsp/jspXml/JspXmlTagBase.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.psi.impl.source.jsp.jspXml;
+
+import com.intellij.psi.impl.source.jsp.jspXml.JspTag;
+import com.intellij.psi.xml.XmlTag;
+
+/**
+ * @author peter
+ */
+public interface JspXmlTagBase extends XmlTag, JspTag {
+  XmlTag findParentTag();
+}
diff --git a/java/jsp-base-openapi/src/com/intellij/psi/jsp/BaseJspFile.java b/java/jsp-base-openapi/src/com/intellij/psi/jsp/BaseJspFile.java
new file mode 100644
index 0000000..117362f
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/psi/jsp/BaseJspFile.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.psi.jsp;
+
+import com.intellij.lang.jsp.JspxFileViewProvider;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.xml.XmlFile;
+import com.intellij.psi.xml.XmlTag;
+import org.jetbrains.annotations.NotNull;
+
+public interface BaseJspFile extends XmlFile {
+  BaseJspFile[] EMPTY_ARRAY = new BaseJspFile[0];
+
+  PsiElement[] getContentsElements();
+
+  boolean isErrorPage();
+  boolean isSessionPage();
+  boolean isTagPage();
+
+  XmlTag[] getDirectiveTags(JspDirectiveKind directiveKind, final boolean searchInIncludes);
+  XmlTag createDirective(XmlTag context, JspDirectiveKind directiveKind);
+  XmlTag createDirective(JspDirectiveKind directiveKind);
+
+  /**
+   * Method with a bad name. Returns file corresponding to getTemplateDataLanguage() method of ViewProvider
+   * @see com.intellij.psi.templateLanguages.TemplateLanguageFileViewProvider#getTemplateDataLanguage()
+   */
+  PsiFile getBaseLanguageRoot();
+  /**
+   * @return file which the errorPage directive references,
+   * or null, if there is no errorPage directive or directive references invalid file
+   */
+  PsiFile getErrorPage();
+
+  @NotNull
+  JspxFileViewProvider getViewProvider();
+
+  @NotNull
+  XmlTag getRootTag();
+}
diff --git a/java/jsp-base-openapi/src/com/intellij/psi/jsp/JspDirectiveKind.java b/java/jsp-base-openapi/src/com/intellij/psi/jsp/JspDirectiveKind.java
new file mode 100644
index 0000000..9a6a539
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/psi/jsp/JspDirectiveKind.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.psi.jsp;
+
+/**
+ * @author ven
+ */
+public enum JspDirectiveKind {
+  /** Mapped to both page and tag directives */
+  PAGE,
+  INCLUDE,
+  TAGLIB,
+  ATTRIBUTE,
+  VARIABLE
+}
diff --git a/java/jsp-base-openapi/src/com/intellij/psi/jsp/JspTokenType.java b/java/jsp-base-openapi/src/com/intellij/psi/jsp/JspTokenType.java
new file mode 100644
index 0000000..31c6420
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/psi/jsp/JspTokenType.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.psi.jsp;
+
+import com.intellij.psi.tree.IElementType;
+import com.intellij.psi.tree.jsp.IJspElementType;
+import com.intellij.psi.xml.XmlTokenType;
+
+/**
+ * @author peter
+ */
+public interface JspTokenType extends XmlTokenType {
+  IElementType JSP_COMMENT = new IJspElementType("JSP_COMMENT");
+  IElementType JSP_SCRIPTLET_START = new IJspElementType("JSP_SCRIPTLET_START");
+  IElementType JSP_SCRIPTLET_END = new IJspElementType("JSP_SCRIPTLET_END");
+  IElementType JSP_DECLARATION_START = new IJspElementType("JSP_DECLARATION_START");
+  IElementType JSP_DECLARATION_END = new IJspElementType("JSP_DECLARATION_END");
+  IElementType JSP_EXPRESSION_START = new IJspElementType("JSP_EXPRESSION_START");
+  IElementType JSP_EXPRESSION_END = new IJspElementType("JSP_EXPRESSION_END");
+  IElementType JSP_DIRECTIVE_START = new IJspElementType("JSP_DIRECTIVE_START");
+  IElementType JSP_DIRECTIVE_END = new IJspElementType("JSP_DIRECTIVE_END");
+  IElementType JSP_BAD_CHARACTER = new IJspElementType("JSP_BAD_CHARACTER");
+  IElementType JSP_WHITE_SPACE = new IJspElementType("JSP_WHITE_SPACE"); // for highlighting purposes
+  IElementType JAVA_CODE = new IJspElementType("JAVA_CODE");
+  IElementType JSP_FRAGMENT = new IJspElementType("JSP_FRAGEMENT"); // passed to template parser for all of jsp code
+  IElementType JSPX_ROOT_TAG_HEADER = new IJspElementType("JSPX_ROOT_TAG_HEADER"); // These two only produced by JspxJavaLexer
+  IElementType JSPX_ROOT_TAG_FOOTER = new IJspElementType("JSPX_ROOT_TAG_FOOTER");
+  IElementType JSPX_JAVA_IN_ATTR_START = new IJspElementType("JSPX_JAVA_IN_ATTR_START");
+  IElementType JSPX_JAVA_IN_ATTR_END = new IJspElementType("JSPX_JAVA_IN_ATTR_END");
+  IElementType JSPX_JAVA_IN_ATTR = new IJspElementType("JSPX_JAVA_IN_ATTR");
+
+  IElementType JSP_TEMPLATE_DATA = XML_DATA_CHARACTERS;
+}
diff --git a/java/jsp-base-openapi/src/com/intellij/psi/tree/jsp/IJspElementType.java b/java/jsp-base-openapi/src/com/intellij/psi/tree/jsp/IJspElementType.java
new file mode 100644
index 0000000..ad60ba7
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/psi/tree/jsp/IJspElementType.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.psi.tree.jsp;
+
+import com.intellij.lang.Language;
+import com.intellij.openapi.fileTypes.StdFileTypes;
+import com.intellij.psi.tree.IElementType;
+import org.jetbrains.annotations.NonNls;
+
+public class IJspElementType extends IElementType {
+  public IJspElementType(@NonNls String debugName) {
+    this(debugName, StdFileTypes.JSP.getLanguage());
+  }
+
+  protected IJspElementType(String debugName, Language language) {
+    super(debugName, language);
+  }
+}
\ No newline at end of file
diff --git a/java/jsp-base-openapi/src/com/intellij/psi/tree/jsp/package.html b/java/jsp-base-openapi/src/com/intellij/psi/tree/jsp/package.html
new file mode 100644
index 0000000..835161f
--- /dev/null
+++ b/java/jsp-base-openapi/src/com/intellij/psi/tree/jsp/package.html
@@ -0,0 +1,20 @@
+<!--
+  ~ Copyright 2000-2007 JetBrains s.r.o.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html><body bgcolor="white">
+Provides interfaces for JSP elements found in AST trees.
+</body></html>