Java Code Examples for com.intellij.openapi.util.ModificationTracker

The following examples show how to use com.intellij.openapi.util.ModificationTracker. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: consulo   Source File: ArtifactBySourceFileFinderImpl.java    License: 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 Project: consulo   Source File: ComputableActionGroup.java    License: 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 3
Source Project: consulo   Source File: PsiModificationTrackerImpl.java    License: 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 Project: consulo   Source File: StructureViewComponent.java    License: 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 5
@NotNull
private static ModificationTracker getModificationTracker(@NotNull Project project) {
    return () -> FileBasedIndex.getInstance().getIndexModificationStamp(TemplateAnnotationIndex.KEY, project);
}
 
Example 6
Source Project: intellij   Source File: BlazeSyncModificationTracker.java    License: Apache License 2.0 4 votes vote down vote up
public static ModificationTracker getInstance(Project project) {
  return ServiceManager.getService(project, BlazeSyncModificationTracker.class)
      .modificationTracker;
}
 
Example 7
Source Project: intellij   Source File: BlazeTypeScriptConfigServiceImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ModificationTracker getConfigTracker(@Nullable VirtualFile file) {
  return BlazeSyncModificationTracker.getInstance(project);
}
 
Example 8
Source Project: intellij   Source File: BlazeTypeScriptConfigServiceImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ModificationTracker getTracker() {
  return BlazeSyncModificationTracker.getInstance(project);
}
 
Example 9
@Override
public ModificationTracker getConfigTracker(@Nullable VirtualFile file) {
  return impl.getConfigTracker(file);
}
 
Example 10
@Override
public ModificationTracker getTracker() {
  return impl.getTracker();
}
 
Example 11
@NotNull
@Override
public ModificationTracker getModificationTracker() {
    return PsiManager.getInstance(getProject()).getModificationTracker();
}
 
Example 12
Source Project: idea-php-symfony2-plugin   Source File: FileIndexCaches.java    License: 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 13
Source Project: consulo   Source File: ComplexPackagingElementType.java    License: Apache License 2.0 4 votes vote down vote up
@javax.annotation.Nullable
public ModificationTracker getAllSubstitutionsModificationTracker(@Nonnull Project project) {
  return null;
}
 
Example 14
Source Project: consulo   Source File: LightFileIndexFacade.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public ModificationTracker getRootModificationTracker() {
  return ModificationTracker.NEVER_CHANGED;
}
 
Example 15
Source Project: consulo   Source File: ProjectFileIndexFacade.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public ModificationTracker getRootModificationTracker() {
  return ProjectRootManager.getInstance(myProject);
}
 
Example 16
Source Project: consulo   Source File: ArtifactManagerImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ModificationTracker getModificationTracker() {
  return myModificationTracker;
}
 
Example 17
Source Project: consulo   Source File: FileIndexFacade.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
public abstract ModificationTracker getRootModificationTracker();
 
Example 18
Source Project: consulo   Source File: DumbServiceImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ModificationTracker getModificationTracker() {
  return this;
}
 
Example 19
Source Project: consulo   Source File: EncodingProjectManagerImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
public ModificationTracker getModificationTracker() {
  return myModificationTracker;
}
 
Example 20
Source Project: consulo   Source File: MockDumbService.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ModificationTracker getModificationTracker() {
  return new SimpleModificationTracker();
}
 
Example 21
Source Project: consulo   Source File: MockFileIndexFacade.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public ModificationTracker getRootModificationTracker() {
  return ModificationTracker.NEVER_CHANGED;
}
 
Example 22
Source Project: consulo   Source File: PsiModificationTrackerImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public ModificationTracker getOutOfCodeBlockModificationTracker() {
  return myModificationCount;
}
 
Example 23
Source Project: consulo   Source File: PsiModificationTrackerImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public ModificationTracker getJavaStructureModificationTracker() {
  return myModificationCount;
}
 
Example 24
Source Project: consulo   Source File: PsiModificationTrackerImpl.java    License: 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 25
Source Project: consulo   Source File: DefaultFileIndexFacade.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public ModificationTracker getRootModificationTracker() {
  return ModificationTracker.NEVER_CHANGED;
}
 
Example 26
Source Project: consulo   Source File: FoldingModelWindow.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public long getModificationCount() {
  return myDelegate instanceof ModificationTracker ? ((ModificationTracker)myDelegate).getModificationCount() : 0;
}
 
Example 27
Source Project: CppTools   Source File: Communicator.java    License: Apache License 2.0 4 votes vote down vote up
public ModificationTracker getServerRestartTracker() {
  return myServerRestartTracker;
}
 
Example 28
Source Project: CppTools   Source File: Communicator.java    License: Apache License 2.0 4 votes vote down vote up
public ModificationTracker getModificationTracker() {
  return myModificationTracker;
}
 
Example 29
Source Project: consulo   Source File: PsiModificationTracker.java    License: 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();
 
Example 30
Source Project: consulo   Source File: PsiModificationTracker.java    License: 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();