use of com.intellij.lang.properties.psi.PropertiesFile in project intellij-community by JetBrains.
the class MavenPropertyPsiReference method collectSystemEnvProperties.
private void collectSystemEnvProperties(String propertiesFileName, @Nullable String prefix, List<Object> result, Set<String> variants) {
VirtualFile virtualFile = MavenPropertiesVirtualFileSystem.getInstance().findFileByPath(propertiesFileName);
PropertiesFile file = MavenDomUtil.getPropertiesFile(myProject, virtualFile);
collectPropertiesFileVariants(file, prefix, result, variants);
}
use of com.intellij.lang.properties.psi.PropertiesFile in project intellij-community by JetBrains.
the class XmlPropertiesTest method testAddPropertyInAlphaOrder.
public void testAddPropertyInAlphaOrder() {
final PsiFile psiFile = myFixture.configureByFile("bar.xml");
final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(psiFile);
assertNotNull(propertiesFile);
WriteCommandAction.runWriteCommandAction(getProject(), () -> {
propertiesFile.addProperty("d", "vvv");
propertiesFile.addProperty("a", "vvv");
propertiesFile.addProperty("l", "vvv");
propertiesFile.addProperty("v", "vvv");
});
assertTrue(propertiesFile.isAlphaSorted());
assertTrue(PropertiesImplUtil.getPropertiesFile(psiFile).isAlphaSorted());
}
use of com.intellij.lang.properties.psi.PropertiesFile in project intellij-community by JetBrains.
the class XmlPropertiesTest method testXmlProperties.
public void testXmlProperties() throws Exception {
myFixture.configureByFile("foo.xml");
List<PropertiesFile> files = PropertiesReferenceManager.getInstance(getProject()).findPropertiesFiles(myModule, "foo");
assertEquals(1, files.size());
PropertiesFile file = files.get(0);
assertEquals(1, file.findPropertiesByKey("foo").size());
List<IProperty> properties = PropertiesImplUtil.findPropertiesByKey(getProject(), "foo");
assertEquals(1, properties.size());
}
use of com.intellij.lang.properties.psi.PropertiesFile in project intellij-community by JetBrains.
the class XmlPropertiesTest method testWrongFile.
public void testWrongFile() throws Exception {
PsiFile psiFile = myFixture.configureByFile("wrong.xml");
PropertiesFile file = PropertiesImplUtil.getPropertiesFile(psiFile);
assertNull(file);
}
use of com.intellij.lang.properties.psi.PropertiesFile in project intellij-community by JetBrains.
the class XmlPropertiesTest method testAddProperty.
public void testAddProperty() {
final PsiFile psiFile = myFixture.configureByFile("foo.xml");
final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(psiFile);
assertNotNull(propertiesFile);
WriteCommandAction.runWriteCommandAction(getProject(), () -> {
propertiesFile.addProperty("kkk", "vvv");
});
final IProperty property = propertiesFile.findPropertyByKey("kkk");
assertNotNull(property);
assertEquals("vvv", property.getValue());
}
Aggregations