use of com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationListenerAdapter in project freeline by alibaba.
the class UpdateAction method updateAction.
/**
* 更新操作
*
* @param newVersion
* @param gradleBuildModels
*/
protected void updateAction(final String newVersion, final Map<GradleBuildModel, List<ArtifactDependencyModel>> gradleBuildModels) {
CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() {
@Override
public void run() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
for (GradleBuildModel file : gradleBuildModels.keySet()) {
List<ArtifactDependencyModel> models = gradleBuildModels.get(file);
for (ArtifactDependencyModel dependencyModel1 : models) {
ArtifactDependencyModelWrapper dependencyModel = new ArtifactDependencyModelWrapper(dependencyModel1);
if (isClasspathLibrary(dependencyModel)) {
dependencyModel1.setVersion(newVersion);
}
if (isDependencyLibrary(dependencyModel)) {
file.dependencies().remove(dependencyModel1);
}
}
file.applyChanges();
}
GradleUtil.executeTask(currentProject, "initFreeline", "-Pmirror", new ExternalSystemTaskNotificationListenerAdapter() {
@Override
public void onTaskOutput(@NotNull ExternalSystemTaskId id, @NotNull String text, boolean stdOut) {
super.onTaskOutput(id, text, stdOut);
}
});
}
});
}
});
}
Aggregations