Live Templates. Substituting Template via TemplateSubstitutor implemented. After...
authorAndrey Vokin <andrey.vokin@jetbrains.com>
Thu, 18 Dec 2014 10:10:30 +0000 (13:10 +0300)
committerAndrey Vokin <andrey.vokin@jetbrains.com>
Thu, 18 Dec 2014 10:11:38 +0000 (13:11 +0300)
platform/lang-impl/src/com/intellij/codeInsight/template/TemplateSubstitutor.java [moved from platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateSubstitutor.java with 79% similarity]
platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java
platform/platform-resources/src/META-INF/LangExtensionPoints.xml

similarity index 79%
rename from platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateSubstitutor.java
rename to platform/lang-impl/src/com/intellij/codeInsight/template/TemplateSubstitutor.java
index b696191c10b1bdcf394b5b2be32f7c542a69b66c..c72f71dddbfadc3be6c5af2bf78c62a464a40f8d 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.intellij.codeInsight.template.impl;
+package com.intellij.codeInsight.template;
 
+import com.intellij.codeInsight.template.impl.TemplateImpl;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.extensions.ExtensionPointName;
 import com.intellij.psi.PsiFile;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 public interface TemplateSubstitutor {
   ExtensionPointName<TemplateSubstitutor> EP_NAME = ExtensionPointName.create("com.intellij.liveTemplateSubstitutor");
 
   @Nullable
-  TemplateImpl substituteTemplate(final Editor editor, final PsiFile file, int caretOffset, final TemplateImpl template);
+  TemplateImpl substituteTemplate(@NotNull PsiFile file, int caretOffset, @NotNull TemplateImpl template);
 }
index 28da15874d3059a94cb56bb65293b1a27eb43204..e80b060d94a81be6629456f03452ac2f30a9e134 100644 (file)
@@ -351,9 +351,9 @@ public class TemplateState implements Disposable {
     }
   }
 
-  private TemplateImpl substituteTemplate(final PsiFile file, int caretOffset, TemplateImpl template) {
+  private static TemplateImpl substituteTemplate(final PsiFile file, int caretOffset, TemplateImpl template) {
     for (TemplateSubstitutor substitutor : Extensions.getExtensions(TemplateSubstitutor.EP_NAME)) {
-      final TemplateImpl substituted = substitutor.substituteTemplate(myEditor, file, caretOffset, template);
+      final TemplateImpl substituted = substitutor.substituteTemplate(file, caretOffset, template);
       if (substituted != null) {
         template = substituted;
       }
index 6b0cd0a5f7784397e472829d08f882e3a9cf127b..d5375dca95bd7f3aa441df9eb4de170d06e2c419 100644 (file)
     <extensionPoint name="liveTemplateMacro" interface="com.intellij.codeInsight.template.Macro"/>
     <extensionPoint name="liveTemplateOptionalProcessor" interface="com.intellij.codeInsight.template.impl.TemplateOptionalProcessor"/>
     <extensionPoint name="liveTemplatePreprocessor" interface="com.intellij.codeInsight.template.impl.TemplatePreprocessor"/>
-    <extensionPoint name="liveTemplateSubstitutor" interface="com.intellij.codeInsight.template.impl.TemplateSubstitutor"/>
+    <extensionPoint name="liveTemplateSubstitutor" interface="com.intellij.codeInsight.template.TemplateSubstitutor"/>
     <extensionPoint name="customLiveTemplate" interface="com.intellij.codeInsight.template.CustomLiveTemplate"/>
     <extensionPoint name="variableTypeCalculator" interface="com.intellij.codeInsight.template.macro.VariableTypeCalculator"/>