final DataFactory theSelectedDataFactory = getSelectedDataSource();
// Delete data-source from structure panel
reportDesignerContext.getActiveContext().getSelectionModel().setSelectedElements(new Object[]{theSelectedDataFactory});
final DeleteAction deleteAction = new DeleteAction();
deleteAction.setReportDesignerContext(reportDesignerContext);
deleteAction.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, ""));
// Delete data-source from the Select data-source dialog
availableDataSourcesModel.remove(theSelectedDataFactory);
}
}