use of com.perl5.lang.perl.psi.mixins.PerlNamespaceDefinitionMixin in project Perl5-IDEA by Camelcade.
the class PerlElementFactory method createPackageName.
// fixme probably we don't need package name and sub. just identifier
public static PerlNamespaceElementImpl createPackageName(Project project, String name) {
PerlFileImpl file = createFile(project, "package " + name + ";");
PerlNamespaceDefinitionMixin def = PsiTreeUtil.findChildOfType(file, PerlNamespaceDefinitionMixin.class);
assert def != null;
return (PerlNamespaceElementImpl) def.getNamespaceElement();
}
use of com.perl5.lang.perl.psi.mixins.PerlNamespaceDefinitionMixin in project Perl5-IDEA by Camelcade.
the class NamespaceTestCase method getNamespaceInFile.
protected PerlNamespaceDefinitionMixin getNamespaceInFile(@NotNull String fileName, @NotNull String namespaceName) {
myFixture.configureByFile(fileName);
PsiFile file = myFixture.getFile();
PerlNamespaceDefinitionMixin namespaceDefinition = null;
for (PerlNamespaceDefinitionMixin element : PsiTreeUtil.findChildrenOfType(file, PerlNamespaceDefinitionMixin.class)) {
if (StringUtil.equals(element.getName(), namespaceName)) {
namespaceDefinition = element;
break;
}
}
assertNotNull(namespaceDefinition);
namespaceDefinition.subtreeChanged();
return namespaceDefinition;
}
use of com.perl5.lang.perl.psi.mixins.PerlNamespaceDefinitionMixin in project Perl5-IDEA by Camelcade.
the class NamespaceParentsDetectionTest method doTest.
public void doTest(String fileName, @NotNull String namespaceName, String[] parentsList) {
PerlNamespaceDefinitionMixin namespaceDefinition = getNamespaceInFile(fileName, namespaceName);
List<String> parents = namespaceDefinition.getParentNamespacesNamesFromPsi();
assertEquals(new ArrayList<>(Arrays.asList(parentsList)), parents);
}
Aggregations