*/
IRunnableWithProgress operation = new IRunnableWithProgress(){
public void run( IProgressMonitor pm ) throws InvocationTargetException, InterruptedException {
IGeoResource geoResource = mainPage.getGeoResource();
String filePath = mainPage.getFilePath();
/*
* finally do some processing
*/
pm.beginTask(Messages.getString("KmlExportWizard.taskExportingMap"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
try {
if (geoResource.canResolve(SimpleFeatureSource.class)) {
SimpleFeatureSource featureStore = (SimpleFeatureSource) geoResource.resolve(SimpleFeatureSource.class,
pm);
KmlUtils.writeKml(new File(filePath), featureStore.getFeatures());
} else {
throw new IOException(Messages.getString("KmlExportWizard.error.ResourceIsNotAFeatureLayer") + geoResource.getTitle()); //$NON-NLS-1$
}
} catch (Exception e) {
e.printStackTrace();
String message = Messages.getString("KmlExportWizard.error.ErrorOccuredWhileExproting") + geoResource.getTitle(); //$NON-NLS-1$
ExceptionDetailsDialog.openError(null, message, IStatus.ERROR, KmlToolPlugin.PLUGIN_ID, e);
}
pm.done();
}