com.intellij.openapi.util.ModificationTracker Java Examples

The following examples show how to use com.intellij.openapi.util.ModificationTracker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArtifactBySourceFileFinderImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
public CachedValue<MultiValuesMap<VirtualFile, Artifact>> getFileToArtifactsMap() {
  if (myFile2Artifacts == null) {
    myFile2Artifacts =
      CachedValuesManager.getManager(myProject).createCachedValue(new CachedValueProvider<MultiValuesMap<VirtualFile, Artifact>>() {
        public Result<MultiValuesMap<VirtualFile, Artifact>> compute() {
          MultiValuesMap<VirtualFile, Artifact> result = computeFileToArtifactsMap();
          List<ModificationTracker> trackers = new ArrayList<ModificationTracker>();
          trackers.add(myArtifactManager.getModificationTracker());
          for (ComplexPackagingElementType<?> type : PackagingElementFactory.getInstance(myProject).getComplexElementTypes()) {
            ContainerUtil.addIfNotNull(trackers, type.getAllSubstitutionsModificationTracker(myProject));
          }
          return Result.create(result, trackers.toArray(new ModificationTracker[trackers.size()]));
        }
      }, false);
  }
  return myFile2Artifacts;
}
 
Example #2
Source File: StructureViewComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
@Nonnull
public Collection<AbstractTreeNode> getChildren() {
  if (ourSettingsModificationCount.get() != modificationCountForChildren) {
    resetChildren();
    modificationCountForChildren = ourSettingsModificationCount.get();
  }

  Object o = unwrapElement(getValue());
  long currentStamp = -1;
  if (o instanceof PsiElement) {
    if (!((PsiElement)o).isValid()) return Collections.emptyList();

    PsiFile file = ((PsiElement)o).getContainingFile();
    if (file != null) {
      currentStamp = file.getModificationStamp();
    }
  }
  else if (o instanceof ModificationTracker) {
    currentStamp = ((ModificationTracker)o).getModificationCount();
  }
  if (childrenStamp != currentStamp) {
    resetChildren();
    childrenStamp = currentStamp;
  }
  try {
    return super.getChildren();
  }
  catch (IndexNotReadyException ignore) {
    return Collections.emptyList();
  }
}
 
Example #3
Source File: PsiModificationTrackerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public ModificationTracker forLanguages(@Nonnull Condition<? super Language> condition) {
  return () -> {
    long result = myAllLanguagesTracker.getModificationCount();
    for (Language l : myLanguageTrackers.keySet()) {
      if (!condition.value(l)) continue;
      result += myLanguageTrackers.get(l).getModificationCount();
    }
    return result;
  };
}
 
Example #4
Source File: ComputableActionGroup.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
protected final CachedValueProvider<AnAction[]> createChildrenProvider(@Nonnull final ActionManager actionManager) {
  return new CachedValueProvider<AnAction[]>() {
    @Nullable
    @Override
    public Result<AnAction[]> compute() {
      return Result.create(computeChildren(actionManager), ModificationTracker.NEVER_CHANGED);
    }
  };
}
 
Example #5
Source File: BlazeSyncModificationTracker.java    From intellij with Apache License 2.0 4 votes vote down vote up
public static ModificationTracker getInstance(Project project) {
  return ServiceManager.getService(project, BlazeSyncModificationTracker.class)
      .modificationTracker;
}
 
Example #6
Source File: Communicator.java    From CppTools with Apache License 2.0 4 votes vote down vote up
public ModificationTracker getModificationTracker() {
  return myModificationTracker;
}
 
Example #7
Source File: Communicator.java    From CppTools with Apache License 2.0 4 votes vote down vote up
public ModificationTracker getServerRestartTracker() {
  return myServerRestartTracker;
}
 
Example #8
Source File: FoldingModelWindow.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public long getModificationCount() {
  return myDelegate instanceof ModificationTracker ? ((ModificationTracker)myDelegate).getModificationCount() : 0;
}
 
Example #9
Source File: DefaultFileIndexFacade.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public ModificationTracker getRootModificationTracker() {
  return ModificationTracker.NEVER_CHANGED;
}
 
Example #10
Source File: PsiModificationTrackerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public ModificationTracker forLanguage(@Nonnull Language language) {
  SimpleModificationTracker languageTracker = myLanguageTrackers.get(language);
  return () -> languageTracker.getModificationCount() + myAllLanguagesTracker.getModificationCount();
}
 
Example #11
Source File: PsiModificationTrackerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public ModificationTracker getJavaStructureModificationTracker() {
  return myModificationCount;
}
 
Example #12
Source File: PsiModificationTrackerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public ModificationTracker getOutOfCodeBlockModificationTracker() {
  return myModificationCount;
}
 
Example #13
Source File: MockFileIndexFacade.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public ModificationTracker getRootModificationTracker() {
  return ModificationTracker.NEVER_CHANGED;
}
 
Example #14
Source File: MockDumbService.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public ModificationTracker getModificationTracker() {
  return new SimpleModificationTracker();
}
 
Example #15
Source File: EncodingProjectManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public ModificationTracker getModificationTracker() {
  return myModificationTracker;
}
 
Example #16
Source File: DumbServiceImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public ModificationTracker getModificationTracker() {
  return this;
}
 
Example #17
Source File: FileIndexFacade.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public abstract ModificationTracker getRootModificationTracker();
 
Example #18
Source File: ArtifactManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public ModificationTracker getModificationTracker() {
  return myModificationTracker;
}
 
Example #19
Source File: ProjectFileIndexFacade.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public ModificationTracker getRootModificationTracker() {
  return ProjectRootManager.getInstance(myProject);
}
 
Example #20
Source File: LightFileIndexFacade.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public ModificationTracker getRootModificationTracker() {
  return ModificationTracker.NEVER_CHANGED;
}
 
Example #21
Source File: ComplexPackagingElementType.java    From consulo with Apache License 2.0 4 votes vote down vote up
@javax.annotation.Nullable
public ModificationTracker getAllSubstitutionsModificationTracker(@Nonnull Project project) {
  return null;
}
 
Example #22
Source File: FileIndexCaches.java    From idea-php-symfony2-plugin with MIT License 4 votes vote down vote up
@NotNull
private static ModificationTracker getModificationTrackerForIndexId(@NotNull Project project, @NotNull final ID<?, ?> id) {
    return () -> FileBasedIndex.getInstance().getIndexModificationStamp(id, project);
}
 
Example #23
Source File: ReferenceDiagramDataModel.java    From intellij-reference-diagram with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
public ModificationTracker getModificationTracker() {
    return PsiManager.getInstance(getProject()).getModificationTracker();
}
 
Example #24
Source File: DelegatingTypeScriptConfigService.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public ModificationTracker getTracker() {
  return impl.getTracker();
}
 
Example #25
Source File: DelegatingTypeScriptConfigService.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public ModificationTracker getConfigTracker(@Nullable VirtualFile file) {
  return impl.getConfigTracker(file);
}
 
Example #26
Source File: BlazeTypeScriptConfigServiceImpl.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public ModificationTracker getTracker() {
  return BlazeSyncModificationTracker.getInstance(project);
}
 
Example #27
Source File: BlazeTypeScriptConfigServiceImpl.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public ModificationTracker getConfigTracker(@Nullable VirtualFile file) {
  return BlazeSyncModificationTracker.getInstance(project);
}
 
Example #28
Source File: TemplateAnnotationTypeProvider.java    From idea-php-generics-plugin with MIT License 4 votes vote down vote up
@NotNull
private static ModificationTracker getModificationTracker(@NotNull Project project) {
    return () -> FileBasedIndex.getInstance().getIndexModificationStamp(TemplateAnnotationIndex.KEY, project);
}
 
Example #29
Source File: PsiModificationTracker.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * @return an object returning {@link #getJavaStructureModificationCount()}
 * @deprecated rarely supported by JVM language plugins; also a wrong way for optimisations
 */
@Deprecated
@Nonnull
ModificationTracker getJavaStructureModificationTracker();
 
Example #30
Source File: PsiModificationTracker.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * @return an object returning {@link #getOutOfCodeBlockModificationCount()}
 * @deprecated rarely supported by language plugins; also a wrong way for optimisations
 */
@Deprecated
@Nonnull
ModificationTracker getOutOfCodeBlockModificationTracker();