fix trouble (do not invoke zen coding in live template activation)
authorEugene Kudelevsky <Eugene.Kudelevsky@jetbrains.com>
Fri, 2 Apr 2010 10:56:21 +0000 (14:56 +0400)
committerEugene Kudelevsky <Eugene.Kudelevsky@jetbrains.com>
Fri, 2 Apr 2010 10:56:21 +0000 (14:56 +0400)
platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateManagerImpl.java

index 26f37bf59d6b311bee9a1286bfe53c57541d7a3b..f468b813c4b07304cf279af050050e117688ed77 100644 (file)
@@ -220,50 +220,11 @@ public class TemplateManagerImpl extends TemplateManager implements ProjectCompo
     }
   }
 
-  private static boolean containsTemplateStartingBefore(Map<TemplateImpl, String> template2argument,
-                                                        int offset,
-                                                        int caretOffset,
-                                                        CharSequence text) {
-    for (TemplateImpl template : template2argument.keySet()) {
-      String argument = template2argument.get(template);
-      int templateStart = getTemplateStart(template, argument, caretOffset, text);
-      if (templateStart <= offset) {
-        return true;
-      }
-    }
-    return false;
-  }
-
   public boolean startTemplate(final Editor editor, char shortcutChar, final PairProcessor<String, String> processor) {
     PsiFile file = PsiUtilBase.getPsiFileInEditor(editor, myProject);
     if (file == null) return false;
     TemplateSettings templateSettings = TemplateSettings.getInstance();
-
     Map<TemplateImpl, String> template2argument = findMatchingTemplates(file, editor, shortcutChar, templateSettings);
-
-    if (shortcutChar == templateSettings.getDefaultShortcutChar()) {
-      for (final CustomLiveTemplate customLiveTemplate : CustomLiveTemplate.EP_NAME.getExtensions()) {
-        int caretOffset = editor.getCaretModel().getOffset();
-        if (customLiveTemplate.isApplicable(file, caretOffset, false)) {
-          final CustomTemplateCallback callback = new CustomTemplateCallback(editor, file);
-          String key = customLiveTemplate.computeTemplateKey(callback);
-          if (key != null) {
-            int offsetBeforeKey = caretOffset - key.length();
-            CharSequence text = editor.getDocument().getCharsSequence();
-            if (template2argument == null || !containsTemplateStartingBefore(template2argument, offsetBeforeKey, caretOffset, text)) {
-              callback.getEditor().getDocument().deleteString(offsetBeforeKey, caretOffset);
-              callback.fixInitialState();
-              customLiveTemplate.expand(key, callback, new TemplateInvokationListener() {
-                public void finished(boolean inSeparateEvent) {
-                  callback.finish();
-                }
-              });
-              return true;
-            }
-          }
-        }
-      }
-    }
     return startNonCustomTemplates(template2argument, editor, processor);
   }