use of org.talend.dataprofiler.core.ui.imex.model.IImportWriter in project tdq-studio-se by Talend.
the class ImportWizard method performFinish.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
@Override
public boolean performFinish() {
// TDQ-10715: only close the DQ editors before import items except the sql editor and text editor.
// TDQ-13856: when click cancel, do NOT close any editors.
IWorkbenchPage activePage = CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart[] editors = activePage.getEditors();
for (IEditorPart editor : editors) {
if (editor instanceof CommonFormEditor) {
boolean isSaved = activePage.closeEditor(editor, true);
if (!isSaved) {
// $NON-NLS-1$
MessageUI.openWarning(DefaultMessagesImpl.getString("ImportItemAction.closeEditors"));
return true;
}
}
}
// ADD xqliu TDQ-4284 2011-12-26
if (ProxyRepositoryFactory.getInstance().isUserReadOnlyOnCurrentProject()) {
return true;
}
// ~ TDQ-4284
final ItemRecord[] records = importPage.getElements();
final IImportWriter writer = importPage.getWriter();
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
// $NON-NLS-1$
monitor.beginTask("Import Item", records.length);
writer.write(records, monitor);
monitor.done();
}
};
try {
ProgressUI.popProgressDialog(op);
} catch (Exception e) {
log.error(e, e);
}
CorePlugin.getDefault().refreshWorkSpace();
CorePlugin.getDefault().refreshDQView();
return true;
}
use of org.talend.dataprofiler.core.ui.imex.model.IImportWriter in project tdq-studio-se by Talend.
the class ImportWizard method performCancel.
@Override
public boolean performCancel() {
final ItemRecord[] records = importPage.getElements();
if (records.length > 0) {
final IImportWriter writer = importPage.getWriter();
try {
writer.finish(records, null);
writer.postFinish();
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
return super.performCancel();
}
Aggregations