use of com.aspose.barcode.maven.utils.TasksExecutor in project Aspose.BarCode-for-Java by aspose-barcode.
the class AsposeMavenProjectWizardIterator method instantiate.
/**
* @param ph
* @return
* @throws IOException
*/
@Override
public Set instantiate(ProgressHandle ph) throws IOException {
ph.start();
ph.switchToIndeterminate();
ph.progress("Processing...");
final AsposeMavenProjectManager asposeMavenProjectManager = AsposeMavenProjectManager.initialize(wiz);
final AsposeJavaAPI asposeBarCodeJavaAPI = AsposeBarCodeJavaAPI.initialize(asposeMavenProjectManager);
boolean isDownloadExamplesSelected = (boolean) wiz.getProperty("downloadExamples");
// Downloading Aspose.BarCode Java (mvn based) examples...
if (isDownloadExamplesSelected) {
TasksExecutor tasksExecutionDownloadExamples = new TasksExecutor(NbBundle.getMessage(AsposeMavenProjectWizardIterator.class, "AsposeManager.progressExamplesTitle"));
// Downloading Aspose API mvn based examples
tasksExecutionDownloadExamples.addNewTask(asposeMavenProjectManager.createDownloadExamplesTask(asposeBarCodeJavaAPI));
// Execute the tasks
tasksExecutionDownloadExamples.processTasks();
}
TasksExecutor tasksExecutionRetrieve = new TasksExecutor(NbBundle.getMessage(AsposeMavenProjectWizardIterator.class, "AsposeManager.progressTitle"));
// Retrieving Aspose.BarCode Java Maven artifact...
tasksExecutionRetrieve.addNewTask(asposeMavenProjectManager.retrieveAsposeAPIMavenTask(asposeBarCodeJavaAPI));
// Execute the tasks
tasksExecutionRetrieve.processTasks();
// Creating Maven project
ph.progress(NbBundle.getMessage(AsposeMavenProjectWizardIterator.class, "AsposeManager.projectMessage"));
Set<FileObject> resultSet = new LinkedHashSet<>();
File projectDir = FileUtil.normalizeFile((File) wiz.getProperty("projdir"));
projectDir.mkdirs();
FileObject template = Templates.getTemplate(wiz);
FileObject projectRoot = FileUtil.toFileObject(projectDir);
createAsposeMavenProject(template.getInputStream(), projectRoot);
createStartupPackage(projectRoot);
resultSet.add(projectRoot);
// Look for nested projects to open as well:
Enumeration<? extends FileObject> e = projectRoot.getFolders(true);
while (e.hasMoreElements()) {
FileObject subfolder = e.nextElement();
if (ProjectManager.getDefault().isProject(subfolder)) {
resultSet.add(subfolder);
}
}
File parent = projectDir.getParentFile();
if (parent != null && parent.exists()) {
ProjectChooser.setProjectsFolder(parent);
}
ph.finish();
return resultSet;
}
Aggregations