import org.simantics.db.WriteGraph;
import org.simantics.db.common.request.WriteRequest;
import org.simantics.db.exception.DatabaseException;
+import org.simantics.document.AddDocumentAction;
+import org.simantics.document.FileDocumentUtil;
import org.simantics.document.ui.dialogs.FileDetailDialog;
-import org.simantics.document.ui.graphfile.FileDocumentUtil;
import org.simantics.layer0.Layer0;
-import org.simantics.utils.datastructures.Callback;
import org.simantics.utils.ui.ExceptionUtils;
/**
Resource newDoc = doDocumentImport(graph, resource, filename, name);
dialog.getAnnotationConfigurator().apply(graph,newDoc);
}
- },new Callback<DatabaseException>() {
- @Override
- public void run(DatabaseException parameter) {
- dialog.getAnnotationConfigurator().dispose();
- if (parameter != null) {
- ExceptionUtils.logAndShowError("Cannot import document.", parameter);
- }
-
- }
+ }, e -> {
+ dialog.getAnnotationConfigurator().dispose();
+ if (e != null)
+ ExceptionUtils.logAndShowError(Messages.ImportDocumentWithDetail_CannotImportDocument, e);
});
}
};
public static Resource importDocumentWithDetailSCL(WriteGraph graph, Resource target, String filename) throws FileNotFoundException, DatabaseException {
File file = new File(filename);
if (!file.exists())
- throw new FileNotFoundException("File not found - " + file.getAbsolutePath());
- ImportDocumentWithDetail document = new ImportDocumentWithDetail(graph, "http://www.simantics.org/Layer0-1.1/ConsistsOf");
+ throw new FileNotFoundException("File not found - " + file.getAbsolutePath()); //$NON-NLS-1$
+ ImportDocumentWithDetail document = new ImportDocumentWithDetail(graph, "http://www.simantics.org/Layer0-1.1/ConsistsOf"); //$NON-NLS-1$
return document.doDocumentImport(graph, target, filename, file.getName());
}