diff --git a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java index 8c1252651a..9ce92b756f 100644 --- a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java @@ -352,6 +352,13 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp }); } } + /** + * 重置 + */ + public void resetAddMenuDef() { + this.addMenuDef.clearShortCuts(); + this.createAddMenuDef(); + } private abstract class TDAction extends UpdateAction { diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 0c072ba033..a50a35b11d 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -646,10 +646,6 @@ public class TableDataTreePane extends BasicTableDataTreePane { } - private void resetAddMenuDef() { - this.addMenuDef.clearShortCuts(); - this.createAddMenuDef(); - } /** * 感觉这里,把一堆Action和Op之类的送到抽象类里去检查,很奇怪,抽象类本身定义的Action只有add和connection diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/LocalTableDataSource.java b/designer-base/src/main/java/com/fr/design/data/tabledata/LocalTableDataSource.java index bcb717e81a..12a8a0c0ef 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/LocalTableDataSource.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/LocalTableDataSource.java @@ -1,8 +1,10 @@ package com.fr.design.data.tabledata; import com.fanruan.config.impl.data.TableDataConfigProviderFactory; +import com.fr.decision.webservice.bean.dataset.FileDataSetBean; import com.fr.decision.webservice.bean.entry.FileNodeBean; import com.fr.decision.webservice.v10.datasource.dataset.processor.impl.FileProcessor; +import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.workspace.server.repository.tabledata.BaseTableDataSource; @@ -49,4 +51,14 @@ public class LocalTableDataSource extends BaseTableDataSource { public List getFileList(String fileType) { return FileProcessor.KEY.getFileList(fileType, StringUtils.EMPTY); } + + @Override + public boolean testFilePath(FileDataSetBean fileDataSetBean) { + try { + return FileProcessor.KEY.testFilePath(fileDataSetBean); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return false; + } + } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java index 3ad4c40678..69bd6819cf 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java @@ -14,6 +14,7 @@ import com.fr.data.impl.ExcelTableData; import com.fr.data.impl.FileTableData; import com.fr.data.impl.TextTableData; import com.fr.data.impl.XMLTableData; +import com.fr.decision.webservice.bean.dataset.FileDataSetBean; import com.fr.design.actions.UpdateAction; import com.fr.design.constants.LayoutConstants; import com.fr.design.data.datapane.preview.PreviewTablePane; @@ -47,6 +48,7 @@ import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLableReader; +import com.fr.workspace.server.repository.tabledata.TableDataRepository; import javax.swing.ButtonGroup; import javax.swing.JOptionPane; @@ -233,22 +235,20 @@ public class FileTableDataPane extends AbstractTableDataPane { } params = getEditorPaneParameter(); URLDataSource url = new URLDataSource(urlText.getText().trim(), params); - InputStream in = null; + boolean result = false; try { - in = url.getSourceStream(params); + String urlText = ParameterHelper.analyze4Templatee(url.getUrl(), params); + FileDataSetBean bean = new FileDataSetBean(); + bean.setFilePath(urlText); + result = TableDataRepository.getInstance().testFilePath(bean); } catch (Throwable e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } - if (in == null) { + if (!result) { FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); } else { FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Connection_Successfully")); - try { - in.close(); - } catch (IOException e) { - in = null; - } } } }; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index fc6be544d2..a4239bc64c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -755,6 +755,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta refresh(); DesignerFrameFileDealerPane.getInstance().refreshDockingView(); TemplateTreePane.getInstance().refreshDockingView(); + TableDataTreePane.getInstanceWithoutRefreshEverytime(DesignModelAdapter.getCurrentModelAdapter()).resetAddMenuDef(); } /** diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/DesignPluginComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/DesignPluginComponent.java index 74f44dee74..be92acac20 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/DesignPluginComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/DesignPluginComponent.java @@ -5,6 +5,7 @@ import com.fanruan.carina.Carina; import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.Start; +import com.fanruan.carina.annotions.Stop; import com.fanruan.carina.annotions.Supplemental; import com.fanruan.plugin.autonomy.AutonomyClassManagerGroup; import com.fanruan.plugin.autonomy.AutonomyClassManagerProvider; @@ -44,4 +45,12 @@ public class DesignPluginComponent extends PluginComponent { protected void addPluginStoreFilter(ServletContext servletContext) { // do nothing } + + /** + * stop + */ + @Stop + public void stop() { + super.stop(); + } }