• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UserDataHolderEx类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
@NotNull
static RefCountHolder get(@NotNull PsiFile file) {
  Reference<RefCountHolder> ref = file.getUserData(REF_COUNT_HOLDER_IN_FILE_KEY);
  RefCountHolder holder = com.intellij.reference.SoftReference.dereference(ref);
  if (holder == null) {
    holder = new RefCountHolder(file);
    Reference<RefCountHolder> newRef = new SoftReference<RefCountHolder>(holder);
    while (true) {
      boolean replaced = ((UserDataHolderEx)file).replace(REF_COUNT_HOLDER_IN_FILE_KEY, ref, newRef);
      if (replaced) {
        break;
      }
      ref = file.getUserData(REF_COUNT_HOLDER_IN_FILE_KEY);
      RefCountHolder newHolder = com.intellij.reference.SoftReference.dereference(ref);
      if (newHolder != null) {
        holder = newHolder;
        break;
      }
    }
  }
  return holder;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:RefCountHolder.java


示例2: shouldAbbreviateName

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
private static boolean shouldAbbreviateName(PsiPackage aPackage) {
  final Project project = aPackage.getProject();
  ConcurrentMap<PsiPackage, Boolean> map = project.getUserData(SHOULD_ABBREV_PACK_KEY);
  if (map == null) {
    final ConcurrentMap<PsiPackage, Boolean> newMap = ContainerUtil.createConcurrentWeakMap();
    map = ((UserDataHolderEx)project).putUserDataIfAbsent(SHOULD_ABBREV_PACK_KEY, newMap);
    if (map == newMap) {
      ((PsiManagerEx)PsiManager.getInstance(project)).registerRunnableToRunOnChange(new Runnable() {
        @Override
        public void run() {
          newMap.clear();
        }
      });
    }
  }

  Boolean ret = map.get(aPackage);
  if (ret != null) return ret;
  ret = scanPackages(aPackage, 1);
  map.put(aPackage, ret);
  return ret;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:TreeViewUtil.java


示例3: getParameterizedCachedValue

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
public <T, D extends UserDataHolder, P> T getParameterizedCachedValue(@NotNull D dataHolder,
                            @NotNull Key<ParameterizedCachedValue<T,P>> key,
                            @NotNull ParameterizedCachedValueProvider<T, P> provider,
                            boolean trackValue,
                            P parameter) {
  ParameterizedCachedValue<T,P> value;

  if (dataHolder instanceof UserDataHolderEx) {
    UserDataHolderEx dh = (UserDataHolderEx)dataHolder;
    value = dh.getUserData(key);
    if (value == null) {
      value = createParameterizedCachedValue(provider, trackValue);
      value = dh.putUserDataIfAbsent(key, value);
    }
  }
  else {
    synchronized (dataHolder) {
      value = dataHolder.getUserData(key);
      if (value == null) {
        value = createParameterizedCachedValue(provider, trackValue);
        dataHolder.putUserData(key, value);
      }
    }
  }
  return value.getValue(parameter);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:CachedValuesManager.java


示例4: set

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
public long set(@NotNull Document document, @NotNull ID<?, ?> indexId, long value) {
  List<IdVersionInfo> list = document.getUserData(KEY);
  if (list == null) {
    list = ((UserDataHolderEx)document).putUserDataIfAbsent(KEY, new ArrayList<IdVersionInfo>());
  }

  synchronized (list) {
    for (IdVersionInfo info : list) {
      if (info.id == indexId) {
        long old = info.docVersion;
        if (info.mapVersion != mapVersion) {
          old = INVALID_STAMP;
          info.mapVersion = mapVersion;
        }
        info.docVersion = value;
        return old;
      }
    }
    list.add(new IdVersionInfo(indexId, value, mapVersion));
    return INVALID_STAMP;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PerIndexDocumentVersionMap.java


示例5: processDynamicElements

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
@Override
public void processDynamicElements(@NotNull PsiType qualifierType,
                                   PsiClass aClass,
                                   @NotNull PsiScopeProcessor processor,
                                   @NotNull PsiElement place,
                                   @NotNull ResolveState state) {
  ClassHint classHint = processor.getHint(ClassHint.KEY);
  if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) return;

  MultiMap<String, PsiMethod> methodMap = aClass.getUserData(KEY);
  if (methodMap == null) {
    MyBuilder builder = new MyBuilder(aClass);
    builder.generateMethods();
    methodMap = ((UserDataHolderEx)aClass).putUserDataIfAbsent(KEY, builder.myResult);
  }

  String nameHint = ResolveUtil.getNameHint(processor);

  Collection<? extends PsiMethod> methods = nameHint == null ? methodMap.values() : methodMap.get(nameHint);

  for (PsiMethod method : methods) {
    if (!processor.execute(method, state)) return;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SwingBuilderNonCodeMemberContributor.java


示例6: shouldAbbreviateName

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
private static boolean shouldAbbreviateName(PsiPackage aPackage) {
  final Project project = aPackage.getProject();
  ConcurrentMap<PsiPackage, Boolean> map = project.getUserData(SHOULD_ABBREV_PACK_KEY);
  if (map == null) {
    final ConcurrentWeakHashMap<PsiPackage, Boolean> newMap = new ConcurrentWeakHashMap<PsiPackage, Boolean>();
    map = ((UserDataHolderEx)project).putUserDataIfAbsent(SHOULD_ABBREV_PACK_KEY, newMap);
    if (map == newMap) {
      ((PsiManagerEx)PsiManager.getInstance(project)).registerRunnableToRunOnChange(new Runnable() {
        @Override
        public void run() {
          newMap.clear();
        }
      });
    }
  }

  Boolean ret = map.get(aPackage);
  if (ret != null) return ret;
  ret = scanPackages(aPackage, 1);
  map.put(aPackage, ret);
  return ret;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:TreeViewUtil.java


示例7: getAndSet

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
public long getAndSet(@NotNull Document document, @NotNull ID<?, ?> indexId, long value) {
  List<IdVersionInfo> list = document.getUserData(KEY);
  if (list == null) {
    list = ((UserDataHolderEx)document).putUserDataIfAbsent(KEY, new ArrayList<IdVersionInfo>());
  }

  synchronized (list) {
    for (IdVersionInfo info : list) {
      if (info.id == indexId) {
        long old = info.docVersion;
        if (info.mapVersion != mapVersion) {
          old = 0;
          info.mapVersion = mapVersion;
        }
        info.docVersion = value;
        return old;
      }
    }
    list.add(new IdVersionInfo(indexId, value, mapVersion));
    return 0;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:PerIndexDocumentVersionMap.java


示例8: processDynamicElements

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
@Override
public void processDynamicElements(@NotNull PsiType qualifierType,
                                   PsiClass aClass,
                                   PsiScopeProcessor processor,
                                   PsiElement place,
                                   ResolveState state) {
  ClassHint classHint = processor.getHint(ClassHint.KEY);
  if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) return;

  MultiMap<String, PsiMethod> methodMap = aClass.getUserData(KEY);
  if (methodMap == null) {
    MyBuilder builder = new MyBuilder(aClass);
    builder.generateMethods();
    methodMap = ((UserDataHolderEx)aClass).putUserDataIfAbsent(KEY, builder.myResult);
  }

  String nameHint = ResolveUtil.getNameHint(processor);

  Collection<? extends PsiMethod> methods = nameHint == null ? methodMap.values() : methodMap.get(nameHint);

  for (PsiMethod method : methods) {
    if (!processor.execute(method, state)) return;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:SwingBuilderNonCodeMemberContributor.java


示例9: getResultCacheResultImpl

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
@Exported
@NotNull
@RequiredReadAction
private static <E extends PsiElement> DotNetTypeRef getResultCacheResultImpl(@NotNull Key<CachedValue<DotNetTypeRef>> cachedValueKey,
		@NotNull E element,
		@NotNull Key dropKey,
		@NotNull final NotNullFunction<E, DotNetTypeRef> resolver)
{
	Class<? extends NotNullFunction> aClass = resolver.getClass();
	if(!BitUtil.isSet(aClass.getModifiers(), Modifier.STATIC))
	{
		throw new IllegalArgumentException("Accepted only static resolver");
	}

	CachedValue<DotNetTypeRef> cachedValue = element.getUserData(cachedValueKey);
	if(cachedValue == null)
	{
		DotNetTypeRefCachedValueProvider<E> provider = new DotNetTypeRefCachedValueProvider<>(dropKey, element, resolver);

		cachedValue = ((UserDataHolderEx) element).putUserDataIfAbsent(cachedValueKey, CachedValuesManager.getManager(element.getProject()).createCachedValue(provider, false));

		return cachedValue.getValue();
	}
	return cachedValue.getValue();
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:26,代码来源:DotNetTypeRefCacheUtil.java


示例10: getParameterizedCachedValue

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
public <T, D extends UserDataHolder, P> T getParameterizedCachedValue(@Nonnull D dataHolder,
                                                                      @Nonnull Key<ParameterizedCachedValue<T, P>> key,
                                                                      @Nonnull ParameterizedCachedValueProvider<T, P> provider,
                                                                      boolean trackValue,
                                                                      P parameter) {
  ParameterizedCachedValue<T, P> value;

  if (dataHolder instanceof UserDataHolderEx) {
    UserDataHolderEx dh = (UserDataHolderEx)dataHolder;
    value = dh.getUserData(key);
    if (value == null) {
      value = createParameterizedCachedValue(provider, trackValue);
      value = dh.putUserDataIfAbsent(key, value);
    }
  }
  else {
    synchronized (dataHolder) {
      value = dataHolder.getUserData(key);
      if (value == null) {
        value = createParameterizedCachedValue(provider, trackValue);
        dataHolder.putUserData(key, value);
      }
    }
  }
  return value.getValue(parameter);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:CachedValuesManager.java


示例11: set

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
public long set(@Nonnull Document document, @Nonnull ID<?, ?> indexId, long value) {
  List<IdVersionInfo> list = document.getUserData(KEY);
  if (list == null) {
    list = ((UserDataHolderEx)document).putUserDataIfAbsent(KEY, new ArrayList<>());
  }

  synchronized (list) {
    for (IdVersionInfo info : list) {
      if (info.id == indexId) {
        long old = info.docVersion;
        if (info.mapVersion != mapVersion) {
          old = INVALID_STAMP;
          info.mapVersion = mapVersion;
        }
        info.docVersion = value;
        return old;
      }
    }
    list.add(new IdVersionInfo(indexId, value, mapVersion));
    return INVALID_STAMP;
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:PerIndexDocumentVersionMap.java


示例12: getMarkupModelMap

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
private static ConcurrentMap<Project, MarkupModelImpl> getMarkupModelMap(@NotNull Document document) {
  ConcurrentMap<Project, MarkupModelImpl> markupModelMap = document.getUserData(MARKUP_MODEL_MAP_KEY);
  if (markupModelMap == null) {
    ConcurrentMap<Project, MarkupModelImpl> newMap = ContainerUtil.newConcurrentMap();
    markupModelMap = ((UserDataHolderEx)document).putUserDataIfAbsent(MARKUP_MODEL_MAP_KEY, newMap);
  }
  return markupModelMap;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DocumentMarkupModel.java


示例13: getCachedValue

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
@Override
@Nullable
public <T, D extends UserDataHolder> T getCachedValue(@NotNull D dataHolder,
                                                      @NotNull Key<CachedValue<T>> key,
                                                      @NotNull CachedValueProvider<T> provider,
                                                      boolean trackValue) {
  CachedValueChecker.checkProvider(provider, dataHolder);
  CachedValue<T> value;
  if (dataHolder instanceof UserDataHolderEx) {
    UserDataHolderEx dh = (UserDataHolderEx)dataHolder;
    value = dh.getUserData(key);
    if (value instanceof CachedValueBase && !((CachedValueBase)value).isFromMyProject(myProject)) {
      value = null;
      dh.putUserData(key, null);
    }
    if (value == null) {
      value = createCachedValue(provider, trackValue);
      assert ((CachedValueBase)value).isFromMyProject(myProject);
      value = dh.putUserDataIfAbsent(key, value);
    }
  }
  else {
    synchronized (dataHolder) {
      value = dataHolder.getUserData(key);
      if (value instanceof CachedValueBase && !((CachedValueBase)value).isFromMyProject(myProject)) {
        value = null;
      }
      if (value == null) {
        value = createCachedValue(provider, trackValue);
        dataHolder.putUserData(key, value);
      }
    }
  }
  return value.getValue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:CachedValuesManagerImpl.java


示例14: updateSaveability

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
private static void updateSaveability(Map<Document, Project> documentsToWarn, boolean allowSave) {
  Object newValue = allowSave ? null : SAVE_DENIED;
  for (Document document : documentsToWarn.keySet()) {
    Project oldData = documentsToWarn.get(document);
    //the committing thread could have finished already and file is not being committed anymore
    ((UserDataHolderEx)document).replace(CommitHelper.DOCUMENT_BEING_COMMITTED_KEY, oldData, newValue);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:VetoSavingCommittingDocumentsAdapter.java


示例15: getHighlightInfoMap

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
@Nullable
public Map<RangeHighlighter, HighlightInfo> getHighlightInfoMap(@NotNull Editor editor, boolean toCreate) {
  if (editor instanceof EditorWindow) return getHighlightInfoMap(((EditorWindow)editor).getDelegate(), toCreate);
  Map<RangeHighlighter, HighlightInfo> map = editor.getUserData(HIGHLIGHT_INFO_MAP_KEY);
  if (map == null && toCreate) {
    map = ((UserDataHolderEx)editor).putUserDataIfAbsent(HIGHLIGHT_INFO_MAP_KEY, new HashMap<RangeHighlighter, HighlightInfo>());
  }
  return map;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:HighlightManagerImpl.java


示例16: getAllTargetNames

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
public static Set<String> getAllTargetNames(@NotNull final Module module) {
  CachedValue<Set<String>> cachedTargets = module.getUserData(ALL_TARGET_KEY);
  if (cachedTargets == null) {
    cachedTargets = CachedValuesManager.getManager(module.getProject()).createCachedValue(new CachedValueProvider<Set<String>>() {
        @Override
        public Result<Set<String>> compute() {
          return Result.create(getAllTargetNamesInternal(module), PsiModificationTracker.MODIFICATION_COUNT);
        }
      }, false);

    cachedTargets = ((UserDataHolderEx)module).putUserDataIfAbsent(ALL_TARGET_KEY, cachedTargets);
  }

  return cachedTargets.getValue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:MvcTargetDialogCompletionUtils.java


示例17: getUseScope

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
@NotNull
@Override
public SearchScope getUseScope() {
    // For find usages, we want GraphQL PSI elements to be considered project-wide.
    // This enables find usages in modules that live outside the project base dir
    // but we only want to find usages in relevant file types, e.g. GraphQL, JS and TypeScript
    final Project project = getProject();
    final GlobalSearchScope cached = project.getUserData(USE_SCOPE);
    return cached != null ? cached : ((UserDataHolderEx)project).putUserDataIfAbsent(USE_SCOPE, createFileTypeRestrictedUsageScope(project));
}
 
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:11,代码来源:JSGraphQLNamedPsiElement.java


示例18: getInstance

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
private static RefCountHolder getInstance(@NotNull PsiFile file, @NotNull ProgressIndicator indicator, boolean acquire) {
  HolderReference ref = file.getUserData(REF_COUNT_HOLDER_IN_FILE_KEY);
  RefCountHolder holder = ref == null ? null : ref.get();
  if (holder == null && acquire) {
    holder = new RefCountHolder(file);
    HolderReference newRef = new HolderReference(holder);
    while (true) {
      boolean replaced = ((UserDataHolderEx)file).replace(REF_COUNT_HOLDER_IN_FILE_KEY, ref, newRef);
      if (replaced) {
        ref = newRef;
        break;
      }
      ref = file.getUserData(REF_COUNT_HOLDER_IN_FILE_KEY);
      RefCountHolder newHolder = ref == null ? null : ref.get();
      if (newHolder != null) {
        holder = newHolder;
        break;
      }
    }
  }
  if (ref != null) {
    if (acquire) {
      ref.acquire(indicator);
    }
    else {
      ref.release(indicator);
    }
  }
  return holder;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:31,代码来源:RefCountHolder.java


示例19: getParameterizedCachedValue

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
public <T, D extends UserDataHolder, P> T getParameterizedCachedValue(@NotNull D dataHolder,
                            @NotNull Key<ParameterizedCachedValue<T,P>> key,
                            @NotNull ParameterizedCachedValueProvider<T, P> provider,
                            boolean trackValue,
                            P parameter) {

  ParameterizedCachedValue<T,P> value;

  if (dataHolder instanceof UserDataHolderEx) {
    UserDataHolderEx dh = (UserDataHolderEx)dataHolder;
    value = dh.getUserData(key);
    if (value == null) {
      value = createParameterizedCachedValue(provider, trackValue);
      value = dh.putUserDataIfAbsent(key, value);
    }
  }
  else {
    synchronized (dataHolder) {
      value = dataHolder.getUserData(key);
      if (value == null) {
        value = createParameterizedCachedValue(provider, trackValue);
        dataHolder.putUserData(key, value);
      }
    }
  }
  return value.getValue(parameter);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:CachedValuesManager.java


示例20: get

import com.intellij.openapi.util.UserDataHolderEx; //导入依赖的package包/类
@NotNull
public static TextBlock get(@NotNull PsiFile file) {
  TextBlock textBlock = file.getUserData(KEY_TEXT_BLOCK);
  if (textBlock == null){
    textBlock = ((UserDataHolderEx)file).putUserDataIfAbsent(KEY_TEXT_BLOCK, new TextBlock());
  }

  return textBlock;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:TextBlock.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LabeledValue类代码示例发布时间:2022-05-23
下一篇:
Java DefaultConnectionFactory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap