Search in sources :

Example 1 with CorpusImportDocumentMetadata

use of de.catma.ui.module.project.corpusimport.CorpusImportDocumentMetadata in project catma by forTEXT.

the class ProjectView method handleCorpusImport.

private void handleCorpusImport() {
    try {
        if (project.hasUncommittedChanges()) {
            SingleTextInputDialog dlg = new SingleTextInputDialog("Commit all changes", "You have changes, that need to be committed first, please enter a short description for this commit:", commitMsg -> {
                try {
                    project.commitChanges(commitMsg);
                    importCollection();
                } catch (Exception e) {
                    setEnabled(true);
                    ((ErrorHandler) UI.getCurrent()).showAndLogError("error committing changes", e);
                }
            });
            dlg.show();
        } else {
            CorpusImportDialog corpusImportDialog = new CorpusImportDialog(new SaveCancelListener<Pair<File, List<CorpusImportDocumentMetadata>>>() {

                @Override
                public void savePressed(Pair<File, List<CorpusImportDocumentMetadata>> result) {
                    importCorpus(result.getFirst(), result.getSecond());
                }
            });
            corpusImportDialog.show();
        }
    } catch (Exception e) {
        errorHandler.showAndLogError("Error accessing Project!", e);
    }
}
Also used : CorpusImportDocumentMetadata(de.catma.ui.module.project.corpusimport.CorpusImportDocumentMetadata) CorpusImportDialog(de.catma.ui.module.project.corpusimport.CorpusImportDialog) ArrayList(java.util.ArrayList) List(java.util.List) SingleTextInputDialog(de.catma.ui.dialog.SingleTextInputDialog) File(java.io.File) UploadFile(de.catma.ui.module.project.documentwizard.UploadFile) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) Pair(de.catma.util.Pair)

Aggregations

SingleTextInputDialog (de.catma.ui.dialog.SingleTextInputDialog)1 CorpusImportDialog (de.catma.ui.module.project.corpusimport.CorpusImportDialog)1 CorpusImportDocumentMetadata (de.catma.ui.module.project.corpusimport.CorpusImportDocumentMetadata)1 UploadFile (de.catma.ui.module.project.documentwizard.UploadFile)1 Pair (de.catma.util.Pair)1 File (java.io.File)1 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1