-
-
- Path csvFile = model.getSource();
- char delim = model.getDelimiter();
-
- List<CSVRecord> rows = DistrictImportUtils.readRows(csvFile, delim, -1);
-
- Path wktFile = model.getWKTFile();
-
- try {
-
-
- CoordinateReferenceSystem crs = CRS.decode(null);
- } catch (FactoryException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
-
- DistrictImportUtils.importCSVAsLayer(csvFile);
- } catch (IOException e) {
- e.printStackTrace();
+ getContainer().run(true, true, new IRunnableWithProgress() {
+
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ monitor.beginTask("Importing CSV", 1);
+
+ if (model.isVertexImport()) {
+ DistrictImportUtils.importVertices(model);
+ } else {
+ DistrictImportUtils.importEdges(model);
+ }
+
+ } catch (Exception e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ });
+ return true;
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getTargetException();
+ WizardPage cp = (WizardPage) getContainer().getCurrentPage();
+ cp.setErrorMessage(t.getMessage());
+ ExceptionUtils.logAndShowError(t);
+ return false;
+ } catch (InterruptedException e) {
+ ExceptionUtils.logAndShowError(e);
+ return false;