当前位置: 首页>>代码示例>>Java>>正文


Java PostfixLiveTemplate类代码示例

本文整理汇总了Java中com.intellij.codeInsight.template.postfix.templates.PostfixLiveTemplate的典型用法代码示例。如果您正苦于以下问题:Java PostfixLiveTemplate类的具体用法?Java PostfixLiveTemplate怎么用?Java PostfixLiveTemplate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PostfixLiveTemplate类属于com.intellij.codeInsight.template.postfix.templates包,在下文中一共展示了PostfixLiveTemplate类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addCompletions

import com.intellij.codeInsight.template.postfix.templates.PostfixLiveTemplate; //导入依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) {
  Editor editor = parameters.getEditor();
  if (!isCompletionEnabled(parameters) || LiveTemplateCompletionContributor.shouldShowAllTemplates() ||
      editor.getCaretModel().getCaretCount() != 1) {
    /**
     * disabled or covered with {@link com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor}
     */
    return;
  }

  PsiFile originalFile = parameters.getOriginalFile();
  PostfixLiveTemplate postfixLiveTemplate = getPostfixLiveTemplate(originalFile, editor);
  if (postfixLiveTemplate != null) {
    postfixLiveTemplate.addCompletions(parameters, result.withPrefixMatcher(new MyPrefixMatcher(result.getPrefixMatcher().getPrefix())));
    String possibleKey = postfixLiveTemplate.computeTemplateKeyWithoutContextChecking(new CustomTemplateCallback(editor, originalFile));
    if (possibleKey != null) {
      result = result.withPrefixMatcher(possibleKey);
      result.restartCompletionOnPrefixChange(
        StandardPatterns.string().oneOf(postfixLiveTemplate.getAllTemplateKeys(originalFile, parameters.getOffset())));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:PostfixTemplatesCompletionProvider.java

示例2: PostfixTemplateLookupElement

import com.intellij.codeInsight.template.postfix.templates.PostfixLiveTemplate; //导入依赖的package包/类
public PostfixTemplateLookupElement(@NotNull PostfixLiveTemplate liveTemplate,
                                    @NotNull PostfixTemplate postfixTemplate,
                                    @NotNull String templateKey,
                                    @NotNull PostfixTemplateProvider provider,
                                    boolean sudden) {
  super(liveTemplate, templateKey, StringUtil.trimStart(templateKey, "."), postfixTemplate.getDescription(), sudden, true);
  myTemplate = postfixTemplate;
  myProvider = provider;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PostfixTemplateLookupElement.java

示例3: PostfixTemplateCompletionContributor

import com.intellij.codeInsight.template.postfix.templates.PostfixLiveTemplate; //导入依赖的package包/类
public PostfixTemplateCompletionContributor() {
  extend(CompletionType.BASIC, PlatformPatterns.psiElement(), new CompletionProvider() {
    @RequiredReadAction
    @Override
    public void addCompletions(@Nonnull CompletionParameters parameters, ProcessingContext context, @Nonnull CompletionResultSet result) {
      Editor editor = parameters.getEditor();
      if (!isCompletionEnabled(parameters) || LiveTemplateCompletionContributor.shouldShowAllTemplates() ||
          editor.getCaretModel().getCaretCount() != 1) {
        /**
         * disabled or covered with {@link com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor}
         */
        return;
      }

      PsiFile originalFile = parameters.getOriginalFile();
      PostfixLiveTemplate postfixLiveTemplate = PostfixTemplateCompletionContributor.getPostfixLiveTemplate(originalFile, editor);
      if (postfixLiveTemplate != null) {
        postfixLiveTemplate.addCompletions(parameters, result.withPrefixMatcher(new MyPrefixMatcher(result.getPrefixMatcher().getPrefix())));
        String possibleKey = postfixLiveTemplate.computeTemplateKeyWithoutContextChecking(new CustomTemplateCallback(editor, originalFile));
        if (possibleKey != null) {
          result = result.withPrefixMatcher(possibleKey);
          result.restartCompletionOnPrefixChange(
                  StandardPatterns.string().oneOf(postfixLiveTemplate.getAllTemplateKeys(originalFile, parameters.getOffset())));
        }
      }
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:29,代码来源:PostfixTemplateCompletionContributor.java

示例4: PostfixTemplateLookupElement

import com.intellij.codeInsight.template.postfix.templates.PostfixLiveTemplate; //导入依赖的package包/类
public PostfixTemplateLookupElement(@Nonnull PostfixLiveTemplate liveTemplate,
                                    @Nonnull PostfixTemplate postfixTemplate,
                                    @Nonnull String templateKey,
                                    @Nonnull PostfixTemplateProvider provider,
                                    boolean sudden) {
  super(liveTemplate, templateKey, StringUtil.trimStart(templateKey, "."), postfixTemplate.getDescription(), sudden, true);
  myTemplate = postfixTemplate;
  myProvider = provider;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:PostfixTemplateLookupElement.java

示例5: getPostfixLiveTemplate

import com.intellij.codeInsight.template.postfix.templates.PostfixLiveTemplate; //导入依赖的package包/类
@Nullable
public static PostfixLiveTemplate getPostfixLiveTemplate(@NotNull PsiFile file, @NotNull Editor editor) {
  PostfixLiveTemplate postfixLiveTemplate = CustomLiveTemplate.EP_NAME.findExtension(PostfixLiveTemplate.class);
  return postfixLiveTemplate != null && TemplateManagerImpl.isApplicable(postfixLiveTemplate, editor, file) ? postfixLiveTemplate : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:PostfixTemplateCompletionContributor.java

示例6: getPostfixLiveTemplate

import com.intellij.codeInsight.template.postfix.templates.PostfixLiveTemplate; //导入依赖的package包/类
@Nullable
public static PostfixLiveTemplate getPostfixLiveTemplate(@Nonnull PsiFile file, @Nonnull Editor editor) {
  PostfixLiveTemplate postfixLiveTemplate = CustomLiveTemplate.EP_NAME.findExtension(PostfixLiveTemplate.class);
  return postfixLiveTemplate != null && TemplateManagerImpl.isApplicable(postfixLiveTemplate, editor, file) ? postfixLiveTemplate : null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:6,代码来源:PostfixTemplateCompletionContributor.java


注:本文中的com.intellij.codeInsight.template.postfix.templates.PostfixLiveTemplate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。