use of org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement in project android by JetBrains.
the class GradleDslMethodCall method apply.
@Override
protected void apply() {
for (GradleDslElement argument : myToBeRemovedArguments) {
if (myArguments.remove(argument)) {
argument.delete();
}
}
GroovyPsiElement psiElement = getPsiElement();
if (psiElement instanceof GrMethodCallExpression) {
GrMethodCallExpression methodCall = (GrMethodCallExpression) psiElement;
if (myToBeAddedArgument != null) {
myToBeAddedArgument.setPsiElement(methodCall.getArgumentList());
myToBeAddedArgument.applyChanges();
myArguments.add(myToBeAddedArgument);
}
}
for (GradleDslElement argument : myArguments) {
if (argument.isModified()) {
argument.applyChanges();
}
}
}
use of org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement in project android by JetBrains.
the class GradlePropertiesDslElement method addAsParsedDslExpressionList.
protected void addAsParsedDslExpressionList(@NotNull String property, GradleDslExpression dslLiteral) {
GroovyPsiElement psiElement = dslLiteral.getPsiElement();
if (psiElement == null) {
return;
}
// Only elements which are added as expression list are the ones which supports both single argument and multiple arguments
// (ex: flavorDimensions in android block). To support that, we create an expression list where appending to the arguments list is
// supported even when there is only one element in it. This does not work in many other places like proguardFile elements where
// only one argument is supported and for this cases we use addToParsedExpressionList method.
GradleDslExpressionList literalList = new GradleDslExpressionList(this, psiElement, property, true);
literalList.addParsedExpression(dslLiteral);
myProperties.put(property, literalList);
}
use of org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement in project android by JetBrains.
the class GradlePropertiesDslElement method addToParsedExpressionList.
public void addToParsedExpressionList(@NotNull String property, @NotNull GradleDslElement element) {
GroovyPsiElement psiElement = element.getPsiElement();
if (psiElement == null) {
return;
}
GradleDslExpressionList gradleDslExpressionList = getPropertyElement(property, GradleDslExpressionList.class);
if (gradleDslExpressionList == null) {
gradleDslExpressionList = new GradleDslExpressionList(this, psiElement, property);
myProperties.put(property, gradleDslExpressionList);
} else {
gradleDslExpressionList.setPsiElement(psiElement);
}
if (element instanceof GradleDslExpression) {
gradleDslExpressionList.addParsedExpression((GradleDslExpression) element);
} else if (element instanceof GradleDslExpressionList) {
List<GradleDslExpression> gradleExpressions = ((GradleDslExpressionList) element).getExpressions();
for (GradleDslExpression expression : gradleExpressions) {
gradleDslExpressionList.addParsedExpression(expression);
}
}
}
Aggregations