From d8140ae8c2e0c14f292ca860ecb88b8e53f37d21 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Mon, 22 Nov 2021 11:58:43 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-60163=20=E5=85=AC=E5=BC=8F=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E4=BC=98=E5=8C=962.0=201.=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E6=B5=8B=E8=AF=95=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/formula/FormulaChecker.java | 4 ++-- .../java/com/fr/design/formula/FormulaPane.java | 13 ++++++------- .../exception/FormulaExceptionTipsProcessor.java | 2 +- .../function/FormulaCheckWrongFunction.java | 8 ++++++-- .../exception/function/MismatchedCharFunction.java | 4 ++-- .../exception/function/MismatchedTokenFunction.java | 4 ++-- .../function/NoViableAltForCharFunction.java | 4 ++-- .../exception/function/NoViableAltFunction.java | 4 ++-- .../FormulaAutoCompletePopupWindow.java | 2 +- 9 files changed, 24 insertions(+), 21 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java b/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java index 1d1097db4..f91322f68 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java @@ -25,7 +25,7 @@ public class FormulaChecker { public static FormulaCheckResult check(String formulaText) { if (StringUtils.isEmpty(formulaText) || formulaText.equals(Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Tips"))) { - return new FormulaCheckResult(true, VALID_FORMULA, FormulaCoordinates.INVALID); + return new FormulaCheckResult(true, VALID_FORMULA, FormulaCoordinates.INVALID, true); } //过滤一些空格等符号 StringReader in = new StringReader(formulaText); @@ -37,7 +37,7 @@ public class FormulaChecker { Node node = expression.getConditionalExpression(); boolean valid = FunctionCheckerDispatcher.getInstance().getFunctionChecker(node).checkFunction(formulaText, node); return new FormulaCheckResult(valid, valid ? Toolkit.i18nText("Fine-Design_Basic_FormulaD_Valid_Formula") : - Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula"), FormulaCoordinates.INVALID); + Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula"), FormulaCoordinates.INVALID, true); } catch (Exception e) { if (e instanceof TokenStreamRecognitionException) { return processor.getExceptionTips(((TokenStreamRecognitionException) e).recog); diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index be73609c8..b11644e68 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -387,7 +387,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } completionProvider.addCompletion(new FormulaCompletion(completionProvider, paramWithoutPre, BaseUtils.readIcon(PARAM_ICON))); } - completionProvider.addCompletion(new FormulaCompletion(completionProvider, "$$$", BaseUtils.readIcon(PARAM_ICON))); return completionProvider; } @@ -787,7 +786,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { // Execute Formula default cell element. String formulaText = formulaTextArea.getText().trim(); FormulaCheckResult checkResult = FormulaChecker.check(formulaText); - confirmCheckResult(checkResult); + confirmCheckResult(checkResult, checkResult.getTips()); } }; @@ -804,7 +803,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { String messageTips; FormulaCheckResult checkResult = FormulaChecker.check(formulaText); - if (checkResult.isValid()) { + if (checkResult.grammarValid()) { messageTips = checkResult.getTips() + NEWLINE; Map paramsMap = setParamsIfExist(formulaText); Calculator calculator = Calculator.createCalculator(); @@ -836,12 +835,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { if (checkResult.isValid()) { showMessageDialog(messageTips, checkResult.isValid()); } else { - confirmCheckResult(checkResult); + confirmCheckResult(checkResult, messageTips); } } }; - private boolean confirmCheckResult(FormulaCheckResult checkResult) { + private boolean confirmCheckResult(FormulaCheckResult checkResult, String messageTips) { if (checkResult.isValid()) { showMessageDialog(checkResult.getTips(), checkResult.isValid()); } else { @@ -849,7 +848,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { + Toolkit.i18nText("Fine-Design_Basic_Formula_Error_Position") + " "; int confirmDialog = FineJOptionPane.showConfirmDialog( FormulaPane.this, - position + checkResult.getTips(), + position + messageTips, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, @@ -902,7 +901,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { String formula = formulaTextArea.getText().trim(); FormulaCheckResult checkResult = FormulaChecker.check(formula); if (!checkResult.isValid()) { - return confirmCheckResult(checkResult); + return confirmCheckResult(checkResult, checkResult.getTips()); } } return true; diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/FormulaExceptionTipsProcessor.java b/designer-base/src/main/java/com/fr/design/formula/exception/FormulaExceptionTipsProcessor.java index 44f3d59b4..53fa9aaf8 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/FormulaExceptionTipsProcessor.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/FormulaExceptionTipsProcessor.java @@ -38,7 +38,7 @@ public class FormulaExceptionTipsProcessor { public FormulaCheckResult getExceptionTips(Exception e) { return EXCEPTION_TIPS.getOrDefault(e.getClass(), - e1 -> new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID)) + e1 -> new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID, false)) .apply(e); } diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java index 274868989..ce2b7cb52 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java @@ -41,9 +41,9 @@ public class FormulaCheckWrongFunction implements Function getFunction() { diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedTokenFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedTokenFunction.java index a1e7aeec9..e573e5693 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedTokenFunction.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedTokenFunction.java @@ -24,9 +24,9 @@ public class MismatchedTokenFunction implements Function getFunction() { diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java index 0cb4058a7..1f0bdf873 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java @@ -20,9 +20,9 @@ public class NoViableAltForCharFunction implements Function getFunction() { diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java index e6bfbd5df..85cc0ecc6 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java @@ -21,9 +21,9 @@ public class NoViableAltFunction implements Function getFunction() { diff --git a/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java b/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java index e704a6bdd..0efd20076 100644 --- a/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java +++ b/designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java @@ -371,7 +371,7 @@ class FormulaAutoCompletePopupWindow extends JWindow implements CaretListener, public void mouseClicked(MouseEvent e) { - if (e.getClickCount() == 2) { + if (e.getClickCount() == 2 && e.getButton() == 1) { insertSelectedCompletion(); refreshInstallComp(); } else if (e.getClickCount() == 1) {