use of org.eclipse.m2e.core.project.MavenProjectChangedEvent in project bndtools by bndtools.
the class MavenWorkspaceRepository method mavenProjectChanged.
@Override
public void mavenProjectChanged(MavenProjectChangedEvent[] events, IProgressMonitor monitor) {
if (events == null)
return;
for (MavenProjectChangedEvent event : events) {
final IMavenProjectFacade oldProject = event.getOldMavenProject();
final Iterator<Entry<String, Entry<IMavenProjectFacade, MavenProject>>> entries = bsnMap.entrySet().iterator();
while (entries.hasNext()) {
final Entry<String, Entry<IMavenProjectFacade, MavenProject>> entry = entries.next();
if (entry.getValue().getKey().equals(oldProject)) {
String bsn = entry.getKey();
bsnMap.remove(bsn);
break;
}
}
final IMavenProjectFacade newProject = event.getMavenProject();
try {
final MavenProject newMavenProject = getMavenProject(newProject, monitor);
final String newBsn = getBsnFromMavenProject(newMavenProject);
final Entry<IMavenProjectFacade, MavenProject> newEntry = new SimpleImmutableEntry<>(newProject, newMavenProject);
bsnMap.put(newBsn, newEntry);
} catch (Exception e) {
logger.logError("Error getting bsn for new project " + newProject.getProject().getName(), e);
}
}
}
Aggregations