use of com.perl5.lang.perl.psi.PerlNamespaceDefinitionElement in project Perl5-IDEA by Camelcade.
the class PerlUtil method processImportedEntities.
/**
* Processing use statements in the namespace or file and processing all imports found
*
* @param namespace Root element to start searching from
*/
public static void processImportedEntities(@NotNull PerlNamespaceDefinitionElement namespace, @NotNull PerlNamespaceEntityProcessor<PerlExportDescriptor> processor) {
for (PsiElement element : PerlPsiUtil.collectUseStatements(namespace)) {
PerlUseStatement useStatement = (PerlUseStatement) element;
String packageName = useStatement.getPackageName();
if (packageName != null) {
for (PerlExportDescriptor entry : useStatement.getPackageProcessor().getImports(useStatement)) {
ProgressManager.checkCanceled();
processor.process(packageName, entry);
}
}
}
PerlImportsProvider.processProviders(namespace, provider -> {
for (PerlExportDescriptor descriptor : provider.getImports()) {
if (!processor.process(namespace.getPackageName(), descriptor)) {
return false;
}
}
return true;
});
}
use of com.perl5.lang.perl.psi.PerlNamespaceDefinitionElement in project Perl5-IDEA by Camelcade.
the class PerlArrayUtil method getImportedArraysDescriptors.
/**
* Returns a map of imported arrays names
*
* @param namespaceDefinitionElement element to start looking from
* @return result map
*/
@NotNull
public static List<PerlExportDescriptor> getImportedArraysDescriptors(@NotNull PerlNamespaceDefinitionElement namespaceDefinitionElement) {
PerlImportsCollector collector = new PerlArrayImportsCollector();
PerlUtil.processImportedEntities(namespaceDefinitionElement, collector);
return collector.getResult();
}
use of com.perl5.lang.perl.psi.PerlNamespaceDefinitionElement in project Perl5-IDEA by Camelcade.
the class PerlHashUtil method getImportedHashesDescriptors.
/**
* Returns a map of imported hashes names
*
* @param namespaceDefinitionElement element to start looking from
* @return result map
*/
@NotNull
public static List<PerlExportDescriptor> getImportedHashesDescriptors(@NotNull PerlNamespaceDefinitionElement namespaceDefinitionElement) {
PerlImportsCollector collector = new PerlHashImportsCollector();
PerlUtil.processImportedEntities(namespaceDefinitionElement, collector);
return collector.getResult();
}
Aggregations