@Nullable
  public DomInvocationHandler getDomHandler(final XmlElement tag) {
    if (tag == null) return null;

    List<DomInvocationHandler> cached = mySemService.getCachedSemElements(DOM_HANDLER_KEY, tag);
    if (cached != null && !cached.isEmpty()) {
      return cached.get(0);
    }

    return mySemService.getSemElement(DOM_HANDLER_KEY, tag);
  }
  @Nullable
  public GenericAttributeValue getDomElement(final XmlAttribute attribute) {
    if (myChanging) return null;

    final AttributeChildInvocationHandler handler =
        mySemService.getSemElement(DOM_ATTRIBUTE_HANDLER_KEY, attribute);
    return handler == null ? null : (GenericAttributeValue) handler.getProxy();
  }
 @NotNull
 public final <T extends DomElement> DomFileElementImpl<T> getFileElement(
     final XmlFile file, final Class<T> aClass, String rootTagName) {
   //noinspection unchecked
   if (file.getUserData(MOCK_DESCRIPTION) == null) {
     file.putUserData(MOCK_DESCRIPTION, new MockDomFileDescription<T>(aClass, rootTagName, file));
     mySemService.clearCache();
   }
   final DomFileElementImpl<T> fileElement = getFileElement(file);
   assert fileElement != null;
   return fileElement;
 }
 public void performAtomicChange(@NotNull Runnable change) {
   mySemService.performAtomicChange(change);
   if (!mySemService.isInsideAtomicChange()) {
     myModificationCount++;
   }
 }
  public final void registerFileDescription(final DomFileDescription description) {
    mySemService.clearCache();

    myApplicationComponent.registerFileDescription(description);
  }
 @SuppressWarnings({"unchecked"})
 @NotNull
 final <T extends DomElement> FileDescriptionCachedValueProvider<T> getOrCreateCachedValueProvider(
     final XmlFile xmlFile) {
   return mySemService.getSemElement(FILE_DESCRIPTION_KEY, xmlFile);
 }
 final void fireEvent(DomEvent event) {
   if (mySemService.isInsideAtomicChange()) return;
   myModificationCount++;
   myListeners.getMulticaster().eventOccured(event);
 }
 public <T extends DomInvocationHandler> void cacheHandler(
     SemKey<T> key, XmlElement element, T handler) {
   mySemService.setCachedSemElement(key, element, handler);
 }