edelta.refactorings.lib.EdeltaBadSmellsChecker.edelta Maven / Gradle / Ivy
The newest version!
import org.eclipse.emf.ecore.EPackage
package edelta.refactorings.lib
use EdeltaBadSmellsFinder as finder
/**
* Shows warnings in case duplicate features are found;
* for each feature that has duplicates shows a warning and the
* list of duplicates.
*
* @param ePackage
*/
def checkDuplicatedFeatures(EPackage ePackage) {
finder
.findDuplicatedFeatures(ePackage)
.entrySet // key: a duplicate feature, value: all duplicates
.forEach[entry|
val duplicates = entry.value
duplicates.forEach[currentDuplicate|
showWarning(currentDuplicate,
getEObjectRepr(currentDuplicate) +
", duplicate features: " +
duplicates
.filter[it !== currentDuplicate]
.map[getEObjectRepr(it)].join(", ")
)
]
]
}