boolean showErrorFrame = true;
// This logic should check if there is an enhancement
// available
if (cfe instanceof NestedCalculateFormulaException) {
NestedCalculateFormulaException ncfe = (NestedCalculateFormulaException) cfe;
if (ncfe.hasEnhancementExceptions()) {
String newLine = System
.getProperty("line.separator"); //$NON-NLS-1$
int answer = JOptionPane
.showConfirmDialog(
null,
Messages.getString("Metrics.Builder.ConsistencyCheck.ErrorsCanBeReducedByUsingTheFormula") + newLine + //$NON-NLS-1$
"\""
+ ncfe.getEnhancementExceptions()
.get(0)
.getEnhancedFormula()
+ "\""
+ newLine
+ Messages
.getString("Metrics.Builder.ConsistencyCheck.DoYouWantToUseThisFormula"), //$NON-NLS-1$
Messages.getString("Metrics.Builder.ConsistencyCheck.EnhancementAvailable"), //$NON-NLS-1$
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE);
// Check if Yes is clicked
if (answer == JOptionPane.YES_OPTION) {
// Writing the new Formula into the Text-Field
MetricsBuilderPanel.jMetricsFormulaTextField
.setText(ncfe
.getEnhancementExceptions()
.get(0).getEnhancedFormula());
// Disable that the original error-screen
showErrorFrame = false;
// Run the check process a second time for
// getting the errors for the new formula
try {
// Run the checker
MetricsCalculator.checkFormula(ncfe
.getEnhancementExceptions().get(0)
.getEnhancedFormula());
// Show the successful Dialog if no errors
// appear