use of org.apache.cayenne.modeler.undo.LinkDataMapsUndoableEdit in project cayenne by apache.
the class LinkDataMapsAction method performAction.
@Override
public void performAction(ActionEvent e) {
ProjectController mediator = getProjectController();
DataChannelDescriptor dataChannelDescriptor = (DataChannelDescriptor) mediator.getProject().getRootNode();
Collection<String> linkedDataMaps = new ArrayList<>();
DataNodeDescriptor dataNodeDescriptor = mediator.getCurrentDataNode();
for (DataNodeDescriptor dataNodeDesc : dataChannelDescriptor.getNodeDescriptors()) {
linkedDataMaps.addAll(dataNodeDesc.getDataMapNames());
}
for (DataMap dataMap : dataChannelDescriptor.getDataMaps()) {
if (!linkedDataMaps.contains(dataMap.getName())) {
dataNodeDescriptor.getDataMapNames().add(dataMap.getName());
mediator.fireDataNodeEvent(new DataNodeEvent(this, dataNodeDescriptor));
}
}
application.getUndoManager().addEdit(new LinkDataMapsUndoableEdit(dataNodeDescriptor, linkedDataMaps, mediator));
}
Aggregations