mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
take transaction in ProjectUtil.openProject (EA-143639)
GitOrigin-RevId: 3013af06d0d4dcab70f17668709f8d926fa27069
This commit is contained in:
committed by
intellij-monorepo-bot
parent
902b8da195
commit
402d7036e6
@@ -11,6 +11,7 @@ import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.application.TransactionGuard;
|
||||
import com.intellij.openapi.components.StorageScheme;
|
||||
import com.intellij.openapi.components.impl.stores.IProjectStore;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -18,6 +19,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.project.ex.ProjectManagerEx;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -181,14 +183,17 @@ public class ProjectUtil {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
return ProjectManager.getInstance().loadAndOpenProject(path);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Messages.showMessageDialog(IdeBundle.message("error.cannot.load.project", e.getMessage()),
|
||||
IdeBundle.message("title.cannot.load.project"), Messages.getErrorIcon());
|
||||
}
|
||||
return null;
|
||||
Ref<Project> result = new Ref<>();
|
||||
TransactionGuard.getInstance().submitTransactionAndWait(() -> {
|
||||
try {
|
||||
result.set(ProjectManager.getInstance().loadAndOpenProject(path));
|
||||
}
|
||||
catch (Exception e) {
|
||||
Messages.showMessageDialog(IdeBundle.message("error.cannot.load.project", e.getMessage()),
|
||||
IdeBundle.message("title.cannot.load.project"), Messages.getErrorIcon());
|
||||
}
|
||||
});
|
||||
return result.get();
|
||||
}
|
||||
|
||||
public static boolean confirmLoadingFromRemotePath(@NotNull String path,
|
||||
|
||||
Reference in New Issue
Block a user