Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336792 - Generated Editor's ModelWizard does not support double file extensions, such as "cov.xml"
Summary: Generated Editor's ModelWizard does not support double file extensions, such ...
Status: RESOLVED WONTFIX
Alias: None
Product: EMF
Classification: Modeling
Component: Edit (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Ed Merks CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-10 04:55 EST by Mikhail Kalkov CLA
Modified: 2011-02-11 06:22 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Kalkov CLA 2011-02-10 04:55:53 EST
Build Identifier: M20100909-0800

I was going to use a double extension (*.cov.xml) as a quick way to associate a specific editor with my kind of XML files. The generated editor could open existing *.cov.xml files, but it was not possible to create any new ones using the generated ModelWizard.

In particular, after selecting the parent folder and entering "My.cov.xml" into the file name field, the error message at the top of the window still read "The file name must end in '.cov.xml'", and the "Next >" button was disabled. After I changed the file extension to "covxml", and regenerated models, everything worked fine.

Reproducible: Always

Steps to Reproduce:
1. Create Ecore and Generator models.
2. In the package properties of genmodel enter "cov.xml" in the File Extensions field.
3. Generate Model, Edit, and Editor, and try to use the created model wizard. It is not possible to finish it.
Comment 1 Ed Merks CLA 2011-02-11 03:44:45 EST
I don't think Eclipse editor associations even support that.  Certainly EMF's extension parser registrations don't either.  Even URI.fileExtension would never know how to interpret an extension with dots verses a file name with dots and an extension without.  I.e., given a.b.c, which is the extension?  I don't want to go down that rat hole.
Comment 2 Mikhail Kalkov CLA 2011-02-11 04:12:09 EST
I am not going to argue about your decision, but totally cannot see why you say that it is difficult to decide which one is the extension. "Given a.b.c", look up the most specific out of registered extensions and call it the one! What is the whole point of registering/declaring extensions otherwise?

On the other note, the bug with stuck ModelWizard is still there. One either has to validate FileExtensions property of genmodel to prevent user from using dots, or give a meaningful error message in the wizard. A ModelWizard that gets stuck without any obvious reasons is by no means a feature.
Comment 3 Eike Stepper CLA 2011-02-11 04:21:55 EST
(In reply to comment #1)
> I don't think Eclipse editor associations even support that.

They are not based on the concept of a file name extension. They do pattern matching against the entire file name.
Comment 4 Ed Merks CLA 2011-02-11 05:22:33 EST
In Window->Preferences->General->Editors->File Associations I can add *.abc, but I can't add *.abc.def...

In any case, EMF supports content types so presumably a *.cov.xml will have recognizable content such that one can get by with that instead.
Comment 5 Mikhail Kalkov CLA 2011-02-11 06:10:45 EST
In my case XML files are produced by a third-party tool, and don't even have an xmlns attribute. I agree that using content types is a better way, but in order to avoid preprocessing, I decided to rely on file extensions so far.

Anyway, what made me submit this bug is that genmodel's property editor lets one enter a double extension, whereas ModelWizard fails because of it without providing any meaningful error message. In case of "Window -> Preferences -> General -> Editors -> File Associations" user at least gets a quick feedback hinting that double extensions are not accepted.
Comment 6 Ed Merks CLA 2011-02-11 06:22:24 EST
I expect a large number of the GenModel's properties are not properly validated.  I suppose in the end, different OS's have restrictions on characters allowed in file names...