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

new method getDefaultBinaryParser()

This commit is contained in:
Alain Magloire 2003-03-31 03:44:10 +00:00
parent 447b3b553a
commit c593b78e02

View file

@ -163,6 +163,7 @@ public class CCorePlugin extends Plugin {
public IBinaryParser getBinaryParser(IProject project) throws CoreException { public IBinaryParser getBinaryParser(IProject project) throws CoreException {
IBinaryParser parser = null; IBinaryParser parser = null;
if (project != null) {
try { try {
ICDescriptor cdesc = (ICDescriptor) getCProjectDescription(project); ICDescriptor cdesc = (ICDescriptor) getCProjectDescription(project);
ICExtensionReference[] cextensions = cdesc.get(BINARY_PARSER_UNIQ_ID); ICExtensionReference[] cextensions = cdesc.get(BINARY_PARSER_UNIQ_ID);
@ -170,7 +171,15 @@ public class CCorePlugin extends Plugin {
parser = (IBinaryParser) cextensions[0].createExtension(); parser = (IBinaryParser) cextensions[0].createExtension();
} catch (CoreException e) { } catch (CoreException e) {
} }
}
if (parser == null) { if (parser == null) {
parser = getDefaultBinaryParser();
}
return parser;
}
public IBinaryParser getDefaultBinaryParser() throws CoreException {
IBinaryParser parser = null;
String id = getPluginPreferences().getDefaultString(PREF_BINARY_PARSER); String id = getPluginPreferences().getDefaultString(PREF_BINARY_PARSER);
if (id == null || id.length() == 0) { if (id == null || id.length() == 0) {
id = DEFAULT_BINARY_PARSER_UNIQ_ID; id = DEFAULT_BINARY_PARSER_UNIQ_ID;
@ -189,7 +198,6 @@ public class CCorePlugin extends Plugin {
IStatus s = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "No Binary Format", null); IStatus s = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "No Binary Format", null);
throw new CoreException(s); throw new CoreException(s);
} }
}
return parser; return parser;
} }