void detachAccessListeners( SModelAccessListener l1, INodesReadListener l2, NodeReadAccessInEditorListener l3) { assert myModel != null : "call createModel() first"; NodeReadAccessCasterInEditor.removeCellBuildNodeAccessListener(); NodeReadEventsCaster.removeNodesReadListener(); myModel.removeAccessListener(l1); }
void attachAccessListeners( SModelAccessListener l1, INodesReadListener l2, NodeReadAccessInEditorListener l3) { assert myModel != null : "call createModel() first"; myModel.addAccessListener(l1); NodeReadEventsCaster.setNodesReadListener(l2); NodeReadAccessCasterInEditor.setCellBuildNodeReadAccessListener(l3); }
public List<String> _getParentsNames(final String conceptFqName) { synchronized (myParentsNamesLock) { List<String> result = myParentsNamesMap.get(conceptFqName); if (result == null) { result = NodeReadAccessCasterInEditor.runReadTransparentAction( new Computable<List<String>>() { @Override public List<String> compute() { SNode declaration = SModelUtil.findConceptDeclaration(conceptFqName, GlobalScope.getInstance()); if (declaration == null) { return Collections.emptyList(); } List<String> result = new ArrayList<String>(); Set<String> parentsSet = new HashSet<String>(); if (SNodeUtil.isInstanceOfConceptDeclaration(declaration)) { SNode superConcept = SNodeUtil.getConceptDeclaration_Extends(declaration); if (superConcept != null) { String name = NameUtil.nodeFQName(superConcept); if (parentsSet.add(name)) { result.add(name); } } else if (!SNodeUtil.concept_BaseConcept.equals( NameUtil.nodeFQName(declaration))) { if (parentsSet.add(SNodeUtil.concept_BaseConcept)) { result.add(SNodeUtil.concept_BaseConcept); } } for (SNode interfaceConcept : SNodeUtil.getConceptDeclaration_Implements(declaration)) { String name = NameUtil.nodeFQName(interfaceConcept); if (parentsSet.add(name)) { result.add(name); } } } else if (SNodeUtil.isInstanceOfInterfaceConceptDeclaration(declaration)) { for (SNode interfaceConcept : SNodeUtil.getInterfaceConceptDeclaration_Extends(declaration)) { String name = NameUtil.nodeFQName(interfaceConcept); if (parentsSet.add(name)) { result.add(name); } } } return result; } }); myParentsNamesMap.put( InternUtil.intern(conceptFqName), Collections.unmodifiableList(result)); } return result; } }
private Set<String> getAncestorsNames_internal(final String conceptFqName) { InternAwareStringSet result = myAncestorsNamesMap.get(conceptFqName); if (result != null) return result; InternAwareStringSet set = NodeReadAccessCasterInEditor.runReadTransparentAction( new Computable<InternAwareStringSet>() { @Override public InternAwareStringSet compute() { InternAwareStringSet res = new InternAwareStringSet(); collectAncestorNames(conceptFqName, res); return res; } }); result = myAncestorsNamesMap.putIfAbsent(InternUtil.intern(conceptFqName), set); return result != null ? result : set; }
public Set<String> getDescendantsOfConcept(String conceptFQName) { Set<String> children; synchronized (myDescendantsLock) { if (!myDescendantsCachesAreValid) { NodeReadAccessCasterInEditor.runReadTransparentAction( new Runnable() { @Override public void run() { rebuildDescendantsCaches(); } }); } children = myDirectDescendantsCache.get(conceptFQName); } return children == null ? Collections.<String>emptySet() : Collections.unmodifiableSet(children); }