本文整理汇总了Java中com.intellij.psi.xml.XmlFile.putUserData方法的典型用法代码示例。如果您正苦于以下问题:Java XmlFile.putUserData方法的具体用法?Java XmlFile.putUserData怎么用?Java XmlFile.putUserData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.xml.XmlFile
的用法示例。
在下文中一共展示了XmlFile.putUserData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMockElement
import com.intellij.psi.xml.XmlFile; //导入方法依赖的package包/类
@Override
public final <T extends DomElement> T createMockElement(final Class<T> aClass, final Module module, final boolean physical) {
final XmlFile file = (XmlFile)PsiFileFactory.getInstance(myProject).createFileFromText("a.xml", StdFileTypes.XML, "", (long)0, physical);
file.putUserData(MOCK_ELEMENT_MODULE, module);
file.putUserData(MOCK, new Object());
return getFileElement(file, aClass, "I_sincerely_hope_that_nobody_will_have_such_a_root_tag_name").getRootElement();
}
示例2: internChildrenHolder
import com.intellij.psi.xml.XmlFile; //导入方法依赖的package包/类
private static <T extends DomChildDescriptionImpl> ChildrenDescriptionsHolder<T> internChildrenHolder(XmlFile file, ChildrenDescriptionsHolder<T> holder) {
SoftReference<WeakInterner<ChildrenDescriptionsHolder>> ref = file.getUserData(HOLDERS_CACHE);
WeakInterner<ChildrenDescriptionsHolder> cache = SoftReference.dereference(ref);
if (cache == null) {
cache = new WeakInterner<ChildrenDescriptionsHolder>();
file.putUserData(HOLDERS_CACHE, new SoftReference<WeakInterner<ChildrenDescriptionsHolder>>(cache));
}
//noinspection unchecked
return cache.intern(holder);
}
示例3: getCachedSchema
import com.intellij.psi.xml.XmlFile; //导入方法依赖的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();
}