use of com.intellij.coldFusion.UI.config.CfmlMappingsConfig in project intellij-plugins by JetBrains.
the class CfmlInspectionsTest method testUnResolveIncludeWithMappings.
public void testUnResolveIncludeWithMappings() throws Throwable {
myFixture.configureByFile(Util.getInputDataFileName(getTestName(true)));
addScriptComponentsTo(myFixture);
Map<String, String> mappings = new HashMap<>();
for (VirtualFile root : ProjectRootManager.getInstance(getProject()).getContentRoots()) {
String directoryName = root.getPresentableUrl() + "/folder";
VirtualFile fileByUrl = LocalFileSystem.getInstance().findFileByPath(directoryName);
if (fileByUrl != null) {
mappings.put("/myf", directoryName);
}
}
CfmlProjectConfiguration.State defaultState = CfmlProjectConfiguration.getInstance(getProject()).getState();
CfmlProjectConfiguration.State state = new CfmlProjectConfiguration.State(new CfmlMappingsConfig(mappings));
try {
CfmlProjectConfiguration.getInstance(getProject()).loadState(state);
myFixture.enableInspections(CfmlFileReferenceInspection.class);
myFixture.testHighlighting(true, false, true);
} finally {
CfmlProjectConfiguration.getInstance(getProject()).loadState(defaultState);
}
}
use of com.intellij.coldFusion.UI.config.CfmlMappingsConfig in project intellij-plugins by JetBrains.
the class CfmlInspectionsTest method testResolveIncludeWithBaclSlashMappings.
public void testResolveIncludeWithBaclSlashMappings() throws Throwable {
myFixture.configureByFile(getTestName(true) + ".test.cfml");
addScriptComponentsTo(myFixture);
Map<String, String> mappings = new HashMap<>();
for (VirtualFile root : ProjectRootManager.getInstance(getProject()).getContentRoots()) {
VirtualFile directory = root.findChild("folder");
if (directory != null && directory.isDirectory()) {
mappings.put("\\myf", directory.getUrl());
}
}
CfmlProjectConfiguration.State defaultState = CfmlProjectConfiguration.getInstance(getProject()).getState();
CfmlProjectConfiguration.State state = new CfmlProjectConfiguration.State(new CfmlMappingsConfig(mappings));
try {
CfmlProjectConfiguration.getInstance(getProject()).loadState(state);
myFixture.enableInspections(CfmlFileReferenceInspection.class);
myFixture.testHighlighting(true, false, true);
} finally {
CfmlProjectConfiguration.getInstance(getProject()).loadState(defaultState);
}
}
use of com.intellij.coldFusion.UI.config.CfmlMappingsConfig in project intellij-plugins by JetBrains.
the class CfscriptResolveTest method setDefaultState.
private void setDefaultState() {
Map<String, String> mappings = new HashMap<>();
for (VirtualFile root : ProjectRootManager.getInstance(getProject()).getContentRoots()) {
String directoryName = root.getPresentableUrl() + "/folder/subfolder";
VirtualFile fileByUrl = LocalFileSystem.getInstance().findFileByPath(directoryName);
if (fileByUrl != null) {
mappings.put("myfolder/subfolder", directoryName);
}
}
CfmlProjectConfiguration.getInstance(getProject()).loadState(new CfmlProjectConfiguration.State(new CfmlMappingsConfig(mappings)));
}
Aggregations