1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-26 10:25:32 +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(); 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; static CModelManager factory = null;
@ -527,12 +529,30 @@ public class CModelManager implements IResourceChangeListener {
return false; return false;
} }
String ext = name.substring(index + 1); String ext = name.substring(index + 1);
for (int i = 0; i < cExtensions.length; i++) { String[] cexts = getTranslationUnitExtensions();
if (ext.equals(cExtensions[i])) for (int i = 0; i < cexts.length; i++) {
if (ext.equals(cexts[i]))
return true; return true;
} }
return false; 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. */ /* Only project with C nature and Open. */
public boolean hasCNature (IProject p) { public boolean hasCNature (IProject p) {