Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 321531 - Patch for correct parsing of integer attributes in editing
Summary: Patch for correct parsing of integer attributes in editing
Status: NEW
Alias: None
Product: GMF-Tooling
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-02 13:40 EDT by Axel Guckelsberger CLA
Modified: 2010-08-02 13:46 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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(?).