Search in sources :

Example 1 with ConvertProjectDialog

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;
    }
}
Also used : ConvertProjectDialog(com.intellij.conversion.impl.ui.ConvertProjectDialog) ConversionRunner(com.intellij.conversion.impl.ConversionRunner) ConversionContextImpl(com.intellij.conversion.impl.ConversionContextImpl) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ConversionContextImpl (com.intellij.conversion.impl.ConversionContextImpl)1 ConversionRunner (com.intellij.conversion.impl.ConversionRunner)1 ConvertProjectDialog (com.intellij.conversion.impl.ui.ConvertProjectDialog)1 File (java.io.File)1 NotNull (org.jetbrains.annotations.NotNull)1