use of com.intellij.coldFusion.UI.config.CfmlMappingsConfig in project intellij-plugins by JetBrains.
the class CfmlCompletionTest method testAutocompletePathToScriptIncludeInPresentOfMappingWithFile.
public void testAutocompletePathToScriptIncludeInPresentOfMappingWithFile() throws Throwable {
addOneComponentToDir(myFixture);
Map<String, String> mappings = new HashMap<>();
for (VirtualFile root : ProjectRootManager.getInstance(getProject()).getContentRoots()) {
String directoryName = root.getPresentableUrl() + "/subfolder";
VirtualFile fileByUrl = LocalFileSystem.getInstance().findFileByPath(directoryName);
if (fileByUrl != null) {
mappings.put("/subfolder", directoryName);
}
}
CfmlProjectConfiguration.State defaultState = CfmlProjectConfiguration.getInstance(getProject()).getState();
CfmlProjectConfiguration.State state = new CfmlProjectConfiguration.State(new CfmlMappingsConfig(mappings));
try {
CfmlProjectConfiguration.getInstance(getProject()).loadState(state);
doTestCompletionVariants("ComponentName.cfc");
} finally {
CfmlProjectConfiguration.getInstance(getProject()).loadState(defaultState);
}
}
use of com.intellij.coldFusion.UI.config.CfmlMappingsConfig in project intellij-plugins by JetBrains.
the class CfmlCompletionTest method testAutocompletePathToIncludeTagInPresentOfMapping.
public void testAutocompletePathToIncludeTagInPresentOfMapping() throws Throwable {
addOneComponentTo(myFixture);
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.State defaultState = CfmlProjectConfiguration.getInstance(getProject()).getState();
CfmlProjectConfiguration.State state = new CfmlProjectConfiguration.State(new CfmlMappingsConfig(mappings));
try {
CfmlProjectConfiguration.getInstance(getProject()).loadState(state);
doTest();
} finally {
CfmlProjectConfiguration.getInstance(getProject()).loadState(defaultState);
}
}
use of com.intellij.coldFusion.UI.config.CfmlMappingsConfig in project intellij-plugins by JetBrains.
the class CfmlFileReferenceSet method computeDefaultContexts.
@NotNull
@Override
public Collection<PsiFileSystemItem> computeDefaultContexts() {
ArrayList<PsiFileSystemItem> contexts = new ArrayList<>();
if (StringUtil.startsWithChar(getPathString(), '/') || StringUtil.startsWithChar(getPathString(), '\\')) {
PsiReference firstFileReference = getElement().getReferences()[0];
if ((firstFileReference instanceof FileReference)) {
CfmlProjectConfiguration.State state = CfmlProjectConfiguration.getInstance(getElement().getProject()).getState();
if (state == null) {
return super.computeDefaultContexts();
}
CfmlMappingsConfig mappingsConfig = state.getMapps();
Map<String, String> mapDir = mappingsConfig.getServerMappings();
for (String value : mapDir.keySet()) {
final String path = mapDir.get(value);
VirtualFile dir = findFile(path);
if (dir != null) {
PsiDirectory psiDirectory = getElement().getManager().findDirectory(dir);
contexts.add(psiDirectory);
}
}
}
}
contexts.addAll(super.computeDefaultContexts());
return contexts;
}
use of com.intellij.coldFusion.UI.config.CfmlMappingsConfig in project intellij-plugins by JetBrains.
the class CfmlCompletionTest method testAutocompletePathToComponentInPresentOfMapping.
public void testAutocompletePathToComponentInPresentOfMapping() throws Throwable {
addOneComponentTo(myFixture);
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.State defaultState = CfmlProjectConfiguration.getInstance(getProject()).getState();
CfmlProjectConfiguration.State state = new CfmlProjectConfiguration.State(new CfmlMappingsConfig(mappings));
try {
CfmlProjectConfiguration.getInstance(getProject()).loadState(state);
doTest();
} finally {
CfmlProjectConfiguration.getInstance(getProject()).loadState(defaultState);
}
}
use of com.intellij.coldFusion.UI.config.CfmlMappingsConfig in project intellij-plugins by JetBrains.
the class CfmlCompletionTest method testAutocompletePathToScriptIncludeInPresentOfMappingWithEnteredPath.
public void testAutocompletePathToScriptIncludeInPresentOfMappingWithEnteredPath() throws Throwable {
addOneComponentToDir(myFixture);
Map<String, String> mappings = new HashMap<>();
for (VirtualFile root : ProjectRootManager.getInstance(getProject()).getContentRoots()) {
String directoryName = root.getPresentableUrl() + "/subfolder";
VirtualFile fileByUrl = LocalFileSystem.getInstance().findFileByPath(directoryName);
if (fileByUrl != null) {
mappings.put("/lot", directoryName);
mappings.put("/fot", directoryName);
}
}
CfmlProjectConfiguration.State defaultState = CfmlProjectConfiguration.getInstance(getProject()).getState();
CfmlProjectConfiguration.State state = new CfmlProjectConfiguration.State(new CfmlMappingsConfig());
state.setMapps(new CfmlMappingsConfig(mappings));
try {
CfmlProjectConfiguration.getInstance(getProject()).loadState(state);
doTestCompletionContainsVariants("lot", "fot");
} finally {
CfmlProjectConfiguration.getInstance(getProject()).loadState(defaultState);
}
}
Aggregations