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


Java ProcessingContext类代码示例

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


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

示例1: addCompletions

import com.intellij.util.ProcessingContext; //导入依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) {
    PsiElement caller = parameters.getPosition().getPrevSibling().getPrevSibling();
    String ns = TSUtil.getElementNamespace(caller);

    //All global functions
    Project project = parameters.getOriginalFile().getProject();
    Collection<TSFnDeclStmt> functions = TSUtil.getFunctionList(project);
    for (TSFnDeclStmt function : functions) {
        if (function.getFunctionType() == TSFunctionType.GLOBAL)
            continue;

        result.addElement(
                LookupElementBuilder.create(function.getFunctionName())
                        .withCaseSensitivity(false)
                        .withPresentableText(function.getNamespace() + "." + function.getFunctionName())
                        .withBoldness(ns != null && function.getNamespace().equalsIgnoreCase(ns))
                        .withTailText(function.getArgList())
                        .withInsertHandler(TSCaseCorrectingInsertHandler.INSTANCE)
        );
    }
}
 
开发者ID:CouleeApps,项目名称:TS-IJ,代码行数:23,代码来源:TSMethodCallCompletionContributor.java

示例2: extendWithTemplateDefinitionLevelKeywords

import com.intellij.util.ProcessingContext; //导入依赖的package包/类
/**
 * Complete the "visibility" and "stricthtml" keywords in template definition open tags.
 */
private void extendWithTemplateDefinitionLevelKeywords() {
  extend(
      CompletionType.BASIC,
      psiElement().andOr(psiElement().inside(SoyBeginTemplate.class)),
      new CompletionProvider<CompletionParameters>() {
        @Override
        protected void addCompletions(
            @NotNull CompletionParameters completionParameters,
            ProcessingContext processingContext,
            @NotNull CompletionResultSet completionResultSet) {
          if (isPrecededBy(completionParameters.getPosition(),
              elt -> elt instanceof SoyTemplateDefinitionIdentifier)) {
            completionResultSet.addElement(
                LookupElementBuilder.create("visibility=\"private\""));
            completionResultSet.addElement(
                LookupElementBuilder.create("stricthtml=\"true\""));
          }
        }
      });
}
 
开发者ID:google,项目名称:bamboo-soy,代码行数:24,代码来源:SoyCompletionContributor.java

示例3: addCompletions

import com.intellij.util.ProcessingContext; //导入依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) {
    List<TSVarExpr> variables = new ArrayList<>();
    for (PsiElement current = parameters.getPosition().getPrevSibling(); current != null; current = current.getPrevSibling()) {
        if (current.getNode().getElementType().equals(TSTypes.FUNCTION))
            break;

        if (current.getNode().getElementType().equals(TSTypes.LOCALVAR)) {
            String prefixless = current.getText().substring(1);
            result.addElement(
                    LookupElementBuilder.create(prefixless)
                    .withPresentableText(current.getText())
                    .withCaseSensitivity(false)
            );
        }
    }
}
 
开发者ID:CouleeApps,项目名称:TS-IJ,代码行数:18,代码来源:TSLocalVariableCompletionContributor.java

示例4: addCompletions

import com.intellij.util.ProcessingContext; //导入依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) {
    String namespace = parameters.getPosition().getPrevSibling().getPrevSibling().getText();

    Project project = parameters.getOriginalFile().getProject();
    Collection<TSFnDeclStmt> functions = TSUtil.getFunctionList(project);

    for (TSFnDeclStmt function : functions) {
        if (function.getFunctionType() == TSFunctionType.GLOBAL)
            continue;
        if (namespace != null && !function.getNamespace().equalsIgnoreCase(namespace))
            continue;

        result.addElement(
                LookupElementBuilder.create(function.getFunctionName())
                        .withCaseSensitivity(false)
                        .withPresentableText(function.getNamespace() + "::" + function.getFunctionName())
                        .withTailText(function.getArgList())
                        .withInsertHandler(TSCaseCorrectingInsertHandler.INSTANCE)
        );
    }
}
 
开发者ID:CouleeApps,项目名称:TS-IJ,代码行数:23,代码来源:TSGlobalNSCallCompletionContributor.java

示例5: addCompletions

import com.intellij.util.ProcessingContext; //导入依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) {
    //All global functions
    Project project = parameters.getOriginalFile().getProject();
    Collection<TSFnDeclStmt> functions = TSUtil.getFunctionList(project);
    for (TSFnDeclStmt function : functions) {
        if (function.getFunctionType() != TSFunctionType.GLOBAL)
            continue;

        result.addElement(
                LookupElementBuilder.create(function)
                        .withCaseSensitivity(false)
                        .withTailText(function.getArgList())
                        .withInsertHandler(TSCaseCorrectingInsertHandler.INSTANCE)
        );
    }
}
 
开发者ID:CouleeApps,项目名称:TS-IJ,代码行数:18,代码来源:TSGlobalCallCompletionContributor.java

示例6: KeywordCompletionContributor

import com.intellij.util.ProcessingContext; //导入依赖的package包/类
public KeywordCompletionContributor() {

    extend(CompletionType.BASIC, psiElement().inFile(StandardPatterns.instanceOf(AppleScriptFile.class)),
        new CompletionProvider<CompletionParameters>() {
          @Override
          protected void addCompletions(@NotNull CompletionParameters completionParameters,
                                        ProcessingContext processingContext,
                                        @NotNull CompletionResultSet completionResultSet) {
            PsiFile file = completionParameters.getOriginalFile();
            if (!(file instanceof AppleScriptFile)) return;
            PsiElement position = completionParameters.getPosition();
            if (position instanceof PsiComment) return;

            ASTNode node = position.getNode();
            if (node.getElementType() == AppleScriptTypes.STRING_LITERAL) return;

            for (IElementType kwElem : AppleScriptTokenTypesSets.KEYWORDS.getTypes()) {
              completionResultSet.addElement(LookupElementBuilder
                  .create(kwElem.toString().toLowerCase().replaceAll("_", " ")).bold()
                  .withTypeText("keyword", true));
            }
          }
        });
  }
 
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:25,代码来源:KeywordCompletionContributor.java

示例7: addCompletions

import com.intellij.util.ProcessingContext; //导入依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet resultSet) {
    MerlinService merlin = ApplicationManager.getApplication().getComponent(MerlinService.class);

    PsiFile originalFile = parameters.getOriginalFile();
    String text = originalFile.getText();
    LineNumbering lineNumbering = new LineNumbering(text);

    String suitablePrefix = findSuitablePrefix(parameters, text);

    MerlinPosition position = lineNumbering.offsetToPosition(parameters.getOffset());
    MerlinCompletion completion = merlin.completions(originalFile.getName(), text, position, suitablePrefix);

    for (MerlinCompletionEntry entry : completion.entries) {
        resultSet.addElement(LookupElementBuilder.
                create(entry.name).
                withIcon(getIcon(entry)).
                withTypeText(entry.desc));
    }
}
 
开发者ID:reasonml-editor,项目名称:reasonml-idea-plugin,代码行数:21,代码来源:MerlinCompletionProvider.java

示例8: registerReferenceProviders

import com.intellij.util.ProcessingContext; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
    // follow, redirect
    registrar.registerReferenceProvider(
            PlatformPatterns.psiElement(StringLiteralExpression.class),
            new PsiReferenceProvider() {
                @NotNull
                @Override
                public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
                    if (!(element instanceof StringLiteralExpression)) {
                        return new PsiReference[0];
                    }

                    StringLiteralExpression stringLiteralExpression = (StringLiteralExpression) element;

                    String methodName = PhpLangUtil.getMethodName(element);
                    int parameterPosition = PhpLangUtil.getParameterPosition(stringLiteralExpression);
                    if (methodName != null && isDirectingActionName(methodName) && parameterPosition == 0) {
                        return new PsiReference[]{new ControllerActionReference(stringLiteralExpression)};
                    }

                    return new PsiReference[0];
                }
            }
    );
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:27,代码来源:ControllerActionReferenceContributor.java

示例9: registerReferenceProviders

import com.intellij.util.ProcessingContext; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
    registrar.registerReferenceProvider(
            PlatformPatterns.psiElement(StringLiteralExpression.class),
            new PsiReferenceProvider() {
                @NotNull
                @Override
                public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
                    if (isGenerator(element)) {
                        return new PsiReference[]{new RouteReference((StringLiteralExpression) element)};
                    }

                    return new PsiReference[0];
                }
            }
    );
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:18,代码来源:RouteReferenceContributor.java

示例10: registerReferenceProviders

import com.intellij.util.ProcessingContext; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
    // "EXT:" strings
    registrar.registerReferenceProvider(
            PlatformPatterns.psiElement(StringLiteralExpression.class),
            new PsiReferenceProvider() {
                @NotNull
                @Override
                public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {

                    StringLiteralExpression stringLiteralExpression = (StringLiteralExpression)element;
                    if (!stringLiteralExpression.getContents().startsWith("EXT:")) {
                        return new PsiReference[0];
                    }

                    return new PsiReference[]{new ResourceReference(stringLiteralExpression)};
                }
            }
    );
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:21,代码来源:ResourceReferenceContributor.java

示例11: registerReferenceProviders

import com.intellij.util.ProcessingContext; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
    registrar.registerReferenceProvider(PlatformPatterns.psiElement(StringLiteralExpression.class), new PsiReferenceProvider() {
        @NotNull
        @Override
        public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
            if (!(element instanceof StringLiteralExpression)) {
                return new PsiReference[0];
            }

            StringLiteralExpression stringLiteralExpression = (StringLiteralExpression) element;
            if (!stringLiteralExpression.getContents().startsWith("LLL:")) {
                return new PsiReference[0];
            }

            return new PsiReference[]{new TranslationReference(stringLiteralExpression)};
        }
    });
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:20,代码来源:TranslationReferenceContributor.java

示例12: addCompletions

import com.intellij.util.ProcessingContext; //导入依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
                              ProcessingContext context,
                              @NotNull CompletionResultSet result) {
    PsiElement position = parameters.getPosition().getOriginalElement();
    if (position == null || !(position instanceof XmlElement)) {
        return;
    }


    DiIndex diIndex = DiIndex.getInstance(position.getProject());
    PhpClass phpClass = diIndex.getPhpClassOfArgument((XmlElement) position);
    if (phpClass != null) {
        Method constructor = phpClass.getConstructor();
        if (constructor != null) {
            for (Parameter parameter : constructor.getParameters()) {
                result.addElement(
                        LookupElementBuilder
                                .create(parameter.getName())
                                .withIcon(parameter.getIcon())
                );
            }
        }
    }
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:26,代码来源:PhpConstructorArgumentCompletionProvider.java

示例13: addCompletions

import com.intellij.util.ProcessingContext; //导入依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
                              ProcessingContext context,
                              @NotNull CompletionResultSet result) {
    PsiElement position = parameters.getPosition().getOriginalElement();
    if (position == null) {
        return;
    }

    Collection<String> keys = LayoutIndex.getAllKeys(ContainerNameIndex.KEY, position.getProject());
    for (String key: keys) {
        result.addElement(
            LookupElementBuilder.create(key).withIcon(PhpIcons.XML_TAG_ICON)
        );
    }
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:17,代码来源:LayoutContainerCompletionContributor.java

示例14: addCompletions

import com.intellij.util.ProcessingContext; //导入依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
                              ProcessingContext context,
                              @NotNull CompletionResultSet result) {
    PsiElement position = parameters.getPosition().getOriginalElement();
    if (position == null) {
        return;
    }
    String prefix = result.getPrefixMatcher().getPrefix();

    Collection<String> moduleNames
            = FileBasedIndex.getInstance().getAllKeys(ModuleNameIndex.KEY, position.getProject());


    moduleNames.removeIf(m -> !m.startsWith(prefix));
    for (String moduleName : moduleNames) {
        result.addElement(
                LookupElementBuilder
                        .create(moduleName)
                        .withIcon(AllIcons.Modules.ModulesNode)
        );
    }
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:24,代码来源:ModuleNameCompletionProvider.java

示例15: addCompletions

import com.intellij.util.ProcessingContext; //导入依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
                              ProcessingContext context,
                              @NotNull CompletionResultSet result) {
    PsiElement position = parameters.getPosition().getOriginalElement();
    if (position == null) {
        return;
    }

    Collection<String> keys = LayoutIndex.getAllKeys(BlockNameIndex.KEY, position.getProject());
    for (String key: keys) {
        result.addElement(
            LookupElementBuilder.create(key).withIcon(PhpIcons.XML_TAG_ICON)
        );
    }
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:17,代码来源:LayoutBlockCompletionContributor.java


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