From 46cb8b8256f456a0deefd99191ab7afe52eea839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=99=BD=E4=B8=8E=E5=AD=9F=E6=B5=A9=E7=84=B6?= <1063889643@qq.com> Date: Wed, 1 Nov 2023 16:01:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?+=20=E8=B0=83=E6=95=B4=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B9=E9=80=89=E6=8B=A9=E5=99=A8=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/light/util/H2PoolUtils.java | 4 ++-- src/main/java/com/light/view/HomeView.java | 2 +- src/main/java/com/light/view/ManagerView.java | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/light/util/H2PoolUtils.java b/src/main/java/com/light/util/H2PoolUtils.java index 9914cb4..6ac268e 100644 --- a/src/main/java/com/light/util/H2PoolUtils.java +++ b/src/main/java/com/light/util/H2PoolUtils.java @@ -256,10 +256,10 @@ public class H2PoolUtils { String sql2 = "insert into git_project_dict(label, label_value, description, createtime, updatetime) values('GIT_CURRENT_THEME','Primer Light','项目当前主题', " + "'" + dateTime + "', '" + dateTime + "')"; stmt.addBatch(sql2); - String sql3 = "insert into git_project_dict(label, label_value, description, createtime, updatetime) values('GIT_CURRENT_CLONE_DIR','D:','项目克隆路径', " + + String sql3 = "insert into git_project_dict(label, label_value, description, createtime, updatetime) values('GIT_CURRENT_CLONE_DIR','','项目克隆路径', " + "'" + dateTime + "', '" + dateTime + "')"; stmt.addBatch(sql3); - String sql4 = "insert into git_project_dict(label, label_value, description, createtime, updatetime) values('GIT_CURRENT_LOCAL_DIR','D:','本地项目路径', " + + String sql4 = "insert into git_project_dict(label, label_value, description, createtime, updatetime) values('GIT_CURRENT_LOCAL_DIR','','本地项目路径', " + "'" + dateTime + "', '" + dateTime + "')"; stmt.addBatch(sql4); stmt.executeBatch(); diff --git a/src/main/java/com/light/view/HomeView.java b/src/main/java/com/light/view/HomeView.java index 5a9176e..01d5ccb 100644 --- a/src/main/java/com/light/view/HomeView.java +++ b/src/main/java/com/light/view/HomeView.java @@ -93,7 +93,7 @@ public class HomeView extends BorderPane { }); right.setOnMouseClicked(event -> { - dirChooser.setInitialDirectory(new File(H2PoolUtils.queryDictByLabel("GIT_CURRENT_CLONE_DIR", "D:") + File.separator)); + dirChooser.setInitialDirectory(new File(H2PoolUtils.queryDictByLabel("GIT_CURRENT_CLONE_DIR", "") + File.separator)); File file = dirChooser.showDialog(getScene().getWindow()); if (null != file) { targetFolderPath.set(file.getPath()); diff --git a/src/main/java/com/light/view/ManagerView.java b/src/main/java/com/light/view/ManagerView.java index bcbcae7..6f6cd41 100644 --- a/src/main/java/com/light/view/ManagerView.java +++ b/src/main/java/com/light/view/ManagerView.java @@ -151,9 +151,10 @@ public class ManagerView extends StackPane { * 按钮 加载 */ addLocalButton.setOnAction(btn -> { - dirChooser.setInitialDirectory(new File(H2PoolUtils.queryDictByLabel("GIT_CURRENT_LOCAL_DIR", "D:") + File.separator)); + dirChooser.setInitialDirectory(new File(H2PoolUtils.queryDictByLabel("GIT_CURRENT_LOCAL_DIR", "") + File.separator)); File file = dirChooser.showDialog(getScene().getWindow()); if (null != file) { + H2PoolUtils.updateDictData("GIT_CURRENT_LOCAL_DIR", file.getPath()); FxAsyncTask.runOnce("加载本地项目", () -> { JGitUtils.parseLocalProjectPath(file); JGitUtils.parseLocalProject(); -- Gitee From 6da6c090cdba6626aa3ed35fadd1281d4b57fb62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=99=BD=E4=B8=8E=E5=AD=9F=E6=B5=A9=E7=84=B6?= <1063889643@qq.com> Date: Wed, 1 Nov 2023 22:15:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?+=20=E8=AF=A6=E6=83=85=E9=A1=B5=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/light/component/DownloadHBox.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/light/component/DownloadHBox.java b/src/main/java/com/light/component/DownloadHBox.java index 4bff0d3..0572145 100644 --- a/src/main/java/com/light/component/DownloadHBox.java +++ b/src/main/java/com/light/component/DownloadHBox.java @@ -2,6 +2,7 @@ package com.light.component; import atlantafx.base.theme.Styles; import com.light.exception.AuthException; +import com.light.exception.JGitException; import com.light.model.GitAuthInfo; import com.light.model.GitProject; import com.light.thread.FxAsyncTask; @@ -39,6 +40,8 @@ public class DownloadHBox extends HBox { private final CustomProgressMonitor customProgressMonitor = new CustomProgressMonitor(progressBar, null, text); private CredentialsProvider provider; + private boolean isAuthException = false; + /** * 构造方法 * @@ -124,8 +127,12 @@ public class DownloadHBox extends HBox { return newProject; } catch (AuthException e) { + isAuthException = true; authPane.refreshData(remoteUrl, (username, password) -> cloneRepo(JGitUtils.createCredential(username, password), true)); throw new AuthException(); + } catch (Exception e) { + isAuthException = false; + throw new JGitException(); } }, success -> { @@ -134,7 +141,7 @@ public class DownloadHBox extends HBox { FxApplicationContextUtils.DOWNLOAD_PROPERTY.set(String.valueOf(FxApplicationContextUtils.DOWNLOAD_NUMBER.decrementAndGet())); }, fail -> { - if (authPane != null) { + if (authPane != null && isAuthException) { authPane.show((Scene) FxApplicationContextUtils.GLOBAL_CONTEXT_MAP.get("scene")); } retryButton.setVisible(true); -- Gitee