@Nonnull private static SimpleModificationTracker wrapped(RegistryValue value, SimpleModificationTracker fallback, boolean testMode) { if (testMode) { return new SimpleModificationTracker(); } return new SimpleModificationTracker() { @Override public long getModificationCount() { return value.asBoolean() ? super.getModificationCount() : fallback.getModificationCount(); } @Override public void incModificationCount() { if (value.asBoolean()) super.incModificationCount(); //else fallback.incModificationCount(); } }; }
private Pair<SimpleModificationTracker, EventDispatcher<ModificationTrackerListener>> getFacetInfo(final Facet facet) { Pair<SimpleModificationTracker, EventDispatcher<ModificationTrackerListener>> pair = myModificationsTrackers.get(facet); if (pair == null) { pair = Pair.create(new SimpleModificationTracker(), EventDispatcher.create(ModificationTrackerListener.class)); myModificationsTrackers.put(facet, pair); } return pair; }
@Override public void facetConfigurationChanged(@NotNull final Facet facet) { final Pair<SimpleModificationTracker, EventDispatcher<ModificationTrackerListener>> pair = myModificationsTrackers.get(facet); if (pair != null) { pair.first.incModificationCount(); pair.second.getMulticaster().modificationCountChanged(facet); } }
private Result<PsiFile> notFound(ClsFileImpl file) { // A "not-found" result is null, but depends on the project sync tracker, so it will expire // after the next blaze sync. This means we'll run this check again after every sync for files // that don't have source jars, but it's not a huge deal because checking for the source jar // only takes a few microseconds. projectSyncTrackers.putIfAbsent(file.getProject(), new SimpleModificationTracker()); return Result.create(null, projectSyncTrackers.get(file.getProject())); }
@Override public void afterSync( Project project, BlazeContext context, SyncMode syncMode, SyncResult syncResult) { SimpleModificationTracker modificationTracker = projectSyncTrackers.get(project); if (modificationTracker != null) { modificationTracker.incModificationCount(); } }
public ClassInnerStuffCache(@NotNull PsiExtensibleClass aClass) { myClass = aClass; myTracker = new SimpleModificationTracker(); }
@Override public ModificationTracker getModificationTracker() { return new SimpleModificationTracker(); }
@Override public void incFacetModificationTracker(@NotNull final Facet facet) { final Pair<SimpleModificationTracker, EventDispatcher<ModificationTrackerListener>> pair = getFacetInfo(facet); pair.first.incModificationCount(); pair.second.getMulticaster().modificationCountChanged(facet); }
public void incLanguageModificationCount(@Nullable Language language) { if (language == null) return; ((SimpleModificationTracker)myLanguageTrackers.get(language)).incModificationCount(); }