use of com.antfortune.freeline.idea.views.CheckUpdateDialog in project freeline by alibaba.
the class UpdateAction method resultHandle.
/**
* 处理结果
*
* @param entity
* @param gradleBuildModels
*/
private void resultHandle(final GradleDependencyEntity entity, final Map<GradleBuildModel, List<ArtifactDependencyModel>> gradleBuildModels) {
String localVersion = null;
StringBuilder builder = new StringBuilder();
for (GradleBuildModel file : gradleBuildModels.keySet()) {
List<ArtifactDependencyModel> models = gradleBuildModels.get(file);
for (ArtifactDependencyModel dependencyModel1 : models) {
ArtifactDependencyModelWrapper dependencyModel = new ArtifactDependencyModelWrapper(dependencyModel1);
if (isClasspathLibrary(dependencyModel) || isDependencyLibrary(dependencyModel)) {
if (isClasspathLibrary(dependencyModel)) {
localVersion = dependencyModel.version();
}
builder.append(dependencyModel.configurationName()).append(" '").append(dependencyModel.group()).append(":").append(dependencyModel.name()).append(":").append(dependencyModel.version()).append("'").append("<br/>");
}
}
}
if (Utils.notEmpty(localVersion)) {
int compare = localVersion.compareTo(entity.getVersion());
final CheckUpdateDialog dialog = new CheckUpdateDialog();
dialog.getButtonOK().setEnabled(compare < 0);
dialog.setServerVersion(entity.getGroupId(), entity.getArtifactId(), entity.getVersion());
dialog.setServerUpdateTime(entity.getUpdateTime());
dialog.setLocalVersion(builder.toString());
dialog.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
updateAction(entity.getVersion(), gradleBuildModels);
dialog.dispose();
}
});
dialog.showDialog();
} else {
NotificationUtils.infoNotification("please add freeline dependency first");
}
}
Aggregations