mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
registry prop for turning code-block and java-structure mod trackers
This commit is contained in:
@@ -19,7 +19,6 @@ package com.intellij.psi.impl;
|
||||
import com.intellij.lang.PsiBuilderFactory;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
@@ -367,9 +366,17 @@ public class PsiManagerImpl extends PsiManagerEx {
|
||||
for (PsiTreeChangePreprocessor preprocessor : myTreeChangePreprocessors) {
|
||||
preprocessor.treeChanged(event);
|
||||
}
|
||||
boolean enableOutOfCodeBlockTracking = myModificationTracker.getOutOfCodeBlockModificationTracker() != myModificationTracker;
|
||||
for (PsiTreeChangePreprocessor preprocessor : Extensions.getExtensions(PsiTreeChangePreprocessor.EP_NAME, myProject)) {
|
||||
if (!enableOutOfCodeBlockTracking && preprocessor instanceof PsiTreeChangePreprocessorBase) continue;
|
||||
preprocessor.treeChanged(event);
|
||||
}
|
||||
if (!enableOutOfCodeBlockTracking) {
|
||||
for (PsiTreeChangePreprocessor preprocessor : Extensions.getExtensions(PsiTreeChangePreprocessor.EP_NAME, myProject)) {
|
||||
if (!(preprocessor instanceof PsiTreeChangePreprocessorBase)) continue;
|
||||
((PsiTreeChangePreprocessorBase)preprocessor).onOutOfCodeBlockModification(event);
|
||||
}
|
||||
}
|
||||
|
||||
for (PsiTreeChangeListener listener : myTreeChangeListeners) {
|
||||
try {
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.application.TransactionGuardImpl;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.ModificationTracker;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiTreeChangeEvent;
|
||||
import com.intellij.psi.util.PsiModificationTracker;
|
||||
@@ -37,9 +38,16 @@ import static com.intellij.psi.impl.PsiTreeChangeEventImpl.PsiEventType.PROPERTY
|
||||
* Date: Jul 18, 2002
|
||||
*/
|
||||
public class PsiModificationTrackerImpl implements PsiModificationTracker, PsiTreeChangePreprocessor {
|
||||
private final boolean myEnableCodeBlockTracker = Registry.is("psi.modification.tracker.code-block");
|
||||
private final boolean myEnableJavaStructureTracker = Registry.is("psi.modification.tracker.java-structure");
|
||||
|
||||
private final AtomicLong myModificationCount = new AtomicLong(0);
|
||||
private final AtomicLong myOutOfCodeBlockModificationCount = new AtomicLong(0);
|
||||
private final AtomicLong myJavaStructureModificationCount = new AtomicLong(0);
|
||||
private final AtomicLong myOutOfCodeBlockModificationCount = myEnableCodeBlockTracker ? new AtomicLong(0) : myModificationCount;
|
||||
private final AtomicLong myJavaStructureModificationCount = myEnableJavaStructureTracker ? new AtomicLong(0) : myModificationCount;
|
||||
|
||||
private final ModificationTracker myOutOfCodeBlockModificationTracker = myEnableCodeBlockTracker ? () -> getOutOfCodeBlockModificationCount() : this;
|
||||
private final ModificationTracker myJavaStructureModificationTracker = myEnableJavaStructureTracker ? () -> getJavaStructureModificationCount() : this;
|
||||
|
||||
private final Listener myPublisher;
|
||||
|
||||
public PsiModificationTrackerImpl(Project project) {
|
||||
@@ -114,13 +122,6 @@ public class PsiModificationTrackerImpl implements PsiModificationTracker, PsiTr
|
||||
return myOutOfCodeBlockModificationCount.get();
|
||||
}
|
||||
|
||||
private final ModificationTracker myOutOfCodeBlockModificationTracker = new ModificationTracker() {
|
||||
@Override
|
||||
public long getModificationCount() {
|
||||
return getOutOfCodeBlockModificationCount();
|
||||
}
|
||||
};
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ModificationTracker getOutOfCodeBlockModificationTracker() {
|
||||
@@ -132,12 +133,6 @@ public class PsiModificationTrackerImpl implements PsiModificationTracker, PsiTr
|
||||
return myJavaStructureModificationCount.get();
|
||||
}
|
||||
|
||||
private final ModificationTracker myJavaStructureModificationTracker = new ModificationTracker() {
|
||||
@Override
|
||||
public long getModificationCount() {
|
||||
return getJavaStructureModificationCount();
|
||||
}
|
||||
};
|
||||
@NotNull
|
||||
@Override
|
||||
public ModificationTracker getJavaStructureModificationTracker() {
|
||||
|
||||
@@ -367,6 +367,11 @@ psi.track.invalidation.description=When PSI elements are invalidated, store stac
|
||||
psi.element.list.cell.renderer.focus.border.enabled=false
|
||||
psi.element.list.cell.renderer.focus.border.enabled.description=Enables default focus border in a list of PSI elements.
|
||||
|
||||
psi.modification.tracker.code-block=true
|
||||
psi.modification.tracker.code-block.description=Controls out-of-code-block PSI modification tracker optimization (requires project reopening)
|
||||
psi.modification.tracker.java-structure=true
|
||||
psi.modification.tracker.java-structure.description=Controls java-structure PSI modification tracker optimization (requires project reopening)
|
||||
|
||||
ide.suggest.file.when.creating.filename.like.directory=true
|
||||
ide.suggest.file.when.creating.filename.like.directory.description=When creating a directory named foo.txt, suggest to create a file with such a name instead
|
||||
|
||||
|
||||
Reference in New Issue
Block a user