Java Code Examples for com.intellij.util.ProcessingContext#put()
The following examples show how to use
com.intellij.util.ProcessingContext#put() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleProviderBinding.java From consulo with Apache License 2.0 | 6 votes |
@Override public void addAcceptableReferenceProviders(@Nonnull PsiElement position, @Nonnull List<ProviderInfo<Provider, ProcessingContext>> list, @Nonnull PsiReferenceService.Hints hints) { for (ProviderInfo<Provider, ElementPattern> trinity : myProviderPairs) { if (hints != PsiReferenceService.Hints.NO_HINTS && !((PsiReferenceProvider)trinity.provider).acceptsHints(position, hints)) { continue; } final ProcessingContext context = new ProcessingContext(); if (hints != PsiReferenceService.Hints.NO_HINTS) { context.put(PsiReferenceService.HINTS, hints); } boolean suitable = false; try { suitable = trinity.processingContext.accepts(position, context); } catch (IndexNotReadyException ignored) { } if (suitable) { list.add(new ProviderInfo<Provider, ProcessingContext>(trinity.provider, context, trinity.priority)); } } }
Example 2
Source File: NamedObjectProviderBinding.java From consulo with Apache License 2.0 | 6 votes |
private void addMatchingProviders(final PsiElement position, @Nullable final List<ProviderInfo<Provider, ElementPattern>> providerList, @Nonnull List<ProviderInfo<Provider, ProcessingContext>> ret, PsiReferenceService.Hints hints) { if (providerList == null) return; for (ProviderInfo<Provider, ElementPattern> trinity : providerList) { if (hints != PsiReferenceService.Hints.NO_HINTS && !((PsiReferenceProvider)trinity.provider).acceptsHints(position, hints)) { continue; } final ProcessingContext context = new ProcessingContext(); if (hints != PsiReferenceService.Hints.NO_HINTS) { context.put(PsiReferenceService.HINTS, hints); } boolean suitable = false; try { suitable = trinity.processingContext.accepts(position, context); } catch (IndexNotReadyException ignored) { } if (suitable) { ret.add(new ProviderInfo<Provider, ProcessingContext>(trinity.provider, context, trinity.priority)); } } }
Example 3
Source File: StandardPatterns.java From consulo with Apache License 2.0 | 5 votes |
public static <T> ElementPattern save(final Key<T> key) { return new ObjectPattern.Capture<T>(new InitialPatternCondition(Object.class) { @Override public boolean accepts(@Nullable final Object o, final ProcessingContext context) { context.put(key, (T)o); return true; } @Override public void append(@Nonnull @NonNls final StringBuilder builder, final String indent) { builder.append("save(").append(key).append(")"); } }); }
Example 4
Source File: PsiProximityComparator.java From consulo with Apache License 2.0 | 5 votes |
@Nullable public static WeighingComparable<PsiElement, ProximityLocation> getProximity(final Computable<? extends PsiElement> elementComputable, final PsiElement context, ProcessingContext processingContext) { PsiElement element = elementComputable.compute(); if (element == null || context == null) return null; Module contextModule = processingContext.get(MODULE_BY_LOCATION); if (contextModule == null) { contextModule = ModuleUtilCore.findModuleForPsiElement(context); processingContext.put(MODULE_BY_LOCATION, contextModule); } return new WeighingComparable<>(elementComputable, new ProximityLocation(context, contextModule, processingContext), getProximityWeighers()); }
Example 5
Source File: CompletionLookupArrangerImpl.java From consulo with Apache License 2.0 | 4 votes |
private ProcessingContext createContext() { ProcessingContext context = new ProcessingContext(); context.put(PREFIX_CHANGES, myPrefixChanges); context.put(WEIGHING_CONTEXT, this); return context; }