public static Library getOrCreateAutoLibrary( AbstractModule usedModule, Project project, LibrariesContainer container) { Library library = getAutoLibrary(usedModule.getModuleReference(), project); if (library != null) { return library; } Set<VirtualFile> stubFiles = ModuleLibraryType.getModuleJars(usedModule); IFile descriptorFile = usedModule.getDescriptorFile(); VirtualFile descriptorVirtualFile = null; if (descriptorFile != null) { descriptorVirtualFile = VirtualFileUtils.getOrCreateVirtualFile(descriptorFile); } return createAutoLibrary( usedModule.getModuleName(), stubFiles, descriptorVirtualFile, container); }
private VirtualFile[] getSelectedFiles() { List<VirtualFile> selectedFilesList = new LinkedList<VirtualFile>(); // add selected model files List<SModelDescriptor> descriptors = getSelectedModels(); if (descriptors != null) { for (SModelDescriptor descriptor : descriptors) { selectedFilesList.addAll(ModelUtil.getVFilesByModelDescriptor(descriptor)); } } // add selected modules files List<SModule> modules = getSelectedModules(); if (modules != null) { for (SModule m : modules) { if (!(m instanceof AbstractModule)) continue; AbstractModule module = (AbstractModule) m; IFile home = module.getBundleHome(); if (home != null) { VirtualFile vfile = VirtualFileUtils.getVirtualFile(home); if (vfile != null) { selectedFilesList.add(vfile); } } IFile ifile = module.getDescriptorFile(); if (ifile != null) { VirtualFile vfile = VirtualFileUtils.getVirtualFile(ifile); if (vfile != null) { selectedFilesList.add(vfile); } } } } if (selectedFilesList.size() == 0) { return null; } return selectedFilesList.toArray(new VirtualFile[selectedFilesList.size()]); }