use of org.apache.cayenne.modeler.dialog.codegen.CodeGeneratorController in project cayenne by apache.
the class GenerateCodeAction method performAction.
public void performAction(ActionEvent e) {
Collection<DataMap> dataMaps;
DataMap dataMap = getProjectController().getCurrentDataMap();
if (dataMap != null) {
dataMaps = new ArrayList<>();
dataMaps.add(dataMap);
new CodeGeneratorController(getApplication().getFrameController(), dataMaps).startup();
} else if (getProjectController().getCurrentDataNode() != null) {
Collection<String> nodeMaps = getProjectController().getCurrentDataNode().getDataMapNames();
Project project = getProjectController().getProject();
dataMaps = ((DataChannelDescriptor) project.getRootNode()).getDataMaps();
Collection<DataMap> resultMaps = new ArrayList<>();
for (DataMap map : dataMaps) {
if (nodeMaps.contains(map.getName())) {
resultMaps.add(map);
}
}
new CodeGeneratorController(getApplication().getFrameController(), resultMaps).startup();
} else {
Project project = getProjectController().getProject();
dataMaps = ((DataChannelDescriptor) project.getRootNode()).getDataMaps();
new CodeGeneratorController(getApplication().getFrameController(), dataMaps).startup();
}
}
Aggregations