- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlPsiElementFactory
类的一些代码示例,展示了YamlPsiElementFactory
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlPsiElementFactory
类的具体详情如下:
包路径:fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlPsiElementFactory
类名称:YamlPsiElementFactory
暂无
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@Nullable
public static <T extends PsiElement> T createFromText(@NotNull Project p, final Class<T> aClass, String text) {
final PsiElement[] ret = new PsiElement[]{null};
createDummyFile(p, text).accept(new PsiRecursiveElementWalkingVisitor() {
public void visitElement(PsiElement element) {
if(ret[0] == null && aClass.isInstance(element)) {
ret[0] = element;
}
super.visitElement(element);
}
});
return (T) ret[0];
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
PsiElement psiElement1 = descriptor.getPsiElement();
YAMLKeyValue replacement = YamlPsiElementFactory.createFromText(
project,
YAMLKeyValue.class,
"class: " + replacementFQN
);
if (replacement != null && replacement.getValue() != null) {
psiElement1.replace(replacement.getValue());
}
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
private void insertYamlServiceTag() {
if(!(this.psiFile instanceof YAMLFile)) {
return;
}
String text = createServiceAsText(ServiceBuilder.OutputType.Yaml, this.psiFile);
YAMLKeyValue fromText = YamlPsiElementFactory.createFromText(project, YAMLKeyValue.class, text);
if(fromText == null) {
return;
}
PsiElement psiElement = YamlHelper.insertKeyIntoFile((YAMLFile) psiFile, fromText, "services");
if(psiElement != null) {
navigateToElement(new TextRange[] {psiElement.getTextRange()});
}
dispose();
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@NotNull
public static PsiElement createYamlPsiFromText(Project p, final IElementType type, @NotNull String text) {
final Ref<PsiElement> ret = new Ref<>();
PsiFile dummyFile = createDummyFile(p, text);
dummyFile.accept(new PsiRecursiveElementWalkingVisitor() {
@Override
public void visitElement(PsiElement element) {
if(element.getNode() == type) {
ret.set(element);
}
super.visitElement(element);
}
});
assert !ret.isNull() : "cannot create element from text:\n" + dummyFile.getText();
return ret.get();
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#getYamlKeyValueAsString
*/
public void testGetYamlKeyValueAsString() {
String[] strings = {
"{ name: routing.loader, method: foo }",
"{ name: routing.loader, method: 'foo' }",
"{ name: routing.loader, method: \"foo\" }",
};
for (String s : strings) {
assertEquals("foo", YamlHelper.getYamlKeyValueAsString(
YamlPsiElementFactory.createFromText(getProject(), YAMLHashImpl.class, s),
"method"
));
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
private int getIndentForTextContent(@NotNull String content) {
return YamlHelper.getIndentSpaceForFile((YAMLFile) YamlPsiElementFactory.createDummyFile(
getProject(),
"foo.yml",
content
));
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#getYamlArrayOnSequenceOrArrayElements
*/
public void testGetYamlArrayOnSequenceOrArrayElementsForArray() {
YAMLCompoundValue fromText = YamlPsiElementFactory.createFromText(getProject(), YAMLCompoundValue.class, "" +
"calls: [@foo, @bar] \n"
);
assertNotNull(fromText);
String join = StringUtils.join(ContainerUtil.map(YamlHelper.getYamlArrayOnSequenceOrArrayElements(fromText), new Function<PsiElement, String>() {
@Override
public String fun(PsiElement psiElement) {
return psiElement.getText();
}
}), ",");
assertTrue(join.contains("foo"));
assertTrue(join.contains("bar"));
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
public void testThatNonConfigRootShouldNotProvideLinemarker() {
PsiElement yaml = YamlPsiElementFactory.createDummyFile(getProject(), "foobar.yml", "foobar_root:\n" +
" foo: ~"
);
assertLineMarkerIsEmpty(yaml);
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#collectServiceTags
*/
public void testCollectServiceTags() {
YAMLKeyValue fromText = YamlPsiElementFactory.createFromText(getProject(), YAMLKeyValue.class, "" +
"foo:\n" +
" tags:\n" +
" - { name: routing.loader, method: crossHint }\n" +
" - { name: routing.loader1, method: crossHint }\n"
);
assertNotNull(fromText);
assertContainsElements(YamlHelper.collectServiceTags(fromText), "routing.loader", "routing.loader1");
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
public void testThatConfigRootProvidesLinemarker() {
PsiElement yaml = YamlPsiElementFactory.createDummyFile(getProject(), "config.yml", "foobar_root:\n" +
" foo: ~"
);
assertLineMarker(yaml, new LineMarker.ToolTipEqualsAssert("Navigate to configuration"));
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#getYamlArrayOnSequenceOrArrayElements
*/
public void testGetYamlArrayOnSequenceOrArrayElements() {
String[] strings = {
"calls: [@foo, @bar] \n",
"calls:\n - @foo\n - @bar\n",
};
for (String s : strings) {
YAMLCompoundValue fromText = YamlPsiElementFactory.createFromText(getProject(), YAMLCompoundValue.class, s);
assertNotNull(fromText);
List<PsiElement> elements = YamlHelper.getYamlArrayOnSequenceOrArrayElements(fromText);
assertNotNull(elements);
String join = StringUtils.join(ContainerUtil.map(elements, new Function<PsiElement, String>() {
@Override
public String fun(PsiElement psiElement) {
return psiElement.getText();
}
}), ",");
assertTrue(join.contains("foo"));
assertTrue(join.contains("bar"));
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see TwigUtil#getTwigPathFromYamlConfigResolved
*/
public void testGetTwigPathFromYamlConfigResolved() {
createFile("app/test/foo.yaml");
PsiFile dummyFile = YamlPsiElementFactory.createDummyFile(getProject(), "" +
"twig:\n" +
" paths:\n" +
" '%kernel.root_dir%/test': foo\n" +
" '%kernel.project_dir%/app/test': project\n" +
" '%kernel.root_dir%/../app': app\n"
);
Collection<Pair<String, String>> paths = TwigUtil.getTwigPathFromYamlConfigResolved((YAMLFile) dummyFile);
assertNotNull(
paths.stream().filter(pair -> "foo".equals(pair.getFirst()) && "app/test".equals(pair.getSecond())).findFirst()
);
assertNotNull(
paths.stream().filter(pair -> "project".equals(pair.getFirst()) && "app/test".equals(pair.getSecond())).findFirst()
);
assertNotNull(
paths.stream().filter(pair -> "app".equals(pair.getFirst()) && "app".equals(pair.getSecond())).findFirst()
);
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
Collection<YAMLDocument> yamlDocuments = new ArrayList<YAMLDocument>();
yamlDocuments.add(YamlPsiElementFactory.createFromText(getProject(), YAMLDocument.class, String.format(
"route1:\n" +
" path: /foo\n" +
)));
yamlDocuments.add(YamlPsiElementFactory.createFromText(getProject(), YAMLDocument.class, String.format(
"route1:\n" +
" path: /foo\n" +
)));
yamlDocuments.add(YamlPsiElementFactory.createFromText(getProject(), YAMLDocument.class, String.format(
"route1:\n" +
" pattern: /foo\n" +
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
public void testBuildForClassWithoutParameter() {
PsiFile dummyFile = YamlPsiElementFactory.createDummyFile(getProject(), "foo.yml", "services:\n foobar: ~");
ServiceBuilder serviceBuilder = new ServiceBuilder(Collections.emptyList(), dummyFile, false);
assertEquals(
"foobar:\n class: Foobar",
serviceBuilder.build(ServiceBuilder.OutputType.Yaml, "Foobar", "foobar")
);
assertEquals(
"<service class=\"Foobar\" id=\"foobar\"/>",
StringUtils.trim(serviceBuilder.build(ServiceBuilder.OutputType.XML, "Foobar", "foobar"))
);
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.routing.RouteHelper#getYamlRouteDefinitions
*/
public void testGetYamlRouteDefinitionsForControllerKeyword() {
Collection<StubIndexedRoute> yamlRouteDefinitions = RouteHelper.getYamlRouteDefinitions(YamlPsiElementFactory.createFromText(getProject(), YAMLDocument.class,
"foo_keyword:\n" +
" path: /foo\n" +
" controller: 'AppBundle:Blog:list'\n"
));
StubIndexedRoute route = ContainerUtil.find(yamlRouteDefinitions, new MyEqualStubIndexedRouteCondition("foo_keyword"));
assertNotNull(route);
assertContainsElements(Collections.singletonList("AppBundle:Blog:list"), route.getController());
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
public void testInsertTranslationForYamlFile() {
PsiFile dummyFile = YamlPsiElementFactory.createDummyFile(getProject(), "foo.de.yml", "car: 'foo'");
CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> {
TranslationInsertUtil.invokeTranslation(dummyFile, "foobar", "value");
}), null, null);
String text = dummyFile.getText();
assertTrue(text.contains("foobar: 'value'"));
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#collectServiceTags
*/
public void testCollectServiceTagsForSymfony33TagsShortcutInline() {
YAMLKeyValue fromText = YamlPsiElementFactory.createFromText(getProject(), YAMLKeyValue.class, "" +
"foo:\n" +
" tags: [routing.loader_tags_3, routing.loader_tags_4]\n"
);
assertNotNull(fromText);
Set<String> collection = YamlHelper.collectServiceTags(fromText);
assertContainsElements(collection, "routing.loader_tags_3");
assertContainsElements(collection, "routing.loader_tags_4");
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
public void testBuildForConstructor() {
ServiceBuilder serviceBuilder = new ServiceBuilder(
getMethodModelParameters(),
YamlPsiElementFactory.createDummyFile(getProject(), "foo.yml", "services:\n foobar: ~"),
false
);
String expectedYaml = "" +
"foobar:\n" +
" class: Foo\\Bar\n" +
" arguments: ['@foobar']";
assertEquals(
expectedYaml,
serviceBuilder.build(ServiceBuilder.OutputType.Yaml, "Foo\\Bar", "foobar")
);
String expectedXml = "" +
"<service class=\"Foo\\Bar\" id=\"foobar\">\n" +
" <argument id=\"foobar\" type=\"service\"/>\n" +
"</service>";
assertEquals(
expectedXml,
StringUtils.trim(serviceBuilder.build(ServiceBuilder.OutputType.XML, "Foo\\Bar", "foobar"))
);
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#collectServiceTags
*/
public void testCollectServiceTagsForSymfony33TagsShortcut() {
YAMLKeyValue fromText = YamlPsiElementFactory.createFromText(getProject(), YAMLKeyValue.class, "" +
"foo:\n" +
" tags:\n" +
" - routing.loader_tags_1\n" +
" - routing.loader_tags_2\n"
);
assertNotNull(fromText);
Set<String> collection = YamlHelper.collectServiceTags(fromText);
assertContainsElements(collection, "routing.loader_tags_1");
assertContainsElements(collection, "routing.loader_tags_2");
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
public void testYmlTagAttributeExtraction() {
YAMLHashImpl fromText = YamlPsiElementFactory.createFromText(getProject(), YAMLHashImpl.class, "{ name: routing.loader, method: foo }");
YamlServiceTag tag = new YamlServiceTag("foo", "routing.loader", (YAMLMapping) fromText);
assertEquals("foo", tag.getAttribute("method"));
assertEquals("routing.loader", tag.getAttribute("name"));
}
}
尝试熟悉 Maven 并参加在线类(class),但陷入困境......感谢提供的任何帮助。 我正在运行站点阶段,虽然它已完成并且我能够在浏览器中实际查看index.html,但我在此过程中遇到了很多
基本上就是标题。。我在任何地方都找不到一个简单的比较,来解释这两者之间的差异:。我知道Gradle中可以有3种类型的插件:。我认为这三种类型的插件在某种程度上与它们可以在settings.gradle
我是 maven 的初学者,现在我对这些 maven 插件之间的区别感到困惑。这些都是创建jar文件吗?现在我的问题是 各个插件创建的jar有什么区别。(组装插件、jar-plugin、shaded插
我使用 tycho-packaging-plugin 来设置 jar 的输出文件夹。这是我的 pom 的缩短版本: 0.21.0 org.eclipse.
When starting the server, refuses to load my plugin with an error:启动服务器时,拒绝加载我的插件,并出现错误: Could n
为什么卸载以下(空)插件会导致错误? 这是my-plugin/my-plugin.php : : my-plugin 关于wordpress - 由于错误 : Could not fully remo
我使用 sbt 与 playframework 和 activator 来构建一个 Web 应用程序。我的 sbt 版本是 0.13.0 我将plugin.sbt 文件更改为: logLevel :=
这是我运行 atlas-create-jira-plugin 时得到的结果后跟 atlas-create-jira-plugin-module选择选项1: Component Import . 问题是
我正在尝试使用 Maven 构建我的 Java 项目,但它失败了,并且出现以下错误: 从存储库 [local (C:\Users\Vinita.Gupta.m2\repository), centra
我正在使用 eclipse mars-2。我想在 Windows 中创建一个新的 Maven Spring Boot 项目。但我遇到了类似 的错误 Could not calculate build
最近开发的产品,我们是有四五个maven模块,开发阶段一直是在eclipse中运行的,然后快发版的时候,需要把这些项目打成jar包,通过命令去启动,那首先就得把这些模块项目打包,或者拷贝一些资源文件等
我想使用 maven-resources-plugin 复制 Excel 并使用 exec-maven-plugin 从该 Excel 创建一些属性文件。并且新创建的属性需要附加到构建中。我可以创建属
当我尝试构建项目时出现此错误。 Errors occurred during the build. Errors running builder 'Maven Project Builder' on
当我在执行 Maven 时从 eclipse 内部 -> 更新项目我遇到以下问题 Unable to update Maven configuration Could not calculate bu
我之前问过一个关于延迟处理事件的问题:Grails non time based queuing .我开始使用 rabbitmq 插件:http://grails.org/plugin/rabbitm
我正在尝试使用 maven 构建一个 java spring 项目(来自 heroku 入门指南的默认项目)。出于某种原因,我不断收到以下错误。机器上网应该没有问题。 Failed to execut
操作系统:OSX 10.11 Cordova :5.4.1(也尝试过 6.0)节点:4.2.6使用的cordova插件:crosswalk-project/cordova-plugin-crosswa
org.sonatype.maven.plugin :emma-maven-plugin:1.2 org.codehaus.mojo :emma-maven-plugin:1.0-alpha-3 or
我正在管理安装了很多插件的多个 shopware 6 商店。后端只允许更新一个插件,这非常耗时,因为更新分两步完成: 更新已加载(加载器圈) 后端已重新加载(html 重新加载) 为什么没有“更新所有
我正在管理安装了很多插件的多个 shopware 6 商店。后端只允许更新一个插件,这非常耗时,因为更新分两步完成: 更新已加载(加载器圈) 后端已重新加载(html 重新加载) 为什么没有“更新所有
我是一名优秀的程序员,十分优秀!