当前位置: 首页>>代码示例>>Java>>正文


Java ModificationTracker类代码示例

本文整理汇总了Java中com.intellij.openapi.util.ModificationTracker的典型用法代码示例。如果您正苦于以下问题:Java ModificationTracker类的具体用法?Java ModificationTracker怎么用?Java ModificationTracker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ModificationTracker类属于com.intellij.openapi.util包,在下文中一共展示了ModificationTracker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNavigationElement

import com.intellij.openapi.util.ModificationTracker; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
@NotNull
public PsiElement getNavigationElement() {
  for (ClsCustomNavigationPolicy customNavigationPolicy : Extensions.getExtensions(ClsCustomNavigationPolicy.EP_NAME)) {
    if (customNavigationPolicy instanceof ClsCustomNavigationPolicyEx) {
      PsiFile navigationElement = ((ClsCustomNavigationPolicyEx)customNavigationPolicy).getFileNavigationElement(this);
      if (navigationElement != null) {
        return navigationElement;
      }
    }
  }

  return CachedValuesManager.getCachedValue(this, new CachedValueProvider<PsiElement>() {
    @Nullable
    @Override
    public Result<PsiElement> compute() {
      PsiElement target = JavaPsiImplementationHelper.getInstance(getProject()).getClsFileNavigationElement(ClsFileImpl.this);
      ModificationTracker tracker = FileIndexFacade.getInstance(getProject()).getRootModificationTracker();
      return Result.create(target, ClsFileImpl.this, target.getContainingFile(), tracker);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ClsFileImpl.java

示例2: getFileToArtifactsMap

import com.intellij.openapi.util.ModificationTracker; //导入依赖的package包/类
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(ArtifactManager.getInstance(myProject).getModificationTracker());
          for (ComplexPackagingElementType<?> type : PackagingElementFactory.getInstance().getComplexElementTypes()) {
            ContainerUtil.addIfNotNull(type.getAllSubstitutionsModificationTracker(myProject), trackers);
          }
          return Result.create(result, trackers.toArray(new ModificationTracker[trackers.size()]));
        }
      }, false);
  }
  return myFile2Artifacts;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ArtifactBySourceFileFinderImpl.java

示例3: cacheParticularEntity

import com.intellij.openapi.util.ModificationTracker; //导入依赖的package包/类
public static void cacheParticularEntity(PsiFile file, XmlEntityDecl decl) {
  synchronized(PsiLock.LOCK) {
    final Map<String, CachedValue<XmlEntityDecl>> cachingMap = getCachingMap(file);
    final String name = decl.getName();
    if (cachingMap.containsKey(name)) return;
    final SmartPsiElementPointer declPointer = SmartPointerManager.getInstance(file.getProject()).createSmartPsiElementPointer(decl);

    cachingMap.put(
      name, CachedValuesManager.getManager(file.getProject()).createCachedValue(new CachedValueProvider<XmlEntityDecl>() {
        @Override
        public Result<XmlEntityDecl> compute() {
          PsiElement declElement = declPointer.getElement();
          if (declElement instanceof XmlEntityDecl && declElement.isValid() && name.equals(((XmlEntityDecl)declElement).getName()))
            return new Result<XmlEntityDecl>((XmlEntityDecl)declElement, declElement);
          cachingMap.put(name,null);
          return new Result<XmlEntityDecl>(null, ModificationTracker.NEVER_CHANGED);
        }
      },
      false
    ));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:XmlEntityCache.java

示例4: compute

import com.intellij.openapi.util.ModificationTracker; //导入依赖的package包/类
@Override
public Result<Map<String, Set<Define>>> compute() {
  try {
    myScope.acceptChildren(this);

    final PsiElement psiElement = myScope.getPsiElement();
    if (psiElement == null || !psiElement.isValid()) {
      return Result.create(null, ModificationTracker.EVER_CHANGED);
    }

    final PsiFile file = psiElement.getContainingFile();
    if (myVisitedFiles.get() != null) {
      myVisitedFiles.get().add(file);
      return Result.create(myDefines.get(), myVisitedFiles.get().toArray());
    } else {
      return Result.create(myDefines.get(), file);
    }
  } finally {
    myVisitedFiles.remove();
    myDefines.remove();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:DefinitionResolver.java

示例5: getDependences

import com.intellij.openapi.util.ModificationTracker; //导入依赖的package包/类
@Override
public Object[] getDependences() {
  if (myPattern != null) {
    if (DumbService.isDumb(myElement.getProject())) {
      return new Object[] { ModificationTracker.EVER_CHANGED, ExternalResourceManager.getInstance()};
    }
    final Object[] a = { myElement, ExternalResourceManager.getInstance() };
    final PsiElementProcessor.CollectElements<XmlFile> processor = new PsiElementProcessor.CollectElements<XmlFile>();
    RelaxIncludeIndex.processForwardDependencies(myFile, processor);
    if (processor.getCollection().size() > 0) {
      return ArrayUtil.mergeArrays(a, processor.toArray());
    } else {
      return a;
    }
  }
  return new Object[]{ ModificationTracker.EVER_CHANGED };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:RngNsDescriptor.java

示例6: compute

import com.intellij.openapi.util.ModificationTracker; //导入依赖的package包/类
@Nullable
@Override
public final Result<T> compute() {
  AndroidFacet[] facets = myComponent.getDataBindingEnabledFacets();
  List<V> values = Lists.newArrayList();

  List<ModificationTracker> newDependencies = Lists.newArrayList();
  newDependencies.add(myComponent);
  Collections.addAll(newDependencies, myAdditionalTrackers);
  for (AndroidFacet facet : facets) {
    CachedValue<V> cachedValue = getCachedValue(facet);
    // we know this for sure since it is created from createCacheProvider
    if (cachedValue.getValueProvider() instanceof ModificationTracker) {
      newDependencies.add((ModificationTracker)cachedValue.getValueProvider());
    }
    V result = cachedValue.getValue();
    if (result != null) {
      values.add(result);
    }
  }
  myDependencyModificationCountOnCompute = calculateModificationCountFrom(newDependencies);
  myDependencies = newDependencies;
  return Result.create(merge(values), this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ProjectResourceCachedValueProvider.java

示例7: getInstance

import com.intellij.openapi.util.ModificationTracker; //导入依赖的package包/类
@Nullable
public static MvcFramework getInstance(@Nullable final Module module) {
  if (module == null) {
    return null;
  }

  final Project project = module.getProject();

  return CachedValuesManager.getManager(project).getCachedValue(module, new CachedValueProvider<MvcFramework>() {
    @Override
    public Result<MvcFramework> compute() {
      final ModificationTracker tracker = MvcModuleStructureSynchronizer.getInstance(project).getFileAndRootsModificationTracker();
      for (final MvcFramework framework : EP_NAME.getExtensions()) {
        if (framework.hasSupport(module)) {
          return Result.create(framework, tracker);
        }
      }
      return Result.create(null, tracker);

    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:MvcFramework.java

示例8: compute

import com.intellij.openapi.util.ModificationTracker; //导入依赖的package包/类
public Result<Map<String, Set<Define>>> compute() {
  try {
    myScope.acceptChildren(this);

    final PsiElement psiElement = myScope.getPsiElement();
    if (psiElement == null || !psiElement.isValid()) {
      return Result.create(null, ModificationTracker.EVER_CHANGED);
    }

    final PsiFile file = psiElement.getContainingFile();
    if (myVisitedFiles.get() != null) {
      myVisitedFiles.get().add(file);
      return Result.create(myDefines.get(), myVisitedFiles.get().toArray());
    } else {
      return Result.create(myDefines.get(), file);
    }
  } finally {
    myVisitedFiles.remove();
    myDefines.remove();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:DefinitionResolver.java

示例9: getDependences

import com.intellij.openapi.util.ModificationTracker; //导入依赖的package包/类
public Object[] getDependences() {
  if (myPattern != null) {
    if (DumbService.isDumb(myElement.getProject())) {
      return new Object[] { ModificationTracker.EVER_CHANGED, ExternalResourceManager.getInstance()};
    }
    final Object[] a = { myElement, ExternalResourceManager.getInstance() };
    final PsiElementProcessor.CollectElements<XmlFile> processor = new PsiElementProcessor.CollectElements<XmlFile>();
    RelaxIncludeIndex.processForwardDependencies(myFile, processor);
    if (processor.getCollection().size() > 0) {
      return ArrayUtil.mergeArrays(a, processor.toArray());
    } else {
      return a;
    }
  }
  return new Object[]{ ModificationTracker.EVER_CHANGED };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:RngNsDescriptor.java

示例10: cacheParticularEntity

import com.intellij.openapi.util.ModificationTracker; //导入依赖的package包/类
public static void cacheParticularEntity(PsiFile file, XmlEntityDecl decl)
{
	synchronized(LOCK)
	{
		final Map<String, CachedValue<XmlEntityDecl>> cachingMap = getCachingMap(file);
		final String name = decl.getName();
		if(cachingMap.containsKey(name))
		{
			return;
		}
		final SmartPsiElementPointer declPointer = SmartPointerManager.getInstance(file.getProject()).createSmartPsiElementPointer(decl);

		cachingMap.put(name, CachedValuesManager.getManager(file.getProject()).createCachedValue(() ->
		{
			PsiElement declElement = declPointer.getElement();
			if(declElement instanceof XmlEntityDecl && declElement.isValid() && name.equals(((XmlEntityDecl) declElement).getName()))
			{
				return new CachedValueProvider.Result<>((XmlEntityDecl) declElement, declElement);
			}
			cachingMap.put(name, null);
			return new CachedValueProvider.Result<>(null, ModificationTracker.NEVER_CHANGED);
		}, false));
	}
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:25,代码来源:XmlEntityCache.java

示例11: getDependences

import com.intellij.openapi.util.ModificationTracker; //导入依赖的package包/类
@Override
public Object[] getDependences() {
  if (myPattern != null) {
    if (DumbService.isDumb(myElement.getProject())) {
      return new Object[] { ModificationTracker.EVER_CHANGED, ExternalResourceManager.getInstance()};
    }
    final Object[] a = { myElement, ExternalResourceManager.getInstance() };
    final PsiElementProcessor.CollectElements<XmlFile> processor = new PsiElementProcessor.CollectElements<>();
    RelaxIncludeIndex.processForwardDependencies(myFile, processor);
    if (processor.getCollection().size() > 0) {
      return ArrayUtil.mergeArrays(a, processor.toArray());
    } else {
      return a;
    }
  }
  return new Object[]{ ModificationTracker.EVER_CHANGED };
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:18,代码来源:RngNsDescriptor.java

示例12: createContractAnnotation

import com.intellij.openapi.util.ModificationTracker; //导入依赖的package包/类
public PsiAnnotation createContractAnnotation(String contractValue)
{
	Map<String, PsiAnnotation> cache = CachedValuesManager.getManager(myProject).getCachedValue(myProject, new CachedValueProvider<Map<String, PsiAnnotation>>()
	{
		@Nullable
		@Override
		public Result<Map<String, PsiAnnotation>> compute()
		{
			Map<String, PsiAnnotation> map = new ConcurrentFactoryMap<String, PsiAnnotation>()
			{
				@Nullable
				@Override
				protected PsiAnnotation create(String attrs)
				{
					return createAnnotationFromText("@org.jetbrains.annotations.Contract(" + attrs + ")");
				}
			};
			return CachedValueProvider.Result.create(map, ModificationTracker.NEVER_CHANGED);
		}
	});
	return cache.get(contractValue);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:ProjectBytecodeAnalysis.java

示例13: TemplateEngineProvider

import com.intellij.openapi.util.ModificationTracker; //导入依赖的package包/类
public TemplateEngineProvider(Project project, NotNullLazyValue<ModificationTracker> tracker) {
  super(project);

  this.tracker = tracker;
  for (TemplateEngine engine : TemplateEngine.values()) {
    engines.put("catberry-" + engine, engine);
  }
}
 
开发者ID:catberry,项目名称:catberry-idea-plugin,代码行数:9,代码来源:TemplateEngineProvider.java

示例14: getNotNullAnnotation

import com.intellij.openapi.util.ModificationTracker; //导入依赖的package包/类
public PsiAnnotation getNotNullAnnotation() {
  return CachedValuesManager.getManager(myProject).getCachedValue(myProject, new CachedValueProvider<PsiAnnotation>() {
    @Nullable
    @Override
    public Result<PsiAnnotation> compute() {
      return Result.create(createAnnotationFromText("@" + AnnotationUtil.NOT_NULL), ModificationTracker.NEVER_CHANGED);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ProjectBytecodeAnalysis.java

示例15: getNullableAnnotation

import com.intellij.openapi.util.ModificationTracker; //导入依赖的package包/类
public PsiAnnotation getNullableAnnotation() {
  return CachedValuesManager.getManager(myProject).getCachedValue(myProject, new CachedValueProvider<PsiAnnotation>() {
    @Nullable
    @Override
    public Result<PsiAnnotation> compute() {
      return Result.create(createAnnotationFromText("@" + AnnotationUtil.NULLABLE), ModificationTracker.NEVER_CHANGED);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ProjectBytecodeAnalysis.java


注:本文中的com.intellij.openapi.util.ModificationTracker类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。