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


Java MultiHostInjector类代码示例

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


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

示例1: checkInjectorsAreDisposed

import com.intellij.lang.injection.MultiHostInjector; //导入依赖的package包/类
@TestOnly
public static void checkInjectorsAreDisposed(@NotNull Project project) {
  InjectedLanguageManagerImpl cachedManager = (InjectedLanguageManagerImpl)project.getUserData(INSTANCE_CACHE);
  if (cachedManager == null) {
    return;
  }
  try {
    ClassMapCachingNulls<MultiHostInjector> cached = cachedManager.cachedInjectors;
    if (cached == null) return;
    for (Map.Entry<Class, MultiHostInjector[]> entry : cached.getBackingMap().entrySet()) {
      Class key = entry.getKey();
      if (cachedManager.myInjectorsClone.isEmpty()) return;
      MultiHostInjector[] oldInjectors = cachedManager.myInjectorsClone.get(key);
      for (MultiHostInjector injector : entry.getValue()) {
        if (!ArrayUtil.contains(injector, oldInjectors)) {
          throw new AssertionError("Injector was not disposed: " + key + " -> " + injector);
        }
      }
    }
  }
  finally {
    cachedManager.myInjectorsClone.clear();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:InjectedLanguageManagerImpl.java

示例2: registerMultiHostInjector

import com.intellij.lang.injection.MultiHostInjector; //导入依赖的package包/类
@Override
public void registerMultiHostInjector(@NotNull MultiHostInjector injector) {
  for (Class<? extends PsiElement> place : injector.elementsToInjectIn()) {
    LOG.assertTrue(place != null, injector);
    while (true) {
      MultiHostInjector[] injectors = this.injectors.get(place);
      if (injectors == null) {
        if (this.injectors.putIfAbsent(place, new MultiHostInjector[]{injector}) == null) break;
      }
      else {
        MultiHostInjector[] newInfos = ArrayUtil.append(injectors, injector);
        if (this.injectors.replace(place, injectors, newInfos)) break;
      }
    }
  }
  cachedInjectors.clearCache();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:InjectedLanguageManagerImpl.java

示例3: unregisterMultiHostInjector

import com.intellij.lang.injection.MultiHostInjector; //导入依赖的package包/类
@Override
public boolean unregisterMultiHostInjector(@NotNull MultiHostInjector injector) {
  boolean removed = false;
  Iterator<Map.Entry<Class,MultiHostInjector[]>> iterator = injectors.entrySet().iterator();
  while (iterator.hasNext()) {
    Map.Entry<Class,MultiHostInjector[]> entry = iterator.next();
    MultiHostInjector[] infos = entry.getValue();
    int i = ArrayUtil.find(infos, injector);
    if (i != -1) {
      MultiHostInjector[] newInfos = ArrayUtil.remove(infos, i);
      if (newInfos.length == 0) {
        iterator.remove();
      }
      else {
        injectors.put(entry.getKey(), newInfos);
      }
      removed = true;
    }
  }
  cachedInjectors.clearCache();
  return removed;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:InjectedLanguageManagerImpl.java

示例4: checkInjectorsAreDisposed

import com.intellij.lang.injection.MultiHostInjector; //导入依赖的package包/类
@TestOnly
public static void checkInjectorsAreDisposed(@NotNull Project project) {
  InjectedLanguageManagerImpl cachedManager = (InjectedLanguageManagerImpl)project.getUserData(INSTANCE_CACHE);
  if (cachedManager == null) {
    return;
  }
  try {
    for (Map.Entry<Class, MultiHostInjector[]> entry : cachedManager.injectors.entrySet()) {
      Class key = entry.getKey();
      if (cachedManager.myInjectorsClone.isEmpty()) return;
      MultiHostInjector[] oldInjectors = cachedManager.myInjectorsClone.get(key);
      for (MultiHostInjector injector : entry.getValue()) {
        if (!ArrayUtil.contains(injector, oldInjectors)) {
          throw new AssertionError("Injector was not disposed: " + key + " -> " + injector);
        }
      }
    }
  }
  finally {
    cachedManager.myInjectorsClone.clear();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:InjectedLanguageManagerImpl.java

示例5: checkInjectorsAreDisposed

import com.intellij.lang.injection.MultiHostInjector; //导入依赖的package包/类
@TestOnly
public static void checkInjectorsAreDisposed(@Nullable Project project) {
  InjectedLanguageManagerImpl cachedManager = project == null ? null : (InjectedLanguageManagerImpl)project.getUserData(INSTANCE_CACHE);
  if (cachedManager == null) return;

  try {
    ClassMapCachingNulls<MultiHostInjector> cached = cachedManager.cachedInjectors;
    if (cached == null) return;
    for (Map.Entry<Class, MultiHostInjector[]> entry : cached.getBackingMap().entrySet()) {
      Class key = entry.getKey();
      if (cachedManager.myInjectorsClone.isEmpty()) return;
      MultiHostInjector[] oldInjectors = cachedManager.myInjectorsClone.get(key);
      for (MultiHostInjector injector : entry.getValue()) {
        if (ArrayUtil.indexOf(oldInjectors, injector) == -1) {
          throw new AssertionError("Injector was not disposed: " + key + " -> " + injector);
        }
      }
    }
  }
  finally {
    cachedManager.myInjectorsClone.clear();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:InjectedLanguageManagerImpl.java

示例6: setUp

import com.intellij.lang.injection.MultiHostInjector; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  Disposer.register(my, BlockExtensions.create(Extensions.getRootArea().getExtensionPoint(LanguageAnnotators.EP_NAME)));
  Disposer.register(my, BlockExtensions.create(Extensions.getRootArea().getExtensionPoint(LineMarkerProviders.EP_NAME)));
  Disposer.register(my, BlockExtensions.create(Extensions.getArea(getProject()).getExtensionPoint(JavaConcatenationInjectorManager.CONCATENATION_INJECTOR_EP_NAME)));
  Disposer.register(my, BlockExtensions.create(Extensions.getArea(getProject()).getExtensionPoint(MultiHostInjector.MULTIHOST_INJECTOR_EP_NAME)));

  IntentionManager.getInstance().getAvailableIntentionActions();  // hack to avoid slowdowns in PyExtensionFactory
  PathManagerEx.getTestDataPath(); // to cache stuff
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:LightAdvHighlightingPerformanceTest.java

示例7: processInjectableElements

import com.intellij.lang.injection.MultiHostInjector; //导入依赖的package包/类
public void processInjectableElements(Collection<PsiElement> in, Processor<PsiElement> processor) {
  ClassMapCachingNulls<MultiHostInjector> map = getInjectorMap();
  for (PsiElement element : in) {
    if (map.get(element.getClass()) != null)
      processor.process(element);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:InjectedLanguageManagerImpl.java

示例8: getInjectorMap

import com.intellij.lang.injection.MultiHostInjector; //导入依赖的package包/类
private ClassMapCachingNulls<MultiHostInjector> getInjectorMap() {
  ClassMapCachingNulls<MultiHostInjector> cached = cachedInjectors;
  if (cached != null) {
    return cached;
  }

  Map<Class, MultiHostInjector[]> injectors = ContainerUtil.newHashMap();

  List<MultiHostInjector> allInjectors = ContainerUtil.newArrayList();
  allInjectors.addAll(myManualInjectors);
  Collections.addAll(allInjectors, MultiHostInjector.MULTIHOST_INJECTOR_EP_NAME.getExtensions(myProject));
  if (LanguageInjector.EXTENSION_POINT_NAME.getExtensions().length > 0) {
    allInjectors.add(PsiManagerRegisteredInjectorsAdapter.INSTANCE);
  }

  for (MultiHostInjector injector : allInjectors) {
    for (Class<? extends PsiElement> place : injector.elementsToInjectIn()) {
      LOG.assertTrue(place != null, injector);
      MultiHostInjector[] existing = injectors.get(place);
      injectors.put(place, existing == null ? new MultiHostInjector[]{injector} : ArrayUtil.append(existing, injector));
    }
  }

  ClassMapCachingNulls<MultiHostInjector> result = new ClassMapCachingNulls<MultiHostInjector>(injectors, new MultiHostInjector[0]);
  cachedInjectors = result;
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:InjectedLanguageManagerImpl.java

示例9: unregisterMultiHostInjector

import com.intellij.lang.injection.MultiHostInjector; //导入依赖的package包/类
@Override
public boolean unregisterMultiHostInjector(@NotNull MultiHostInjector injector) {
  try {
    return myManualInjectors.remove(injector);
  }
  finally {
    clearInjectorCache();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:InjectedLanguageManagerImpl.java

示例10: processInPlaceInjectorsFor

import com.intellij.lang.injection.MultiHostInjector; //导入依赖的package包/类
public void processInPlaceInjectorsFor(@NotNull PsiElement element, @NotNull InjProcessor processor) {
  MultiHostInjector[] infos = getInjectorMap().get(element.getClass());
  if (infos != null) {
    final boolean dumb = myDumbService.isDumb();
    for (MultiHostInjector injector : infos) {
      if (dumb && !DumbService.isDumbAware(injector)) {
        continue;
      }

      if (!processor.process(element, injector)) return;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:InjectedLanguageManagerImpl.java

示例11: process

import com.intellij.lang.injection.MultiHostInjector; //导入依赖的package包/类
@Override
public boolean process(PsiElement element, MultiHostInjector injector) {
  if (hostRegistrar == null) {
    hostRegistrar = new MultiHostRegistrarImpl(myProject, myHostPsiFile, element);
  }
  injector.getLanguagesToInject(hostRegistrar, element);
  List<Pair<Place,PsiFile>> result = hostRegistrar.getResult();
  return result == null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:InjectedPsiCachedValueProvider.java

示例12: psiManagerInjectorsChanged

import com.intellij.lang.injection.MultiHostInjector; //导入依赖的package包/类
public void psiManagerInjectorsChanged() {
  LanguageInjector[] extensions = Extensions.getExtensions(LanguageInjector.EXTENSION_POINT_NAME);
  if (extensions.length == 0) {
    MultiHostInjector prev = myPsiManagerRegisteredInjectorsAdapter.getAndSet(null);
    if (prev != null) {
      unregisterMultiHostInjector(prev);
    }
  }
  else {
    PsiManagerRegisteredInjectorsAdapter adapter = new PsiManagerRegisteredInjectorsAdapter();
    if (myPsiManagerRegisteredInjectorsAdapter.compareAndSet(null, adapter)) {
      registerMultiHostInjector(adapter);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:InjectedLanguageManagerImpl.java

示例13: processInPlaceInjectorsFor

import com.intellij.lang.injection.MultiHostInjector; //导入依赖的package包/类
public void processInPlaceInjectorsFor(@NotNull PsiElement element, @NotNull InjProcessor processor) {
  MultiHostInjector[] infos = cachedInjectors.get(element.getClass());
  if (infos != null) {
    final boolean dumb = myDumbService.isDumb();
    for (MultiHostInjector injector : infos) {
      if (dumb && !DumbService.isDumbAware(injector)) {
        continue;
      }

      if (!processor.process(element, injector)) return;
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:InjectedLanguageManagerImpl.java

示例14: processInjectableElements

import com.intellij.lang.injection.MultiHostInjector; //导入依赖的package包/类
public void processInjectableElements(@Nonnull Collection<PsiElement> in, @Nonnull Processor<PsiElement> processor) {
  ClassMapCachingNulls<MultiHostInjector> map = getInjectorMap();
  for (PsiElement element : in) {
    if (map.get(element.getClass()) != null) {
      processor.process(element);
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:9,代码来源:InjectedLanguageManagerImpl.java

示例15: getInjectorMap

import com.intellij.lang.injection.MultiHostInjector; //导入依赖的package包/类
@Nonnull
private ClassMapCachingNulls<MultiHostInjector> getInjectorMap() {
  ClassMapCachingNulls<MultiHostInjector> cached = cachedInjectors;
  if (cached != null) {
    return cached;
  }

  Map<Class, MultiHostInjector[]> injectors = ContainerUtil.newHashMap();

  MultiMap<Class, MultiHostInjector> allInjectors = new MultiMap<>();
  allInjectors.putAllValues(myManualInjectors);
  if (LanguageInjector.EXTENSION_POINT_NAME.getExtensions().length > 0) {
    allInjectors.putValue(PsiLanguageInjectionHost.class, PsiManagerRegisteredInjectorsAdapter.INSTANCE);
  }

  for (MultiHostInjectorExtensionPoint point : MultiHostInjector.EP_NAME.getExtensions(myProject)) {
    Class<PsiElement> key = point.getKey();
    MultiHostInjector multiHostInjector = point.getInstance(myProject);
    allInjectors.putValue(key, multiHostInjector);
  }

  for (Map.Entry<Class, Collection<MultiHostInjector>> entry : allInjectors.entrySet()) {
    injectors.put(entry.getKey(), entry.getValue().toArray(MultiHostInjector.EMPTY_ARRAY));
  }

  ClassMapCachingNulls<MultiHostInjector> result = new ClassMapCachingNulls<>(injectors, MultiHostInjector.EMPTY_ARRAY, new ArrayList<>(allInjectors.values()));
  cachedInjectors = result;
  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:30,代码来源:InjectedLanguageManagerImpl.java


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