Bug 15428 - Need to allow products to override editor associations
Summary: Need to allow products to override editor associations
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 2.0 M6   Edit
Assignee: Eduardo Pereira CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-05-07 10:51 EDT by Nick Edgar CLA
Modified: 2002-05-29 09:26 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 Nick Edgar CLA 2002-05-07 10:51:28 EDT
For 2.0, we need to allow products to specify which editor should be the 
default associated with a specific file type.

This can be done by using the preference store to specify the order of editor 
associations.

For example, plugin A defines an XML editor.  Plugin B defines a better XML 
editor.  The product should be able to say that plugin B's editor gets used 
instead of A's.
Comment 1 Bruce Sutton CLA 2002-05-14 15:32:51 EDT
Our plugins are normally shipped with other plugins which are responsible
for supplying appropriate editors.  However, it looks like there will be
(at least) one product that our plugins will be included in that does not
have these editors.  So we want to include a basic editor which has 
minimal
support (ability to add / remove breakpoints and show the breakpoint 
icon),
but don't want it to end up as the default editor for the file extension
type unless no other editor is registered for that file extension type.

From some trial and error it appears to me that the first time eclipse is
started up the editors for a particular file extension are added in
alphabetical order (of the plugin id that the editor is declared in), and
then the first one in the list is the default.

Instead of doing it alphabetically, it would be better if we could 
register
our editor with a relative priority.   This would allow our editor to be
used only if there are no others
Comment 2 Eduardo Pereira CLA 2002-05-15 14:37:54 EDT
Released changes to HEAD stream. Product can specify the default editors for 
each extension setting "org.eclipse.ui/defaultEditors" in the file 
plugin_customization.ini. e.g., org.eclipse.ui/defaultEditors= 
*.ext1:editorId1;*.ext2:editorId2;fileName:editorId3

Must test it again in the next build. In the build I have, the file must be in 
org.eclipse.platform instead of sdk. Must open a bug report in core if a file 
in sdk does not work.

Bruce,
The product should specify what are the default editors. When you are defining 
your editor (in xml) you should not add the tag default and another editor in 
that product should have that tag. If not editor or more than one editor have 
the default tag equals true then the product can specified the which one will 
be the default by using the plugin_customization.ini file.

Other option you have is to create a separate plugin for your editors and ship 
it only in the product that does not have the proper editors.
Comment 3 Eduardo Pereira CLA 2002-05-16 19:23:52 EDT
Opened bug 16212 about plugin_customization.ini.

Bruce,
I am going to close this report if you think the options I gave are good enough 
to fix the problem you described.
Comment 4 Bruce Sutton CLA 2002-05-17 09:51:59 EDT
Yes, it sounds like this meets our requirements.  Thanks.
Comment 5 Eduardo Pereira CLA 2002-05-17 12:13:43 EDT
Closing it.
Comment 6 Eduardo Pereira CLA 2002-05-28 14:04:39 EDT
See bug 13603 and bug 16892.
Comment 7 Gili Mendel CLA 2002-05-29 06:15:08 EDT
Are you suggesting that one would have to append:

org.eclipse.ui/defaultEditors=*.java:org.eclipse.jdt.ui.javaeditor

to the plugin_customization.ini file in the org.eclipse.platform_2.0.0 plugin ?

It will require a plugin to provide specialized packaging code, a significant 
impediment for a small plugin.

For the .java case, I would think that the Java editor should be the default 
editor by default, no interventions.
Comment 8 Nick Edgar CLA 2002-05-29 09:26:55 EDT
The Java editor has recently changed to mark itself as the default for *.java.
The support described here is intended for products to override such settings.