mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[ExternalSystem] cleanup: extract select project data logic from the project sync callback
### Issues * CPP-44637 Multiple meson test failures GitOrigin-RevId: 92a4f71a09797cfec1d39088d2c85b9cc1e662b6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
58d4105d95
commit
e81acc0cd4
@@ -316,6 +316,7 @@ com.intellij.openapi.externalSystem.importing.ImportSpec
|
||||
- a:isPreviewMode():Z
|
||||
- a:shouldCreateDirectoriesForEmptyContentRoots():Z
|
||||
- a:shouldImportProjectData():Z
|
||||
- a:shouldSelectProjectDataToImport():Z
|
||||
c:com.intellij.openapi.externalSystem.importing.ImportSpecBuilder
|
||||
- <init>(com.intellij.openapi.externalSystem.importing.ImportSpec):V
|
||||
- <init>(com.intellij.openapi.project.Project,com.intellij.openapi.externalSystem.model.ProjectSystemId):V
|
||||
@@ -338,6 +339,7 @@ c:com.intellij.openapi.externalSystem.importing.ImportSpecBuilder
|
||||
- withImportProjectData(Z):com.intellij.openapi.externalSystem.importing.ImportSpecBuilder
|
||||
- withPreviewMode(Z):com.intellij.openapi.externalSystem.importing.ImportSpecBuilder
|
||||
- withRerunAction(java.lang.Runnable):com.intellij.openapi.externalSystem.importing.ImportSpecBuilder
|
||||
- withSelectProjectDataToImport(Z):com.intellij.openapi.externalSystem.importing.ImportSpecBuilder
|
||||
- withUserData(com.intellij.openapi.util.UserDataHolderBase):com.intellij.openapi.externalSystem.importing.ImportSpecBuilder
|
||||
- withVmOptions(java.lang.String):com.intellij.openapi.externalSystem.importing.ImportSpecBuilder
|
||||
c:com.intellij.openapi.externalSystem.model.DataNode
|
||||
|
||||
@@ -47,6 +47,8 @@ public interface ImportSpec {
|
||||
|
||||
boolean shouldImportProjectData();
|
||||
|
||||
boolean shouldSelectProjectDataToImport();
|
||||
|
||||
boolean shouldCreateDirectoriesForEmptyContentRoots();
|
||||
|
||||
boolean isActivateBuildToolWindowOnStart();
|
||||
|
||||
@@ -34,6 +34,7 @@ public class ImportSpecBuilder {
|
||||
private @Nullable String myVmOptions = null;
|
||||
private @Nullable String myArguments = null;
|
||||
private boolean myImportProjectData = true;
|
||||
private boolean mySelectProjectDataToImport = false;
|
||||
private boolean myCreateDirectoriesForEmptyContentRoots = false;
|
||||
private @Nullable ProjectResolverPolicy myProjectResolverPolicy = null;
|
||||
private @Nullable Runnable myRerunAction = null;
|
||||
@@ -56,6 +57,7 @@ public class ImportSpecBuilder {
|
||||
myVmOptions = importSpec.getVmOptions();
|
||||
myArguments = importSpec.getArguments();
|
||||
myImportProjectData = importSpec.shouldImportProjectData();
|
||||
mySelectProjectDataToImport = importSpec.shouldSelectProjectDataToImport();
|
||||
myCreateDirectoriesForEmptyContentRoots = importSpec.shouldCreateDirectoriesForEmptyContentRoots();
|
||||
myProjectResolverPolicy = importSpec.getProjectResolverPolicy();
|
||||
myRerunAction = importSpec.getRerunAction();
|
||||
@@ -140,6 +142,12 @@ public class ImportSpecBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
@CheckReturnValue
|
||||
public ImportSpecBuilder withSelectProjectDataToImport(boolean selectProjectDataToImport) {
|
||||
mySelectProjectDataToImport = selectProjectDataToImport;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ImportSpecBuilder createDirectoriesForEmptyContentRoots() {
|
||||
myCreateDirectoriesForEmptyContentRoots = true;
|
||||
return this;
|
||||
@@ -212,6 +220,7 @@ public class ImportSpecBuilder {
|
||||
myCallback,
|
||||
isPreviewMode,
|
||||
myImportProjectData,
|
||||
mySelectProjectDataToImport,
|
||||
myCreateDirectoriesForEmptyContentRoots,
|
||||
isActivateBuildToolWindowOnStart,
|
||||
isActivateBuildToolWindowOnFailure,
|
||||
|
||||
@@ -23,6 +23,7 @@ public final class ImportSpecImpl implements ImportSpec {
|
||||
private @Nullable ExternalProjectRefreshCallback myCallback;
|
||||
private boolean isPreviewMode;
|
||||
private boolean importProjectData;
|
||||
private boolean selectProjectDataToImport;
|
||||
private boolean createDirectoriesForEmptyContentRoots;
|
||||
private boolean isActivateBuildToolWindowOnStart;
|
||||
private boolean isActivateBuildToolWindowOnFailure;
|
||||
@@ -51,6 +52,7 @@ public final class ImportSpecImpl implements ImportSpec {
|
||||
@Nullable ExternalProjectRefreshCallback callback,
|
||||
boolean isPreviewMode,
|
||||
boolean importProjectData,
|
||||
boolean selectProjectDataToImport,
|
||||
boolean createDirectoriesForEmptyContentRoots,
|
||||
boolean isActivateBuildToolWindowOnStart,
|
||||
boolean isActivateBuildToolWindowOnFailure,
|
||||
@@ -67,6 +69,7 @@ public final class ImportSpecImpl implements ImportSpec {
|
||||
this.myCallback = callback;
|
||||
this.isPreviewMode = isPreviewMode;
|
||||
this.importProjectData = importProjectData;
|
||||
this.selectProjectDataToImport = selectProjectDataToImport;
|
||||
this.createDirectoriesForEmptyContentRoots = createDirectoriesForEmptyContentRoots;
|
||||
this.isActivateBuildToolWindowOnStart = isActivateBuildToolWindowOnStart;
|
||||
this.isActivateBuildToolWindowOnFailure = isActivateBuildToolWindowOnFailure;
|
||||
@@ -132,6 +135,11 @@ public final class ImportSpecImpl implements ImportSpec {
|
||||
return importProjectData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSelectProjectDataToImport() {
|
||||
return selectProjectDataToImport;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCreateDirectoriesForEmptyContentRoots() {
|
||||
return createDirectoriesForEmptyContentRoots;
|
||||
|
||||
@@ -53,6 +53,7 @@ import com.intellij.openapi.externalSystem.service.project.manage.ExternalProjec
|
||||
import com.intellij.openapi.externalSystem.service.project.manage.ExternalSystemTaskActivator;
|
||||
import com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl;
|
||||
import com.intellij.openapi.externalSystem.service.project.trusted.ExternalSystemTrustedProjectDialog;
|
||||
import com.intellij.openapi.externalSystem.service.ui.ExternalProjectDataSelectorDialog;
|
||||
import com.intellij.openapi.externalSystem.settings.AbstractExternalSystemLocalSettings;
|
||||
import com.intellij.openapi.externalSystem.settings.ExternalProjectSettings;
|
||||
import com.intellij.openapi.externalSystem.statistics.ExternalSystemStatUtilKt;
|
||||
@@ -572,6 +573,9 @@ public final class ExternalSystemUtil {
|
||||
externalProject.putUserData(ContentRootDataService.CREATE_EMPTY_DIRECTORIES, Boolean.TRUE);
|
||||
}
|
||||
if (importSpec.shouldImportProjectData()) {
|
||||
if (importSpec.shouldSelectProjectDataToImport()) {
|
||||
selectProjectDataToImport(project, externalProjectData);
|
||||
}
|
||||
projectDataManager.importData(externalProject, project);
|
||||
}
|
||||
}
|
||||
@@ -625,6 +629,24 @@ public final class ExternalSystemUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static void selectProjectDataToImport(
|
||||
@NotNull Project project,
|
||||
@NotNull ExternalProjectInfo projectInfo
|
||||
) {
|
||||
var application = ApplicationManager.getApplication();
|
||||
if (!application.isHeadlessEnvironment()) {
|
||||
application.invokeAndWait(() -> {
|
||||
var dialog = new ExternalProjectDataSelectorDialog(project, projectInfo);
|
||||
if (dialog.hasMultipleDataToSelect()) {
|
||||
dialog.showAndGet();
|
||||
}
|
||||
else {
|
||||
Disposer.dispose(dialog.getDisposable());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static @NotNull FinishBuildEvent getSyncFinishEvent(
|
||||
@NotNull ExternalSystemTaskId taskId,
|
||||
@NotNull Ref<? extends Supplier<? extends FinishBuildEvent>> finishSyncEventSupplier
|
||||
@@ -1011,7 +1033,9 @@ public final class ExternalSystemUtil {
|
||||
//noinspection unchecked
|
||||
systemSettings.linkProject(projectSettings);
|
||||
|
||||
refreshProject(projectSettings.getExternalProjectPath(), importSpec);
|
||||
refreshProject(projectSettings.getExternalProjectPath(), new ImportSpecBuilder(importSpec)
|
||||
.withSelectProjectDataToImport(systemSettings.showSelectiveImportDialogOnInitialImport())
|
||||
);
|
||||
}
|
||||
|
||||
public static @Nullable VirtualFile refreshAndFindFileByIoFile(final @NotNull File file) {
|
||||
|
||||
Reference in New Issue
Block a user