// Rename css .class selectors. We look for all @external declarations in
// the stylesheet and then compute the per-instance replacements.
ExternalClassesCollector externalClasses = new ExternalClassesCollector();
externalClasses.accept(sheet);
ClassRenamer renamer = new ClassRenamer(logger,
classReplacementsWithPrefix, strict, externalClasses.getClasses());
renamer.accept(sheet);
Map<JMethod, String> actualReplacements = new TreeMap<JMethod, String>(
new Comparator<JMethod>() {
@Override
public int compare(JMethod o1, JMethod o2) {
int result = source(o1).compareTo(source(o2));
if (result == 0) {
result = o1.getName().compareTo(o2.getName());
}
return result;
}
private String source(JMethod o) {
return o.getEnclosingType().getQualifiedSourceName();
}
});
actualReplacements.putAll(renamer.getReplacements());
// Combine rules with identical selectors
if (enableMerge) {
(new SplitRulesVisitor()).accept(sheet);
(new MergeIdenticalSelectorsVisitor()).accept(sheet);