PHP persistent injections
authorAlexey Gopachenko <alexey.gopachenko@jetbrains.com>
Mon, 15 Feb 2010 10:38:18 +0000 (15 13:38 +0300)
committerAlexey Gopachenko <alexey.gopachenko@jetbrains.com>
Mon, 15 Feb 2010 10:38:18 +0000 (15 13:38 +0300)
plugins/IntelliLang/IntelliLangJava.iml
plugins/IntelliLang/src/LanguageInjectionConfiguration.xml
plugins/IntelliLang/src/META-INF/intellilang-php-support.xml [new file with mode: 0644]
plugins/IntelliLang/src/META-INF/plugin.xml
plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/php/PhpLanguageInjectionSupport.java [new file with mode: 0644]

index e6aaec1..33f4ef6 100644 (file)
@@ -20,6 +20,7 @@
     <orderEntry type="module" module-name="jetgroovy" />
     <orderEntry type="module" module-name="java-impl" />
     <orderEntry type="library" name="Jaxen" level="project" />
+    <orderEntry type="module" module-name="php" />
   </component>
   <component name="copyright">
     <Base>
index 40a0e91..fd31db1 100644 (file)
     <place><![CDATA[xmlAttribute().withLocalName(not(string().matches("id|type"))).withText(string().matches("[^${}/\\]+")).inside(xmlTag().withNamespace(string().matches("http://tapestry.apache.org/schema/tapestry_5_1_0.xsd|http://tapestry.apache.org/schema/tapestry_5_0_0.xsd")))]]></place>
     <place><![CDATA[xmlAttribute().withLocalName(not(string().matches("id|type"))).withText(string().matches("[^${}/\\]+")).withNamespace(string().matches("http://tapestry.apache.org/schema/tapestry_5_1_0.xsd|http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"))]]></place>
   </injection>
+  <!--
+  <injection language="CSS" injector-id="php">
+    <display-name>&lt;&lt;&lt; CSS</display-name>
+    <place><![CDATA[heredocWithName("CSS")]]></place>
+  </injection>
+  <injection language="SQL" injector-id="php">
+    <display-name>&lt;&lt;&lt; SQL</display-name>
+    <place><![CDATA[heredocWithName("SQL")]]></place>
+  </injection>
+  <injection language="HTML" injector-id="php">
+    <display-name>&lt;&lt;&lt; HTML</display-name>
+    <place><![CDATA[heredocWithName("HTML")]]></place>
+  </injection>
+  -->
 </component>
diff --git a/plugins/IntelliLang/src/META-INF/intellilang-php-support.xml b/plugins/IntelliLang/src/META-INF/intellilang-php-support.xml
new file mode 100644 (file)
index 0000000..74cbdb0
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<idea-plugin version="2">
+
+  <extensions defaultExtensionNs="org.intellij.intelliLang">
+    <languageSupport implementation="org.intellij.plugins.intelliLang.inject.php.PhpLanguageInjectionSupport"/>
+  </extensions>
+
+</idea-plugin>
\ No newline at end of file
index 08fc534..987b6c0 100644 (file)
@@ -10,6 +10,7 @@
   <depends optional="true" config-file="intellilang-javaee-support.xml">com.intellij.javaee</depends>
   <depends optional="true" config-file="intellilang-xml-support.xml">com.intellij.modules.xml</depends>
   <depends optional="true" config-file="intellilang-groovy-support.xml">org.intellij.groovy</depends>
+  <depends optional="true" config-file="intellilang-php-support.xml">com.jetbrains.php</depends>
 
   <vendor email="sascha.weinreuter@cit.de" logo="/org/intellij/plugins/intelliLang/icon_small.png">Sascha Weinreuter</vendor>
 
diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/php/PhpLanguageInjectionSupport.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/php/PhpLanguageInjectionSupport.java
new file mode 100644 (file)
index 0000000..244756c
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2000-2010 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 org.intellij.plugins.intelliLang.inject.php;
+
+import com.intellij.psi.PsiElement;
+import com.jetbrains.php.lang.patterns.PhpPatterns;
+import com.jetbrains.php.lang.psi.elements.PhpPsiElement;
+import org.intellij.plugins.intelliLang.inject.AbstractLanguageInjectionSupport;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+
+public class PhpLanguageInjectionSupport extends AbstractLanguageInjectionSupport {
+  @NonNls private static final String SUPPORT_ID = "php";
+
+  @NotNull
+  public String getId() {
+    return SUPPORT_ID;
+  }
+
+  @NotNull
+  public Class[] getPatternClasses() {
+    return new Class[] {PhpPatterns.class};
+  }
+
+  public boolean useDefaultInjector(final PsiElement host) {
+    return host instanceof PhpPsiElement;
+  }
+}