Bug 95227 - WTP1.0m4 SSE contentType file associations override default editors
Summary: WTP1.0m4 SSE contentType file associations override default editors
Status: CLOSED DUPLICATE of bug 95317
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.sse (show other bugs)
Version: 0.7   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: wst.sse CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-13 16:31 EDT by Greg Smith CLA
Modified: 2005-07-07 12:29 EDT (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 Greg Smith CLA 2005-05-13 16:31:13 EDT
In 1.0m3, I have a set of editor associated to various file extensions. The file
format is xml, so I had previously done an:

<extension
     point="org.eclipse.core.runtime.contentTypes">
    <file-association
          content-type="org.eclipse.core.runtime.xml"
          file-extensions="..."/>
</extension>

to get Eclipse to pull the file encoding from the xml decl. This worked fine in
that my editors were the defaults for the files, but the xml editors were
available in the Open With... menu.

After switching to 1.0m4, my files are associated with the XML Source Page by
default. I switched my editors to have default="true" in plugin.xml, but that
didn't help.

In the General|Editor|File Associations preferences page, my files do show their
appropriate editors being the default. In General|Editor|Content Types, they
show up as (locked) under XML. They open with the XML Source Page editor by default.

I would think the contentType based associations should not override an editor
set to default="true", unless the user chooses to do that.

As a workaround, I'm going to not associate my files with the xml contentType,
but make my own that does the same thing. However, with this, the xml editors
don't show up in the Open With... menu anymore.
Comment 1 David Williams CLA 2005-05-13 18:09:04 EDT
Greg, can you clarify ... you have another editor you want to use for your 
own file type, which is xmlish, but which has an extension other than *.xml ..
right? (I can't imagine hy anyone would not want to use our editor, but I have
heard of such cases :) And your editor is only for that one file extension, not
xml in general, right?

While there's probably more investigation needed here, and there are changes to 
the filetype/contentType "ordering" in M7 (our WTP M5) which may effect this,
I'm wondering if one thing you could help investigate is if associating your
editor via the contentType association would help (instead of the filetype
association). 
In principle, you could define your own "subtype" of xml and have the editor just 
associated to that. 

While we may want to test better and make recommendations the base handle
'default' in a more compatible way, I'm wondering if you've investigated this
approach (and if it would be one avenue of a work around, if none other were
found). 

Hopefully these suggestions will help you make clearer to me exactly what's 
going on here and what our next steps should be.  (BTW, there's several other
bugs/featues requests on improvemtents in meaning of 'default' for editor
management]

BTW, one thing to be sure to check, after you change the plugin(s) to have
different 'default' settings, you might have to restart with -clean to get 
them "noticied" and refreshed. 
Thanks,


For example, our editor-to-contentType association is defined this way. 

   <extension
         point="org.eclipse.ui.editors">
      <editor
            name="%XML_Source_Page_Editor.name"
            icon="icons/sourceEditor.gif"
            default="true"
           
contributorClass="org.eclipse.wst.xml.ui.internal.actions.ActionContributorXML"
           
class="org.eclipse.wst.xml.ui.internal.provisional.StructuredTextEditorXML"
            symbolicFontName="org.eclipse.wst.sse.ui.textfont"
            id="org.eclipse.core.runtime.xml.source">
      <contentTypeBinding contentTypeId="org.eclipse.core.runtime.xml" />
      </editor>
Comment 2 Greg Smith CLA 2005-05-16 12:46:10 EDT
David - Your assumptions are correct. I have a visual, drag-n-drop,
point-n-click type editor for files which are xml format but have a different
file extension (let's say '.cam'). This editor is just for files of this
extension (which match a certain schema that this editor is hard-coded to know
about). I want my editor to open by default for .cam files; it would be nice if
the XML Editor was available in the Open With... menu and/or via the user
changing their Content Type and/or File Association preferences.

I wasn't aware of the contentTypeBinding in M6. I tried out your suggestion of
making a new contentType (with base type of xml) and associating my file
extensions to that. Seems to work like a champ. My editor opens by default, and
XML Editor/XML Source Page Editor are automatically in the Open With... menu,
and it's getting the IResource correctly encoding via the xml decl. So, I think
I'm set for this. Thanks for the heads up.

However, I still think the current editor-choosing behavior is incorrect and
should be rectified. It's a bit confusing to have both Content Type and File
Association settings for specifying editors for files, especially since there's
no information visible to the user about which one wins. Also, if there are
already built editor plugins in this same situation (esp. ones not tested in
conjunction with wtp), they will have this same problem and will stop being the
default editor when used in an eclipse w/ WTP also in it.

My view on it is that the most-specific should win in the case of a tie. So,
there's 2 ways to automatically associate editors: via a filename/extension
association, and via a contentTypeBinding. To me, the filename/extension
association seems more specific. So, if there's a filename and
contentTypeBinding both with default="true", I would think the filename/ext
should win.

Of course, that's just my $0.02 on the matter. Now that I've got a fix for my
exact problem, I'm willing to let others more involved make the decision.

If the other bugs/feature requests on editor managment cover this issue, feel
free to resolve this to WONTFIX. Otherwise, can you get this bug in with the
rest for consideration? Thanks.
Comment 3 David Williams CLA 2005-05-17 02:48:17 EDT

*** This bug has been marked as a duplicate of 95317 ***
Comment 4 David Williams CLA 2005-06-15 01:32:52 EDT
Changed Version field given new release numbering.
Comment 5 Greg Smith CLA 2005-07-07 12:29:04 EDT
Sounds good.