本文整理汇总了Java中com.intellij.util.xml.ConvertContext类的典型用法代码示例。如果您正苦于以下问题:Java ConvertContext类的具体用法?Java ConvertContext怎么用?Java ConvertContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConvertContext类属于com.intellij.util.xml包,在下文中一共展示了ConvertContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromString
import com.intellij.util.xml.ConvertContext; //导入依赖的package包/类
@Override
public String fromString(@Nullable @NonNls String s, final ConvertContext context) {
if (s == null) return null;
if (myAllowEmpty && s.trim().length() == 0) return s;
if (s.trim().length() == 1) return s;
if (isUnicodeCharacterSequence(s)) {
try {
Integer.parseInt(s.substring(UNICODE_PREFIX.length()), 16);
return s;
} catch (NumberFormatException e) {}
}
return null;
}
示例2: doIsValid
import com.intellij.util.xml.ConvertContext; //导入依赖的package包/类
@Override
protected boolean doIsValid(MavenId id, MavenProjectIndicesManager manager, ConvertContext context) {
if (StringUtil.isEmpty(id.getGroupId()) || StringUtil.isEmpty(id.getArtifactId())) return false;
if (manager.hasArtifactId(id.getGroupId(), id.getArtifactId())) {
return true;
}
// Check if artifact was found on importing.
MavenProject mavenProject = findMavenProject(context);
if (mavenProject != null) {
for (MavenArtifact artifact : mavenProject.findDependencies(id.getGroupId(), id.getArtifactId())) {
if (artifact.isResolved()) {
return true;
}
}
}
return false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:MavenArtifactCoordinatesArtifactIdConverter.java
示例3: fromString
import com.intellij.util.xml.ConvertContext; //导入依赖的package包/类
public TargetResolver.Result fromString(@Nullable @NonNls String s, ConvertContext context) {
final AntDomProject project = context.getInvocationElement().getParentOfType(AntDomProject.class, false);
if (project == null) {
return null;
}
final AntDomTarget contextTarget = context.getInvocationElement().getParentOfType(AntDomTarget.class, false);
if (contextTarget == null) {
return null;
}
final List<String> refs;
if (s == null) {
refs = Collections.emptyList();
}
else {
refs = new ArrayList<String>();
final StringTokenizer tokenizer = new StringTokenizer(s, ",", false);
while (tokenizer.hasMoreTokens()) {
final String ref = tokenizer.nextToken();
refs.add(ref.trim());
}
}
final TargetResolver.Result result = TargetResolver.resolve(project.getContextAntProject(), contextTarget, refs);
result.setRefsString(s);
return result;
}
示例4: fromString
import com.intellij.util.xml.ConvertContext; //导入依赖的package包/类
@Nullable
public TargetResolver.Result fromString(@Nullable @NonNls String s, ConvertContext context) {
final AntDomElement element = AntSupport.getInvocationAntDomElement(context);
if (element != null && s != null) {
final AntDomProject project = element.getAntProject();
AntDomProject projectToSearchFrom;
final AntDomAnt antDomAnt = element.getParentOfType(AntDomAnt.class, false);
if (antDomAnt != null) {
final PsiFileSystemItem antFile = antDomAnt.getAntFilePath().getValue();
projectToSearchFrom = antFile instanceof PsiFile? AntSupport.getAntDomProjectForceAntFile((PsiFile)antFile) : null;
}
else {
projectToSearchFrom = project.getContextAntProject();
}
if (projectToSearchFrom == null) {
return null;
}
final TargetResolver.Result result = TargetResolver.resolve(projectToSearchFrom, null, s);
result.setRefsString(s);
return result;
}
return null;
}
示例5: fromString
import com.intellij.util.xml.ConvertContext; //导入依赖的package包/类
@Nullable
@Override
public ActionOrGroup fromString(@Nullable @NonNls final String value, ConvertContext context) {
if (StringUtil.isEmptyOrSpaces(value)) return null;
final ActionOrGroup[] result = {null};
PairProcessor<String, ActionOrGroup> findProcessor = new PairProcessor<String, ActionOrGroup>() {
@Override
public boolean process(String s, ActionOrGroup actionOrGroup) {
if (isRelevant(actionOrGroup) &&
Comparing.strEqual(value, s)) {
result[0] = actionOrGroup;
return false;
}
return true;
}
};
processActionOrGroup(context, findProcessor);
return result[0];
}
示例6: collectLibraryLanguages
import com.intellij.util.xml.ConvertContext; //导入依赖的package包/类
private static List<LanguageDefinition> collectLibraryLanguages(final ConvertContext context,
final Collection<PsiClass> allLanguages) {
return ContainerUtil.mapNotNull(Language.getRegisteredLanguages(), new NullableFunction<Language, LanguageDefinition>() {
@Override
public LanguageDefinition fun(Language language) {
if (language.getID().isEmpty() ||
language instanceof DependentLanguage) {
return null;
}
final PsiClass psiClass = DomJavaUtil.findClass(language.getClass().getName(), context.getInvocationElement());
if (psiClass == null) {
return null;
}
if (!allLanguages.contains(psiClass)) {
return null;
}
final LanguageFileType type = language.getAssociatedFileType();
final Icon icon = type != null ? type.getIcon() : null;
return new LanguageDefinition(language.getID(),
psiClass,
icon, language.getDisplayName());
}
});
}
示例7: getVariants
import com.intellij.util.xml.ConvertContext; //导入依赖的package包/类
@NotNull
@Override
public Collection<? extends String> getVariants(ConvertContext context) {
final XmlElement element = context.getXmlElement();
if (element == null) {
return Collections.emptyList();
}
final String value = ResourceReferenceConverter.getValue(element);
if (value == null) {
return Collections.emptyList();
}
final String intPrefix = getIntegerPrefix(value);
if (intPrefix.isEmpty()) {
return Collections.emptyList();
}
final List<String> result = new ArrayList<String>(ourUnits.size());
for (String unit : ourUnits.keySet()) {
result.add(intPrefix + unit);
}
return result;
}
示例8: doIsValid
import com.intellij.util.xml.ConvertContext; //导入依赖的package包/类
@Override
protected boolean doIsValid(MavenId id, MavenProjectIndicesManager manager, ConvertContext context) {
if (StringUtil.isEmpty(id.getGroupId())) return false;
if (manager.hasGroupId(id.getGroupId())) return true;
// Check if artifact was found on importing.
MavenProject mavenProject = findMavenProject(context);
if (mavenProject != null) {
for (MavenArtifact artifact : mavenProject.findDependencies(id.getGroupId(), id.getArtifactId())) {
if (artifact.isResolved()) {
return true;
}
}
}
return false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MavenArtifactCoordinatesGroupIdConverter.java
示例9: createReferences
import com.intellij.util.xml.ConvertContext; //导入依赖的package包/类
@NotNull
@Override
public PsiReference[] createReferences(GenericDomValue value, final PsiElement element, final ConvertContext context) {
return new PsiReference[]{new WebReference(element) {
@NotNull
@Override
public Object[] getVariants() {
Module module = context.getModule();
if (module != null) {
String name = MavenRepositoriesProvider.getInstance().getRepositoryUrl(getRepositoryId(context));
if (!StringUtil.isEmptyOrSpaces(name)) return new Object[]{name};
}
return super.getVariants();
}
}};
}
示例10: fromString
import com.intellij.util.xml.ConvertContext; //导入依赖的package包/类
@Nullable
@Override
public PsiField fromString(@Nullable final String text, final ConvertContext context) {
DomElement host = context.getInvocationElement();
if (host instanceof GenericAttributeValue<?>) {
DomElement domProperty = host.getParent();
return domProperty instanceof Property ? BeansUtils.resolveToPsiField((Property) domProperty, text) : null;
}
return null;
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:11,代码来源:BeansPropertyNameConverter.java
示例11: searchForName
import com.intellij.util.xml.ConvertContext; //导入依赖的package包/类
@Override
protected ItemType searchForName(
@NotNull final String name, @NotNull final ConvertContext context, @NotNull final TSMetaModel meta
) {
return Optional.ofNullable(meta.findMetaClassByName(name))
.map(TSMetaClass::retrieveAllDomsStream)
.orElse(Stream.empty())
.findFirst()
.orElse(null);
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:11,代码来源:ItemTypeConverter.java
示例12: searchAll
import com.intellij.util.xml.ConvertContext; //导入依赖的package包/类
@Override
protected Collection<? extends ItemType> searchAll(
@NotNull final ConvertContext context, @NotNull final TSMetaModel meta
) {
return meta.getMetaClassesStream()
.map(TSMetaClass::retrieveAllDomsStream)
.map(Stream::findFirst)
.filter(Optional::isPresent)
.map(Optional::get)
.collect(Collectors.toList());
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:12,代码来源:ItemTypeConverter.java
示例13: fromString
import com.intellij.util.xml.ConvertContext; //导入依赖的package包/类
@Nullable
@Override
public final DOM fromString(
@Nullable @NonNls final String s, final ConvertContext context
) {
if (StringUtil.isEmpty(s)) {
return null;
}
return searchForName(s, context, TSMetaModelAccess.getInstance(context.getProject()).
getTypeSystemMeta(context.getFile()));
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:12,代码来源:TypeSystemConverterBase.java
示例14: searchForName
import com.intellij.util.xml.ConvertContext; //导入依赖的package包/类
@Override
protected AtomicType searchForName(
@NotNull final String name, @NotNull final ConvertContext context, @NotNull final TSMetaModel meta
) {
return Optional.ofNullable(meta.findMetaAtomicByName(name))
.map(TSMetaAtomic::retrieveDom)
.orElse(null);
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:9,代码来源:AtomicTypeConverter.java
示例15: searchAll
import com.intellij.util.xml.ConvertContext; //导入依赖的package包/类
@Override
protected Collection<? extends AtomicType> searchAll(
@NotNull final ConvertContext context, @NotNull final TSMetaModel meta
) {
return meta.getMetaAtomicStream()
.map(TSMetaAtomic::retrieveDom)
.filter(Objects::nonNull)
.collect(Collectors.toList());
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:10,代码来源:AtomicTypeConverter.java