本文整理汇总了Java中org.jetbrains.yaml.psi.YAMLValue类的典型用法代码示例。如果您正苦于以下问题:Java YAMLValue类的具体用法?Java YAMLValue怎么用?Java YAMLValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
YAMLValue类属于org.jetbrains.yaml.psi包,在下文中一共展示了YAMLValue类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: visitFile
import org.jetbrains.yaml.psi.YAMLValue; //导入依赖的package包/类
@Override
public void visitFile(PsiFile file) {
// @TODO: detection of routing files in right way
// routing.yml
// comment.routing.yml
// routing/foo.yml
if(!YamlHelper.isRoutingFile(file)) {
return;
}
YAMLDocument document = PsiTreeUtil.findChildOfType(file, YAMLDocument.class);
if(document == null) {
return;
}
YAMLValue topLevelValue = document.getTopLevelValue();
if(topLevelValue != null) {
YamlHelper.attachDuplicateKeyInspection(topLevelValue, holder);
}
}
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:21,代码来源:DuplicateLocalRouteInspection.java
示例2: handleContentChange
import org.jetbrains.yaml.psi.YAMLValue; //导入依赖的package包/类
public YAMLKeyValueImpl handleContentChange(@NotNull YAMLKeyValueImpl element, @NotNull TextRange range, String newContent) throws IncorrectOperationException {
String oldText = element.getText();
String newText = oldText.substring(0, range.getStartOffset()) + newContent + oldText.substring(range.getEndOffset());
YAMLValue value = element.getValue();
Project project = element.getProject();
if (value instanceof YAMLPlainTextImpl) {
return (YAMLKeyValueImpl) element.replace(createYamlPlainText(project, element.getKeyText(), newText.substring(element.getTextLength() - element.getValueText().length())));
}
if (value instanceof YAMLQuotedTextImpl) {
return (YAMLKeyValueImpl) element.replace(createYamlDoubleQuotedString(project, element.getKeyText(), newText.substring(element.getTextLength() - element.getValueText().length())));
}
return null;
}
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:14,代码来源:CoffigYamlKeyValueManipulator.java
示例3: isPrivateInput
import org.jetbrains.yaml.psi.YAMLValue; //导入依赖的package包/类
private boolean isPrivateInput(PsiElement element, String keyForLookup) {
if (element instanceof YAMLKeyValue && keyForLookup.equals(INPUT_KEY)) {
YAMLValue value = ((YAMLKeyValue) element).getValue();
if (value instanceof YAMLBlockMappingImpl) {
return isPrivatePropertyTrue(value);
}
}
return false;
}
开发者ID:CloudSlang,项目名称:cs-intellij-plugin,代码行数:10,代码来源:ExecutableAnnotator.java
示例4: isPrivatePropertyTrue
import org.jetbrains.yaml.psi.YAMLValue; //导入依赖的package包/类
private boolean isPrivatePropertyTrue(YAMLValue value) {
List<YAMLPsiElement> yamlElements = value.getYAMLElements();
for (YAMLPsiElement e : yamlElements) {
if (e instanceof YAMLKeyValue) {
YAMLKeyValue property = (YAMLKeyValue) e;
if (property.getKeyText().equals(PRIVATE) && property.getValueText().equals(TRUE.toString())) {
return true;
}
}
}
return false;
}
开发者ID:CloudSlang,项目名称:cs-intellij-plugin,代码行数:13,代码来源:ExecutableAnnotator.java
示例5: registerReferenceProviders
import org.jetbrains.yaml.psi.YAMLValue; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(
PlatformPatterns.psiElement(YAMLValue.class),
new ValueReferenceProvider()
);
}
开发者ID:cvette,项目名称:intellij-neos,代码行数:8,代码来源:ValueReferenceContributor.java
示例6: getReferencesByElement
import org.jetbrains.yaml.psi.YAMLValue; //导入依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
if(!NeosProjectComponent.isEnabled(element)) {
return new PsiReference[0];
}
YAMLValue yamlElement = (YAMLValue) element;
return new PsiReference[] {
new ValueReference(yamlElement)
};
}
开发者ID:cvette,项目名称:intellij-neos,代码行数:13,代码来源:ValueReferenceContributor.java
示例7: annotate
import org.jetbrains.yaml.psi.YAMLValue; //导入依赖的package包/类
@Override
public void annotate(@NotNull final PsiElement element, @NotNull final AnnotationHolder annotationHolder) {
if (!KubernetesYamlPsiUtil.isKubernetesFile(element)) {
return;
}
final ModelProvider modelProvider = ModelProvider.INSTANCE;
final ResourceTypeKey resourceKey = KubernetesYamlPsiUtil.findResourceKey(element);
if (resourceKey != null && element instanceof YAMLKeyValue) {
final YAMLKeyValue keyValue = (YAMLKeyValue) element;
final Property property = KubernetesYamlPsiUtil.propertyForKey(modelProvider, resourceKey, keyValue);
final YAMLValue value = keyValue.getValue();
if (property != null && property.getType() != null && value != null) {
switch (property.getType()) {
case ARRAY:
if (!(value instanceof YAMLSequence)) {
annotationHolder.createErrorAnnotation(value, "The content of " + keyValue.getKeyText() + " should be an array.");
}
break;
case OBJECT:
if (!(value instanceof YAMLMapping)) {
annotationHolder.createErrorAnnotation(value, "The content of " + keyValue.getKeyText() + " should be an object.");
}
break;
}
}
}
}
开发者ID:tinselspoon,项目名称:intellij-kubernetes,代码行数:28,代码来源:DataTypeCheckerAnnotator.java
示例8: getTopLevelMapping
import org.jetbrains.yaml.psi.YAMLValue; //导入依赖的package包/类
/**
* Gets the top-level mapping in the document, if present.
*
* @param element an element within the document.
* @return the top-level mapping, or {@code null} if one is not defined (e.g. in an empty document).
*/
@Nullable
public static YAMLMapping getTopLevelMapping(final PsiElement element) {
final YAMLDocument document = PsiTreeUtil.getParentOfType(element, YAMLDocument.class);
if (document != null) {
final YAMLValue topLevelValue = document.getTopLevelValue();
if (topLevelValue instanceof YAMLMapping) {
return (YAMLMapping) topLevelValue;
}
}
return null;
}
开发者ID:tinselspoon,项目名称:intellij-kubernetes,代码行数:18,代码来源:KubernetesYamlPsiUtil.java
示例9: findGUIDFromFile
import org.jetbrains.yaml.psi.YAMLValue; //导入依赖的package包/类
public static String findGUIDFromFile(@NotNull YAMLFile psiFile)
{
String guid = null;
List<YAMLDocument> documents = psiFile.getDocuments();
for(YAMLDocument document : documents)
{
YAMLValue topLevelValue = document.getTopLevelValue();
if(topLevelValue instanceof YAMLMapping)
{
YAMLKeyValue guidValue = ((YAMLMapping) topLevelValue).getKeyValueByKey(Unity3dMetaManager.GUID_KEY);
guid = guidValue == null ? null : guidValue.getValueText();
}
}
return guid;
}
开发者ID:consulo,项目名称:consulo-unity3d,代码行数:16,代码来源:Unity3dMetaIndexExtension.java
示例10: getRangeInElement
import org.jetbrains.yaml.psi.YAMLValue; //导入依赖的package包/类
@RequiredReadAction
@NotNull
@Override
public TextRange getRangeInElement()
{
YAMLValue value = myKeyValue.getValue();
if(value == null)
{
return super.getRangeInElement();
}
int startOffsetInParent = value.getStartOffsetInParent();
return new TextRange(startOffsetInParent, startOffsetInParent + value.getTextLength());
}
开发者ID:consulo,项目名称:consulo-unity3d,代码行数:14,代码来源:Unity3dAssetGUIDReference.java
示例11: ValueReference
import org.jetbrains.yaml.psi.YAMLValue; //导入依赖的package包/类
public ValueReference(YAMLValue yamlElement) {
// the "textRange" is used for highlighting the source element
super(yamlElement, new TextRange(0, yamlElement.getTextLength()));
this.yamlElement = yamlElement;
}
开发者ID:cvette,项目名称:intellij-neos,代码行数:6,代码来源:ValueReference.java
示例12: filePattern
import org.jetbrains.yaml.psi.YAMLValue; //导入依赖的package包/类
private PsiElementPattern.Capture<YAMLValue> filePattern() {
return psiElement(YAMLValue.class)
.withText(StandardPatterns.string().matches("(.)*.ya?ml$"))
.withLanguage(YAMLLanguage.INSTANCE);
}
开发者ID:zalando,项目名称:intellij-swagger,代码行数:6,代码来源:OpenApiYamlReferenceContributor.java
示例13: filePattern
import org.jetbrains.yaml.psi.YAMLValue; //导入依赖的package包/类
private PsiElementPattern.Capture<YAMLValue> filePattern() {
return swagger(psiElement(YAMLValue.class)
.withText(StandardPatterns.string().matches("(.)*.ya?ml(.)*"))
.withLanguage(YAMLLanguage.INSTANCE));
}
开发者ID:zalando,项目名称:intellij-swagger,代码行数:6,代码来源:SwaggerYamlReferenceContributor.java
示例14: tagsPattern
import org.jetbrains.yaml.psi.YAMLValue; //导入依赖的package包/类
private PsiElementPattern.Capture<YAMLValue> tagsPattern() {
return swagger(psiElement(YAMLValue.class).inside(psiElement(YAMLKeyValue.class).withName(SwaggerConstants.TAGS_KEY))
.withLanguage(YAMLLanguage.INSTANCE));
}
开发者ID:zalando,项目名称:intellij-swagger,代码行数:5,代码来源:SwaggerYamlReferenceContributor.java
注:本文中的org.jetbrains.yaml.psi.YAMLValue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论