private static String getMDMDemoPluginId() { if (!PluginChecker.isPluginLoaded("org.talend.mdm.workbench.enterprise")) { // CE //$NON-NLS-1$ return "org.talend.mdm.repository"; //$NON-NLS-1$ } else { // EE return "org.talend.mdm.repository.enterprise"; //$NON-NLS-1$ } }
/** * Gets all demo projects information. * * @return a list of <code>DemoProjectBean</code> */ public static List<DemoProjectBean> getAllDemoProjects() { SAXReader reader = new SAXReader(); Document doc = null; List<DemoProjectBean> demoProjectList = new ArrayList<DemoProjectBean>(); DemoProjectBean demoProject = null; List<File> xmlFilePath = getXMLFilePath(); for (int t = 0; t < xmlFilePath.size(); t++) { try { doc = reader.read(xmlFilePath.get(t)); } catch (DocumentException e) { ExceptionHandler.process(e); return null; } Element demoProjectsInfo = doc.getRootElement(); IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class); String[] availableLanguages = brandingService.getBrandingConfiguration().getAvailableLanguages(); for (Iterator<DemoProjectBean> i = demoProjectsInfo.elementIterator("project"); i.hasNext(); ) { // $NON-NLS-1$ Element demoProjectElement = (Element) i.next(); demoProject = new DemoProjectBean(); demoProject.setProjectName(demoProjectElement.attributeValue("name")); // $NON-NLS-1$ String language = demoProjectElement.attributeValue("language"); // $NON-NLS-1$ if (!ArrayUtils.contains(availableLanguages, language)) { // if the language is not available in current branding, don't display this demo project continue; } demoProject.setLanguage(ECodeLanguage.getCodeLanguage(language)); String demoProjectFileType = demoProjectElement.attributeValue("demoProjectFileType"); // $NON-NLS-1$ demoProject.setDemoProjectFileType( EDemoProjectFileType.getDemoProjectFileTypeName(demoProjectFileType)); demoProject.setDemoProjectFilePath( demoProjectElement.attributeValue("demoFilePath")); // $NON-NLS-1$ demoProject.setDescriptionFilePath( demoProjectElement.attributeValue("descriptionFilePath")); // $NON-NLS-1$ // get the demo plugin Id demoProject.setPluginId(demoProjectElement.attributeValue("pluginId")); // $NON-NLS-1$ if (demoProject.getProjectName().equals("ESBDEMOS")) { if (!PluginChecker.isPluginLoaded("org.talend.repository.services")) { continue; } } demoProjectList.add(demoProject); } } return demoProjectList; }