Java Code Examples for com.intellij.patterns.StandardPatterns#or()
The following examples show how to use
com.intellij.patterns.StandardPatterns#or() .
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: CommandNameCompletionProvider.java From BashSupport with Apache License 2.0 | 5 votes |
@Override void addTo(CompletionContributor contributor) { BashPsiPattern internal = new BashPsiPattern().withParent(BashInternalCommand.class); BashPsiPattern generic = new BashPsiPattern().withParent(BashGenericCommand.class); ElementPattern<PsiElement> internalOrGeneric = StandardPatterns.or(internal, generic); BashPsiPattern pattern = new BashPsiPattern().withParent(internalOrGeneric); contributor.extend(CompletionType.BASIC, pattern, this); }
Example 2
Source File: PsiReferenceProviderBean.java From consulo with Apache License 2.0 | 5 votes |
@Nullable public ElementPattern<PsiElement> createElementPattern() { if (patterns.length > 1) { List<ElementPattern<? extends PsiElement>> list = ContainerUtil.mapNotNull(patterns, PATTERN_NULLABLE_FUNCTION); //noinspection unchecked return StandardPatterns.or(list.toArray(new ElementPattern[list.size()])); } else if (patterns.length == 1) { return patterns[0].compilePattern(); } else { LOG.error("At least one pattern should be specified"); return null; } }