use of com.intellij.conversion.impl.ui.ConvertProjectDialog in project intellij-community by JetBrains.
the class ConversionServiceImpl method convert.
@NotNull
@Override
public ConversionResult convert(@NotNull String projectPath) {
try {
if (!new File(projectPath).exists() || ApplicationManager.getApplication().isHeadlessEnvironment() || !isConversionNeeded(projectPath)) {
return ConversionResultImpl.CONVERSION_NOT_NEEDED;
}
final ConversionContextImpl context = new ConversionContextImpl(projectPath);
final List<ConversionRunner> converters = getConversionRunners(context);
ConvertProjectDialog dialog = new ConvertProjectDialog(context, converters);
dialog.show();
if (dialog.isConverted()) {
saveConversionResult(context);
return new ConversionResultImpl(converters);
}
return ConversionResultImpl.CONVERSION_CANCELED;
} catch (CannotConvertException e) {
LOG.info(e);
Messages.showErrorDialog(IdeBundle.message("error.cannot.convert.project", e.getMessage()), IdeBundle.message("title.cannot.convert.project"));
return ConversionResultImpl.ERROR_OCCURRED;
}
}
Aggregations