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


Java DebugUtil.finishPsiModification方法代码示例

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


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

示例1: testMergeWhenEmptyElementAfterWhitespaceIsLastChild

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
public void testMergeWhenEmptyElementAfterWhitespaceIsLastChild() throws Throwable {
  myBuilder = createBuilder(" foo bar");
  parseWhenEmptyElementAfterWhitespaceIsLastChild();
  final ASTNode tree = myBuilder.getTreeBuilt();
  new DummyHolder(getPsiManager(), (TreeElement)tree, null);

  myBuilder = createBuilder("  bar", tree);
  parseWhenEmptyElementAfterWhitespaceIsLastChild();
  DebugUtil.startPsiModification(null);
  try {
    myBuilder.getTreeBuilt();
    fail();
  }
  catch (BlockSupport.ReparsedSuccessfullyException e) {
    e.getDiffLog().performActualPsiChange(tree.getPsi().getContainingFile());
  }
  finally {
    DebugUtil.finishPsiModification();
  }

  assertEquals("  bar", tree.getText());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PsiBuilderTest.java

示例2: cacheEverything

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

  DebugUtil.startPsiModification("MultiHostRegistrar cacheEverything");
  try {
    viewProvider.forceCachedPsi(psiFile);
  }
  finally {
    DebugUtil.finishPsiModification();
  }

  psiFile.putUserData(FileContextUtil.INJECTED_IN_ELEMENT, pointer);
  PsiDocumentManagerBase.cachePsi(documentWindow, psiFile);

  keepTreeFromChameleoningBack(psiFile);

  return viewProvider.setShreds(place, psiFile.getProject());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:MultiHostRegistrarImpl.java

示例3: encodeInformation

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
private static void encodeInformation(TreeElement element, ASTNode original) {
  DebugUtil.startPsiModification(null);
  try {
    encodeInformation(element, original, new HashMap<Object, Object>());
  }
  finally {
    DebugUtil.finishPsiModification();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ChangeUtil.java

示例4: decodeInformation

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
public static TreeElement decodeInformation(TreeElement element) {
  DebugUtil.startPsiModification(null);
  try {
    return decodeInformation(element, new HashMap<Object, Object>());
  }
  finally {
    DebugUtil.finishPsiModification();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ChangeUtil.java

示例5: clearCaches

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

  DebugUtil.startPsiModification("injected clearCaches");
  try {
    psiManagerEx.getFileManager().setViewProvider(virtualFile, null);
  }
  finally {
    DebugUtil.finishPsiModification();
  }

  PsiElement context = InjectedLanguageManager.getInstance(injected.getProject()).getInjectionHost(injected);
  PsiFile hostFile;
  if (context != null) {
    hostFile = context.getContainingFile();
  }
  else {
    VirtualFile delegate = virtualFile.getDelegate();
    hostFile = delegate.isValid() ? psiManagerEx.findFile(delegate) : null;
  }
  if (hostFile != null) {
    // modification of cachedInjectedDocuments must be under PsiLock
    synchronized (PsiLock.LOCK) {
      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:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:InjectedLanguageUtil.java

示例6: encodeInformation

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
private static void encodeInformation(TreeElement element, ASTNode original) {
  DebugUtil.startPsiModification(null);
  try {
    encodeInformation(element, original, new HashMap<>());
  }
  finally {
    DebugUtil.finishPsiModification();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:ChangeUtil.java

示例7: decodeInformation

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
public static TreeElement decodeInformation(TreeElement element) {
  DebugUtil.startPsiModification(null);
  try {
    return decodeInformation(element, new HashMap<>());
  }
  finally {
    DebugUtil.finishPsiModification();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:ChangeUtil.java

示例8: parseContents

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
@Override
public ASTNode parseContents(ASTNode chameleon) {
  final CharTable charTable = SharedImplUtil.findCharTableByTree(chameleon);
  final FileElement fileElement = TreeUtil.getFileElement((TreeElement)chameleon);
  final PsiFile psiFile = (PsiFile)fileElement.getPsi();
  PsiFile originalPsiFile = psiFile.getOriginalFile();

  final TemplateLanguageFileViewProvider viewProvider = (TemplateLanguageFileViewProvider)originalPsiFile.getViewProvider();

  final Language templateLanguage = getTemplateFileLanguage(viewProvider);
  final CharSequence sourceCode = chameleon.getChars();

  RangesCollector collector = new RangesCollector();
  final PsiFile templatePsiFile = createTemplateFile(psiFile, templateLanguage, sourceCode, viewProvider, collector);

  final FileElement templateFileElement = ((PsiFileImpl)templatePsiFile).calcTreeElement();

  DebugUtil.startPsiModification("template language parsing");
  try {
    prepareParsedTemplateFile(templateFileElement);
    insertOuters(templateFileElement, sourceCode, collector.myRanges, charTable);

    TreeElement childNode = templateFileElement.getFirstChildNode();

    DebugUtil.checkTreeStructure(templateFileElement);
    DebugUtil.checkTreeStructure(chameleon);
    if (fileElement != chameleon) {
      DebugUtil.checkTreeStructure(psiFile.getNode());
      DebugUtil.checkTreeStructure(originalPsiFile.getNode());
    }

    return childNode;
  }
  finally {
    DebugUtil.finishPsiModification();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:38,代码来源:TemplateDataElementType.java

示例9: ensureParsed

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
private void ensureParsed() {
  if (!ourParsingAllowed) {
    LOG.error("Parsing not allowed!!!");
  }
  CharSequence text = myText();
  if (text == null) return;

  if (TreeUtil.getFileElement(this) == null) {
    LOG.error("Chameleons must not be parsed till they're in file tree: " + this);
  }

  ApplicationManager.getApplication().assertReadAccessAllowed();

  DebugUtil.startPsiModification("lazy-parsing");
  try {
    ILazyParseableElementType type = (ILazyParseableElementType)getElementType();
    ASTNode parsedNode = type.parseContents(this);

    if (parsedNode == null && text.length() > 0) {
      CharSequence diagText = ApplicationManager.getApplication().isInternal() ? text : "";
      LOG.error("No parse for a non-empty string: " + diagText + "; type=" + LogUtil.objectAndClass(type));
    }

    synchronized (lock) {
      if (myText == null) return;
      if (rawFirstChild() != null) {
        LOG.error("Reentrant parsing?");
      }

      myText = null;

      if (parsedNode == null) return;
      super.rawAddChildrenWithoutNotifications((TreeElement)parsedNode);
    }
  }
  finally {
    DebugUtil.finishPsiModification();
  }

  if (!Boolean.TRUE.equals(ourSuppressEagerPsiCreation.get())) {
    // create PSI all at once, to reduce contention of PsiLock in CompositeElement.getPsi()
    // create PSI outside the 'lock' since this method grabs PSI_LOCK and deadlock is possible when someone else locks in the other order.
    createAllChildrenPsiIfNecessary();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:46,代码来源:LazyParseableElement.java

示例10: parseContents

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
@Override
public ASTNode parseContents(ASTNode chameleon) {
  final CharTable table = SharedImplUtil.findCharTableByTree(chameleon);
  final FileElement treeElement = new DummyHolder(((TreeElement)chameleon).getManager(), null, table).getTreeElement();
  final FileElement fileElement = TreeUtil.getFileElement((TreeElement)chameleon);
  final PsiFile file = (PsiFile)fileElement.getPsi();
  PsiFile originalFile = file.getOriginalFile();

  final TemplateLanguageFileViewProvider viewProvider = (TemplateLanguageFileViewProvider)originalFile.getViewProvider();

  final Language language = getTemplateFileLanguage(viewProvider);
  final CharSequence chars = chameleon.getChars();

  final PsiFile templateFile = createTemplateFile(file, language, chars, viewProvider);

  final FileElement parsed = ((PsiFileImpl)templateFile).calcTreeElement();

  DebugUtil.startPsiModification("template language parsing");
  try {
    prepareParsedTemplateFile(parsed);
    Lexer langLexer = LanguageParserDefinitions.INSTANCE.forLanguage(language).createLexer(file.getProject());
    final Lexer lexer = new MergingLexerAdapter(
      new TemplateBlackAndWhiteLexer(createBaseLexer(viewProvider), langLexer, myTemplateElementType, myOuterElementType),
      TokenSet.create(myTemplateElementType, myOuterElementType));
    lexer.start(chars);
    insertOuters(parsed, lexer, table);

    if (parsed != null) {
      final TreeElement element = parsed.getFirstChildNode();
      if (element != null) {
        parsed.rawRemoveAllChildren();
        treeElement.rawAddChildren(element);
      }
    }
  }
  finally {
    DebugUtil.finishPsiModification();
  }

  treeElement.subtreeChanged();
  TreeElement childNode = treeElement.getFirstChildNode();

  DebugUtil.checkTreeStructure(parsed);
  DebugUtil.checkTreeStructure(treeElement);
  DebugUtil.checkTreeStructure(chameleon);
  if (fileElement != chameleon) {
    DebugUtil.checkTreeStructure(file.getNode());
    DebugUtil.checkTreeStructure(originalFile.getNode());
  }

  return childNode;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:53,代码来源:TemplateDataElementType.java


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