private void addVariableDeclarationReferencesFromImportedFiles(XQueryFile file) {
   if (variableHasNamespacePrefix()) {
     for (XQueryFile importedFile : getFilesFromImportWithMatchingNamespacePrefix(file)) {
       addVariableDeclarationReferencesFromFile(
           importedFile, importedFile.getModuleNamespaceName().getText());
     }
   }
 }
  @Test
  public void shouldPopulatePathListWithChosenFile() {
    setUpPanelWithUserLibrary(ENABLED);
    XQueryFile file = createFile();
    panel.onFileChosen(file.getVirtualFile());

    String[] contents = window.list(PATH_LIST_NAME).contents();
    assertThat(contents.length, is(1));
    assertThat(contents[0], is(file.getVirtualFile().getPresentableUrl()));
  }
 public static List<LookupElement> getLookupItems(XQueryFile file) {
   List<LookupElement> lookupItems = new ArrayList<LookupElement>();
   Map<String, String> functionPrefixToNamespaceMap = file.getFunctionPrefixToNamespaceMap();
   Set<String> availableNamespaces = new HashSet<String>(functionPrefixToNamespaceMap.values());
   for (String namespace : availableNamespaces) {
     if (file.isPredeclaredNamespace(namespace)) {
       lookupItems.addAll(
           getLookupItemsForNamespace(
               getFunctionsSignatures(file, namespace),
               getMatchingPrefixes(namespace, functionPrefixToNamespaceMap)));
     }
   }
   return lookupItems;
 }
 private Collection<XQueryFile> getFilesFromImportWithMatchingNamespacePrefix(XQueryFile file) {
   return file.getImportedFilesThatExist(
       new Condition<XQueryModuleImport>() {
         @Override
         public boolean value(XQueryModuleImport moduleImport) {
           String namespacePrefix = myElement.getVarName().getVarNamespace().getText();
           return namespacePrefix.equals(moduleImport.getNamespaceName().getText());
         }
       });
 }
 private static Collection<BuiltInFunctionSignature> getFunctionsSignatures(
     XQueryFile file, String namespace) {
   return file.getBuiltInFunctionTable().getFunctionsSignatures(namespace);
 }
 private void addVariableDeclarationReferencesFromFile(XQueryFile file, String checkedNamespace) {
   for (XQueryVarDecl varDecl : file.getVariableDeclarations()) {
     addVariableAsTargetIfMatches(varDecl, checkedNamespace);
   }
 }