|
|
|
@ -814,10 +814,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
|
|
|
|
|
String formulaText = formulaTextArea.getText().trim(); |
|
|
|
|
String unSupportFormula = containsUnsupportedSimulationFormulas(formulaText); |
|
|
|
|
if (unSupportFormula != null) { |
|
|
|
|
showMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula, false); |
|
|
|
|
showMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula, false, true); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
boolean calException = false; |
|
|
|
|
String messageTips; |
|
|
|
|
FormulaCheckResult checkResult = FormulaChecker.check(formulaText); |
|
|
|
|
if (checkResult.grammarValid()) { |
|
|
|
@ -846,6 +847,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
|
|
|
|
|
} catch (Exception ce) { |
|
|
|
|
//模拟计算如果出现错误,则抛出错误
|
|
|
|
|
calResult = ce.getMessage(); |
|
|
|
|
calException = true; |
|
|
|
|
FineLoggerFactory.getLogger().error(ce.getMessage(), ce); |
|
|
|
|
messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Error") + ":" + calResult; |
|
|
|
|
} |
|
|
|
@ -854,7 +856,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
|
|
|
|
|
messageTips = checkResult.getTips(); |
|
|
|
|
} |
|
|
|
|
if (checkResult.isValid()) { |
|
|
|
|
showMessageDialog(messageTips, checkResult.isValid()); |
|
|
|
|
showMessageDialog(messageTips, checkResult.isValid(), calException); |
|
|
|
|
} else { |
|
|
|
|
confirmCheckResult(checkResult, messageTips); |
|
|
|
|
} |
|
|
|
@ -871,7 +873,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
|
|
|
|
|
|
|
|
|
|
private boolean confirmCheckResult(FormulaCheckResult checkResult, String messageTips) { |
|
|
|
|
if (checkResult.isValid()) { |
|
|
|
|
showMessageDialog(checkResult.getTips(), checkResult.isValid()); |
|
|
|
|
showMessageDialog(checkResult.getTips(), checkResult.isValid(), false); |
|
|
|
|
} else { |
|
|
|
|
int columns = checkResult.getFormulaCoordinates().getColumns(); |
|
|
|
|
String position = StringUtils.EMPTY; |
|
|
|
@ -897,8 +899,8 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void showMessageDialog(String message, boolean formulaValid) { |
|
|
|
|
if (formulaValid) { |
|
|
|
|
private void showMessageDialog(String message, boolean formulaValid, boolean calException) { |
|
|
|
|
if (formulaValid && !calException) { |
|
|
|
|
FineJOptionPane.showMessageDialog( |
|
|
|
|
FormulaPane.this, |
|
|
|
|
message); |
|
|
|
|