use of org.hibernate.eclipse.jdt.ui.internal.jpa.process.ChangeStructure in project jbosstools-hibernate by jbosstools.
the class HibernateJPARefactoring method createChange.
@Override
public Change createChange(IProgressMonitor pm) {
// $NON-NLS-1$
final CompositeChange cc = new CompositeChange("");
for (int i = 0; i < changes.size(); i++) {
ChangeStructure cs = changes.get(i);
final String change_name = cs.path.toString();
TextFileChange change = new TextFileChange(change_name, (IFile) cs.icu.getResource());
change.setSaveMode(TextFileChange.LEAVE_DIRTY);
change.setEdit(cs.textEdit);
cs.change = change;
cc.add(change);
}
cc.markAsSynthetic();
return cc;
}
use of org.hibernate.eclipse.jdt.ui.internal.jpa.process.ChangeStructure 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