From 3b309e8b2ab9de91bc9c4a7698b453a211f94ab8 Mon Sep 17 00:00:00 2001 From: "Link.Zhao" Date: Wed, 31 Aug 2022 11:36:34 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-79456=20=E3=80=90=E8=BF=90=E8=90=A5?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=8C=96=E4=BA=8C=E6=9C=9F=E3=80=91=E8=BF=9C?= =?UTF-8?q?=E7=A8=8B=E8=AE=BE=E8=AE=A1=E4=B8=8B=20=E7=AB=8B=E5=8D=B3?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E4=B8=8B=E8=BD=BD=E4=B8=8D=E6=88=90=E5=8A=9F?= =?UTF-8?q?=20=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=9A=84=E4=B8=8B=E8=BD=BD=E8=B7=AF=E5=BE=84=E6=98=AF=E4=B8=AA?= =?UTF-8?q?url=EF=BC=8C=E4=B8=8D=E5=8F=AF=E7=94=A8=20=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=88=B0=E6=A1=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/action/StartUseAction.java | 23 +++++++++++-------- .../download/FineMarketDownloadManager.java | 6 ++--- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/action/StartUseAction.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/action/StartUseAction.java index 330d230699..de813883f8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/action/StartUseAction.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/action/StartUseAction.java @@ -54,28 +54,33 @@ public class StartUseAction implements ActionListener { }.execute(); } + /** + * 打开模板并打开文件目录 + * */ void open(String fileName) throws IOException { if (Strings.isEmpty(fileName)) { return; } + // 打开模板 + openInDesigner(fileName); + + // 打开系统文件夹 + File parentDir = new File(fileName).getParentFile(); + Desktop.getDesktop().open(parentDir); + } + + void openInDesigner(String fileName) { File fileNeedOpen = new File(fileName); if (fileName.endsWith(FineMarketConstants.ZIP)) { File[] files = fileNeedOpen.getParentFile().listFiles(); fileNeedOpen = getFirstCptOrFrm(files); } else if (fileName.endsWith(FineMarketConstants.RAR)) { - // rar直接打开系统文件夹 - File parentDir = new File(fileName).getParentFile(); - Desktop.getDesktop().open(parentDir); + // rar资源没有解压,所以不用打开模板 return; } - openInDesigner(fileNeedOpen); - } - void openInDesigner(File file) { - // 刷新目录 - DesignerFrameFileDealerPane.getInstance().refresh(); // 打开模板 - DesignerContext.getDesignerFrame().openTemplate(new FileFILE(file)); + DesignerContext.getDesignerFrame().openTemplate(new FileFILE(fileNeedOpen)); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/download/FineMarketDownloadManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/download/FineMarketDownloadManager.java index 08a7853119..c95ee8bde8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/download/FineMarketDownloadManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/download/FineMarketDownloadManager.java @@ -13,9 +13,9 @@ import com.fr.design.mainframe.alphafine.search.helper.FineMarketClientHelper; import com.fr.design.mainframe.toast.SimpleToast; import com.fr.log.FineLoggerFactory; import com.fr.third.jodd.io.ZipUtil; -import com.fr.workspace.WorkContext; import javax.swing.SwingUtilities; +import javax.swing.filechooser.FileSystemView; import java.awt.Window; import java.io.File; import java.io.IOException; @@ -57,8 +57,8 @@ public class FineMarketDownloadManager { } private String install(TemplateResource resource, Window parentWindow) { - // 获取报表录作为下载位置 - String workDir = WorkContext.getCurrent().getPath() + FineMarketConstants.REPORTLETS; + // 默认下载到桌面 + String workDir = FileSystemView.getFileSystemView().getHomeDirectory().getPath(); File destDir = new File(workDir); DownloadProcess downloadProcess = new DownloadProcess(parentWindow);