use of com.intellij.psi.PsiDisjunctionType in project intellij-community by JetBrains.
the class GrDisjunctionTypeElementImpl method getType.
@NotNull
@Override
public PsiType getType() {
PsiType cachedType = myCachedType;
if (cachedType != null)
return myCachedType;
final GrTypeElement[] typeElements = getTypeElements();
final ArrayList<PsiType> types = new ArrayList<>();
for (GrTypeElement typeElement : typeElements) {
types.add(typeElement.getType());
}
cachedType = new PsiDisjunctionType(types, getManager());
myCachedType = cachedType;
return cachedType;
}
use of com.intellij.psi.PsiDisjunctionType in project intellij-community by JetBrains.
the class PsiTypeTokenizer method tokenize.
@Override
public void tokenize(@NotNull PsiTypeElement element, TokenConsumer consumer) {
final PsiType type = element.getType();
if (type instanceof PsiDisjunctionType) {
tokenizeComplexType(element, consumer);
return;
}
final PsiClass psiClass = PsiUtil.resolveClassInType(type);
if (psiClass == null || psiClass.getContainingFile() == null || psiClass.getContainingFile().getVirtualFile() == null) {
return;
}
final String name = psiClass.getName();
if (name == null) {
return;
}
final VirtualFile virtualFile = psiClass.getContainingFile().getVirtualFile();
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(element.getProject()).getFileIndex();
final boolean isInSource = (virtualFile != null) && fileIndex.isInContent(virtualFile);
if (isInSource) {
final String elementText = element.getText();
if (elementText.contains(name)) {
consumer.consumeToken(element, elementText, true, 0, getRangeToCheck(elementText, name), IdentifierSplitter.getInstance());
}
}
}
Aggregations