Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 149535 - [content type] cannot set extra C++ file types in plugin_customization.ini when used with -pluginCustomization command line arg
Summary: [content type] cannot set extra C++ file types in plugin_customization.ini wh...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-Resources-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-04 05:17 EDT by Nikolay Metchev CLA
Modified: 2019-09-06 03:33 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolay Metchev CLA 2006-07-04 05:17:00 EDT
I would like to add *.prv files as C++ Source files to a global plugin_customization.ini file. I noticed that the setting lives in 
org.eclipse.core.runtime.prefs so I added the following line to plugin_customization.ini:
org.eclipse.core.runtime/content-types/org.eclipse.cdt.core.cxxSource/file-extensions=prv

However that seemed to have no effect. Is there any way we can make this work?
Comment 1 Anton Leherbauer CLA 2006-07-05 04:33:29 EDT
I presume this does not work because the preferences are initialized (DefaultPreferences.applyProductDefaults) after the content-types are processed and cached by the ContentTypeManager.
Anyway, to add a file extension to a content-type, you should add a <file-association/> element to the extension point "org.eclipse.core.runtime.contentTypes".
Comment 2 Nikolay Metchev CLA 2006-07-05 04:36:37 EDT
>>"Anyway, to add a file extension to a content-type, you should add a
>><file-association/> element to the extension point
>>"org.eclipse.core.runtime.contentTypes"."

Can you clarify what that means? Is it possible to do that accross a group of developers (like you can with a plugin_customization.ini file)?
Comment 3 Anton Leherbauer CLA 2006-07-05 05:14:17 EDT
Open the Plug-in Manifest editor for one of your plug-ins (e.g. the plug-in which contains your plugin_customization.ini file), select the "Extensions" tab, click on "Add..." and select the extension point "org.eclipse.core.runtime.contentTypes", open the context menu on this new node, select New > file-association and enter the content-type id and the extension you like.
The resulting entry in the plugin.xml should look like the following:

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

You could also simply copy and paste this into the plugin.xml file (if there is one).
Comment 4 Anton Leherbauer CLA 2006-07-05 05:17:00 EDT
Beware of the typo: file-extensions="moc" should be file-extensions="prv" 
Comment 5 Nikolay Metchev CLA 2006-07-05 05:21:40 EDT
It seems I haven't realized that there are multiple uses of plugin_customization.ini files. I am using it with the -pluginCustomization command line argument of eclipse as documented in:
http://help.eclipse.org/help30/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html
This is how I am able to set ecliipse settings accross a group of developers (by making them all run eclipse with the same plugin_customization.ini file).

Just to be clear I am not writing my own plugin. I need to configure all the developers in my department to treat *.prv files as C++ source files.

Hope this clarifies things.
Comment 6 Anton Leherbauer CLA 2006-07-05 05:31:40 EDT
Well, in this case, I suggest to create a plugin (or fragment) containing the content-type customization and add it to your installation.
Comment 7 Nikolay Metchev CLA 2006-07-05 05:35:58 EDT
Are you recommending that as a workaround or as a solution to this bug?
Comment 8 Anton Leherbauer CLA 2006-07-05 05:55:42 EDT
If you just want to get the bug fixed we should reroute it to the platform. We (CDT) can do nothing about it.
BTW, another solution (or workaround) for your scenario is to export the preference settings and have your developers import the settings (once per workspace).
Comment 9 Nikolay Metchev CLA 2006-07-05 05:59:33 EDT
I have no problems rerouting to platform. I would prefer not to have to learn how to write a custom plugin. I would also prefer not to have any manual steps every time we have a new development wide eclipse setting. 
Comment 10 Anton Leherbauer CLA 2006-07-05 06:51:44 EDT
(In reply to comment #9)
> I would prefer not to have to learn how to write a custom plugin. 
That's actually a piece of cake, no code needed. Everyone does it.

Anyway, rerouting to platform.
Comment 11 DJ Houghton CLA 2006-07-11 14:36:51 EDT
This happens because of the way the content types are processed. First the registry elements are applied and then the stored preferences. The key is that the default preferences don't look like they are applied. Relevant code is in: ContentTypeBuild#applyPreferences. 

The preferences which are stored in the instance scope are applied but the default preferences are never queried.
Comment 12 John Arthorne CLA 2007-01-18 16:29:49 EST
Moving content type bugs to the resources component.
Comment 13 John Arthorne CLA 2007-01-18 16:37:53 EST
I'm truly sorry for all the spam.  Apparently I don't know how to use the "change several bugs at once" feature.
Comment 14 Lars Vogel CLA 2019-09-06 03:33:32 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it and remove the stalebug whiteboard tag. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.