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);