本文整理汇总了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);
}
}
示例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;
}
});
}
示例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;
}
});
});
}
示例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;
}
示例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);
});
}
示例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);
}
}
});
}
示例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);
}
}
}
}
}
示例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));
}
示例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);
}