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


Java ProcessingContext.get方法代码示例

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


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

示例1: addCompletions

import com.intellij.util.ProcessingContext; //导入方法依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
                              ProcessingContext processingContext,
                              @NotNull CompletionResultSet result) {

    final PsiElement original = parameters.getOriginalPosition();
    if (original != null) {
        result = result.withPrefixMatcher(getPrefix(parameters.getOffset(), parameters.getOriginalFile()));
        SyntheticTypeInfo sti = processingContext.get(SYNTHETIC_TYPE_INFO_KEY);
        if (sti.hasSyntheticConstructor()) {
            for (SyntheticMemberInfo smi : sti.getMembers()) {
                LookupElement lookupElement =
                        LookupElementBuilder
                                .create(smi.getName() + "=")
                                .withIcon(PlatformIcons.PARAMETER_ICON);
                result.addElement(lookupElement);
            }
        }
    }
}
 
开发者ID:jhominal,项目名称:pysynthetic-intellij,代码行数:21,代码来源:SyntheticInitArgsCompletionContributor.java

示例2: addUnfinishedMethodTypeParameters

import com.intellij.util.ProcessingContext; //导入方法依赖的package包/类
private static void addUnfinishedMethodTypeParameters(PsiElement position, final Consumer<LookupElement> result) {
  final ProcessingContext context = new ProcessingContext();
  if (psiElement().inside(
    psiElement(PsiTypeElement.class).afterLeaf(
      psiElement().withText(">").withParent(
        psiElement(PsiTypeParameterList.class).withParent(PsiErrorElement.class).save("typeParameterList")))).accepts(position, context)) {
    final PsiTypeParameterList list = (PsiTypeParameterList)context.get("typeParameterList");
    PsiElement current = list.getParent().getParent();
    if (current instanceof PsiField) {
      current = current.getParent();
    }
    if (current instanceof PsiClass) {
      for (PsiTypeParameter typeParameter : list.getTypeParameters()) {
        result.consume(new JavaPsiClassReferenceElement(typeParameter));
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:JavaKeywordCompletion.java

示例3: getProximity

import com.intellij.util.ProcessingContext; //导入方法依赖的package包/类
@Nullable
public static WeighingComparable<PsiElement, ProximityLocation> getProximity(final Computable<PsiElement> elementComputable, final PsiElement context, ProcessingContext processingContext) {
  PsiElement element = elementComputable.compute();
  if (element == null) return null;
  if (element instanceof MetadataPsiElementBase) return null;
  if (context == null) return null;
  Module contextModule = processingContext.get(MODULE_BY_LOCATION);
  if (contextModule == null) {
    contextModule = ModuleUtilCore.findModuleForPsiElement(context);
    processingContext.put(MODULE_BY_LOCATION, contextModule);
  }

  if (contextModule == null) return null;

  return new WeighingComparable<PsiElement,ProximityLocation>(elementComputable,
                                                              new ProximityLocation(context, contextModule, processingContext),
                                                              PROXIMITY_WEIGHERS);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:PsiProximityComparator.java

示例4: resolve

import com.intellij.util.ProcessingContext; //导入方法依赖的package包/类
@Override
public PsiElement resolve() {
  final ProcessingContext context = new ProcessingContext();
  final ResolvingVisitor visitor = new ResolvingVisitor(PATTERN.with(myCondition).save(TARGET), context) {
    @Override
    public void visitXmlTag(XmlTag tag) {
      super.visitXmlTag(tag);
      if (shouldContinue()) {
        visitSubTags(tag);
      }
    }
    @Override
    protected boolean shouldContinue() {
      return context.get(TARGET) == null;
    }
  };

  process(visitor);

  return context.get(TARGET);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:IdRefProvider.java

示例5: addCompletions

import com.intellij.util.ProcessingContext; //导入方法依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
                              ProcessingContext context,
                              @NotNull CompletionResultSet result) {
    List<SyntheticTypeInfo> typeInfoList = context.get(SYNTHETIC_TYPE_INFO_KEY);

    for (SyntheticTypeInfo typeInfo : typeInfoList) {
        result.addAllElements(typeInfo.getLookupElements());
    }
}
 
开发者ID:jhominal,项目名称:pysynthetic-intellij,代码行数:11,代码来源:SyntheticMembersCompletionContributor.java

示例6: isAfterExpression

import com.intellij.util.ProcessingContext; //导入方法依赖的package包/类
private static boolean isAfterExpression(PsiElement element) {
  ProcessingContext context = new ProcessingContext();
  if (psiElement().withAncestor(1, instanceOf(PsiExpression.class))
    .afterLeaf(psiElement().withAncestor(1, psiElement(PsiExpression.class).save("prevExpr"))).accepts(element, context)) {
    PsiExpression prevExpr = (PsiExpression)context.get("prevExpr");
    if (prevExpr.getTextRange().getEndOffset() <= element.getTextRange().getStartOffset()) {
      return true;
    }
  }

  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:JavaCodeContextType.java

示例7: getReferencesByElement

import com.intellij.util.ProcessingContext; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {

  if (XmlSchemaTagsProcessor.PROCESSING_FLAG.get() != null || context.get(SUPPRESS) != null) {
    return PsiReference.EMPTY_ARRAY;
  }
  @SuppressWarnings("unchecked") PsiElement host = getHost((T)element);
  if (host instanceof PsiLanguageInjectionHost && InjectedLanguageUtil.hasInjections((PsiLanguageInjectionHost)host)) {
    return PsiReference.EMPTY_ARRAY;
  }
  String unquotedValue = ElementManipulators.getValueText(element);
  if (XmlHighlightVisitor.skipValidation(element) || !XmlUtil.isSimpleValue(unquotedValue, element)) {
    return PsiReference.EMPTY_ARRAY;
  }
  @SuppressWarnings("unchecked") final Object descriptor = getDescriptor((T)element);
  if (descriptor instanceof XmlEnumerationDescriptor) {
    XmlEnumerationDescriptor enumerationDescriptor = (XmlEnumerationDescriptor)descriptor;

    if (enumerationDescriptor.isFixed() || enumerationDescriptor.isEnumerated((XmlElement)element)) {
      //noinspection unchecked
      return enumerationDescriptor.getValueReferences((XmlElement)element, unquotedValue);
    }
    else if (unquotedValue.equals(enumerationDescriptor.getDefaultValue())) {  // todo case insensitive
      return ContainerUtil.map2Array(enumerationDescriptor.getValueReferences((XmlElement)element, unquotedValue), PsiReference.class,
                                     new Function<PsiReference, PsiReference>() {
                                       @Override
                                       public PsiReference fun(PsiReference reference) {
                                         return PsiDelegateReference.createSoft(reference, true);
                                       }
                                     });
    }
  }
  return PsiReference.EMPTY_ARRAY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:XmlEnumeratedValueReferenceProvider.java

示例8: findPsiType

import com.intellij.util.ProcessingContext; //导入方法依赖的package包/类
@NotNull
public static PsiType findPsiType(GroovyClassDescriptor descriptor, ProcessingContext ctx) {
  String typeText = descriptor.getTypeText();
  final String key = getClassKey(typeText);
  final Object cached = ctx.get(key);
  if (cached instanceof PsiType) {
    return (PsiType)cached;
  }

  final PsiType found = JavaPsiFacade.getElementFactory(descriptor.getProject()).createTypeFromText(typeText, descriptor.getPlaceFile());
  ctx.put(key, found);
  return found;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ClassUtil.java

示例9: isAfterExpression

import com.intellij.util.ProcessingContext; //导入方法依赖的package包/类
private static boolean isAfterExpression(PsiElement element) {
  ProcessingContext context = new ProcessingContext();
  if (PlatformPatterns.psiElement().afterLeaf(
    PlatformPatterns.psiElement().inside(PlatformPatterns.psiElement(GrExpression.class).save("prevExpr"))).accepts(element, context)) {
    PsiElement prevExpr = (PsiElement)context.get("prevExpr");
    if (prevExpr.getTextRange().getEndOffset() <= element.getTextRange().getStartOffset()) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:GroovyTemplateContextType.java

示例10: getCompletionVariants

import com.intellij.util.ProcessingContext; //导入方法依赖的package包/类
public Object[] getCompletionVariants(String prefix, PsiElement location, ProcessingContext context) {
  Set<PyClassType> visited = context.get(CTX_VISITED);
  if (visited == null) {
    visited = new HashSet<PyClassType>();
    context.put(CTX_VISITED, visited);
  }
  if (visited.contains(this)) {
    return ArrayUtil.EMPTY_OBJECT_ARRAY;
  }
  visited.add(this);
  Set<String> namesAlready = context.get(CTX_NAMES);
  if (namesAlready == null) {
    namesAlready = new HashSet<String>();
  }
  List<Object> ret = new ArrayList<Object>();

  boolean suppressParentheses = context.get(CTX_SUPPRESS_PARENTHESES) != null;
  addOwnClassMembers(location, namesAlready, suppressParentheses, ret);

  PsiFile origin = (location != null) ?
                   CompletionUtil.getOriginalOrSelf(location)
                     .getContainingFile() :
                   null;
  final TypeEvalContext typeEvalContext = TypeEvalContext.codeCompletion(myClass.getProject(), origin);
  addInheritedMembers(prefix, location, namesAlready, context, ret, typeEvalContext);

  // from providers
  for (final PyClassMembersProvider provider : Extensions.getExtensions(PyClassMembersProvider.EP_NAME)) {
    for (final PyCustomMember member : provider.getMembers(this, location)) {
      final String name = member.getName();
      if (!namesAlready.contains(name)) {
        ret.add(PyCustomMemberUtils.toLookUpElement(member, getName()));
      }
    }
  }

  if (!myClass.isNewStyleClass(null)) {
    final PyBuiltinCache cache = PyBuiltinCache.getInstance(myClass);
    final PyClassType classobjType = cache.getOldstyleClassobjType();
    if (classobjType != null) {
      ret.addAll(Arrays.asList(classobjType.getCompletionVariants(prefix, location, context)));
    }
  }

  if (isDefinition() && myClass.isNewStyleClass(null)) {
    final PyClassLikeType typeType = getMetaClassType(typeEvalContext, true);
    if (typeType != null) {
      Collections.addAll(ret, typeType.getCompletionVariants(prefix, location, context));
    }
  }

  return ret.toArray();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:54,代码来源:PyClassTypeImpl.java


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