Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Setting content types on a per-project basis
Setting content types on a per-project basis [message #329400] Mon, 23 June 2008 12:19 Go to next message
Eclipse UserFriend
Originally posted by: sampsa.toivanen.hiq.fi

Hi,

in Eclipse 3.3.0, is there a way to specify content type preferences
(Preferences / General / Content Types) independently for each project in
the same workspace? We need to specify character encoding for files
depending on both their file name suffix and the project they belong to.

Setting text file encoding in project properties (Project / Properties /
Resource) is not enough because we need to set the encoding separately for
each file name suffix.

With best regards,
Sampsa Toivanen
Re: Setting content types on a per-project basis [message #329402 is a reply to message #329400] Mon, 23 June 2008 12:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Sampsa,

I don't think this is possible. The describe method isn't passed the
full path and you can only register against extensions or names, not paths.


Sampsa Toivanen wrote:
> Hi,
>
> in Eclipse 3.3.0, is there a way to specify content type preferences
> (Preferences / General / Content Types) independently for each project
> in the same workspace? We need to specify character encoding for files
> depending on both their file name suffix and the project they belong to.
>
> Setting text file encoding in project properties (Project / Properties
> / Resource) is not enough because we need to set the encoding
> separately for each file name suffix.
>
> With best regards,
> Sampsa Toivanen
>
Re: Setting content types on a per-project basis [message #329410 is a reply to message #329400] Mon, 23 June 2008 14:00 Go to previous messageGo to next message
David Williams is currently offline David WilliamsFriend
Messages: 722
Registered: July 2009
Senior Member
On Mon, 23 Jun 2008 08:19:05 -0400, Sampsa Toivanen <sampsa.toivanen@hiq.fi> wrote:

> Hi,
>
> in Eclipse 3.3.0, is there a way to specify content type preferences
> (Preferences / General / Content Types) independently for each project in
> the same workspace? We need to specify character encoding for files
> depending on both their file name suffix and the project they belong to.
>
......

I'm not sure this does exactly what you want, but you might be able to re-think
your situation with this info ...

In help, under Project Natures of all places! :)
<quote>
Starting with release 3.1, natures can declare affinity with arbitrary content types, affecting the way content type determination happens for files in the workspace. In case of conflicts (two or more content types deemed equally suitable for a given file), the content type having affinity with any of the natures configured for the corresponding project will be chosen.
</quote>

In other words, the project nature can be used as "hint" as to which content type get's "picked" by the content type manager.

There is also a way (somewhere, I forget where) where a content type can be associcated with an exact filename, if that helps (I think that's done for "build.xml", assuming it's always an ant content type).
Re: Setting content types on a per-project basis [message #329434 is a reply to message #329410] Tue, 24 June 2008 08:47 Go to previous message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
> There is also a way (somewhere, I forget where) where a content type
can be associcated with an exact filename, if that helps (I think that's
done for "build.xml", assuming it's always an ant content type)

Its available in the contentType extension itself - the file-names
attribute. Alternatively the file-association extension point can be
used to bind a content type with a file name/extension

> In other words, the project nature can be used as "hint" as to which
content type get's "picked" by the content type manager.

This sounds interesting. I was under the assumption that content-type
is generic(not tied to workspace resources) and applied to any stream.
Can you explain how this hint thing works?


- Prakash

www.eclipse-tips.com


David Williams wrote:
> On Mon, 23 Jun 2008 08:19:05 -0400, Sampsa Toivanen <sampsa.toivanen@hiq.fi> wrote:
>
>> Hi,
>>
>> in Eclipse 3.3.0, is there a way to specify content type preferences
>> (Preferences / General / Content Types) independently for each project in
>> the same workspace? We need to specify character encoding for files
>> depending on both their file name suffix and the project they belong to.
>>
> ......
>
> I'm not sure this does exactly what you want, but you might be able to re-think
> your situation with this info ...
>
> In help, under Project Natures of all places! :)
> <quote>
> Starting with release 3.1, natures can declare affinity with arbitrary content types, affecting the way content type determination happens for files in the workspace. In case of conflicts (two or more content types deemed equally suitable for a given file), the content type having affinity with any of the natures configured for the corresponding project will be chosen.
> </quote>
>
> In other words, the project nature can be used as "hint" as to which content type get's "picked" by the content type manager.
>
> There is also a way (somewhere, I forget where) where a content type can be associcated with an exact filename, if that helps (I think that's done for "build.xml", assuming it's always an ant content type).
>
>
>
Previous Topic:showPerspective send a "invalid access thread"
Next Topic:Any way to "reduce" a "jar-URL" to an actual path?
Goto Forum:
  


Current Time: Sun Dec 22 06:15:39 GMT 2024

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

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

Back to the top