Java Code Examples for com.intellij.psi.PsiNameIdentifierOwner#getName()
The following examples show how to use
com.intellij.psi.PsiNameIdentifierOwner#getName() .
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: DotExpressionCompletionProvider.java From reasonml-idea-plugin with MIT License | 5 votes |
private static void addExpressions(@NotNull CompletionResultSet resultSet, @NotNull Collection<PsiNameIdentifierOwner> expressions, @NotNull Language language) { for (PsiNameIdentifierOwner expression : expressions) { if (!(expression instanceof PsiOpen) && !(expression instanceof PsiInclude) && !(expression instanceof PsiAnnotation)) { // TODO: if include => include String name = expression.getName(); if (name != null) { String signature = PsiSignatureUtil.getSignature(expression, language); resultSet.addElement(LookupElementBuilder. create(name). withTypeText(signature). withIcon(PsiIconUtil.getProvidersIcon(expression, 0))); } if (expression instanceof PsiType) { PsiType eType = (PsiType) expression; Collection<PsiVariantDeclaration> variants = eType.getVariants(); if (!variants.isEmpty()) { for (PsiVariantDeclaration variant : variants) { String variantName = variant.getName(); if (variantName != null) { resultSet.addElement(LookupElementBuilder. create(variantName). withTypeText(eType.getName()). withIcon(PsiIconUtil.getProvidersIcon(variant, 0))); } } } } } } }
Example 2
Source File: InlineOptionsDialog.java From consulo with Apache License 2.0 | 5 votes |
protected static int initOccurrencesNumber(PsiNameIdentifierOwner nameIdentifierOwner) { final ProgressManager progressManager = ProgressManager.getInstance(); final PsiSearchHelper searchHelper = PsiSearchHelper.SERVICE.getInstance(nameIdentifierOwner.getProject()); final GlobalSearchScope scope = GlobalSearchScope.projectScope(nameIdentifierOwner.getProject()); final String name = nameIdentifierOwner.getName(); final boolean isCheapToSearch = name != null && searchHelper.isCheapEnoughToSearch(name, scope, null, progressManager.getProgressIndicator()) != PsiSearchHelper.SearchCostResult.TOO_MANY_OCCURRENCES; return isCheapToSearch ? ReferencesSearch.search(nameIdentifierOwner).findAll().size() : - 1; }
Example 3
Source File: RenameChangeInfo.java From consulo with Apache License 2.0 | 5 votes |
public void perform() { final PsiNameIdentifierOwner element = getNamedElement(); if (element != null) { final String name = element.getName(); ApplicationManager.getApplication().runWriteAction(() -> { element.setName(myOldName); }); new RenameProcessor(element.getProject(), element, name, false, false).run(); } }
Example 4
Source File: ORUtil.java From reasonml-idea-plugin with MIT License | 4 votes |
@NotNull public static String getQualifiedName(@NotNull PsiNameIdentifierOwner element) { String name = element.getName(); String qualifiedPath = getQualifiedPath(element); return name == null ? qualifiedPath + ".UNKNOWN" : qualifiedPath + "." + name; }
Example 5
Source File: RenameChangeInfo.java From consulo with Apache License 2.0 | 4 votes |
public RenameChangeInfo(final PsiNameIdentifierOwner namedElement, final ChangeInfo oldInfo) { myOldName = oldInfo instanceof RenameChangeInfo ? ((RenameChangeInfo)oldInfo).getOldName() : namedElement.getName(); myFile = namedElement.getContainingFile(); myOffset = namedElement.getTextOffset(); }
Example 6
Source File: RenameChangeInfo.java From consulo with Apache License 2.0 | 4 votes |
@Override public String getNewName() { final PsiNameIdentifierOwner nameOwner = getNamedElement(); return nameOwner != null ? nameOwner.getName() : null; }