mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
correctly handle project opening cancellation (RUBY-9997)
This commit is contained in:
+15
-6
@@ -453,7 +453,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
|
||||
|
||||
public Project loadAndOpenProject(@NotNull final String filePath) throws IOException {
|
||||
|
||||
final Project project = convertAndLoadProject(filePath, null);
|
||||
final Project project = convertAndLoadProject(filePath);
|
||||
if (project == null) {
|
||||
showWelcomeScreenIfNoProjectOpened();
|
||||
return null;
|
||||
@@ -478,14 +478,17 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Converts and loads the project at the specified path.
|
||||
*
|
||||
* @param filePath the path to open the project.
|
||||
* @return the project, or null if the user has cancelled opening the project.
|
||||
*/
|
||||
@Nullable
|
||||
public Project convertAndLoadProject(String filePath, @Nullable Ref<ConversionResult> conversionResultRef) throws IOException {
|
||||
public Project convertAndLoadProject(String filePath) throws IOException {
|
||||
final String fp = canonicalize(filePath);
|
||||
final ConversionResult conversionResult = ConversionService.getInstance().convert(fp);
|
||||
if (conversionResultRef != null) {
|
||||
conversionResultRef.set(conversionResult);
|
||||
}
|
||||
if (conversionResult.openingIsCanceled()) {
|
||||
return null;
|
||||
}
|
||||
@@ -503,6 +506,12 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
|
||||
return project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the project at the specified path.
|
||||
*
|
||||
* @param filePath the path to open the project.
|
||||
* @return the project, or null if the user has cancelled opening the project.
|
||||
*/
|
||||
@Nullable
|
||||
private Project loadProjectWithProgress(final @NotNull String filePath) throws IOException {
|
||||
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.intellij.platform;
|
||||
|
||||
import com.intellij.conversion.ConversionResult;
|
||||
|
||||
import com.intellij.ide.GeneralSettings;
|
||||
import com.intellij.ide.impl.ProjectUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -145,9 +143,8 @@ public class PlatformProjectOpenProcessor extends ProjectOpenProcessor {
|
||||
processor.refreshProjectFiles(projectDir);
|
||||
}
|
||||
|
||||
Ref<ConversionResult> conversionResultRef = new Ref<ConversionResult>();
|
||||
project = ((ProjectManagerImpl) projectManager).convertAndLoadProject(baseDir.getPath(), conversionResultRef);
|
||||
if (conversionResultRef.get().openingIsCanceled()) {
|
||||
project = ((ProjectManagerImpl) projectManager).convertAndLoadProject(baseDir.getPath());
|
||||
if (project == null) {
|
||||
return null;
|
||||
}
|
||||
runConfigurators = false;
|
||||
|
||||
Reference in New Issue
Block a user