how to add a new file type to c/c++->file types [message #1338886] |
Wed, 07 May 2014 12:18 |
jan baeyens Messages: 15 Registered: March 2012 |
Junior Member |
|
|
Hi
For my arduino eclipse plugin I want to programmatically add *.ino and *.pde as c++ source code.
I can do this via the gui but I want this done automagically (I mean the end user should not need to do this)
I have searched a lot but didn't find any solution. Well I did but those were for the old managed build environment. (it seems it used to be org.eclipse.cdt.core.CFileTypeAssociation)
What comes closest is this
<extension point="org.eclipse.core.contenttype.contentTypes">
<!-- declares a content type for ino and pde source files -->
<content-type id="cxxSource" name="%cxxSourceName"
base-type="org.eclipse.cdt.core.cSource"
file-extensions="ino,pde"
priority="high"/>
</extension>
</plugin>
This looks good but the indexer does not parse the *.ino and *.pde code and the files are not added to the windows->preferences->c/c++->file types.
Anyone can give me a hint
Best regards
Jantje
[Updated on: Wed, 07 May 2014 12:19] Report message to a moderator
|
|
|
|
|
Re: how to add a new file type to c/c++->file types [message #1748639 is a reply to message #1748623] |
Fri, 25 November 2016 14:40 |
jan baeyens Messages: 15 Registered: March 2012 |
Junior Member |
|
|
I found how to do this. This is my code
// add the extension to the content type manager
final IContentTypeManager ctm = Platform.getContentTypeManager();
final IContentType ctbin = ctm.getContentType(CCorePlugin.CONTENT_TYPE_CXXSOURCE);
try {
ctbin.addFileSpec("ino", IContentTypeSettings.FILE_EXTENSION_SPEC); //$NON-NLS-1$
ctbin.addFileSpec("pde", IContentTypeSettings.FILE_EXTENSION_SPEC); //$NON-NLS-1$
} catch (CoreException e) {
Common.log(new Status(IStatus.WARNING, Activator.getId(),
"Failed to add *.ino and *.pde as file extensions.", e)); //$NON-NLS-1$
}
[Updated on: Fri, 25 November 2016 14:42] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.01865 seconds