- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.jetbrains.yaml.psi.YAMLKeyValue.getKeyText()
方法的一些代码示例,展示了YAMLKeyValue.getKeyText()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YAMLKeyValue.getKeyText()
方法的具体详情如下:
包路径:org.jetbrains.yaml.psi.YAMLKeyValue
类名称:YAMLKeyValue
方法名:getKeyText
暂无
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@Override
public boolean accepts(@NotNull YAMLKeyValue yamlKeyValue, ProcessingContext processingContext) {
return this.keyText.equals(yamlKeyValue.getKeyText());
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@Override
public boolean accepts(@NotNull YAMLKeyValue yamlKeyValue, ProcessingContext context) {
return "_defaults".equals(yamlKeyValue.getKeyText());
}
}));
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@Override
public boolean accepts(@NotNull YAMLKeyValue yamlKeyValue, ProcessingContext context) {
return "bind".equals(yamlKeyValue.getKeyText());
}
}).withParent(defaultsKey));
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@Nullable
@Override
protected String getElementText(@NotNull PsiElement element) {
PsiElement parent = element.getParent();
if(!(parent instanceof YAMLKeyValue)) {
return null;
}
String keyText = ((YAMLKeyValue) parent).getKeyText();
if(StringUtils.isBlank(keyText)) {
return null;
}
return keyText;
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@Nullable
private PsiElement getYamlKeyPath(@NotNull PsiFile psiFile, final @NotNull String findServiceName, @NotNull String rootKey) {
final Collection<PsiElement> psiElements = new ArrayList<>();
// @TODO: support case insensitive
visitQualifiedKeyValuesInFile((YAMLFile) psiFile, rootKey, yamlKeyValue -> {
if(findServiceName.equalsIgnoreCase(yamlKeyValue.getKeyText())) {
psiElements.add(yamlKeyValue);
}
});
if(psiElements.size() == 0) {
return null;
}
// @TODO: provide support for multiple targets
return psiElements.iterator().next();
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@NotNull
private Collection<PsiElement> visitConfigKey(@NotNull PsiElement psiElement) {
PsiElement parent = psiElement.getParent();
if(!(parent instanceof YAMLKeyValue)) {
return Collections.emptyList();
}
String keyText = ((YAMLKeyValue) parent).getKeyText();
if(StringUtils.isBlank(keyText)) {
return Collections.emptyList();
}
return ConfigUtil.getTreeSignatureTargets(psiElement.getProject(), keyText);
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@Override
public boolean value(PsiElement psiElement) {
return psiElement instanceof YAMLKeyValue && ((YAMLKeyValue) psiElement).getKeyText().equals(this.key);
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@Override
public boolean value(PsiElement psiElement) {
return psiElement instanceof YAMLKeyValue && ((YAMLKeyValue) psiElement).getKeyText().equals("name");
}
}));
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@Override
public boolean value(YAMLKeyValue yamlKeyValue) {
return key.equals(yamlKeyValue.getKeyText());
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* services:
* My<caret>Class: ~
*/
private Collection<PsiElement> getClassesForServiceKey(@NotNull PsiElement psiElement) {
PsiElement parent = psiElement.getParent();
if(parent instanceof YAMLKeyValue) {
String valueText = ((YAMLKeyValue) parent).getKeyText();
if(StringUtils.isNotBlank(valueText)) {
return new ArrayList<>(PhpElementsUtil.getClassesInterface(psiElement.getProject(), valueText));
}
}
return Collections.emptyList();
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
private void registerYmlRoutePatternProblem(@NotNull ProblemsHolder holder, @NotNull YAMLKeyValue element) {
String s = PsiElementUtils.trimQuote(element.getKeyText());
if(("factory_class".equals(s) || "factory_method".equals(s) || "factory_service".equals(s)) && YamlElementPatternHelper.getInsideServiceKeyPattern().accepts(element)) {
// services:
// foo:
// factory_*:
registerProblem(holder, element.getKey());
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@Override
public boolean accepts(@NotNull YAMLKeyValue yamlKeyValue, ProcessingContext processingContext) {
return yamlKeyValue.getKeyText().equals("foo");
}
})));
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@Override
public boolean accepts(@NotNull YAMLKeyValue yamlKeyValue, ProcessingContext processingContext) {
return yamlKeyValue.getKeyText().equals("Service\\YamlBar");
}
})));
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
private void registerYmlRoutePatternProblem(@NotNull ProblemsHolder holder, @NotNull YAMLKeyValue element) {
String s = PsiElementUtils.trimQuote(element.getKeyText());
if("pattern".equals(s) && YamlHelper.isRoutingFile(element.getContainingFile())) {
// pattern: foo
holder.registerProblem(element.getKey(), "Pattern is deprecated; use path instead", ProblemHighlightType.LIKE_DEPRECATED);
} else if(("_method".equals(s) || "_scheme".equals(s)) && YamlHelper.isRoutingFile(element.getContainingFile())) {
// requirements: { _method: 'foo', '_scheme': 'foo' }
YAMLKeyValue parentOfType = PsiTreeUtil.getParentOfType(element, YAMLKeyValue.class);
if(parentOfType != null && "requirements".equals(parentOfType.getKeyText())) {
holder.registerProblem(element.getKey(), String.format("The '%s' requirement is deprecated", s), ProblemHighlightType.LIKE_DEPRECATED);
}
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
public static void visitFile(@NotNull YAMLFile psiFile, @NotNull Consumer<ServiceConsumer> consumer) {
ServiceFileDefaults defaults = null;
for (YAMLKeyValue keyValue : YamlHelper.getQualifiedKeyValuesInFile(psiFile, "services")) {
if(defaults == null) {
defaults = createDefaults(psiFile);
}
String serviceId = keyValue.getKeyText();
if(StringUtils.isBlank(serviceId) || "_defaults".equals(serviceId)) {
continue;
}
consumer.consume(new ServiceConsumer(keyValue, serviceId, new YamlKeyValueAttributeValue(keyValue), defaults));
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@Nullable
public static PsiElement insertKeyIntoFile(final @NotNull YAMLFile yamlFile, final @NotNull YAMLKeyValue yamlKeyValue, @NotNull String... keys) {
String keyText = yamlKeyValue.getKeyText();
return insertKeyIntoFile(yamlFile, (yamlMapping, chainedKey) -> {
String text = yamlKeyValue.getText();
final String previousIndent = StringUtil.repeatSymbol(' ', YAMLUtil.getIndentInThisLine(yamlMapping));
// split content of array value object;
// drop first item as getValueText() removes our key indent
String[] remove = (String[]) ArrayUtils.remove(text.split("\\r?\\n"), 0);
List<String> map = ContainerUtil.map(remove, s -> previousIndent + s);
return "\n" + StringUtils.strip(StringUtils.join(map, "\n"), "\n");
}, (String[]) ArrayUtils.add(keys, keyText));
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
private void visitRootElements(@NotNull Collection<LineMarkerInfo> result, @NotNull PsiElement psiElement, @NotNull LazyConfigTreeSignatures function) {
PsiElement parent = psiElement.getParent();
if(!(parent instanceof YAMLKeyValue)) {
return;
}
String keyText = ((YAMLKeyValue) parent).getKeyText();
Map<String, Collection<String>> treeSignatures = function.value();
if(!treeSignatures.containsKey(keyText)) {
return;
}
NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(Symfony2Icons.SYMFONY_LINE_MARKER)
.setTargets(new MyClassIdLazyValue(psiElement.getProject(), treeSignatures.get(keyText), keyText))
.setTooltipText("Navigate to configuration");
result.add(builder.createLineMarkerInfo(psiElement));
}
代码示例来源:origin: zalando/intellij-swagger
@Override
public void visitElement(final PsiElement element) {
if (element instanceof YAMLKeyValue) {
final YAMLKeyValue yamlKeyValue = (YAMLKeyValue) element;
if (OpenApiConstants.REF_KEY.equals(yamlKeyValue.getKeyText())) {
final String refValue = StringUtils.removeAllQuotes(yamlKeyValue.getValueText());
if (isYamlFile(refValue)) {
result.add(
extractFileNameFromFileRefValue(refValue)
+ DELIMITER
+ getOpenApiFileTypeFromRefElement(yamlKeyValue.getValue(), refValue));
}
}
}
super.visitElement(element);
}
代码示例来源:origin: zalando/intellij-swagger
@Override
public void visitElement(final PsiElement element) {
if (element instanceof YAMLKeyValue) {
final YAMLKeyValue yamlKeyValue = (YAMLKeyValue) element;
if (SwaggerConstants.REF_KEY.equals(yamlKeyValue.getKeyText())) {
final String refValue = StringUtils.removeAllQuotes(yamlKeyValue.getValueText());
if (isYamlFile(refValue)) {
result.add(
extractFileNameFromFileRefValue(refValue)
+ DELIMITER
+ getSwaggerFileType(yamlKeyValue.getValue(), refValue));
}
}
}
super.visitElement(element);
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#findServiceInContext
*/
public void testFindServiceInContext() {
assertEquals("foo", YamlHelper.findServiceInContext(myFixture.configureByText(YAMLFileType.YML, "" +
"services:\n" +
" foo:\n" +
" tags:\n" +
" - { name: fo<caret>o}\n"
).findElementAt(myFixture.getCaretOffset())).getKeyText());
assertEquals("foo", YamlHelper.findServiceInContext(myFixture.configureByText(YAMLFileType.YML, "" +
"services:\n" +
" foo:\n" +
" class: fo<caret>o"
).findElementAt(myFixture.getCaretOffset())).getKeyText());
}
我有一个非常简单的应用程序。我的目标是获取角色及其代码。但是当我运行这段代码时 key 代码:(未知 key 代码:0x0) 我想我错过了一些事情或者犯了一个错误。你能帮忙吗? String s=S
本文整理了Java中org.jetbrains.yaml.psi.YAMLKeyValue.getKeyText()方法的一些代码示例,展示了YAMLKeyValue.getKeyText()的具体用
我正在使用 KeyEvents 和 KeyEvent.getKeyText(KeyEvent.VK_...) 为了得到KeyEvent对应的文本。 在 OSX (Lion) 中,当我请求特殊键的文本时
我是一名优秀的程序员,十分优秀!