Search in sources :

Example 6 with ReplacePathToMacroMap

use of com.intellij.application.options.ReplacePathToMacroMap in project intellij-plugins by JetBrains.

the class ConversionHelper method collapsePaths.

public static void collapsePaths(Element element) {
    ReplacePathToMacroMap map = new ReplacePathToMacroMap();
    PathMacrosImpl.getInstanceEx().addMacroReplacements(map);
    map.substitute(element, SystemInfo.isFileSystemCaseSensitive, true);
}
Also used : ReplacePathToMacroMap(com.intellij.application.options.ReplacePathToMacroMap)

Example 7 with ReplacePathToMacroMap

use of com.intellij.application.options.ReplacePathToMacroMap in project intellij-community by JetBrains.

the class BasePathMacroManager method getReplacePathMap.

@NotNull
protected ReplacePathToMacroMap getReplacePathMap() {
    ReplacePathToMacroMap result = new ReplacePathToMacroMap();
    getPathMacros().addMacroReplacements(result);
    for (Map.Entry<String, String> entry : PathMacroUtil.getGlobalSystemMacros().entrySet()) {
        result.addMacroReplacement(entry.getValue(), entry.getKey());
    }
    return result;
}
Also used : ReplacePathToMacroMap(com.intellij.application.options.ReplacePathToMacroMap) ExpandMacroToPathMap(com.intellij.openapi.components.ExpandMacroToPathMap) ReplacePathToMacroMap(com.intellij.application.options.ReplacePathToMacroMap) Map(java.util.Map) NotNull(org.jetbrains.annotations.NotNull)

Example 8 with ReplacePathToMacroMap

use of com.intellij.application.options.ReplacePathToMacroMap in project intellij-community by JetBrains.

the class ModulePathMacroManager method getReplacePathMap.

@NotNull
@Override
public ReplacePathToMacroMap getReplacePathMap() {
    final ReplacePathToMacroMap result = super.getReplacePathMap();
    final String modulePath = PathMacroUtil.getModuleDir(myModule.getModuleFilePath());
    addFileHierarchyReplacements(result, PathMacroUtil.MODULE_DIR_MACRO_NAME, modulePath, PathMacroUtil.getUserHomePath());
    return result;
}
Also used : ReplacePathToMacroMap(com.intellij.application.options.ReplacePathToMacroMap) NotNull(org.jetbrains.annotations.NotNull)

Example 9 with ReplacePathToMacroMap

use of com.intellij.application.options.ReplacePathToMacroMap in project intellij-community by JetBrains.

the class ProjectPathMacroManager method getReplacePathMap.

@NotNull
@Override
public ReplacePathToMacroMap getReplacePathMap() {
    final ReplacePathToMacroMap result = super.getReplacePathMap();
    addFileHierarchyReplacements(result, PathMacroUtil.PROJECT_DIR_MACRO_NAME, myProject.getBasePath(), null);
    return result;
}
Also used : ReplacePathToMacroMap(com.intellij.application.options.ReplacePathToMacroMap) NotNull(org.jetbrains.annotations.NotNull)

Example 10 with ReplacePathToMacroMap

use of com.intellij.application.options.ReplacePathToMacroMap in project intellij-community by JetBrains.

the class PathMacroManagerTest method testRightMacrosOrder_RelativeValues_NoVariables.

@Test
public void testRightMacrosOrder_RelativeValues_NoVariables() {
    setUpMocks("/tmp/foo");
    final ReplacePathToMacroMap replacePathMap = new ModulePathMacroManager(myPathMacros, myModule).getReplacePathMap();
    assertReplacements(replacePathMap, "file:/tmp/foo/module -> file:$MODULE_DIR$\n" + "file://tmp/foo/module -> file:/$MODULE_DIR$\n" + "file:///tmp/foo/module -> file://$MODULE_DIR$\n" + "jar:/tmp/foo/module -> jar:$MODULE_DIR$\n" + "jar://tmp/foo/module -> jar:/$MODULE_DIR$\n" + "jar:///tmp/foo/module -> jar://$MODULE_DIR$\n" + "/tmp/foo/module -> $MODULE_DIR$\n" + APP_HOME + " -> $APPLICATION_HOME_DIR$\n" + "file:" + APP_HOME + " -> file:$APPLICATION_HOME_DIR$\n" + "file:/" + APP_HOME + " -> file:/$APPLICATION_HOME_DIR$\n" + "file://" + APP_HOME + " -> file://$APPLICATION_HOME_DIR$\n" + "jar:" + APP_HOME + " -> jar:$APPLICATION_HOME_DIR$\n" + "jar:/" + APP_HOME + " -> jar:/$APPLICATION_HOME_DIR$\n" + "jar://" + APP_HOME + " -> jar://$APPLICATION_HOME_DIR$\n" + USER_HOME + " -> $USER_HOME$\n" + "file:" + USER_HOME + " -> file:$USER_HOME$\n" + "file:/" + USER_HOME + " -> file:/$USER_HOME$\n" + "file://" + USER_HOME + " -> file://$USER_HOME$\n" + "jar:" + USER_HOME + " -> jar:$USER_HOME$\n" + "jar:/" + USER_HOME + " -> jar:/$USER_HOME$\n" + "jar://" + USER_HOME + " -> jar://$USER_HOME$\n" + "file:/tmp/foo -> file:$MODULE_DIR$/..\n" + "file://tmp/foo -> file:/$MODULE_DIR$/..\n" + "file:///tmp/foo -> file://$MODULE_DIR$/..\n" + "jar:/tmp/foo -> jar:$MODULE_DIR$/..\n" + "jar://tmp/foo -> jar:/$MODULE_DIR$/..\n" + "jar:///tmp/foo -> jar://$MODULE_DIR$/..\n" + "/tmp/foo -> $MODULE_DIR$/..\n" + "file:/tmp -> file:$MODULE_DIR$/../..\n" + "file://tmp -> file:/$MODULE_DIR$/../..\n" + "file:///tmp -> file://$MODULE_DIR$/../..\n" + "jar:/tmp -> jar:$MODULE_DIR$/../..\n" + "jar://tmp -> jar:/$MODULE_DIR$/../..\n" + "jar:///tmp -> jar://$MODULE_DIR$/../..\n" + "/tmp -> $MODULE_DIR$/../..");
}
Also used : ReplacePathToMacroMap(com.intellij.application.options.ReplacePathToMacroMap) Test(org.junit.Test)

Aggregations

ReplacePathToMacroMap (com.intellij.application.options.ReplacePathToMacroMap)13 Test (org.junit.Test)4 NotNull (org.jetbrains.annotations.NotNull)3 PathMacros (com.intellij.openapi.application.PathMacros)1 ExpandMacroToPathMap (com.intellij.openapi.components.ExpandMacroToPathMap)1 Map (java.util.Map)1 Element (org.jdom.Element)1 Nullable (org.jetbrains.annotations.Nullable)1