Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » how to add a new file type to c/c++->file types
how to add a new file type to c/c++->file types [message #1338886] Wed, 07 May 2014 12:18 Go to next message
jan baeyens is currently offline jan baeyensFriend
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 #1418654 is a reply to message #1338886] Sun, 07 September 2014 11:49 Go to previous messageGo to next message
jan baeyens is currently offline jan baeyensFriend
Messages: 15
Registered: March 2012
Junior Member
bump.



I got the request again and for testing doing the change on each and every workspace is kind of like.... well you know.

Best regards
Jantje
Re: how to add a new file type to c/c++->file types [message #1748623 is a reply to message #1418654] Fri, 25 November 2016 11:59 Go to previous messageGo to next message
trampas Mising name is currently offline trampas Mising nameFriend
Messages: 41
Registered: July 2009
Member
I have the same problem!
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 Go to previous message
jan baeyens is currently offline jan baeyensFriend
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

Previous Topic:Adding pkg_config as linker option
Next Topic:Problem with debugging in Eclipse.
Goto Forum:
  


Current Time: Sun Jan 23 00:12:56 GMT 2022

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

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

Back to the top