Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 321531

Summary: Patch for correct parsing of integer attributes in editing
Product: [Modeling] GMF-Tooling Reporter: Axel Guckelsberger <info>
Component: CoreAssignee: Project Inbox <gmp.gmf-tooling-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Axel Guckelsberger CLA 2010-08-02 13:40:41 EDT
Build Identifier: 20100617-1415

This patch fixes the bug that an integer feature with a value greater than 999 is displayed with a thousand separator preventing a successful editing.

1. templates/parsers/PredefinedParser.xpt
Change
protected java.text.MessageFormat getEditorProcessor() {
to
public java.text.MessageFormat getEditorProcessor() {

2. templates/impl/parsers/ParserProvider.xpt
Change
            «parserFieldName(element)» = parser;
        }
        return «parserFieldName(element)»;
to
            «parserFieldName(element)» = parser;

            final java.text.DecimalFormat df = new java.text.DecimalFormat();
            df.setMaximumFractionDigits(0);
            df.setGroupingUsed(false);

            for (int i = 0; i < features.length; i++) {
                EAttribute eAttribute = features[i];
                if (eAttribute.getEType().getName().equals("EInt")) {
                    parser.getEditorProcessor().setFormatByArgumentIndex(i, df);
                }
            }
        }
        return «parserFieldName(element)»;

Regards,
Axel


Reproducible: Always
Comment 1 Axel Guckelsberger CLA 2010-08-02 13:46:22 EDT
Note: this does not work with native parser (yet), as there is no editorProcessor(?).