@Override
public void refreshDataModel() {
myNodes.clear();
myEdges.clear();
RuleGraphHelper ruleGraphHelper = RuleGraphHelper.getCached(myFile);
((BnfDiagramProvider)getProvider()).myGraphHelper = ruleGraphHelper;
Map<BnfRule, DiagramNode<PsiNamedElement>> nodeMap = new THashMap<BnfRule, DiagramNode<PsiNamedElement>>();
List<BnfRule> rules = myFile.getRules();
BnfRule root = ContainerUtil.getFirstItem(rules);
for (BnfRule rule : rules) {
if (rule != root && !RuleGraphHelper.shouldGeneratePsi(rule, true)) continue;
DiagramNode<PsiNamedElement> diagramNode = new PsiDiagramNode<PsiNamedElement>(rule, getProvider()) {
@Override
public String getTooltip() {
return getIdentifyingElement().getName();
}
};
nodeMap.put(rule, diagramNode);
myNodes.add(diagramNode);
}
for (BnfRule rule : rules) {
if (rule != root && !RuleGraphHelper.shouldGeneratePsi(rule, true)) continue;
Map<PsiElement, RuleGraphHelper.Cardinality> map = ruleGraphHelper.getFor(rule);
BnfRule superRule = myFile.getRule(getAttribute(rule, KnownAttribute.EXTENDS));
if (superRule != null) {
DiagramNode<PsiNamedElement> source = nodeMap.get(rule);
DiagramNode<PsiNamedElement> target = nodeMap.get(superRule);