Search in sources :

Example 1 with IExportWriter

use of org.talend.dataprofiler.core.ui.imex.model.IExportWriter in project tdq-studio-se by Talend.

the class ExportForExchangeWizard method performFinish.

@Override
public boolean performFinish() {
    // alwayse use ZipFileExportWriter instead of the writer from the page
    final IExportWriter writer = ExportWriterFactory.create(EImexType.ZIP_FILE);
    final IPath writerBashPath = exportPage.getWriter().getBasePath();
    final Map<String, ItemRecord[]> recordsList = buildItemRecordList(exportPage.getElements());
    IRunnableWithProgress op = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            // $NON-NLS-1$
            monitor.beginTask("Export Item", recordsList.size());
            for (String zipFileName : recordsList.keySet()) {
                writer.setBasePath(writerBashPath.append(zipFileName));
                writer.write(recordsList.get(zipFileName), monitor);
            }
            monitor.done();
        }
    };
    try {
        ProgressUI.popProgressDialog(op);
    } catch (Exception e) {
        log.error(e, e);
    }
    return true;
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IPath(org.eclipse.core.runtime.IPath) IExportWriter(org.talend.dataprofiler.core.ui.imex.model.IExportWriter) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 2 with IExportWriter

use of org.talend.dataprofiler.core.ui.imex.model.IExportWriter in project tdq-studio-se by Talend.

the class ExportWizard method performFinish.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.wizard.Wizard#performFinish()
     */
@Override
public boolean performFinish() {
    if (!exportPage.canFinish()) {
        return false;
    }
    final IExportWriter writer = exportPage.getWriter();
    final ItemRecord[] records = exportPage.getElements();
    IRunnableWithProgress op = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            // $NON-NLS-1$
            monitor.beginTask("Export Item", records.length);
            writer.write(records, monitor);
            monitor.done();
        }
    };
    try {
        ProgressUI.popProgressDialog(op);
    } catch (Exception e) {
        log.error(e, e);
    }
    return true;
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IExportWriter(org.talend.dataprofiler.core.ui.imex.model.IExportWriter) ItemRecord(org.talend.dataprofiler.core.ui.imex.model.ItemRecord) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)2 IExportWriter (org.talend.dataprofiler.core.ui.imex.model.IExportWriter)2 IPath (org.eclipse.core.runtime.IPath)1 ItemRecord (org.talend.dataprofiler.core.ui.imex.model.ItemRecord)1