private void createBSGroup(Group optionsGroup) { if (!PluginChecker.isPluginLoaded(PluginChecker.EXPORT_ROUTE_PLUGIN_ID)) { return; } Font font = optionsGroup.getFont(); optionsGroup.setLayout(new GridLayout(2, false)); addBSButton = new Button(optionsGroup, SWT.CHECK | SWT.LEFT); addBSButton.setText("Add maven script"); // $NON-NLS-1$ addBSButton.setFont(font); addBSButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean show = addBSButton.getSelection(); String destinationValue = getDestinationValue(); if (destinationValue.endsWith(getOutputSuffix())) { if (show) { destinationValue = destinationValue.substring(0, destinationValue.indexOf(getOutputSuffix())) + OUTPUT_FILE_SUFFIX; } } else if (destinationValue.endsWith(OUTPUT_FILE_SUFFIX)) { if (!show) { destinationValue = destinationValue.substring(0, destinationValue.indexOf(OUTPUT_FILE_SUFFIX)) + getOutputSuffix(); } } setDestinationValue(destinationValue); } }); }
private void addDQDependencies(IFolder parentFolder, List<Item> items) throws IOException { if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQItemService.class)) { ITDQItemService tdqItemService = (ITDQItemService) GlobalServiceRegister.getDefault().getService(ITDQItemService.class); for (Item item : items) { if (tdqItemService != null && tdqItemService.hasProcessItemDependencies(Arrays.asList(new Item[] {item}))) { // add .Talend.definition file String defIdxFolderName = "TDQ_Libraries"; // $NON-NLS-1$ String defIdxFileName = ".Talend.definition"; // $NON-NLS-1$ Project pro = getProject(processItem); IFolder itemsProjectFolder = parentFolder.getFolder(pro.getTechnicalLabel().toLowerCase()); File itemsFolderDir = new File(parentFolder.getLocation().toFile().getAbsolutePath()); IProject project = ReponsitoryContextBridge.getRootProject(); String defIdxRelativePath = defIdxFolderName + PATH_SEPARATOR + defIdxFileName; IFile defIdxFile = project.getFile(defIdxRelativePath); if (defIdxFile.exists()) { File defIdxFileSource = new File( project .getLocation() .makeAbsolute() .append(defIdxFolderName) .append(defIdxFileName) .toFile() .toURI()); File defIdxFileTarget = new File( itemsProjectFolder .getFile(defIdxRelativePath) .getLocation() .toFile() .getAbsolutePath()); FilesUtils.copyFile(defIdxFileSource, defIdxFileTarget); } // add report header image & template files String reportingBundlePath = PluginChecker.getBundlePath("org.talend.dataquality.reporting"); // $NON-NLS-1$ File imageFolder = new File(reportingBundlePath + PATH_SEPARATOR + "images"); // $NON-NLS-1$ if (imageFolder.exists()) { FilesUtils.copyDirectory(imageFolder, itemsFolderDir); } File templateFolder = new File(reportingBundlePath + PATH_SEPARATOR + "reports"); // $NON-NLS-1$ if (templateFolder.exists() && templateFolder.isDirectory()) { FilesUtils.copyDirectory(templateFolder, itemsFolderDir); } } } } }