if (dataSourcePlugin.canHandle(dataFactory) == false)
{
return;
}
final DefaultDataFactoryChangeRecorder recorder = new DefaultDataFactoryChangeRecorder();
final DataFactory editedDataFactory = dataSourcePlugin.performEdit
(new ReportDesignerDesignTimeContext(getReportDesignerContext()), dataFactory, null, recorder);
if (editedDataFactory == null)
{
return;
}
final ReportDocumentContext activeContext = getActiveContext();
final AbstractReportDefinition report = activeContext.getReportDefinition();
final CompoundDataFactory collection = (CompoundDataFactory) report.getDataFactory();
final int j = collection.indexOfByReference(dataFactory);
if (j == -1)
{
throw new IllegalStateException("Edited data-source does not exist in the report anymore.");
}
DefaultDataFactoryChangeRecorder.applyChanges(collection, recorder.getChanges());
final DataFactory editedClone = editedDataFactory.derive();
collection.set(j, editedDataFactory);
activeContext.getUndo().addChange
(ActionMessages.getString("EditDataSourceAction.UndoName"), new DataSourceEditUndoEntry(j, storedFactory, editedClone));