diff --git a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java index e95a105d57..9332368881 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java @@ -1,32 +1,22 @@ package com.fr.design.mainframe.check; +import com.fanruan.repository.TemplateRepository; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; -import com.fr.base.BaseUtils; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; -import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; -import com.fr.rpc.ExceptionHandler; -import com.fr.rpc.RPCInvokerExceptionInfo; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.check.TemplateChecker; -import javax.swing.BoxLayout; -import javax.swing.JDialog; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; -import java.awt.BorderLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; @@ -34,14 +24,9 @@ import java.awt.event.WindowEvent; import java.util.Set; import java.util.concurrent.ExecutionException; -import static com.fine.swing.ui.layout.Layouts.cell; -import static com.fine.swing.ui.layout.Layouts.column; -import static com.fine.swing.ui.layout.Layouts.flex; -import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.*; import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; -import static javax.swing.JOptionPane.OK_CANCEL_OPTION; -import static javax.swing.JOptionPane.OK_OPTION; -import static javax.swing.JOptionPane.WARNING_MESSAGE; +import static javax.swing.JOptionPane.*; public class CheckButton extends UIButton { @@ -174,16 +159,15 @@ public class CheckButton extends UIButton { private Set check(JTemplate jtemplate) { String path = jtemplate.getEditingFILE().getEnvFullName(); - Set fontSet = WorkContext.getCurrent().get(TemplateChecker.class, new ExceptionHandler() { - - @Override - public Void callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) { - imageLabel.setIcon(new LazyIcon("error", 20)); - message.setText("" + Toolkit.i18nText("Fine_Designer_Check_Font_Upgrade") + ""); - okButton.setEnabled(true); - return null; - } - }).checkFont(path); + Set fontSet = null; + try { + fontSet = TemplateRepository.getInstance().checkFont(path); + } catch (Exception e) { + imageLabel.setIcon(new LazyIcon("error", 20)); + message.setText("" + Toolkit.i18nText("Fine_Designer_Check_Font_Upgrade") + ""); + okButton.setEnabled(true); + return null; + } return fontSet; }