use of org.eclipse.core.runtime.NullProgressMonitor in project tdi-studio-se by Talend.
the class RemoveProjectLibsFolder method execute.
/*
* (non-Javadoc)
*
* @see org.talend.migration.IProjectMigrationTask#execute(org.talend.core.model.general.Project)
*/
@Override
public ExecutionResult execute(Project project) {
String libsFolderName = "libs";
IFolder libsF = null;
try {
IProject fsProject = ResourceUtils.getProject(project.getTechnicalLabel());
libsF = fsProject.getFolder(libsFolderName);
if (!libsF.exists()) {
return ExecutionResult.NOTHING_TO_DO;
}
final IPath location = libsF.getLocation();
libsFolder = new File(location.toPortableString());
ShareProjectLibsMigration migration = new ShareProjectLibsMigration();
migration.shareLibs(null, new NullProgressMonitor());
} catch (PersistenceException e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
try {
libsF.delete(true, new NullProgressMonitor());
} catch (CoreException e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
return ExecutionResult.SUCCESS_NO_ALERT;
}
use of org.eclipse.core.runtime.NullProgressMonitor in project tesb-studio-se by Talend.
the class PublishMetadataRunnable method getTempFile.
private File getTempFile(InputStream inputStream) throws PersistenceException, IOException, CoreException {
Project project = ProjectManager.getInstance().getCurrentProject();
IProject fsProject = null;
fsProject = ResourceUtils.getProject(project);
IPath path = new Path("temp");
String name = File.createTempFile("tESBConsumer", ".wsdl").getName();
path = path.append(name);
IFile file = fsProject.getFile(path);
file.create(inputStream, false, new NullProgressMonitor());
return new File(file.getLocation().toPortableString());
}
use of org.eclipse.core.runtime.NullProgressMonitor in project tdi-studio-se by Talend.
the class BuildJobManager method buildJobs.
public boolean buildJobs(String destinationPath, List<? extends IRepositoryNode> nodes, List<String> topNames, String version, String context, Map<ExportChoice, Object> exportChoiceMap, JobExportType jobExportType, IProgressMonitor monitor) throws Exception {
IProgressMonitor pMonitor = new NullProgressMonitor();
if (monitor != null) {
pMonitor = monitor;
}
final List<ProcessItem> processes = getProcesses(nodes);
if (processes.size() == 1) {
ProcessItem item = processes.get(0);
buildJob(destinationPath, item, version, context, exportChoiceMap, jobExportType, pMonitor);
} else {
int scale = 1000;
int steps = 3;
pMonitor.beginTask(Messages.getString("JobScriptsExportWizardPage.newExportJobScript", jobExportType), //$NON-NLS-1$
steps * scale * nodes.size());
String topName = null;
if (topNames != null && !topNames.isEmpty()) {
topName = topNames.get(0);
} else {
topName = ProjectManager.getInstance().getCurrentProject().getLabel();
}
File desFile = new File(destinationPath);
//$NON-NLS-1$ //$NON-NLS-2$
File createTempFile = File.createTempFile("building_job", "");
createTempFile.delete();
File tempFolder = new File(desFile.getParent() + File.separator + createTempFile.getName());
if (tempFolder.exists()) {
tempFolder.delete();
}
File tempProFolder = new File(tempFolder, topName);
tempProFolder.mkdirs();
for (int i = 0; i < processes.size(); i++) {
ProcessItem processItem = processes.get(i);
//$NON-NLS-1$
pMonitor.setTaskName(Messages.getString("BuildJobManager.building", processItem.getProperty().getLabel()));
IBuildJobHandler buildJobHandler = BuildJobFactory.createBuildJobHandler(processItem, context, processItem.getProperty().getVersion(), exportChoiceMap, jobExportType);
buildJobHandler.generateItemFiles(true, new SubProgressMonitor(pMonitor, scale));
buildJobHandler.generateJobFiles(new SubProgressMonitor(pMonitor, scale));
buildJobHandler.build(new SubProgressMonitor(pMonitor, scale));
IFile jobTargetFile = buildJobHandler.getJobTargetFile();
if (jobTargetFile != null && jobTargetFile.exists()) {
// unzip to temp folder
FilesUtils.unzip(jobTargetFile.getLocation().toPortableString(), tempProFolder.getAbsolutePath());
String zipPath = jobTargetFile.getLocation().toPortableString();
if (needClasspathJar(exportChoiceMap)) {
JavaJobExportReArchieveCreator creator = new JavaJobExportReArchieveCreator(zipPath, processItem.getProperty().getLabel());
creator.setTempFolder(tempFolder.getAbsolutePath());
creator.buildNewJar();
}
}
pMonitor.worked(scale);
}
FilesUtils.zip(tempFolder.getAbsolutePath(), destinationPath);
FilesUtils.deleteFile(tempFolder, true);
pMonitor.done();
}
return true;
}
use of org.eclipse.core.runtime.NullProgressMonitor in project tdi-studio-se by Talend.
the class BigDataEeImportTest method importEeDemo.
@Before
public void importEeDemo() throws Exception {
initDemo(BIG_DATA_EE_DEMO_PLUGIN_ID);
Assert.assertNotNull(currentDemo);
initTestPaths();
initTempPro();
eeResManager = DemoImportTestUtil.getResourceManager(currentDemo);
Assert.assertNotNull(eeResManager);
ImportExportHandlersManager importManager = new ImportExportHandlersManager();
List<ImportItem> projectRecords = importManager.populateImportingItems(eeResManager, true, new NullProgressMonitor());
Assert.assertTrue(projectRecords.size() > 0);
importManager.importItemRecords(new NullProgressMonitor(), eeResManager, projectRecords, true, projectRecords.toArray(new ImportItem[0]), null);
}
use of org.eclipse.core.runtime.NullProgressMonitor in project tdi-studio-se by Talend.
the class BigdataCeImportTest method importCeDemo.
@Before
public void importCeDemo() throws Exception {
initDemo(BIG_DATA_CE_DEMO_PLUGIN_ID);
if (currentDemo == null) {
// maybe license problem, the demo plugin is not loaded.
return;
}
initTestPaths();
initTempPro();
Assert.assertNotNull(currentDemo);
ceResManager = DemoImportTestUtil.getResourceManager(currentDemo);
Assert.assertNotNull(ceResManager);
ImportExportHandlersManager importManager = new ImportExportHandlersManager();
List<ImportItem> projectRecords = importManager.populateImportingItems(ceResManager, true, new NullProgressMonitor());
Assert.assertTrue(projectRecords.size() > 0);
importManager.importItemRecords(new NullProgressMonitor(), ceResManager, projectRecords, true, projectRecords.toArray(new ImportItem[0]), null);
}
Aggregations