Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » File associations
File associations [message #272550] Thu, 23 September 2004 07:10 Go to next message
Eclipse UserFriend
My application creates new files with a .msg extensions. These files
should be opened with the text editor. Instead, when a new .msg file is
created, Eclipse tries to open Outlook Express!

I managed to change this from within the runtime environment by adding
*.msg as a file association in the preferences, and associating it with
the Text Editor.

Now, I want to do this programmatically, as we obviously don't want to
have to ask the end users to have to do this themselves when they install
our product. I tried adding this to my plugin.xml:

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

but it doesn't seem to work. *.msg doesn't show up in the file extensions
page of the preferences in the runtime workbench. I think this may be an
Eclipse bug. Is there something else I should be doing? Help!
Re: File associations [message #272558 is a reply to message #272550] Thu, 23 September 2004 09:45 Go to previous message
Eclipse UserFriend
Originally posted by: douglas.pollock.magma.ca

Matthew Dickie wrote:
> <extension point="org.eclipse.core.runtime.contentTypes">
> <file-association
> content-type="org.eclipse.core.runtime.text"
> file-extensions="msg">
> </file-association>
> </extension>

This extension point was introduced late in 3.0, and is still not hooked up
to the file associations for editors. To do what you want to do, you could
try something like this:

<extension
point="org.eclipse.ui.editors">
<editor
name="My Message Text Editor"
extensions="msg"
icon="path/to/my/icon.gif"
class="org.eclipse.ui.editors.text.TextEditor"
contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor "
id="org.eclipse.ui.MessageTextEditor">
</editor>
</extension>



cheers,
d.
Previous Topic:How to run "Junit Plug-in Test" in command line?
Next Topic:Is that a bug?
Goto Forum:
  


Current Time: Fri May 30 05:16:41 EDT 2025

Powered by FUDForum. Page generated in 0.04231 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top