Search in sources :

Example 1 with MacroManager

use of com.intellij.ide.macro.MacroManager in project intellij-community by JetBrains.

the class AntBuildFileImpl method getExternalProperties.

@NotNull
public Map<String, String> getExternalProperties() {
    Map<String, String> result = myCachedExternalProperties;
    if (result == null) {
        synchronized (myOptionsLock) {
            result = myCachedExternalProperties;
            if (result == null) {
                result = new HashMap<>();
                final DataContext context = SimpleDataContext.getProjectContext(myProject);
                final MacroManager macroManager = MacroManager.getInstance();
                Iterator<BuildFileProperty> properties = ANT_PROPERTIES.getIterator(myAllOptions);
                while (properties.hasNext()) {
                    BuildFileProperty property = properties.next();
                    try {
                        String value = property.getPropertyValue();
                        value = macroManager.expandSilentMarcos(value, true, context);
                        value = macroManager.expandSilentMarcos(value, false, context);
                        result.put(property.getPropertyName(), value);
                    } catch (Macro.ExecutionCancelledException e) {
                        LOG.debug(e);
                    }
                }
                myCachedExternalProperties = result;
            }
        }
    }
    return result;
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) SimpleDataContext(com.intellij.openapi.actionSystem.impl.SimpleDataContext) Macro(com.intellij.ide.macro.Macro) MacroManager(com.intellij.ide.macro.MacroManager) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with MacroManager

use of com.intellij.ide.macro.MacroManager in project intellij-community by JetBrains.

the class AntCommandLineBuilder method expandProperty.

private void expandProperty(DataContext dataContext, Project project, BuildFileProperty property) throws Macro.ExecutionCancelledException {
    String value = property.getPropertyValue();
    final MacroManager macroManager = GlobalAntConfiguration.getMacroManager();
    value = macroManager.expandMacrosInString(value, true, dataContext);
    value = macroManager.expandMacrosInString(value, false, dataContext);
    value = PathMacroManager.getInstance(project).expandPath(value);
    myExpandedProperties.add("-D" + property.getPropertyName() + "=" + value);
}
Also used : MacroManager(com.intellij.ide.macro.MacroManager) PathMacroManager(com.intellij.openapi.components.PathMacroManager)

Aggregations

MacroManager (com.intellij.ide.macro.MacroManager)2 Macro (com.intellij.ide.macro.Macro)1 DataContext (com.intellij.openapi.actionSystem.DataContext)1 SimpleDataContext (com.intellij.openapi.actionSystem.impl.SimpleDataContext)1 PathMacroManager (com.intellij.openapi.components.PathMacroManager)1 NotNull (org.jetbrains.annotations.NotNull)1