public static void updateModuleList(Node node) { List<ModuleNeeded> moduleNeededList = ModulesNeededProvider.getModulesNeeded(); Set<String> moduleNameList = new TreeSet<String>(); Set<String> moduleValueList = new TreeSet<String>(); for (ModuleNeeded module : moduleNeededList) { String moduleName = module.getModuleName(); moduleNameList.add(moduleName); moduleValueList.add(TalendTextUtils.addQuotes(moduleName)); } Comparator<String> comprarator = new IgnoreCaseComparator(); String[] moduleNameArray = moduleNameList.toArray(new String[0]); String[] moduleValueArray = moduleValueList.toArray(new String[0]); Arrays.sort(moduleNameArray, comprarator); Arrays.sort(moduleValueArray, comprarator); for (int i = 0; i < node.getElementParameters().size(); i++) { IElementParameter param = node.getElementParameters().get(i); if (param.getFieldType() == EParameterFieldType.MODULE_LIST) { param.setListItemsDisplayName(moduleNameArray); param.setListItemsValue(moduleValueArray); } else if (param.getFieldType() == EParameterFieldType.TABLE) { Object[] listItemsValue = param.getListItemsValue(); if (listItemsValue != null) { for (Object o : listItemsValue) { if (o instanceof IElementParameter && ((IElementParameter) o).getFieldType() == EParameterFieldType.MODULE_LIST) { ((IElementParameter) o).setListItemsDisplayName(moduleNameArray); ((IElementParameter) o).setListItemsValue(moduleValueArray); } } } } } }
public void openDialog() { List<ModuleNeeded> updatedModules = new ArrayList<ModuleNeeded>(); for (ModuleNeeded neededModule : ModulesNeededProvider.getModulesNeeded()) { if (neededModule.getStatus() != ELibraryInstallStatus.NOT_INSTALLED) { continue; } updatedModules.add(neededModule); } inputList.clear(); RemoteModulesHelper.getInstance().getNotInstalledModules(updatedModules, inputList, this, true); }
@Override public Map<ModuleNeeded, File> getFilesToShare(IProgressMonitor monitor) { Map<ModuleNeeded, File> files = new HashMap<ModuleNeeded, File>(); SubMonitor mainSubMonitor = SubMonitor.convert(monitor, 1); mainSubMonitor.setTaskName(Messages.getString("ShareLibsJob.getFilesToShare")); // $NON-NLS-1$ final List<ModuleNeeded> modulesNeeded = new ArrayList<ModuleNeeded>(ModulesNeededProvider.getModulesNeeded()); ILibraryManagerService librariesService = (ILibraryManagerService) GlobalServiceRegister.getDefault().getService(ILibraryManagerService.class); Set<String> filePaths = new HashSet<String>(); for (ModuleNeeded module : modulesNeeded) { if (monitor.isCanceled()) { return null; } // only deploy libraries with group id org.talend.libraries MavenArtifact parseMvnUrl = MavenUrlHelper.parseMvnUrl(module.getMavenUri()); if (parseMvnUrl == null || !MavenConstants.DEFAULT_LIB_GROUP_ID.equals(parseMvnUrl.getGroupId())) { continue; } final String jarPathFromMaven = librariesService.getJarPathFromMaven(module.getMavenUriSnapshot()); if (jarPathFromMaven == null) { continue; } File jarFile = new File(jarPathFromMaven); if (jarFile.exists()) { if (!filePaths.contains(jarPathFromMaven)) { files.put(module, jarFile); } filePaths.add(jarPathFromMaven); } } mainSubMonitor.worked(1); return files; }