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());
}
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);
}
}
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();
}
Aggregations