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


Java CachedValuesManager.getManager方法代码示例

本文整理汇总了Java中com.intellij.psi.util.CachedValuesManager.getManager方法的典型用法代码示例。如果您正苦于以下问题:Java CachedValuesManager.getManager方法的具体用法?Java CachedValuesManager.getManager怎么用?Java CachedValuesManager.getManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.util.CachedValuesManager的用法示例。


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

示例1: invoke

import com.intellij.psi.util.CachedValuesManager; //导入方法依赖的package包/类
@Override
public Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
  if (myConverter == Converter.EMPTY_CONVERTER) {
    return getValueInner(handler, myConverter);
  }

  CachedValue<List<Pair<Converter,Object>>> value = handler.getUserData(DOM_VALUE_KEY);
  if (value == null) {
    final DomManagerImpl domManager = handler.getManager();
    final Project project = domManager.getProject();
    final CachedValuesManager cachedValuesManager = CachedValuesManager.getManager(project);
    handler.putUserData(DOM_VALUE_KEY, value = cachedValuesManager.createCachedValue(new CachedValueProvider<List<Pair<Converter,Object>>>() {
      @Override
      public Result<List<Pair<Converter,Object>>> compute() {
        List<Pair<Converter, Object>> list = ContainerUtil.createLockFreeCopyOnWriteList();
        return Result
          .create(list, PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, domManager, ProjectRootManager.getInstance(project));
      }
    }, false));
  }

  return getOrCalcValue(handler, value.getValue());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:GetInvocation.java

示例2: getCachedValue

import com.intellij.psi.util.CachedValuesManager; //导入方法依赖的package包/类
@Nullable
public T getCachedValue(final @NotNull H dataHolder) {
  CachedValue<T> cachedValue = dataHolder.getUserData(myKey);
  if (cachedValue == null) {
    final CachedValueProvider<T> myProvider = new CachedValueProvider<T>() {
      @Override
      @Nullable
      public Result<T> compute() {
        return computeValue(dataHolder);
      }
    };
    final CachedValuesManager manager = CachedValuesManager.getManager(myProject);
    cachedValue = manager.createCachedValue(myProvider, false);
    dataHolder.putUserData(myKey, cachedValue);
  }
  return cachedValue.getValue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DomModelCache.java

示例3: getPropertiesFile

import com.intellij.psi.util.CachedValuesManager; //导入方法依赖的package包/类
public static PropertiesFile getPropertiesFile(final PsiFile file) {
  CachedValuesManager manager = CachedValuesManager.getManager(file.getProject());
  if (file instanceof XmlFile) {
    return manager.getCachedValue(file, KEY,
                                  new CachedValueProvider<PropertiesFile>() {
                                    @Override
                                    public Result<PropertiesFile> compute() {
                                      PropertiesFile value =
                                        XmlPropertiesIndex.isPropertiesFile((XmlFile)file)
                                        ? new XmlPropertiesFileImpl((XmlFile)file)
                                        : null;
                                      return Result.create(value, file);
                                    }
                                  }, false
    );
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:XmlPropertiesFileImpl.java

示例4: runPreview

import com.intellij.psi.util.CachedValuesManager; //导入方法依赖的package包/类
protected void runPreview(boolean forceRefresh) {
    if (!isAutoSync() && !forceRefresh)
        return;

    final Map<String, Object> payload = new HashMap<String, Object>();
    Map<String, Map<String, Object>> flowVars = new HashMap<String, Map<String, Object>>();
    /*
    1. Get input from tabs - if payload exists, use payload, otherwise put in the Map
    2. Get text from DW
    3. Run preview, put the output to the output tab
     */

    int count = inputTabs.getTabCount();
    for (int index = 0; index < count; index++) {
        String title = inputTabs.getTitleAt(index);
        Editor editor = editors.get(title);
        Document document = editor.getDocument();
        String text = document.getText();
        String contentType = contentTypes.get(title);
        Map<String, Object> content = WeavePreview.createContent(contentType, text);
        if ("payload".equalsIgnoreCase(title)) {
            payload.clear();
            payload.putAll(content);
        } else {
            flowVars.put(title, content);
        }
    }

    final CachedValuesManager manager = CachedValuesManager.getManager(project);
    List<String> melFunctions = manager.getCachedValue(psiFile, MEL_STRINGS_KEY, new MelStringsCachedProvider());

    String dwScript = this.textEditor.getEditor().getDocument().getText();

    String output = WeavePreview.runPreview(module, dwScript, payload, flowVars, flowVars, flowVars, flowVars, flowVars, melFunctions);
    if (output != null)
        editors.get("output").getDocument().setText(output);
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:38,代码来源:WeaveEditor.java

示例5: hasErrors

import com.intellij.psi.util.CachedValuesManager; //导入方法依赖的package包/类
private static boolean hasErrors(@NotNull final PsiFile psiFile) {
  CachedValuesManager cachedValuesManager = CachedValuesManager.getManager(psiFile.getProject());
  return cachedValuesManager.getCachedValue(
    psiFile,
    CONTAINS_ERROR_ELEMENT,
    new CachedValueProvider<Boolean>() {
      @Override
      public Result<Boolean> compute() {
        boolean error = hasErrorElements(psiFile);
        return Result.create(error, psiFile);
      }
    },
    false
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:PsiErrorElementUtil.java

示例6: getCachedSchema

import com.intellij.psi.util.CachedValuesManager; //导入方法依赖的package包/类
public static Schema getCachedSchema(final XmlFile descriptorFile) {
  CachedValue<Schema> value = descriptorFile.getUserData(SCHEMA_KEY);
  if (value == null) {
    final CachedValueProvider<Schema> provider = new CachedValueProvider<Schema>() {
      @Override
      public Result<Schema> compute() {
        final InputSource inputSource = makeInputSource(descriptorFile);

        try {
          final Schema schema = new MySchemaReader(descriptorFile).createSchema(inputSource, EMPTY_PROPS);
          final PsiElementProcessor.CollectElements<XmlFile> processor = new PsiElementProcessor.CollectElements<XmlFile>();
          RelaxIncludeIndex.processForwardDependencies(descriptorFile, processor);
          if (processor.getCollection().size() > 0) {
            return Result.create(schema, processor.toArray(), descriptorFile);
          } else {
            return Result.createSingleDependency(schema, descriptorFile);
          }
        } catch (Exception e) {
          LOG.info(e);
          return Result.createSingleDependency(null, descriptorFile);
        }
      }
    };

    final CachedValuesManager mgr = CachedValuesManager.getManager(descriptorFile.getProject());
    value = mgr.createCachedValue(provider,  false);
    descriptorFile.putUserData(SCHEMA_KEY, value);
  }
  return value.getValue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:RngParser.java

示例7: getAllVariants

import com.intellij.psi.util.CachedValuesManager; //导入方法依赖的package包/类
@Nullable
public static Map<String, Set<Define>> getAllVariants(Grammar scope) {
  final PsiElement psiElement = scope.getPsiElement();
  if (psiElement == null || !psiElement.isValid()) return null;

  final CachedValuesManager manager = CachedValuesManager.getManager(psiElement.getProject());
  CachedValue<Map<String, Set<Define>>> data = psiElement.getUserData(KEY);
  if (data == null || !((DefinitionResolver)data.getValueProvider()).isValid()) {
    final DefinitionResolver resolver = new DefinitionResolver(scope);
    data = manager.createCachedValue(resolver, false);
    psiElement.putUserData(KEY, data);
  }
  return data.getValue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:DefinitionResolver.java

示例8: getSchema

import com.intellij.psi.util.CachedValuesManager; //导入方法依赖的package包/类
@Override
public XmlFile getSchema(@NotNull @NonNls String url, @Nullable final Module module, @NotNull PsiFile baseFile) {
  if (module == null || AndroidFacet.getInstance(module) == null) return null;

  Map<String, CachedValue<XmlFile>> descriptors = module.getUserData(DESCRIPTORS_MAP_IN_MODULE);
  if (descriptors == null) {
    descriptors = new THashMap<String, CachedValue<XmlFile>>();
    module.putUserData(DESCRIPTORS_MAP_IN_MODULE, descriptors);
  }
  CachedValue<XmlFile> reference = descriptors.get(url);
  if (reference != null) {
    return reference.getValue();
  }
  CachedValuesManager manager = CachedValuesManager.getManager(module.getProject());
  reference = manager.createCachedValue(new CachedValueProvider<XmlFile>() {
    @Override
    public Result<XmlFile> compute() {
      final URL resource = AndroidXmlSchemaProvider.class.getResource("android.xsd");
      final VirtualFile fileByURL = VfsUtil.findFileByURL(resource);
      XmlFile result = (XmlFile)PsiManager.getInstance(module.getProject()).findFile(fileByURL).copy();
      return new Result<XmlFile>(result, PsiModificationTracker.MODIFICATION_COUNT);
    }
  }, false);

  descriptors.put(url, reference);
  return reference.getValue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:AndroidXmlSchemaProvider.java

示例9: getCachedValue

import com.intellij.psi.util.CachedValuesManager; //导入方法依赖的package包/类
@Override
public <T> T getCachedValue(@NotNull GroovyPsiElement element, @NotNull final Computable<T> computable) {
  CachedValuesManager manager = CachedValuesManager.getManager(element.getProject());
  Key<CachedValue<T>> key = manager.getKeyForClass(computable.getClass());
  return manager.getCachedValue(element, key, new CachedValueProvider<T>() {
    @Nullable
    @Override
    public Result<T> compute() {
      return Result.create(computable.compute(), PsiModificationTracker.MODIFICATION_COUNT);
    }
  }, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:InferenceContext.java

示例10: FacetFinderImpl

import com.intellij.psi.util.CachedValuesManager; //导入方法依赖的package包/类
public FacetFinderImpl(Project project) {
  myProject = project;
  myCachedValuesManager = CachedValuesManager.getManager(project);
  myModuleManager = ModuleManager.getInstance(myProject);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:FacetFinderImpl.java

示例11: getURLsForModule

import com.intellij.psi.util.CachedValuesManager; //导入方法依赖的package包/类
private static List<URL> getURLsForModule(Module module) throws Exception {

        final CachedValuesManager manager = CachedValuesManager.getManager(module.getProject());
        List<URL> loaderUrls = manager.getParameterizedCachedValue(module, URLS_KEY, new ClasspathUtils.UrlsCachedProvider(), false, module);

        return loaderUrls;
    }
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:8,代码来源:ClasspathUtils.java


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