Search in sources :

Example 6 with PsiModificationTrackerImpl

use of com.intellij.psi.impl.PsiModificationTrackerImpl in project intellij-community by JetBrains.

the class GroovyDslFileIndex method clearScriptCache.

private static void clearScriptCache() {
    Application app = ApplicationManager.getApplication();
    app.invokeLater(() -> {
        for (Project project : ProjectManager.getInstance().getOpenProjects()) {
            project.putUserData(SCRIPTS_CACHE, null);
            ((PsiModificationTrackerImpl) PsiManager.getInstance(project).getModificationTracker()).incCounter();
        }
    }, app.getDisposed());
}
Also used : Project(com.intellij.openapi.project.Project) PsiModificationTrackerImpl(com.intellij.psi.impl.PsiModificationTrackerImpl) Application(com.intellij.openapi.application.Application)

Example 7 with PsiModificationTrackerImpl

use of com.intellij.psi.impl.PsiModificationTrackerImpl in project kotlin by JetBrains.

the class AbstractOutOfBlockModificationTest method doTest.

protected void doTest(String path) throws IOException {
    myFixture.configureByFile(path);
    boolean expectedOutOfBlock = getExpectedOutOfBlockResult();
    PsiModificationTrackerImpl tracker = (PsiModificationTrackerImpl) PsiManager.getInstance(myFixture.getProject()).getModificationTracker();
    PsiElement element = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
    assertNotNull("Should be valid element", element);
    long oobBeforeType = tracker.getOutOfCodeBlockModificationCount();
    long modificationCountBeforeType = tracker.getModificationCount();
    myFixture.type(getStringToType());
    PsiDocumentManager.getInstance(myFixture.getProject()).commitDocument(myFixture.getDocument(myFixture.getFile()));
    long oobAfterCount = tracker.getOutOfCodeBlockModificationCount();
    long modificationCountAfterType = tracker.getModificationCount();
    assertTrue("Modification tracker should always be changed after type", modificationCountBeforeType != modificationCountAfterType);
    assertEquals("Result for out of block test is differs from expected on element in file:\n" + FileUtil.loadFile(new File(path)), expectedOutOfBlock, oobBeforeType != oobAfterCount);
    boolean isSkipCheckDefined = InTextDirectivesUtils.isDirectiveDefined(myFixture.getFile().getText(), "SKIP_ANALYZE_CHECK");
    assertTrue("It's allowed to skip check with analyze only for tests where out-of-block is expected", !isSkipCheckDefined || expectedOutOfBlock);
    if (!isSkipCheckDefined) {
        checkOOBWithDescriptorsResolve(expectedOutOfBlock);
    }
}
Also used : PsiModificationTrackerImpl(com.intellij.psi.impl.PsiModificationTrackerImpl) File(java.io.File) PsiElement(com.intellij.psi.PsiElement)

Example 8 with PsiModificationTrackerImpl

use of com.intellij.psi.impl.PsiModificationTrackerImpl in project android by JetBrains.

the class DataBindingUtil method invalidateJavaCodeOnOpenDataBindingProjects.

private static void invalidateJavaCodeOnOpenDataBindingProjects() {
    ourDataBindingEnabledModificationCount.incrementAndGet();
    for (Project project : ProjectManager.getInstance().getOpenProjects()) {
        DataBindingProjectComponent component = project.getComponent(DataBindingProjectComponent.class);
        if (component == null) {
            continue;
        }
        boolean invalidated = invalidateAllSources(component);
        if (!invalidated) {
            return;
        }
        PsiModificationTracker tracker = PsiManager.getInstance(project).getModificationTracker();
        if (tracker instanceof PsiModificationTrackerImpl) {
            ((PsiModificationTrackerImpl) tracker).incCounter();
        }
        FileContentUtil.reparseFiles(project, Collections.EMPTY_LIST, true);
    }
    ourDataBindingEnabledModificationCount.incrementAndGet();
}
Also used : Project(com.intellij.openapi.project.Project) PsiModificationTracker(com.intellij.psi.util.PsiModificationTracker) PsiModificationTrackerImpl(com.intellij.psi.impl.PsiModificationTrackerImpl)

Aggregations

PsiModificationTrackerImpl (com.intellij.psi.impl.PsiModificationTrackerImpl)8 Project (com.intellij.openapi.project.Project)2 PsiElement (com.intellij.psi.PsiElement)2 Language (com.intellij.lang.Language)1 Application (com.intellij.openapi.application.Application)1 PlainTextLanguage (com.intellij.openapi.fileTypes.PlainTextLanguage)1 PsiManager (com.intellij.psi.PsiManager)1 PsiManagerImpl (com.intellij.psi.impl.PsiManagerImpl)1 FileReference (com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReference)1 PsiModificationTracker (com.intellij.psi.util.PsiModificationTracker)1 File (java.io.File)1 FileReferenceInjector (org.intellij.plugins.intelliLang.references.FileReferenceInjector)1 Element (org.jdom.Element)1