use of org.hibernate.eclipse.jdt.ui.internal.jpa.collect.CompilationUnitCollector in project jbosstools-hibernate by jbosstools.
the class HibernateJPAWizardDataFactory method createHibernateJPAWizardData.
public static IHibernateJPAWizardData createHibernateJPAWizardData(final IStructuredSelection selection2Update, IHibernateJPAWizardParams params, int depth) {
CompilationUnitCollector compileUnitCollector = new CompilationUnitCollector();
@SuppressWarnings("rawtypes") Iterator itSelection2Update = selection2Update.iterator();
while (itSelection2Update.hasNext()) {
Object obj = itSelection2Update.next();
compileUnitCollector.processJavaElements(obj, true);
}
Iterator<ICompilationUnit> it = compileUnitCollector.setSelectionCUIterator();
AllEntitiesInfoCollector collector = new AllEntitiesInfoCollector();
collector.initCollector();
while (it.hasNext()) {
ICompilationUnit cu = it.next();
collector.collect(cu, depth);
}
collector.resolveRelations();
final Map<String, EntityInfo> entities = collector.getMapCUs_Info();
params.performDisconnect();
params.reCollectModification(entities);
final ArrayList<ChangeStructure> changes = params.getChanges();
IHibernateJPAWizardData data = new IHibernateJPAWizardData() {
public Map<String, EntityInfo> getEntities() {
return entities;
}
public ArrayList<ChangeStructure> getChanges() {
return changes;
}
public IStructuredSelection getSelection2Update() {
return selection2Update;
}
};
return data;
}
Aggregations