use of com.intellij.openapi.components.ExpandMacroToPathMap in project intellij-community by JetBrains.
the class ConversionContextImpl method getClassRoots.
@NotNull
public List<File> getClassRoots(Element libraryElement, @Nullable ModuleSettingsImpl moduleSettings) {
List<File> files = new ArrayList<>();
//todo[nik] support jar directories
final Element classesChild = libraryElement.getChild("CLASSES");
if (classesChild != null) {
final ExpandMacroToPathMap pathMap = createExpandMacroMap(moduleSettings);
for (Element root : classesChild.getChildren("root")) {
final String url = root.getAttributeValue("url");
final String path = VfsUtilCore.urlToPath(url);
files.add(new File(PathUtil.getLocalPath(pathMap.substitute(path, true))));
}
}
return files;
}
use of com.intellij.openapi.components.ExpandMacroToPathMap in project intellij-community by JetBrains.
the class ModuleRootsExternalizationTest method testExpandMacro1.
public void testExpandMacro1() {
final ExpandMacroToPathMap map = new ExpandMacroToPathMap();
map.addMacroExpand("MACRO", "C:/idea");
final String expanded = map.substitute("jar://$MACRO$/lib/forms_rt.jar!/", false);
assertEquals("jar://C:/idea/lib/forms_rt.jar!/", expanded);
}
use of com.intellij.openapi.components.ExpandMacroToPathMap in project intellij-community by JetBrains.
the class ModuleRootsExternalizationTest method testExpandMacro3.
public void testExpandMacro3() {
final ExpandMacroToPathMap map = new ExpandMacroToPathMap();
map.addMacroExpand("MACRO1", "C:/idea");
map.addMacroExpand("MACRO2", "forms_rt.jar!/");
final String expanded = map.substitute("jar://$MACRO1$/lib/$MACRO2$", false);
assertEquals("jar://C:/idea/lib/forms_rt.jar!/", expanded);
}
use of com.intellij.openapi.components.ExpandMacroToPathMap in project intellij-community by JetBrains.
the class ModuleRootsExternalizationTest method testExpandMacroNoExpand3.
public void testExpandMacroNoExpand3() {
final ExpandMacroToPathMap map = new ExpandMacroToPathMap();
map.addMacroExpand("MACRO", "C:/idea");
final String expanded = map.substitute("jar://$UNKNOWN$/lib/forms_rt.jar!/", false);
assertEquals("jar://$UNKNOWN$/lib/forms_rt.jar!/", expanded);
}
use of com.intellij.openapi.components.ExpandMacroToPathMap in project intellij-community by JetBrains.
the class BasePathMacroManager method getExpandMacroMap.
@NotNull
public ExpandMacroToPathMap getExpandMacroMap() {
ExpandMacroToPathMap result = new ExpandMacroToPathMap();
getPathMacros().addMacroExpands(result);
for (Map.Entry<String, String> entry : PathMacroUtil.getGlobalSystemMacros().entrySet()) {
result.addMacroExpand(entry.getKey(), entry.getValue());
}
return result;
}
Aggregations