Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Default editors ?
Default editors ? [message #290749] Wed, 31 August 2005 07:42 Go to next message
Eclipse UserFriend
Hi,

I've been looking at

https://bugs.eclipse.org/bugs/show_bug.cgi?id=97811#c4
https://bugs.eclipse.org/bugs/show_bug.cgi?id=88370
and some other editor lookup related bugs.

Is it still true that a plugin is not capable of changing the default
editor for e.g. more specific xml files ?

Registring a xml content-type and a editor for that specific content type
does not result in the editor
being chosen as the default editor? Furthermore it does not show up on the
Open with... list unless the file name
is a complete match (registring the editor for just *.xml is not an option
as it does not make sense to use it for all
*.xml files)

With hope that someone knows about how plugins should be able to "win"
over the generic platform provided editors ;)

/max
Re: Default editors ? [message #290755 is a reply to message #290749] Wed, 31 August 2005 09:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Yes you can use content type. The Ant build editor does just that. Look
up IContentDescriber. As an example see the
org.eclipse.ant.internal.core.contentDescriber.AntBuildfileC ontentDescriber
as an example, except that you will need to do your own super class
implementation because AntBuildfileContentDescriber inherits from an
internal class.

The IContentDescriber reads a file to determine if the content is of
interest to the type it is looking for. For example the
AntBuildfileContentDescriber sees if the xml file starts with a
"project" element and has a "target" element in it.

A content type can be a subtype of another content type, so for example
the AntBuild content type is a subtype of XML content type, so it
doesn't need to try to determine if it is an XML type, that is already
been determined.

You will need to update your plugin.xml to add your content type
describer and to have your editor use your content type.

Look up the ContentDescriber extension point in the help.

--
Thanks,
Rich Kulp
Re: Default editors ? [message #290757 is a reply to message #290755] Wed, 31 August 2005 10:28 Go to previous message
Eclipse UserFriend
I figured out why it selected a different editor than i expected it.

The id of a content-type is a short name where as the content-type id in
the editor association
is <pluginid>+<content-type>...when I fixed that stuff started to work ;)

/max

> Yes you can use content type. The Ant build editor does just that. Look
> up IContentDescriber. As an example see the
> org.eclipse.ant.internal.core.contentDescriber.AntBuildfileC ontentDescriber
> as an example, except that you will need to do your own super class
> implementation because AntBuildfileContentDescriber inherits from an
> internal class.
>
> The IContentDescriber reads a file to determine if the content is of
> interest to the type it is looking for. For example the
> AntBuildfileContentDescriber sees if the xml file starts with a
> "project" element and has a "target" element in it.
>
> A content type can be a subtype of another content type, so for example
> the AntBuild content type is a subtype of XML content type, so it
> doesn't need to try to determine if it is an XML type, that is already
> been determined.
>
> You will need to update your plugin.xml to add your content type
> describer and to have your editor use your content type.
>
> Look up the ContentDescriber extension point in the help.
>



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Previous Topic:Opening a file in a TextEditor via FileEditorInput
Next Topic:Disabling and enabling icons
Goto Forum:
  


Current Time: Thu Jul 24 13:21:16 EDT 2025

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

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

Back to the top