use of com.intellij.refactoring.safeDelete.NonCodeUsageSearchInfo in project intellij-community by JetBrains.
the class PropertiesFilesSafeDeleteProcessor method findUsages.
@Override
public NonCodeUsageSearchInfo findUsages(@NotNull final PsiElement element, @NotNull final PsiElement[] allElementsToDelete, @NotNull final List<UsageInfo> result) {
PropertiesFile file = (PropertiesFile) element;
List<PsiElement> elements = new ArrayList<>();
elements.add(file.getContainingFile());
for (IProperty property : file.getProperties()) {
elements.add(property.getPsiElement());
}
for (PsiElement psiElement : elements) {
SafeDeleteProcessor.findGenericElementUsages(psiElement, result, allElementsToDelete);
}
return new NonCodeUsageSearchInfo(SafeDeleteProcessor.getDefaultInsideDeletedCondition(allElementsToDelete), elements);
}
use of com.intellij.refactoring.safeDelete.NonCodeUsageSearchInfo in project android by JetBrains.
the class AndroidComponentSafeDeleteProcessor method findUsages.
@Override
public NonCodeUsageSearchInfo findUsages(@NotNull PsiElement element, @NotNull PsiElement[] allElementsToDelete, @NotNull List<UsageInfo> result) {
final ArrayList<UsageInfo> usages = new ArrayList<UsageInfo>();
final NonCodeUsageSearchInfo info = getBaseHandler().findUsages(element, allElementsToDelete, usages);
if (info == null) {
return info;
}
assert element instanceof PsiClass;
final PsiClass componentClass = (PsiClass) element;
final AndroidAttributeValue<PsiClass> declaration = AndroidDomUtil.findComponentDeclarationInManifest(componentClass);
if (declaration == null) {
return info;
}
final XmlAttributeValue declarationAttributeValue = declaration.getXmlAttributeValue();
for (UsageInfo usage : usages) {
if (declarationAttributeValue != usage.getElement()) {
result.add(usage);
}
}
return info;
}
use of com.intellij.refactoring.safeDelete.NonCodeUsageSearchInfo in project intellij by bazelbuild.
the class BuildFileSafeDeleteProcessor method findUsages.
/**
* Delegates to JavaSafeDeleteProcessor, then removes indirect glob references which we don't want
* to block safe delete.
*/
@Nullable
@Override
public NonCodeUsageSearchInfo findUsages(@NotNull PsiElement element, @NotNull PsiElement[] allElementsToDelete, @NotNull List<UsageInfo> result) {
NonCodeUsageSearchInfo superResult = super.findUsages(element, allElementsToDelete, result);
result.removeIf(BuildFileSafeDeleteProcessor::ignoreUsage);
return superResult;
}
Aggregations