mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 14:15:23 +02:00
Patch from Sam Robb to cover PR 52864
This commit is contained in:
parent
0ce4a707ab
commit
0d674490cf
10 changed files with 380 additions and 33 deletions
|
@ -1,3 +1,16 @@
|
|||
2004-04-16 Alain Magloire
|
||||
|
||||
Patch from Sam Robb to cover PR 52864
|
||||
* src/org/eclipse/cdt/core/internal/fileType/CFileType.java
|
||||
* src/org/eclipse/cdt/core/internal/fileType/CFileTypeResolver.java
|
||||
* src/org/eclipse/cdt/core/internal/fileType/CLanguage.java
|
||||
* srcorg.eclipse/cdt/core/filetype/ICFileType.java
|
||||
* srcorg.eclipse/cdt/core/filetype/ICFileTypeConstants.java
|
||||
* srcorg.eclipse/cdt/core/filetype/ICLanguage.java
|
||||
* schema/CFileType.exsd
|
||||
* schema/CLanguage.exsd
|
||||
* plugin.xml
|
||||
|
||||
2004-04-16 Hoda Amer
|
||||
-CModelBuilder and scalability problems: Starting children list with initial size = 0
|
||||
Now 25,000 element Translation unit takes 450 ms in CModelBuilder.
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
<!-- =================================================================================== -->
|
||||
<!-- Extension Point: CFileType and CFileTypeAssociation for translation unit ident -->
|
||||
<!-- =================================================================================== -->
|
||||
<extension-point id="CLanguage" name="CLanguage" schema="schema/CLanguage.exsd"/>
|
||||
<extension-point id="CFileType" name="CFileType" schema="schema/CFileType.exsd"/>
|
||||
<extension-point id="CFileTypeAssociation" name="CFileTypeAssociation" schema="schema/CFileTypeAssociation.exsd"/>
|
||||
|
||||
|
@ -175,54 +176,78 @@
|
|||
<!-- =================================================================================== -->
|
||||
<!-- CDT file type mappings -->
|
||||
<!-- =================================================================================== -->
|
||||
<extension
|
||||
point="org.eclipse.cdt.core.CLanguage">
|
||||
<language
|
||||
name="C"
|
||||
id="org.eclipse.cdt.core.language.c">
|
||||
</language>
|
||||
<language
|
||||
name="C++"
|
||||
id="org.eclipse.cdt.core.language.cxx">
|
||||
</language>
|
||||
<language
|
||||
name="Assembly"
|
||||
id="org.eclipse.cdt.core.language.asm">
|
||||
</language>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.cdt.core.CFileType">
|
||||
<fileType
|
||||
name="C Source File"
|
||||
type="source"
|
||||
language="org.eclipse.cdt.core.language.c"
|
||||
id="org.eclipse.cdt.core.fileType.c_source">
|
||||
</fileType>
|
||||
<fileType
|
||||
name="C Header File"
|
||||
type="header"
|
||||
language="org.eclipse.cdt.core.language.c"
|
||||
id="org.eclipse.cdt.core.fileType.c_header">
|
||||
</fileType>
|
||||
<fileType
|
||||
name="C++ Source File"
|
||||
type="source"
|
||||
language="org.eclipse.cdt.core.language.cxx"
|
||||
id="org.eclipse.cdt.core.fileType.cxx_source">
|
||||
</fileType>
|
||||
<fileType
|
||||
name="C++ Header File"
|
||||
type="header"
|
||||
language="org.eclipse.cdt.core.language.cxx"
|
||||
id="org.eclipse.cdt.core.fileType.cxx_header">
|
||||
</fileType>
|
||||
<fileType
|
||||
name="Assembly Source File"
|
||||
type="source"
|
||||
language="org.eclipse.cdt.core.language.asm"
|
||||
id="org.eclipse.cdt.core.fileType.asm_source">
|
||||
</fileType>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.cdt.core.CFileTypeAssociation">
|
||||
<association
|
||||
pattern="*.c"
|
||||
type="org.eclipse.cdt.core.fileType.c_source" />
|
||||
<association
|
||||
pattern="*.h"
|
||||
type="org.eclipse.cdt.core.fileType.c_header" />
|
||||
<association
|
||||
pattern="*.cpp,*.cxx,*.cc,*.C"
|
||||
type="org.eclipse.cdt.core.fileType.cxx_source" />
|
||||
<association
|
||||
pattern="*.hpp,*.hxx,*.hh,*.H"
|
||||
file="template/cpp_headers"
|
||||
type="org.eclipse.cdt.core.fileType.cxx_header" />
|
||||
<association
|
||||
pattern="*.asm,*.s,*.S"
|
||||
type="org.eclipse.cdt.core.fileType.asm_source" />
|
||||
<association
|
||||
type="org.eclipse.cdt.core.fileType.c_source"
|
||||
pattern="*.c">
|
||||
</association>
|
||||
<association
|
||||
type="org.eclipse.cdt.core.fileType.c_header"
|
||||
pattern="*.h">
|
||||
</association>
|
||||
<association
|
||||
type="org.eclipse.cdt.core.fileType.cxx_source"
|
||||
pattern="*.cpp,*.cxx,*.cc,*.C">
|
||||
</association>
|
||||
<association
|
||||
file="template/cpp_headers"
|
||||
type="org.eclipse.cdt.core.fileType.cxx_header"
|
||||
pattern="*.hpp,*.hxx,*.hh,*.H">
|
||||
</association>
|
||||
<association
|
||||
type="org.eclipse.cdt.core.fileType.asm_source"
|
||||
pattern="*.asm,*.s,*.S">
|
||||
</association>
|
||||
</extension>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Some well known C file extensions override for the team plugins -->
|
||||
<!-- =================================================================================== -->
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<meta.schema plugin="org.eclipse.cdt.core" id="CFileType" name="CFileType"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
Extension point representing the of a CDT file type. File types consist of a unique identifier (id), a human-readable name, and an enumerated value that indicates how this file should be treated by CDT.
|
||||
Extension point representing a CDT file type. File types consist of a unique identifier (id), a human-readable name, an associated source language, and an enumerated value that indicates how this file should be treated by CDT.
|
||||
|
||||
By themselves, file types don't serve much purpose. However, they are used to build file type assocations (see the CFileTypeAssocation extension point), which are used by CDT to classify files and determine how they should be processed.
|
||||
</documentation>
|
||||
|
@ -72,6 +72,13 @@ By themselves, file types don't serve much purpose. However, they are used
|
|||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="language" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
|
@ -96,7 +103,8 @@ By themselves, file types don't serve much purpose. However, they are used
|
|||
<fileType
|
||||
name="My File Type"
|
||||
type="source"
|
||||
id="com.example.product.fileType.my_file_type">
|
||||
language="com.example.product.language.my_language"
|
||||
id="com.example.product.fileType.my_language_source">
|
||||
</fileType>
|
||||
</extension>
|
||||
|
||||
|
|
118
core/org.eclipse.cdt.core/schema/CLanguage.exsd
Normal file
118
core/org.eclipse.cdt.core/schema/CLanguage.exsd
Normal file
|
@ -0,0 +1,118 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.eclipse.cdt.core">
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.schema plugin="org.eclipse.cdt.core" id="CLanguage" name="CLanguage"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
Extension point representing a CDT language. At the moment, languages consist of a unique identifier (id), and a human-readable name.
|
||||
|
||||
By themselves, languages don't serve much purpose. However, they are used to build file types (see the CFileType extension point), which are used by CDT to classify files and determine how they should be processed.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<complexType>
|
||||
<sequence>
|
||||
<element ref="language" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="language">
|
||||
<complexType>
|
||||
<attribute name="name" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="since"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
CDT 2.0
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="examples"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
To declare a new language:
|
||||
|
||||
<extension
|
||||
point="org.eclipse.cdt.core.CLanguage">
|
||||
<language
|
||||
name="My Language"
|
||||
id="com.example.product.language.my_language">
|
||||
</fileType>
|
||||
</extension>
|
||||
|
||||
This indicates to CDT that there is a new language, identified using the language id "com.example.product.language.my_language".
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="apiInfo"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
This extension point is purely declarative.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -28,7 +28,12 @@ public interface ICFileType {
|
|||
* @return Id associated with this file type.
|
||||
*/
|
||||
public String getId();
|
||||
|
||||
|
||||
/**
|
||||
* @return Language id associated with this file type.
|
||||
*/
|
||||
public String getLanguageId();
|
||||
|
||||
/**
|
||||
* @return Name of this file type.
|
||||
*/
|
||||
|
|
|
@ -15,17 +15,33 @@ package org.eclipse.cdt.core.filetype;
|
|||
*/
|
||||
public interface ICFileTypeConstants {
|
||||
|
||||
public static String ID_PREFIX = "org.eclipse.cdt.core.fileType."; //$NON-NLS-1$
|
||||
public static String ID_PREFIX = "org.eclipse.cdt.core."; //$NON-NLS-1$
|
||||
|
||||
public static String UNKNOWN = ID_PREFIX + "unknown"; //$NON-NLS-1$
|
||||
// Default languages known to CDT
|
||||
|
||||
public static String LANG_PREFIX = ID_PREFIX + "language."; //$NON-NLS-1$
|
||||
|
||||
public static String C_SOURCE = ID_PREFIX + "c_source"; //$NON-NLS-1$
|
||||
public static String LANG_UNKNOWN = LANG_PREFIX + "unknown"; //$NON-NLS-1$
|
||||
|
||||
public static String C_HEADER = ID_PREFIX + "c_header"; //$NON-NLS-1$
|
||||
public static String LANG_C = LANG_PREFIX + "c"; //$NON-NLS-1$
|
||||
|
||||
public static String CXX_HEADER = ID_PREFIX + "cxx_source"; //$NON-NLS-1$
|
||||
public static String LANG_CXX = LANG_PREFIX + "cxx"; //$NON-NLS-1$
|
||||
|
||||
public static String CXX_SOURCE = ID_PREFIX + "cxx_header"; //$NON-NLS-1$
|
||||
public static String LANG_ASM = LANG_PREFIX + "asm"; //$NON-NLS-1$
|
||||
|
||||
// Default file types known to CDT
|
||||
|
||||
public static String ASM_SOURCE = ID_PREFIX + "asm_source"; //$NON-NLS-1$
|
||||
public static String FT_PREFIX = ID_PREFIX + "fileType."; //$NON-NLS-1$
|
||||
|
||||
public static String FT_UNKNOWN = FT_PREFIX + "unknown"; //$NON-NLS-1$
|
||||
|
||||
public static String FT_C_SOURCE = FT_PREFIX + "c_source"; //$NON-NLS-1$
|
||||
|
||||
public static String FT_C_HEADER = FT_PREFIX + "c_header"; //$NON-NLS-1$
|
||||
|
||||
public static String FT_CXX_HEADER = FT_PREFIX + "cxx_source"; //$NON-NLS-1$
|
||||
|
||||
public static String FT_CXX_SOURCE = FT_PREFIX + "cxx_header"; //$NON-NLS-1$
|
||||
|
||||
public static String FT_ASM_SOURCE = FT_PREFIX + "asm_source"; //$NON-NLS-1$
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 TimeSys Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* TimeSys Corporation - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.filetype;
|
||||
|
||||
/**
|
||||
* Corresponds to an org.eclipse.cdt.core.CLanguage entry.
|
||||
*/
|
||||
public interface ICLanguage {
|
||||
|
||||
/**
|
||||
* @return Id associated with this language.
|
||||
*/
|
||||
public String getId();
|
||||
|
||||
/**
|
||||
* @return Name of this language.
|
||||
*/
|
||||
public String getName();
|
||||
}
|
|
@ -18,11 +18,13 @@ import org.eclipse.cdt.core.filetype.ICFileType;
|
|||
public class CFileType implements ICFileType {
|
||||
|
||||
private String fId;
|
||||
private String fLangId;
|
||||
private String fName;
|
||||
private int fType;
|
||||
|
||||
public CFileType(String id, String name, int type) {
|
||||
public CFileType(String id, String languageId, String name, int type) {
|
||||
fId = id;
|
||||
fLangId = languageId;
|
||||
fName = name;
|
||||
fType = type;
|
||||
}
|
||||
|
@ -31,6 +33,10 @@ public class CFileType implements ICFileType {
|
|||
return fId;
|
||||
}
|
||||
|
||||
public String getLanguageId() {
|
||||
return fLangId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return fName;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.cdt.core.filetype.ICFileType;
|
|||
import org.eclipse.cdt.core.filetype.ICFileTypeAssociation;
|
||||
import org.eclipse.cdt.core.filetype.ICFileTypeConstants;
|
||||
import org.eclipse.cdt.core.filetype.ICFileTypeResolver;
|
||||
import org.eclipse.cdt.core.filetype.ICLanguage;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IExtension;
|
||||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
|
@ -38,9 +39,11 @@ import org.eclipse.core.runtime.IExtensionPoint;
|
|||
*/
|
||||
public class CFileTypeResolver implements ICFileTypeResolver {
|
||||
|
||||
private static final String EXTENSION_LANG = "CLanguage"; //$NON-NLS-1$
|
||||
private static final String EXTENSION_TYPE = "CFileType"; //$NON-NLS-1$
|
||||
private static final String EXTENSION_ASSOC = "CFileTypeAssociation"; //$NON-NLS-1$
|
||||
private static final String ATTR_ID = "id"; //$NON-NLS-1$
|
||||
private static final String ATTR_LANGUAGE = "langauge"; //$NON-NLS-1$
|
||||
private static final String ATTR_NAME = "name"; //$NON-NLS-1$
|
||||
private static final String ATTR_TYPE = "type"; //$NON-NLS-1$
|
||||
private static final String ATTR_EXT = "pattern"; //$NON-NLS-1$
|
||||
|
@ -48,19 +51,27 @@ public class CFileTypeResolver implements ICFileTypeResolver {
|
|||
private static final String ATTR_VAL_SOURCE = "source"; //$NON-NLS-1$
|
||||
private static final String ATTR_VAL_HEADER = "header"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Default language, returned when no other language matches a language id.
|
||||
*/
|
||||
public static final ICLanguage DEFAULT_LANG_TYPE =
|
||||
new CLanguage(ICFileTypeConstants.LANG_UNKNOWN, ""); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Default file type, returned when no other file type matches a file name.
|
||||
*/
|
||||
public static final ICFileType DEFAULT_FILE_TYPE =
|
||||
new CFileType(ICFileTypeConstants.UNKNOWN, "", ICFileType.TYPE_UNKNOWN);
|
||||
new CFileType(ICFileTypeConstants.FT_UNKNOWN, ICFileTypeConstants.LANG_UNKNOWN, "", ICFileType.TYPE_UNKNOWN); //$NON-NLS-1$
|
||||
|
||||
// Singleton
|
||||
private static ICFileTypeResolver instance = new CFileTypeResolver();
|
||||
|
||||
// Private ctor to preserve singleton status
|
||||
private CFileTypeResolver() {
|
||||
loadLanguages();
|
||||
loadTypes();
|
||||
loadAssociations();
|
||||
|
||||
if (CCorePlugin.getDefault().isDebugging()) {
|
||||
String[] test = { "foo.c", "bar.h", "baz.s", "numeric" };
|
||||
for (int i = 0; i < test.length; i++) {
|
||||
|
@ -77,6 +88,11 @@ public class CFileTypeResolver implements ICFileTypeResolver {
|
|||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* The language map holds a map of language IDs to descriptive strings.
|
||||
*/
|
||||
private Map fLangMap = new HashMap();
|
||||
|
||||
/**
|
||||
* The type map holds a map of file type IDs to file types.
|
||||
*/
|
||||
|
@ -120,7 +136,29 @@ public class CFileTypeResolver implements ICFileTypeResolver {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the file types know to the resolver
|
||||
* Get the language that has the specified id.
|
||||
* Returns null if no language has that id.
|
||||
*
|
||||
* @param languageId language id
|
||||
*
|
||||
* @return language with the specified id, or null
|
||||
*/
|
||||
public ICLanguage getLanguageById(String languageId) {
|
||||
ICLanguage lang = (ICLanguage) fLangMap.get(languageId);
|
||||
return ((null != lang) ? lang : DEFAULT_LANG_TYPE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the languages known to the resolver
|
||||
*/
|
||||
public ICLanguage[] getLanguages() {
|
||||
Collection values = fLangMap.values();
|
||||
return (ICLanguage[]) values.toArray(new ICLanguage[values.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the file types known to the resolver
|
||||
*/
|
||||
public ICFileType[] getFileTypes() {
|
||||
Collection values = fTypeMap.values();
|
||||
|
@ -128,12 +166,49 @@ public class CFileTypeResolver implements ICFileTypeResolver {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the file type associations know to the resolver
|
||||
* @return the file type associations known to the resolver
|
||||
*/
|
||||
public ICFileTypeAssociation[] getFileTypeAssociations() {
|
||||
return (ICFileTypeAssociation[]) fAssocList.toArray(new ICFileTypeAssociation[fAssocList.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an instance of a language to the languages known to the
|
||||
* resolver.
|
||||
*
|
||||
* Returns true if the instance is added; returns false if the
|
||||
* instance is not added, or if it is already present in the list.
|
||||
*
|
||||
* @param lang language instance to add
|
||||
*
|
||||
* @return true if the language is added, false otherwise
|
||||
*/
|
||||
public boolean addLanguage(ICLanguage lang) {
|
||||
if (CCorePlugin.getDefault().isDebugging()) {
|
||||
System.out.println("File Type Resolver: adding language " + lang.getId() + " as " + lang.getName());
|
||||
}
|
||||
boolean added = false;
|
||||
if (!fLangMap.containsValue(lang)) {
|
||||
added = (null != fTypeMap.put(lang.getId(), lang));
|
||||
}
|
||||
return added;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a language from the list of languages known to the resolver.
|
||||
*
|
||||
* @param lang language to remove
|
||||
*
|
||||
* @return true if the language is removed, false otherwise
|
||||
*/
|
||||
public boolean removeLanguage(ICLanguage lang) {
|
||||
if (CCorePlugin.getDefault().isDebugging()) {
|
||||
System.out.println("File Type Resolver: removing language " + lang.getId() + " as " + lang.getName());
|
||||
}
|
||||
// TODO: must remove any file types based on this language as well
|
||||
return (null != fLangMap.remove(lang));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an instance of a file type to the file types known to the
|
||||
* resolver.
|
||||
|
@ -148,7 +223,6 @@ public class CFileTypeResolver implements ICFileTypeResolver {
|
|||
public boolean addFileType(ICFileType type) {
|
||||
if (CCorePlugin.getDefault().isDebugging()) {
|
||||
System.out.println("File Type Resolver: adding type " + type.getId() + " as " + type.getName());
|
||||
System.out.println();
|
||||
}
|
||||
boolean added = false;
|
||||
if (!fTypeMap.containsValue(type)) {
|
||||
|
@ -200,6 +274,25 @@ public class CFileTypeResolver implements ICFileTypeResolver {
|
|||
}
|
||||
return fAssocList.remove(assoc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load languages declared through the CLanguage extension point.
|
||||
*/
|
||||
private void loadLanguages() {
|
||||
IExtensionPoint point = getExtensionPoint(EXTENSION_LANG);
|
||||
IExtension[] extensions = point.getExtensions();
|
||||
IConfigurationElement[] elements = null;
|
||||
|
||||
for (int i = 0; i < extensions.length; i++) {
|
||||
elements = extensions[i].getConfigurationElements();
|
||||
for (int j = 0; j < elements.length; j++) {
|
||||
String id = elements[j].getAttribute(ATTR_ID);
|
||||
String name = elements[j].getAttribute(ATTR_NAME);
|
||||
addLanguage(new CLanguage(id, name));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load file type declared through the CFileType extension point.
|
||||
|
@ -213,9 +306,10 @@ public class CFileTypeResolver implements ICFileTypeResolver {
|
|||
elements = extensions[i].getConfigurationElements();
|
||||
for (int j = 0; j < elements.length; j++) {
|
||||
String id = elements[j].getAttribute(ATTR_ID);
|
||||
String lang = elements[j].getAttribute(ATTR_LANGUAGE);
|
||||
String name = elements[j].getAttribute(ATTR_NAME);
|
||||
String type = elements[j].getAttribute(ATTR_TYPE);
|
||||
addFileType(new CFileType(id, name, parseType(type)));
|
||||
addFileType(new CFileType(id, lang, name, parseType(type)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 TimeSys Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* TimeSys Corporation - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.internal.filetype;
|
||||
|
||||
import org.eclipse.cdt.core.filetype.ICLanguage;
|
||||
|
||||
/**
|
||||
* Representation of a declared file type.
|
||||
*/
|
||||
public class CLanguage implements ICLanguage {
|
||||
|
||||
private String fId;
|
||||
private String fName;
|
||||
|
||||
public CLanguage(String id, String name) {
|
||||
fId = id;
|
||||
fName = name;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return fId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return fName;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue