当前位置: 首页>>代码示例>>Java>>正文


Java DebugUtil.performPsiModification方法代码示例

本文整理汇总了Java中com.intellij.psi.impl.DebugUtil.performPsiModification方法的典型用法代码示例。如果您正苦于以下问题:Java DebugUtil.performPsiModification方法的具体用法?Java DebugUtil.performPsiModification怎么用?Java DebugUtil.performPsiModification使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.impl.DebugUtil的用法示例。


在下文中一共展示了DebugUtil.performPsiModification方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setViewProvider

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
@Override
public void setViewProvider(@Nonnull final VirtualFile virtualFile, @Nullable final FileViewProvider fileViewProvider) {
  FileViewProvider prev = findCachedViewProvider(virtualFile);
  if (prev == fileViewProvider) return;
  if (prev != null) {
    DebugUtil.performPsiModification(null, () -> {
      markInvalidated(prev);
      DebugUtil.onInvalidated(prev);
    });
  }

  if (fileViewProvider == null) {
    getVFileToViewProviderMap().remove(virtualFile);
  }
  else if (virtualFile instanceof LightVirtualFile) {
    virtualFile.putUserData(myPsiHardRefKey, fileViewProvider);
  }
  else {
    getVFileToViewProviderMap().put(virtualFile, fileViewProvider);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:FileManagerImpl.java

示例2: processFileTypesChanged

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
void processFileTypesChanged() {
  if (myProcessingFileTypesChange) return;
  myProcessingFileTypesChange = true;
  DebugUtil.performPsiModification(null, () -> {
    try {
      ApplicationManager.getApplication().runWriteAction(() -> {
        PsiTreeChangeEventImpl event = new PsiTreeChangeEventImpl(myManager);
        event.setPropertyName(PsiTreeChangeEvent.PROP_FILE_TYPES);
        myManager.beforePropertyChange(event);

        invalidateAllPsi();

        myManager.propertyChanged(event);
      });
    }
    finally {
      myProcessingFileTypesChange = false;
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:FileManagerImpl.java

示例3: removeFilesAndDirsRecursively

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
void removeFilesAndDirsRecursively(@Nonnull VirtualFile vFile) {
  DebugUtil.performPsiModification("removeFilesAndDirsRecursively", () -> {
    VfsUtilCore.visitChildrenRecursively(vFile, new VirtualFileVisitor() {
      @Override
      public boolean visitFile(@Nonnull VirtualFile file) {
        if (file.isDirectory()) {
          getVFileToPsiDirMap().remove(file);
        }
        else {
          FileViewProvider viewProvider = getVFileToViewProviderMap().remove(file);
          if (viewProvider != null) {
            markInvalidated(viewProvider);
          }
        }
        return true;
      }
    });
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:FileManagerImpl.java

示例4: getPsiInner

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
@Override
@Nullable
protected PsiFile getPsiInner(@Nonnull Language target) {
  if (target != getBaseLanguage()) {
    return null;
  }
  PsiFile psiFile = myPsiFile.get();
  if (psiFile == null) {
    psiFile = createFile();
    if (psiFile == null) {
      psiFile = PsiUtilCore.NULL_PSI_FILE;
    }
    boolean set = myPsiFile.compareAndSet(null, psiFile);
    if (!set && psiFile != PsiUtilCore.NULL_PSI_FILE) {
      PsiFile alreadyCreated = myPsiFile.get();
      if (alreadyCreated == psiFile) {
        LOG.error(this + ".createFile() must create new file instance but got the same: " + psiFile);
      }
      if (psiFile instanceof PsiFileEx) {
        PsiFile finalPsiFile = psiFile;
        DebugUtil.performPsiModification("invalidating throw-away copy", () ->
                ((PsiFileEx)finalPsiFile).markInvalidated()
        );
      }
      psiFile = alreadyCreated;
    }
  }
  return psiFile == PsiUtilCore.NULL_PSI_FILE ? null : psiFile;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:30,代码来源:SingleRootFileViewProvider.java

示例5: clearViewProviders

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
private void clearViewProviders() {
  ApplicationManager.getApplication().assertWriteAccessAllowed();
  DebugUtil.performPsiModification("clearViewProviders", () -> {
    ConcurrentMap<VirtualFile, FileViewProvider> map = myVFileToViewProviderMap.get();
    if (map != null) {
      for (final FileViewProvider provider : map.values()) {
        markInvalidated(provider);
      }
    }
    myVFileToViewProviderMap.set(null);
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:FileManagerImpl.java

示例6: markInvalidations

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
private void markInvalidations(@Nonnull Map<VirtualFile, FileViewProvider> originalFileToPsiFileMap) {
  DebugUtil.performPsiModification(null, ()->{
    for (Map.Entry<VirtualFile, FileViewProvider> entry : originalFileToPsiFileMap.entrySet()) {
      FileViewProvider viewProvider = entry.getValue();
      if (getVFileToViewProviderMap().get(entry.getKey()) != viewProvider) {
        markInvalidated(viewProvider);
      }
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:FileManagerImpl.java

示例7: clearCaches

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
static void clearCaches(@Nonnull PsiFile injected, @Nonnull DocumentWindowImpl documentWindow) {
  VirtualFileWindowImpl virtualFile = (VirtualFileWindowImpl)injected.getVirtualFile();
  PsiManagerEx psiManagerEx = (PsiManagerEx)injected.getManager();
  if (psiManagerEx.getProject().isDisposed()) return;

  DebugUtil.performPsiModification("injected clearCaches", () ->
          psiManagerEx.getFileManager().setViewProvider(virtualFile, null));

  VirtualFile delegate = virtualFile.getDelegate();
  if (!delegate.isValid()) return;

  FileViewProvider viewProvider = psiManagerEx.getFileManager().findCachedViewProvider(delegate);
  if (viewProvider == null) return;

  for (PsiFile hostFile : ((AbstractFileViewProvider)viewProvider).getCachedPsiFiles()) {
    // modification of cachedInjectedDocuments must be under InjectedLanguageManagerImpl.ourInjectionPsiLock
    synchronized (InjectedLanguageManagerImpl.ourInjectionPsiLock) {
      List<DocumentWindow> cachedInjectedDocuments = getCachedInjectedDocuments(hostFile);
      for (int i = cachedInjectedDocuments.size() - 1; i >= 0; i--) {
        DocumentWindow cachedInjectedDocument = cachedInjectedDocuments.get(i);
        if (cachedInjectedDocument == documentWindow) {
          cachedInjectedDocuments.remove(i);
        }
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:28,代码来源:InjectedLanguageUtil.java

示例8: clearViewProvider

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
private void clearViewProvider(@Nonnull VirtualFile vFile, @Nonnull String why) {
  DebugUtil.performPsiModification(why, () -> myFileManager.setViewProvider(vFile, null));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:4,代码来源:PsiVFSListener.java

示例9: cacheEverything

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
private static boolean cacheEverything(@Nonnull Place place, @Nonnull DocumentWindowImpl documentWindow, @Nonnull InjectedFileViewProvider viewProvider, @Nonnull PsiFile psiFile) {
  FileDocumentManagerImpl.registerDocument(documentWindow, viewProvider.getVirtualFile());

  DebugUtil.performPsiModification("MultiHostRegistrar cacheEverything", () -> viewProvider.forceCachedPsi(psiFile));

  SmartPsiElementPointer<PsiLanguageInjectionHost> pointer = ((ShredImpl)place.get(0)).getSmartPointer();
  psiFile.putUserData(FileContextUtil.INJECTED_IN_ELEMENT, pointer);

  keepTreeFromChameleoningBack(psiFile);

  return viewProvider.setShreds(place);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:InjectionRegistrarImpl.java


注:本文中的com.intellij.psi.impl.DebugUtil.performPsiModification方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。