Search in sources :

Example 11 with PathMacros

use of com.intellij.openapi.application.PathMacros in project kotlin by JetBrains.

the class PluginStartupComponent method registerPathVariable.

private static void registerPathVariable() {
    PathMacros macros = PathMacros.getInstance();
    macros.setMacro(KOTLIN_BUNDLED, PathUtil.getKotlinPathsForIdeaPlugin().getHomePath().getPath());
}
Also used : PathMacros(com.intellij.openapi.application.PathMacros)

Example 12 with PathMacros

use of com.intellij.openapi.application.PathMacros in project intellij-elixir by KronicDeth.

the class ParametersList method getMacroMap.

private Map<String, String> getMacroMap() {
    if (myMacroMap == null) {
        // the insertion order is important for later iterations, so LinkedHashMap is used
        myMacroMap = new LinkedHashMap<String, String>();
        // ApplicationManager.getApplication() will return null if executed in ParameterListTest
        final Application application = ApplicationManager.getApplication();
        if (application != null) {
            final PathMacros pathMacros = PathMacros.getInstance();
            if (pathMacros != null) {
                for (String name : pathMacros.getUserMacroNames()) {
                    final String value = pathMacros.getValue(name);
                    if (value != null) {
                        myMacroMap.put("${" + name + "}", value);
                    }
                }
            }
            final Map<String, String> env = EnvironmentUtil.getEnvironmentMap();
            for (String name : env.keySet()) {
                final String key = "${" + name + "}";
                if (!myMacroMap.containsKey(key)) {
                    myMacroMap.put(key, env.get(name));
                }
            }
        }
    }
    return myMacroMap;
}
Also used : PathMacros(com.intellij.openapi.application.PathMacros) Application(com.intellij.openapi.application.Application)

Aggregations

PathMacros (com.intellij.openapi.application.PathMacros)12 Application (com.intellij.openapi.application.Application)2 ReplacePathToMacroMap (com.intellij.application.options.ReplacePathToMacroMap)1 Project (com.intellij.openapi.project.Project)1 JarFileSystem (com.intellij.openapi.vfs.JarFileSystem)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 THashMap (gnu.trove.THashMap)1 File (java.io.File)1 Nullable (org.jetbrains.annotations.Nullable)1