use of org.eclipse.jpt.jpa.core.JpaProject in project jbosstools-hibernate by jbosstools.
the class HibernateJptPlugin method start.
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
KnownConfigurations.getInstance().addConsoleConfigurationListener(new KnownConfigurationsAdapter() {
private void revalidateProjects(ConsoleConfiguration ccfg) {
// INFO: should revalidate project to calculate correct naming strategy's values
JpaProjectManager manager = (JpaProjectManager) ResourcesPlugin.getWorkspace().getAdapter(JpaProjectManager.class);
Iterator<JpaProject> jpaProjects = manager.getJpaProjects().iterator();
while (jpaProjects.hasNext()) {
JpaProject jpaProject = jpaProjects.next();
if (jpaProject instanceof HibernateJpaProject) {
String ccName = ((HibernateJpaProject) jpaProject).getDefaultConsoleConfigurationName();
if (ccfg.getName().equals(ccName)) {
rebuildJpaProject(jpaProject.getJavaProject().getProject());
// jpaProject.getJavaProject().getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
}
}
}
}
@Override
public void configurationBuilt(ConsoleConfiguration ccfg) {
if (ccfg.getConfiguration() == null) {
return;
}
revalidateProjects(ccfg);
}
@Override
public void configurationRemoved(ConsoleConfiguration root, boolean forUpdate) {
if (forUpdate) {
return;
}
revalidateProjects(root);
}
});
}
Aggregations