1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 18:56:02 +02:00

New methods

getHeaderExtensions()
getSourceExtensions()
getTranslationUnitExtensions()
This commit is contained in:
Alain Magloire 2003-01-23 16:40:04 +00:00
parent b365162ce5
commit 2600c79835

View file

@ -82,7 +82,9 @@ public class CModelManager implements IResourceChangeListener {
*/
protected ArrayList fElementChangedListeners= new ArrayList();
public static final String [] cExtensions = {"c", "cxx", "cc", "C", "cpp", "h", "hh"};
public static final String [] sourceExtensions = {"c", "cxx", "cc", "C", "cpp"};
public static final String [] headerExtensions = {"h", "hh", "hpp"};
static CModelManager factory = null;
@ -527,12 +529,30 @@ public class CModelManager implements IResourceChangeListener {
return false;
}
String ext = name.substring(index + 1);
for (int i = 0; i < cExtensions.length; i++) {
if (ext.equals(cExtensions[i]))
String[] cexts = getTranslationUnitExtensions();
for (int i = 0; i < cexts.length; i++) {
if (ext.equals(cexts[i]))
return true;
}
return false;
}
public String[] getHeaderExtensions() {
return headerExtensions;
}
public String[] getSourceExtensions() {
return sourceExtensions;
}
public String[] getTranslationUnitExtensions() {
String[] headers = getHeaderExtensions();
String[] sources = getSourceExtensions();
String[] cexts = new String[headers.length + sources.length];
System.arraycopy(sources, 0, cexts, 0, sources.length);
System.arraycopy(headers, 0, cexts, sources.length, headers.length);
return cexts;
}
/* Only project with C nature and Open. */
public boolean hasCNature (IProject p) {